From 9039a0a5797bc67a75b09476aff0c36dfecf2337 Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 3 Apr 2008 18:03:42 +0000 Subject: [PATCH] minor changes and cleanup --- common/msgpanel.cpp | 4 -- eeschema/annotate_dialog.cpp | 10 +-- eeschema/annotate_dialog.h | 4 +- pcbnew/lay2plot.cpp | 12 +++- polygon/PolyLine.h | 1 - polygon/freepcb_ids.h | 118 ---------------------------------- polygon/math_for_graphics.cpp | 1 - 7 files changed, 19 insertions(+), 131 deletions(-) delete mode 100644 polygon/freepcb_ids.h diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index e9db398f13..8f1b70c93e 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -9,9 +9,7 @@ #include "fctsys.h" #include "wxstruct.h" -#include "gr_basic.h" #include "common.h" -#include "macros.h" /* table des evenements captes par un WinEDA_MsgPanel */ BEGIN_EVENT_TABLE( WinEDA_MsgPanel, wxPanel ) @@ -171,7 +169,6 @@ void WinEDA_MsgPanel::EraseMsgBox() Refresh(); } - /*******************************************/ void WinEDA_MsgPanel::erase( wxDC* DC ) /*******************************************/ @@ -192,4 +189,3 @@ void WinEDA_MsgPanel::erase( wxDC* DC ) DC->DrawRectangle( 0, 0, size.x, size.y ); } - diff --git a/eeschema/annotate_dialog.cpp b/eeschema/annotate_dialog.cpp index 86b7214718..9759f642ab 100644 --- a/eeschema/annotate_dialog.cpp +++ b/eeschema/annotate_dialog.cpp @@ -51,7 +51,7 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_AnnotateFrame, wxDialog ) */ BEGIN_EVENT_TABLE( WinEDA_AnnotateFrame, wxDialog ) - EVT_BUTTON( wxID_CLEAR, WinEDA_AnnotateFrame::OnClear ) + EVT_BUTTON( ID_CLEAR_ANNOTATION, WinEDA_AnnotateFrame::OnClearAnnotation ) EVT_BUTTON( wxID_APPLY, WinEDA_AnnotateFrame::OnApply ) EVT_BUTTON( wxID_CANCEL, WinEDA_AnnotateFrame::OnCancel ) END_EVENT_TABLE() @@ -204,15 +204,15 @@ void WinEDA_AnnotateFrame::CreateControls() /* Standard dialog buttons and sizer. */ wxBoxSizer* sizerDialogButtons = new wxBoxSizer( wxHORIZONTAL ); - wxButton* btnClose = new wxButton( this, wxID_CANCEL ); + wxButton* btnClose = new wxButton( this, wxID_CANCEL, _("Close") ); /* TODO: Check if there is any existing annotation and enable/disable * the clear button accordingly. Probably should also enable/ * disable new components radio button if all of the components * are already annotated. Some low level work on the DrawSheetPath * class will need to be done to accomadate this. */ - m_btnClear = new wxButton( this, wxID_CLEAR ); - wxButton* btnApply = new wxButton( this, wxID_APPLY ); + m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION, _("Clear Annotation") ); + wxButton* btnApply = new wxButton( this, wxID_APPLY, _("Annotation") ); sizerDialogButtons->Add( btnClose, flagsDialogButtonSpacing ); sizerDialogButtons->Add( new wxBoxSizer( wxHORIZONTAL ), wxSizerFlags( 1 ).Expand( ) ); @@ -256,7 +256,7 @@ wxIcon WinEDA_AnnotateFrame::GetIconResource( const wxString& name ) return wxNullIcon; } -void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event ) +void WinEDA_AnnotateFrame::OnClearAnnotation( wxCommandEvent& event ) { int response; diff --git a/eeschema/annotate_dialog.h b/eeschema/annotate_dialog.h index bfb491852b..770ca71d83 100644 --- a/eeschema/annotate_dialog.h +++ b/eeschema/annotate_dialog.h @@ -40,6 +40,8 @@ #define ID_RESET_ANNOTATION 10003 #define ID_SORT_BY_POSITION 10004 #define ID_SORT_BY_VALUE 10005 +#define ID_CLEAR_ANNOTATION 10006 + #define ANNOTATE_DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER #define ANNOTATE_DIALOG_TITLE _( "Annotate" ) @@ -101,7 +103,7 @@ public: private: void CloseDialog( void ); - void OnClear( wxCommandEvent& event ); + void OnClearAnnotation( wxCommandEvent& event ); void OnApply( wxCommandEvent& event ); void OnCancel( wxCommandEvent& event ); diff --git a/pcbnew/lay2plot.cpp b/pcbnew/lay2plot.cpp index 4bfefc2534..8ef092b3e4 100644 --- a/pcbnew/lay2plot.cpp +++ b/pcbnew/lay2plot.cpp @@ -150,7 +150,17 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC, { if( (pt_pad->m_Masque_Layer & masklayer ) == 0 ) continue; - pt_pad->Draw( panel, DC, draw_mode ); + // Usually we draw pads in sketch mode on non copper layers: + if ( (masklayer & ALL_CU_LAYERS) == 0 ) + { + int tmp_fill = ((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill; + // Switch in sketch mode + ((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill = 0; + pt_pad->Draw( panel, DC, draw_mode ); + ((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill = tmp_fill; + } + else // on copper layer, draw pads accordint to current options + pt_pad->Draw( panel, DC, draw_mode ); } /* draw footprint graphic shapes */ diff --git a/polygon/PolyLine.h b/polygon/PolyLine.h index ce7c6b96a5..47a8b3c3d9 100644 --- a/polygon/PolyLine.h +++ b/polygon/PolyLine.h @@ -25,7 +25,6 @@ #include "PolyLine2Kicad.h" -#include "freepcb_ids.h" #include "freepcbDisplayList.h" #include "math_for_graphics.h" diff --git a/polygon/freepcb_ids.h b/polygon/freepcb_ids.h deleted file mode 100644 index 586162d043..0000000000 --- a/polygon/freepcb_ids.h +++ /dev/null @@ -1,118 +0,0 @@ -// definition of ID structure used by FreePCB -// -#pragma once - -// struct id : this structure is used to identify PCB design elements -// such as instances of parts or nets, and their subelements -// Each element will have its own id. -// An id is attached to each item of the Display List so that it can -// be linked back to the PCB design element which drew it. -// These are mainly used to identify items selected by clicking the mouse -// -// In general: -// id.type = type of PCB element (e.g. part, net, text) -// id.st = subelement type (e.g. part pad, net connection) -// id.i = subelement index (zero-based) -// id.sst = subelement of subelement (e.g. net connection segment) -// id.ii = subsubelement index (zero-based) -// -// For example, the id for segment 0 of connection 4 of net 12 would be -// id = { ID_NET, 12, ID_CONNECT, 4, ID_SEG, 0 }; -// -// -class id { -public: - // constructor - id( int qt=0, int qst=0, int qis=0, int qsst=0, int qiis=0 ) - { type=qt; st=qst; i=qis; sst=qsst; ii=qiis; } - // operators - friend int operator ==(id id1, id id2) - { return (id1.type==id2.type - && id1.st==id2.st - && id1.sst==id2.sst - && id1.i==id2.i - && id1.ii==id2.ii ); - } - // member functions - void Clear() - { type=0; st=0; i=0; sst=0; ii=0; } - void Set( int qt, int qst=0, int qis=0, int qsst=0, int qiis=0 ) - { type=qt; st=qst; i=qis; sst=qsst; ii=qiis; } - // member variables - unsigned int type; // type of element - unsigned int st; // type of subelement - unsigned int i; // index of subelement - unsigned int sst; // type of subsubelement - unsigned int ii; // index of subsubelement -}; - - -// these are constants used in ids -// root types -enum { - ID_NONE = 0, // an undefined type or st (or an error) - ID_BOARD, // board outline - ID_PART, // part - ID_NET, // net - ID_TEXT, // free-standing text - ID_DRC, // DRC error - ID_SM_CUTOUT, // cutout for solder mask - ID_MULTI // if multiple selections -}; - -// subtypes of ID_PART -enum { - ID_PAD = 1, // pad_stack in a part - ID_SEL_PAD, // selection rectangle for pad_stack in a part - ID_OUTLINE, // part outline - ID_REF_TXT, // text showing ref num for part - ID_ORIG, // part origin - ID_SEL_RECT, // selection rectangle for part - ID_SEL_REF_TXT // selection rectangle for ref text -}; - -// subtypes of ID_TEXT -enum { - ID_SEL_TXT = 1, // selection rectangle - ID_STROKE // stroke for text -}; - -// subtypes of ID_NET -enum { - ID_ENTIRE_NET = 0, - ID_CONNECT, // connection - ID_AREA // copper area -}; - -// subtypes of ID_BOARD -enum { - ID_BOARD_OUTLINE = 1, -}; - -// subsubtypes of ID_NET.ID_CONNECT -enum { - ID_ENTIRE_CONNECT = 0, - ID_SEG, - ID_SEL_SEG, - ID_VERTEX, - ID_SEL_VERTEX, - ID_VIA -}; - -// subsubtypes of ID_NET.ID_AREA, ID_BOARD.ID_BOARD_OUTLINE, ID_SM_CUTOUT -enum { - ID_SIDE = 1, - ID_SEL_SIDE, - ID_SEL_CORNER, - ID_HATCH, - ID_PIN_X, // only used by ID_AREA - ID_STUB_X // only used by ID_AREA -}; - -// subtypes of ID_DRC -// for subsubtypes, use types in DesignRules.h -enum { - ID_DRE = 1, - ID_SEL_DRE -}; - diff --git a/polygon/math_for_graphics.cpp b/polygon/math_for_graphics.cpp index f77cdb6de7..6ed28c927f 100644 --- a/polygon/math_for_graphics.cpp +++ b/polygon/math_for_graphics.cpp @@ -13,7 +13,6 @@ using namespace std; #include "defs-macros.h" #include "PolyLine2Kicad.h" -#include "freepcb_ids.h" #include "PolyLine.h"