From 6245ac528614441695599ae33437e909be2db756 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Mon, 1 Oct 2007 13:51:07 +0000 Subject: [PATCH] minor maintainability improvements --- change_log.txt | 2 +- include/pcbstruct.h | 81 +++++++++++++++++++++--------------------- pcbnew/class_track.cpp | 16 ++++++--- pcbnew/class_track.h | 8 +++++ todo.txt | 2 -- 5 files changed, 61 insertions(+), 48 deletions(-) diff --git a/change_log.txt b/change_log.txt index 3819568461..a854c44ecd 100644 --- a/change_log.txt +++ b/change_log.txt @@ -9,7 +9,7 @@ email address. ================================================================================ + pcbnew Added dedicated Show() function for SEGVIA. Enhanced BOARD_ITEM::MenuText() - for SEGVIA. Added to todo.txt. + for SEGVIA. 2007-Sep-29 UPDATE Dick Hollenbeck diff --git a/include/pcbstruct.h b/include/pcbstruct.h index fb597c9e13..0267a4c477 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -34,46 +34,6 @@ #define CHAIN 0x01 /* segment marque */ -/*************************************/ -/* constantes de gestion des couches */ -/*************************************/ -#define CUIVRE_LAYER 0x00000001 /* Bit layer cuivre */ -#define LAYER_2 0x00000002 /* Bit layer 2 */ -#define LAYER_3 0x00000004 /* Bit layer 3 */ -#define LAYER_4 0x00000008 /* Bit layer 4 */ -#define LAYER_5 0x00000010 /* Bit layer 5 */ -#define LAYER_6 0x00000020 /* Bit layer 6 */ -#define LAYER_7 0x00000040 /* Bit layer 7 */ -#define LAYER_8 0x00000080 /* Bit layer 8 */ -#define LAYER_9 0x00000100 /* Bit layer 9 */ -#define LAYER_10 0x00000200 /* Bit layer 10 */ -#define LAYER_11 0x00000400 /* Bit layer 11 */ -#define LAYER_12 0x00000800 /* Bit layer 12 */ -#define LAYER_13 0x00001000 /* Bit layer 13 */ -#define LAYER_14 0x00002000 /* Bit layer 14 */ -#define LAYER_15 0x00004000 /* Bit layer 15 */ -#define CMP_LAYER 0x00008000 /* Bit layer cmp */ -#define ADHESIVE_LAYER_CU 0x00010000 -#define ADHESIVE_LAYER_CMP 0x00020000 -#define SOLDERPASTE_LAYER_CU 0x00040000 -#define SOLDERPASTE_LAYER_CMP 0x00080000 -#define SILKSCREEN_LAYER_CU 0x00100000 -#define SILKSCREEN_LAYER_CMP 0x00200000 -#define SOLDERMASK_LAYER_CU 0x00400000 -#define SOLDERMASK_LAYER_CMP 0x00800000 -#define DRAW_LAYER 0x01000000 -#define COMMENT_LAYER 0x02000000 -#define ECO1_LAYER 0x04000000 -#define ECO2_LAYER 0x08000000 -#define EDGE_LAYER 0x10000000 -// extra bits 0xE0000000 -/* masques generaux : */ -#define ALL_LAYERS 0x1FFFFFFF -#define ALL_NO_CU_LAYERS 0x1FFF0000 -#define ALL_CU_LAYERS 0x0000FFFF -#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */ -#define EXTERNAL_LAYERS 0x00008001 - /* Flags pour les couches cuivres */ /* numero des couches particulieres */ #define LAYER_CUIVRE_N 0 @@ -115,6 +75,47 @@ #define LAYER_COUNT 32 + +/*************************************/ +/* constantes de gestion des couches */ +/*************************************/ +#define CUIVRE_LAYER (1<> 4) & 15; - int top_layer = m_Layer & 15; - if( bottom_layer > top_layer ) - EXCHG( bottom_layer, top_layer ); + + int bottom_layer; + int top_layer; + + // ReturnLayerPair() knows how layers are stored + ((SEGVIA*)this)->ReturnLayerPair( &top_layer, &bottom_layer ); + int layermask = 0; while( bottom_layer <= top_layer ) { @@ -272,8 +276,10 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const if( b_layer > t_layer ) EXCHG( b_layer, t_layer ); + if( top_layer ) *top_layer = t_layer; + if( bottom_layer ) *bottom_layer = b_layer; } diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 283f1b3de8..f09375de9d 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -96,8 +96,16 @@ public: /* divers */ int Shape() const { return m_Shape & 0xFF; } + /** + * Function ReturnMaskLayer + * returns a "layer mask", which is a bitmap of all layers on which the + * TRACK segment or SEGVIA physically resides. + * @return int - a layer mask, see pcbstruct.h's CUIVRE_LAYER, etc. + */ int ReturnMaskLayer(); + int IsPointOnEnds( const wxPoint& point, int min_dist = 0 ); + bool IsNull(); // return TRUE if segment lenght = 0 diff --git a/todo.txt b/todo.txt index c841941e3a..7107c309c1 100644 --- a/todo.txt +++ b/todo.txt @@ -51,5 +51,3 @@ understanding by new developers. *** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items, when Undo/Redo stack is empty/filled. -*** There is no way to truly edit a via, such as changing its layers. -