From dff70646a2a955210c7b5216bbceb4dd26ecfbfb Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Sat, 1 Sep 2007 12:00:30 +0000 Subject: [PATCH] see change_log for 2007-Aug-31 --- 3d-viewer/3d_canvas.cpp | 8 +- 3d-viewer/3d_draw.cpp | 6 +- 3d-viewer/3d_viewer.h | 2 +- change_log.txt | 13 + common/base_screen.cpp | 37 +- common/base_struct.cpp | 24 +- common/block_commande.cpp | 6 +- common/common.cpp | 6 +- common/displlst.cpp | 2 +- common/gestfich.cpp | 6 +- common/pyhandler.cpp | 2 +- cvpcb/visumod.cpp | 4 +- eeschema/affiche.cpp | 2 +- eeschema/annotate.cpp | 8 +- eeschema/block.cpp | 62 +- eeschema/block_libedit.cpp | 8 +- eeschema/bus-wire-junction.cpp | 16 +- eeschema/busentry.cpp | 2 +- eeschema/class_hierarchy_sheet.cpp | 8 +- eeschema/class_screen.cpp | 19 +- eeschema/class_screen.h | 24 +- eeschema/class_text-label.cpp | 375 +++--- eeschema/cleanup.cpp | 8 +- eeschema/cmpclass.cpp | 20 +- eeschema/component_class.cpp | 4 +- eeschema/component_class.h | 2 +- eeschema/controle.cpp | 2 +- eeschema/dangling_ends.cpp | 6 +- eeschema/delete.cpp | 28 +- eeschema/delsheet.cpp | 6 +- eeschema/dialog_build_BOM.cpp | 10 +- eeschema/dialog_cmp_graphic_properties.cpp | 2 +- eeschema/dialog_edit_label.cpp | 4 +- eeschema/edit_component_in_lib.cpp | 2 +- eeschema/edit_component_in_schematic.cpp | 14 +- eeschema/edit_label.cpp | 16 +- eeschema/editpart.cpp | 8 +- eeschema/{eeclass.cpp => eeclass.cpp.notused} | 8 +- eeschema/eecreate.cpp | 8 +- eeschema/eelibs_draw_components.cpp | 6 +- eeschema/eelibs_read_libraryfiles.cpp | 16 +- eeschema/eeload.cpp | 2 +- eeschema/eeredraw.cpp | 4 +- eeschema/eeschema.cpp | 6 +- eeschema/erc.cpp | 4 +- eeschema/fieldedi.cpp | 2 +- eeschema/files-io.cpp | 2 +- eeschema/find.cpp | 6 +- eeschema/genliste.cpp | 24 +- eeschema/getpart.cpp | 2 +- eeschema/hierarch.cpp | 2 +- eeschema/hotkeys.cpp | 8 +- eeschema/libclass.cpp | 42 +- eeschema/libcmp.h | 60 +- eeschema/libedit_onleftclick.cpp | 8 +- eeschema/libedit_onrightclick.cpp | 4 +- eeschema/libedpart.cpp | 2 +- eeschema/libframe.cpp | 14 +- eeschema/locate.cpp | 18 +- eeschema/netform.cpp | 12 +- eeschema/netlist.cpp | 6 +- eeschema/onleftclick.cpp | 10 +- eeschema/onrightclick.cpp | 6 +- eeschema/pinedit-dialog.cpp | 2 +- eeschema/pinedit.cpp | 34 +- eeschema/plot.cpp | 16 +- eeschema/plothpgl.cpp | 4 +- eeschema/plotps.cpp | 4 +- eeschema/plugins/netlist_form_pads-pcb.cpp | 4 +- eeschema/program.h | 51 +- eeschema/protos.h | 2 +- eeschema/save_schemas.cpp | 2 +- eeschema/savelib.cpp | 960 +++++++------- eeschema/schedit.cpp | 26 +- eeschema/schematic_undo_redo.cpp | 1125 +++++++++-------- eeschema/sheet.cpp | 6 +- eeschema/sheetlab.cpp | 6 +- eeschema/symbdraw.cpp | 22 +- eeschema/symbedit.cpp | 12 +- eeschema/symbtext.cpp | 2 +- eeschema/tool_lib.cpp | 4 +- eeschema/tool_sch.cpp | 6 +- gerbview/affiche.cpp | 4 +- gerbview/deltrack.cpp | 2 +- gerbview/edit.cpp | 12 +- gerbview/export_to_pcbnew.cpp | 75 +- gerbview/initpcb.cpp | 4 +- gerbview/locate.cpp | 8 +- gerbview/onrightclick.cpp | 4 +- gerbview/protos.h | 2 +- gerbview/struct.cpp | 4 +- gerbview/undelete.cpp | 155 +-- include/appl_wxstruct.h | 20 +- include/base_struct.h | 43 +- include/drawpanel_wxstruct.h | 74 +- include/wxstruct.h | 260 ++-- pcbnew/affiche.cpp | 2 +- pcbnew/ar_protos.h | 8 +- pcbnew/attribut.cpp | 2 +- pcbnew/autoplac.cpp | 8 +- pcbnew/autorout.cpp | 6 +- pcbnew/block.cpp | 16 +- pcbnew/block_module_editor.cpp | 20 +- pcbnew/board.cpp | 14 +- pcbnew/class_board.cpp | 10 +- pcbnew/class_cotation.cpp | 4 +- pcbnew/class_cotation.h | 2 +- pcbnew/class_edge_mod.cpp | 8 +- pcbnew/class_edge_mod.h | 4 +- pcbnew/class_equipot.cpp | 4 +- pcbnew/class_equipot.h | 2 +- pcbnew/class_mire.cpp | 4 +- pcbnew/class_mire.h | 2 +- pcbnew/class_module.cpp | 34 +- pcbnew/class_module.h | 8 +- pcbnew/class_pad.cpp | 14 +- pcbnew/class_pad.h | 12 +- pcbnew/class_pcb_text.cpp | 6 +- pcbnew/class_pcb_text.h | 2 +- pcbnew/class_text_mod.cpp | 18 +- pcbnew/class_text_mod.h | 14 +- pcbnew/class_track.cpp | 96 +- pcbnew/class_track.h | 35 +- pcbnew/classpcb.cpp | 22 +- pcbnew/clean.cpp | 22 +- pcbnew/collectors.cpp | 4 +- pcbnew/collectors.h | 87 +- pcbnew/connect.cpp | 24 +- pcbnew/copy_track.cpp | 8 +- pcbnew/cotation.cpp | 2 +- pcbnew/deltrack.cpp | 10 +- pcbnew/dialog_edit_module.cpp | 12 +- pcbnew/dialog_graphic_items_options.cpp | 2 +- pcbnew/dialog_graphic_items_options.h | 2 +- pcbnew/drc.cpp | 14 +- pcbnew/edgemod.cpp | 8 +- pcbnew/edit.cpp | 60 +- pcbnew/edit_track_width.cpp | 4 +- pcbnew/editedge.cpp | 9 +- pcbnew/editmod.cpp | 6 +- pcbnew/editrack-part2.cpp | 29 +- pcbnew/editrack.cpp | 12 +- pcbnew/editrout.cpp | 4 +- pcbnew/export_gencad.cpp | 10 +- pcbnew/find.cpp | 2 +- pcbnew/gen_modules_placefile.cpp | 2 +- pcbnew/gendrill.cpp | 8 +- pcbnew/graphpcb.cpp | 2 +- pcbnew/hotkeys.cpp | 16 +- pcbnew/initpcb.cpp | 18 +- pcbnew/ioascii.cpp | 2 +- pcbnew/lay2plot.cpp | 8 +- pcbnew/loadcmp.cpp | 4 +- pcbnew/locate.cpp | 22 +- pcbnew/mirepcb.cpp | 2 +- pcbnew/modedit.cpp | 10 +- pcbnew/modedit_onclick.cpp | 12 +- pcbnew/modedit_undo_redo.cpp | 4 +- pcbnew/moduleframe.cpp | 4 +- pcbnew/modules.cpp | 4 +- pcbnew/move_copy_track.cpp | 12 +- pcbnew/move_or_drag_track.cpp | 16 +- pcbnew/muonde.cpp | 2 +- pcbnew/netlist.cpp | 6 +- pcbnew/onrightclick.cpp | 16 +- pcbnew/pcbframe.cpp | 4 +- pcbnew/pcbnew.cpp | 2 +- pcbnew/pcbnew.h | 2 +- pcbnew/pcbpiste.cpp | 4 +- pcbnew/pcbtexte.cpp | 2 +- pcbnew/plot_rtn.cpp | 12 +- pcbnew/plotgerb.cpp | 8 +- pcbnew/plothpgl.cpp | 8 +- pcbnew/plotps.cpp | 10 +- pcbnew/protos.h | 4 +- pcbnew/queue.cpp | 2 +- pcbnew/ratsnest.cpp | 6 +- pcbnew/router.cpp | 12 +- pcbnew/sel_layer.cpp | 6 +- pcbnew/set_color.cpp | 117 +- pcbnew/solve.cpp | 2 +- pcbnew/struct.cpp | 236 ++-- pcbnew/swap_layers.cpp | 6 +- pcbnew/tool_modedit.cpp | 8 +- pcbnew/tool_pcb.cpp | 12 +- pcbnew/tr_modif.cpp | 8 +- pcbnew/tracepcb.cpp | 4 +- pcbnew/track.cpp | 6 +- pcbnew/undelete.cpp | 18 +- pcbnew/via_edit.cpp | 4 +- pcbnew/work.cpp | 2 +- pcbnew/xchgmod.cpp | 6 +- pcbnew/zones.cpp | 4 +- share/drawframe.cpp | 18 +- share/drawpanel.cpp | 33 +- share/selcolor.cpp | 222 ++-- todo.txt | 9 +- 197 files changed, 3032 insertions(+), 2652 deletions(-) rename eeschema/{eeclass.cpp => eeclass.cpp.notused} (95%) diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index 05d056b081..3b029caa05 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -80,7 +80,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, wxWindowID id, /*************************************/ -Pcb3D_GLCanvas::~Pcb3D_GLCanvas( void ) +Pcb3D_GLCanvas::~Pcb3D_GLCanvas() /*************************************/ { ClearLists(); @@ -88,7 +88,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas( void ) /*************************************/ -void Pcb3D_GLCanvas::ClearLists( void ) +void Pcb3D_GLCanvas::ClearLists() /*************************************/ { if( m_gllist > 0 ) @@ -448,7 +448,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event ) /***************************************/ -void Pcb3D_GLCanvas::DisplayStatus( void ) +void Pcb3D_GLCanvas::DisplayStatus() /***************************************/ { wxString msg; @@ -573,7 +573,7 @@ void Pcb3D_GLCanvas::InitGL() /***********************************/ -void Pcb3D_GLCanvas::SetLights( void ) +void Pcb3D_GLCanvas::SetLights() /***********************************/ /* Init sources lumineuses pour OPENGL diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 056a2862d8..1ef5ea68fe 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -168,7 +168,7 @@ glEnable(GL_FOG); /* Tracé des pistes : */ for (pt_piste = pcb->m_Track ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) { - if ( pt_piste->m_StructType == TYPEVIA ) + if ( pt_piste->Type() == TYPEVIA ) Draw3D_Via((SEGVIA*)pt_piste); else Draw3D_Track( pt_piste); } @@ -178,7 +178,7 @@ EDA_BaseStruct * PtStruct; for ( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext) { #define STRUCT ((DRAWSEGMENT *) PtStruct) - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; Draw3D_DrawSegment(STRUCT); } @@ -358,7 +358,7 @@ bool As3dShape = FALSE; glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis for( ;Struct != NULL; Struct = Struct->Pnext ) { - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case TYPETEXTEMODULE: break; diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index bb0be69b84..e1bb17636f 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -97,7 +97,7 @@ public: void OnEnterWindow( wxMouseEvent& event ); - void Render( void ); + void Render(); GLuint CreateDrawGL_List(void); void InitGL(void); void SetLights(void); diff --git a/change_log.txt b/change_log.txt index be32cede1f..4a53e5d4b0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,19 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + +2007-Aug-31 UPDATE Dick Hollenbeck +================================================================================ ++ pcbnew & gerbview + * Added TRACK::Copy() which can copy a SEGVIA or a TRACK. + * Changed export_to_pcbnew.cpp so it created a SEGVIA properly, a significant change. + Moved and changed a big block of code in export_to_pcbnew.cpp so we can + properly construct the SEGVIA(). Not tested. + * Make EDA_BaseStruct::m_StructType private so we can trap where it is being + changed. (It should never be changed after construction, see comment above + EDA_BaseStruct::SetType().) + + 2007-Aug-30 UPDATE Dick Hollenbeck ================================================================================ + pcbnew diff --git a/common/base_screen.cpp b/common/base_screen.cpp index de1d5f452c..cd3e1fe003 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -16,7 +16,8 @@ /*******************************************************/ /* Class BASE_SCREEN: classe de gestion d'un affichage */ /*******************************************************/ -BASE_SCREEN::BASE_SCREEN( int idscreen ) : EDA_BaseStruct( SCREEN_STRUCT_TYPE ) +BASE_SCREEN::BASE_SCREEN( int idscreen, KICAD_T aType ) : + EDA_BaseStruct( aType ) { EEDrawList = NULL; /* Schematic items list */ m_Type = idscreen; @@ -31,7 +32,7 @@ BASE_SCREEN::BASE_SCREEN( int idscreen ) : EDA_BaseStruct( SCREEN_STRUCT_TYPE ) /******************************/ -BASE_SCREEN::~BASE_SCREEN( void ) +BASE_SCREEN::~BASE_SCREEN() /******************************/ { if( m_ZoomList ) @@ -43,7 +44,7 @@ BASE_SCREEN::~BASE_SCREEN( void ) /*******************************/ -void BASE_SCREEN::InitDatas( void ) +void BASE_SCREEN::InitDatas() /*******************************/ { m_SheetNumber = m_NumberOfSheet = 1; /* gestion hierarchie: Root: SheetNumber = 1 */ @@ -121,7 +122,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) /***************************************/ -int BASE_SCREEN::GetInternalUnits( void ) +int BASE_SCREEN::GetInternalUnits() /***************************************/ { switch( m_Type ) @@ -141,7 +142,7 @@ int BASE_SCREEN::GetInternalUnits( void ) /*****************************************/ -wxSize BASE_SCREEN::ReturnPageSize( void ) +wxSize BASE_SCREEN::ReturnPageSize() /*****************************************/ /* Retourne en unites internes la taille de la feuille de dessin @@ -199,7 +200,7 @@ void BASE_SCREEN::SetZoomList( int* zoomlist ) /***********************************/ -void BASE_SCREEN::SetFirstZoom( void ) +void BASE_SCREEN::SetFirstZoom() /***********************************/ /* ajuste le coeff de zoom a 1*/ { @@ -208,7 +209,7 @@ void BASE_SCREEN::SetFirstZoom( void ) /****************************/ -int BASE_SCREEN::GetZoom( void ) +int BASE_SCREEN::GetZoom() /****************************/ /* retourne le coeff de zoom */ { @@ -228,7 +229,7 @@ void BASE_SCREEN::SetZoom( int coeff ) /********************************/ -void BASE_SCREEN::SetNextZoom( void ) +void BASE_SCREEN::SetNextZoom() /********************************/ /* Selectionne le prochain coeff de zoom @@ -249,7 +250,7 @@ void BASE_SCREEN::SetNextZoom( void ) /*************************************/ -void BASE_SCREEN::SetPreviousZoom( void ) +void BASE_SCREEN::SetPreviousZoom() /*************************************/ /* Selectionne le precedent coeff de zoom @@ -262,7 +263,7 @@ void BASE_SCREEN::SetPreviousZoom( void ) /**********************************/ -void BASE_SCREEN::SetLastZoom( void ) +void BASE_SCREEN::SetLastZoom() /**********************************/ /* ajuste le coeff de zoom au max @@ -326,7 +327,7 @@ void BASE_SCREEN::SetGrid( const wxSize& size ) /*********************************/ -wxSize BASE_SCREEN::GetGrid( void ) +wxSize BASE_SCREEN::GetGrid() /*********************************/ { wxSize grid = m_Grid; @@ -351,7 +352,7 @@ wxSize BASE_SCREEN::GetGrid( void ) /*********************************/ -void BASE_SCREEN::SetNextGrid( void ) +void BASE_SCREEN::SetNextGrid() /*********************************/ /* Selectionne la prochaine grille @@ -376,7 +377,7 @@ void BASE_SCREEN::SetNextGrid( void ) /*************************************/ -void BASE_SCREEN::SetPreviousGrid( void ) +void BASE_SCREEN::SetPreviousGrid() /*************************************/ /* Selectionne le precedent coeff de grille @@ -401,7 +402,7 @@ void BASE_SCREEN::SetPreviousGrid( void ) /**********************************/ -void BASE_SCREEN::SetFirstGrid( void ) +void BASE_SCREEN::SetFirstGrid() /**********************************/ /* ajuste le coeff de grille a 1 @@ -419,7 +420,7 @@ void BASE_SCREEN::SetFirstGrid( void ) /**********************************/ -void BASE_SCREEN::SetLastGrid( void ) +void BASE_SCREEN::SetLastGrid() /**********************************/ /* ajuste le coeff de grille au max @@ -432,7 +433,7 @@ void BASE_SCREEN::SetLastGrid( void ) /*****************************************/ -void BASE_SCREEN::ClearUndoRedoList( void ) +void BASE_SCREEN::ClearUndoRedoList() /*****************************************/ /* free the undo and the redo lists @@ -532,7 +533,7 @@ void BASE_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem ) /*****************************************************/ -EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList( void ) +EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList() /*****************************************************/ { EDA_BaseStruct* item = m_UndoList; @@ -544,7 +545,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList( void ) /******************************************************/ -EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void ) +EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList() /******************************************************/ { EDA_BaseStruct* item = m_RedoList; diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 4109ee86df..5fad30f045 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -93,7 +93,7 @@ EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType ) /********************************************/ -void EDA_BaseStruct::InitVars( void ) +void EDA_BaseStruct::InitVars() /********************************************/ { m_StructType = TYPE_NOT_INIT; @@ -151,7 +151,7 @@ void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off msg.Printf( wxT( "EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ), - m_StructType ); + Type() ); msg += ReturnClassName() + wxT( ")\n" ); printf( CONV_TO_UTF8( msg ) ); } @@ -175,10 +175,10 @@ wxString EDA_BaseStruct::ReturnClassName() const /*********************************************/ /* Used at run time for diags: return the class name of the item, - * from its .m_StructType value. + * from its .Type() value. */ { - int ii = m_StructType; + int ii = Type(); wxString classname; if( (ii < 0) || (ii > MAX_STRUCT_TYPE_ID) ) @@ -218,7 +218,7 @@ SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData, for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p ) { // If caller wants to inspect my type - if( stype == m_StructType ) + if( stype == Type() ) { if( SEARCH_QUIT == inspector->Inspect( this, testData ) ) return SEARCH_QUIT; @@ -307,7 +307,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text ) } -EDA_TextStruct::~EDA_TextStruct( void ) +EDA_TextStruct::~EDA_TextStruct() { if( m_TextDrawings ) /* pointeur sur la liste des segments de dessin */ { @@ -318,7 +318,7 @@ EDA_TextStruct::~EDA_TextStruct( void ) /********************************/ -int EDA_TextStruct::Len_Size( void ) +int EDA_TextStruct::Len_Size() /********************************/ // Return the text lenght in internal units @@ -364,7 +364,7 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref ) /*******************************/ -int EDA_TextStruct::Pitch( void ) +int EDA_TextStruct::Pitch() /*******************************/ /* retourne le pas entre 2 caracteres @@ -474,7 +474,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, /****************************************/ -void EDA_TextStruct::CreateDrawData( void ) +void EDA_TextStruct::CreateDrawData() /****************************************/ /* Cree le tableau de donn�s n�essaire au trace d'un texte (pcb, module..) @@ -683,7 +683,7 @@ void EDA_TextStruct::CreateDrawData( void ) /******************************/ -void EDA_Rect::Normalize( void ) +void EDA_Rect::Normalize() /******************************/ // Ensure the height ant width are >= 0 @@ -785,13 +785,13 @@ DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) : } -DrawPickedStruct::~DrawPickedStruct( void ) +DrawPickedStruct::~DrawPickedStruct() { } /*********************************************/ -void DrawPickedStruct::DeleteWrapperList( void ) +void DrawPickedStruct::DeleteWrapperList() /*********************************************/ /* Delete this item all the items of the linked list diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 363de56ae2..b8a2cde51f 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -17,7 +17,7 @@ /*******************/ /****************************************************************************/ -DrawBlockStruct::DrawBlockStruct( void ) : +DrawBlockStruct::DrawBlockStruct() : EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ) , EDA_Rect() /****************************************************************************/ @@ -30,7 +30,7 @@ DrawBlockStruct::DrawBlockStruct( void ) : /****************************************/ -DrawBlockStruct::~DrawBlockStruct( void ) +DrawBlockStruct::~DrawBlockStruct() /****************************************/ { } @@ -219,7 +219,7 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC ) if( (screen->BlockLocate.m_Command != BLOCK_PASTE) && screen->BlockLocate.m_BlockDrawStruct ) { - if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { DrawPickedStruct* PickedList; PickedList = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; diff --git a/common/common.cpp b/common/common.cpp index e2b5535697..488edf981f 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -14,7 +14,7 @@ #include "build_version.h" /*****************************/ -wxString GetBuildVersion( void ) +wxString GetBuildVersion() /*****************************/ /* Return the build date @@ -193,7 +193,7 @@ int From_User_Unit( bool is_metric, double val, int internal_unit_value ) /**********************/ -wxString GenDate( void ) +wxString GenDate() /**********************/ /* Return the string date "day month year" like "23 jun 2005" @@ -427,7 +427,7 @@ void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& K /***********************/ -int GetTimeStamp( void ) +int GetTimeStamp() /***********************/ /* diff --git a/common/displlst.cpp b/common/displlst.cpp index 709628d39c..7cea8d3bb3 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -233,7 +233,7 @@ static int SortItems( const wxString ** ptr1, const wxString ** ptr2 ) /************************************/ -void WinEDAListBox:: SortList( void ) +void WinEDAListBox:: SortList() /************************************/ { int ii, NbItems = m_List->GetCount(); diff --git a/common/gestfich.cpp b/common/gestfich.cpp index b5c835db7b..544f22a569 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -312,7 +312,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti /********************************************************/ -wxString FindKicadHelpPath( void ) +wxString FindKicadHelpPath() /********************************************************/ /* Find absolute path for kicad/help (or kicad/help/) */ @@ -536,7 +536,7 @@ void SetRealLibraryPath( const wxString& shortlibname ) /***********************************/ -wxString ReturnKicadDatasPath( void ) +wxString ReturnKicadDatasPath() /***********************************/ /* Retourne le chemin des donnees communes de kicad. @@ -605,7 +605,7 @@ wxString ReturnKicadDatasPath( void ) /***************************/ -wxString GetEditorName( void ) +wxString GetEditorName() /***************************/ /* Return the prefered editor name diff --git a/common/pyhandler.cpp b/common/pyhandler.cpp index 03cc855398..56f96fe84a 100644 --- a/common/pyhandler.cpp +++ b/common/pyhandler.cpp @@ -27,7 +27,7 @@ using namespace boost::python; /* Common Python Binding */ /*****************************************************************************/ -static int GetLastID( void ) { return ID_END_LIST; } +static int GetLastID() { return ID_END_LIST; } static object ChooseFile( str objTitle, str objMask, object objOpen ) { diff --git a/cvpcb/visumod.cpp b/cvpcb/visumod.cpp index d6282643e2..aaebba73e2 100644 --- a/cvpcb/visumod.cpp +++ b/cvpcb/visumod.cpp @@ -58,7 +58,7 @@ wxString msg; PtStruct = (EDA_BaseStruct *) GenericStructure; if( PtStruct == NULL) return ; - typestruct = (int)PtStruct->m_StructType; + typestruct = (int)PtStruct->Type(); IsDeleted = PtStruct->GetState(DELETED); PtNext = PtStruct->Pnext; @@ -167,7 +167,7 @@ wxString msg; default: msg.Printf( wxT(" DeleteStructure: Type %d Inattendu"), - PtStruct->m_StructType); + PtStruct->Type()); DisplayError(NULL, msg); break; } diff --git a/eeschema/affiche.cpp b/eeschema/affiche.cpp index 15344f83e8..121b3bb1c2 100644 --- a/eeschema/affiche.cpp +++ b/eeschema/affiche.cpp @@ -132,7 +132,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) /* affichage du type */ msg = wxT( "??" ); - switch( m_StructType ) + switch( Type() ) { case COMPONENT_ARC_DRAW_TYPE: msg = wxT( "Arc" ); break; diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index e1116bbee6..896c8e17ea 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -26,7 +26,7 @@ static bool SortByPosition = TRUE; /**************************************/ -void ReAnnotatePowerSymbolsOnly( void ) +void ReAnnotatePowerSymbolsOnly() /**************************************/ /* Used to reannotate the power symbols, before testing erc or computing netlist when a true component reannotation is not necessary @@ -48,7 +48,7 @@ In order to avoid conflicts the ref number start with a 0: EDA_BaseStruct *DrawList = screen->EEDrawList; for ( ; DrawList != NULL ; DrawList = DrawList->Pnext ) { - if ( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if ( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) DrawList; EDA_LibComponentStruct * Entry = @@ -194,7 +194,7 @@ EDA_SchComponentStruct *DrawLibItem; EDA_BaseStruct *DrawList = screen->EEDrawList; for ( ; DrawList != NULL ; DrawList = DrawList->Pnext ) { - if ( DrawList->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if ( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) { DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem->ClearAnnotation(); @@ -224,7 +224,7 @@ EDA_LibComponentStruct *Entry; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_JUNCTION_STRUCT_TYPE : diff --git a/eeschema/block.cpp b/eeschema/block.cpp index c130d45b5e..529d8e278b 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -371,7 +371,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); if( block->m_BlockDrawStruct ) { - if( block->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( block->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { /* Delete the picked wrapper if this is a picked list. */ DrawPickedStruct* PickedList; PickedList = (DrawPickedStruct*) block->m_BlockDrawStruct; @@ -490,7 +490,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y ); /* Effacement ancien affichage */ - if( PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( PtBlock->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct; while( PickedList ) @@ -523,7 +523,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( PtBlock->m_BlockDrawStruct ) { - if( PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( PtBlock->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct; while( PickedList ) @@ -558,7 +558,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ) if( !DrawStruct ) return FALSE; - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { if( DC ) RedrawStructList( panel, DC, DrawStruct, g_XorMode ); @@ -613,7 +613,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) if( !DrawStruct ) return; - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPE_NOT_INIT: break; @@ -756,7 +756,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct if( !DrawStruct ) return FALSE; - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { if( DC ) RedrawStructList( panel, DC, DrawStruct, g_XorMode ); @@ -813,14 +813,14 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE PlaceStruct( screen, NewDrawStruct ); /* Draw the new structure and chain it in: */ - if( NewDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( NewDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { PickedList = (DrawPickedStruct*) NewDrawStruct; while( PickedList ) // Clear annotation for new components { EDA_BaseStruct* Struct = PickedList->m_PickedStruct; - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE: { @@ -862,7 +862,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE } else { - switch( NewDrawStruct->m_StructType ) + switch( NewDrawStruct->Type() ) { case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE: @@ -905,7 +905,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE } /* Free the original DrawPickedStruct chain: */ - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { PickedList = (DrawPickedStruct*) DrawStruct; PickedList->DeleteWrapperList(); @@ -931,7 +931,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct return; - if( DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) { /* Cette stucture est rattachee a une feuille, et n'est pas * accessible par la liste globale directement */ frame->SaveCopyInUndoList( ( (DrawSheetLabelStruct*) DrawStruct )->m_Parent, IS_CHANGED ); @@ -939,7 +939,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct return; } - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { /* Unlink all picked structs from current EEDrawList */ PickedList = (DrawPickedStruct*) DrawStruct; @@ -988,7 +988,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ) /* Make a copy of the original picked item. */ DrawStructCopy = DuplicateStruct( DrawStruct ); - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { /* Delete the picked wrapper if this is a picked list. */ PickedList = (DrawPickedStruct*) DrawStruct; @@ -1036,12 +1036,12 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); // Clear annotation and init new time stamp for the new components: - if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) // Clear annotation for new components { EDA_BaseStruct* Struct = PickedList->m_PickedStruct; - if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) { ( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp(); ( (EDA_SchComponentStruct*) Struct )->ClearAnnotation(); @@ -1065,7 +1065,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) } else { - if( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) { ( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp(); ( (EDA_SchComponentStruct*) DrawStruct )->ClearAnnotation(); @@ -1104,7 +1104,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct ) move_vector.y = screen->m_Curseur.y - screen->BlockLocate.m_BlockLastCursorPosition.y; - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { default: case TYPE_NOT_INIT: @@ -1161,7 +1161,7 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector ) if( !DrawStruct ) return; - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPE_NOT_INIT: break; @@ -1276,7 +1276,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) return NULL; } - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_POLYLINE_STRUCT_TYPE: NewDrawStruct = ( (DrawPolylineStruct*) DrawStruct )->GenCopy(); @@ -1350,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) { wxString msg; msg << wxT( "DuplicateStruct error: unexpected StructType " ) << - DrawStruct->m_StructType << wxT( " " ) << DrawStruct->ReturnClassName(); + DrawStruct->Type() << wxT( " " ) << DrawStruct->ReturnClassName(); DisplayError( NULL, msg ); } break; @@ -1374,10 +1374,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Pnext ) Struct->m_Flags = 0; - if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) + if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; - else if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) + else if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) { DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; while( DrawStructs ) @@ -1403,7 +1403,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) /* Pour Drag Block: remise sous forme de liste de structure, s'il n'y * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ - if( screen->BlockLocate.m_BlockDrawStruct->m_StructType != DRAW_PICK_ITEM_STRUCT_TYPE ) + if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) { DrawStructs = new DrawPickedStruct( screen->BlockLocate.m_BlockDrawStruct ); screen->BlockLocate.m_BlockDrawStruct = DrawStructs; @@ -1416,7 +1416,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) { Struct = DrawStructs->m_PickedStruct; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; - if( Struct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) + if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { SegmStruct = (EDA_DrawLineStruct*) Struct; if( (SegmStruct->m_Start.x < ox) || (SegmStruct->m_Start.x > fx) @@ -1438,7 +1438,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) { Struct = DrawStructs->m_PickedStruct; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; - if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) { LibEDA_BaseStruct* DrawItem; int x, y; @@ -1452,18 +1452,18 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) } } - if( Struct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) { DrawSheetLabelStruct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label; while( SLabel ) { - if( SLabel->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( SLabel->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) AddPickedItem( screen, SLabel->m_Pos.x, SLabel->m_Pos.y ); SLabel = (DrawSheetLabelStruct*) SLabel->Pnext; } } - if( Struct->m_StructType == DRAW_BUSENTRY_STRUCT_TYPE ) + if( Struct->Type() == DRAW_BUSENTRY_STRUCT_TYPE ) { DrawBusEntryStruct* item = (DrawBusEntryStruct*) Struct; AddPickedItem( screen, item->m_Pos.x, item->m_Pos.y ); @@ -1487,7 +1487,7 @@ static void AddPickedItem( SCH_SCREEN* screen, int px, int py ) Struct = DrawStructs->m_PickedStruct; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE: #undef STRUCT @@ -1509,7 +1509,7 @@ static void AddPickedItem( SCH_SCREEN* screen, int px, int py ) Struct = screen->EEDrawList; while( Struct ) { - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case TYPE_NOT_INIT: break; @@ -1684,7 +1684,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( EDA_SchComponentStruct* DrawLibIte continue; if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) continue; - if( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE ) + if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; Pin = (LibDrawPin*) DEntry; diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index a1a19c4f58..4ac9631d89 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -81,7 +81,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, ItemIsInOtherConvert = TRUE; if( ItemIsInOtherPart || ItemIsInOtherConvert ) { - if( item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if( item->Type() == COMPONENT_PIN_DRAW_TYPE ) { // Specific rules for pins: if( g_EditPinByPinIsOn ) continue; @@ -94,7 +94,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, continue; } - switch( item->m_StructType ) + switch( item->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -545,7 +545,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case COMPONENT_PIN_DRAW_TYPE: ( (LibDrawPin*) item )->m_Pos.x += offset.x; @@ -647,7 +647,7 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case COMPONENT_PIN_DRAW_TYPE: SETMIRROR( ( (LibDrawPin*) item )->m_Pos.x ); diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 8d6b7188f3..166f734fa9 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -45,7 +45,7 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy ) { next_item = item->Pnext; - switch( item->m_StructType ) + switch( item->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE: @@ -54,7 +54,7 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy ) List = item; if( CreateCopy ) { - if( item->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) + if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE ) new_item = ( (DrawJunctionStruct*) item )->GenCopy(); else new_item = ( (EDA_DrawLineStruct*) item )->GenCopy(); @@ -85,7 +85,7 @@ static void RestoreOldWires( SCH_SCREEN* screen ) { next_item = item->Pnext; - switch( item->m_StructType ) + switch( item->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE: @@ -123,7 +123,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) if( GetScreen()->GetCurItem() ) { - switch( GetScreen()->GetCurItem()->m_StructType ) + switch( GetScreen()->GetCurItem()->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE: @@ -337,7 +337,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) EDA_BaseStruct* item = GetScreen()->EEDrawList; while( item ) { - switch( item->m_StructType ) + switch( item->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE: @@ -510,7 +510,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) } /* Trace en cours: annulation */ - if( GetScreen()->GetCurItem()->m_StructType == DRAW_POLYLINE_STRUCT_TYPE ) + if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE ) { Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ } @@ -622,7 +622,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) if( g_ItemToRepeat == NULL ) return; - switch( g_ItemToRepeat->m_StructType ) + switch( g_ItemToRepeat->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: #undef STRUCT @@ -825,7 +825,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) return TRUE; item = PickStruct( pos, screen->EEDrawList, LABELITEM ); - if( item && (item->m_StructType != DRAW_TEXT_STRUCT_TYPE) + if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) return TRUE; diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 80f70cc26d..bd0e2b5042 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -137,7 +137,7 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, if( BusEntry == NULL ) return; - if( BusEntry->m_StructType != DRAW_BUSENTRY_STRUCT_TYPE ) + if( BusEntry->Type() != DRAW_BUSENTRY_STRUCT_TYPE ) { DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) ); return; diff --git a/eeschema/class_hierarchy_sheet.cpp b/eeschema/class_hierarchy_sheet.cpp index 545fa88d65..0edcd56b57 100644 --- a/eeschema/class_hierarchy_sheet.cpp +++ b/eeschema/class_hierarchy_sheet.cpp @@ -34,7 +34,7 @@ /***********************************************************/ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : - SCH_SCREEN( SCHEMATIC_FRAME ) + SCH_SCREEN( DRAW_SHEET_STRUCT_TYPE ) /***********************************************************/ { m_Label = NULL; @@ -42,8 +42,6 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : m_Layer = LAYER_SHEET; m_Pos = pos; m_SheetNameSize = m_FileNameSize = 60; - /* change the struct type: SCREEN_STRUCT_TYPE to DRAW_SHEET_STRUCT_TYPE */ - m_StructType = DRAW_SHEET_STRUCT_TYPE; } @@ -63,7 +61,7 @@ DrawSheetStruct::~DrawSheetStruct() /***********************************************/ -DrawSheetStruct* DrawSheetStruct::GenCopy( void ) +DrawSheetStruct* DrawSheetStruct::GenCopy() /***********************************************/ /* creates a copy of a sheet @@ -226,7 +224,7 @@ DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent, /***********************************************************/ -DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy( void ) +DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy() /***********************************************************/ { DrawSheetLabelStruct* newitem = diff --git a/eeschema/class_screen.cpp b/eeschema/class_screen.cpp index 6910f8d9a2..680ea5967a 100644 --- a/eeschema/class_screen.cpp +++ b/eeschema/class_screen.cpp @@ -17,7 +17,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) /******************************************************************/ { - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE: @@ -82,7 +82,8 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */ /* Constructeur de SCREEN */ -SCH_SCREEN::SCH_SCREEN( int screentype ) : BASE_SCREEN( screentype ) +SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) : + BASE_SCREEN( screentype, aType ) { EEDrawList = NULL; /* Schematic items list */ m_Zoom = 32; @@ -94,7 +95,7 @@ SCH_SCREEN::SCH_SCREEN( int screentype ) : BASE_SCREEN( screentype ) /****************************/ -SCH_SCREEN::~SCH_SCREEN( void ) +SCH_SCREEN::~SCH_SCREEN() /****************************/ { ClearUndoRedoList(); @@ -103,7 +104,7 @@ SCH_SCREEN::~SCH_SCREEN( void ) /***********************************/ -void SCH_SCREEN::FreeDrawList( void ) +void SCH_SCREEN::FreeDrawList() /***********************************/ /* Routine to clear (free) EESchema drawing list of a screen. @@ -187,7 +188,7 @@ EDA_ScreenList::~EDA_ScreenList() /*****************************************/ -SCH_SCREEN* EDA_ScreenList::GetFirst( void ) +SCH_SCREEN* EDA_ScreenList::GetFirst() /*****************************************/ { m_Index = 0; @@ -199,7 +200,7 @@ SCH_SCREEN* EDA_ScreenList::GetFirst( void ) /*****************************************/ -SCH_SCREEN* EDA_ScreenList::GetNext( void ) +SCH_SCREEN* EDA_ScreenList::GetNext() /*****************************************/ { if( m_Index < m_Count ) @@ -231,7 +232,7 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( int index ) /**************************************************/ -void EDA_ScreenList::UpdateSheetNumberAndDate( void ) +void EDA_ScreenList::UpdateSheetNumberAndDate() /**************************************************/ /* Update the sheet number, the sheet count and the date for all sheets in list @@ -285,7 +286,7 @@ SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList, CurrStruct = DrawStruct; while( CurrStruct ) { - if( CurrStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) { HasSubhierarchy = TRUE; if( ScreenList ) @@ -306,7 +307,7 @@ SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList, CurrStruct = DrawStruct; while( CurrStruct ) { - if( CurrStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) { SCH_SCREEN* Screen = (SCH_SCREEN*) CurrStruct; diff --git a/eeschema/class_screen.h b/eeschema/class_screen.h index 73878b6a01..40d912c6b9 100644 --- a/eeschema/class_screen.h +++ b/eeschema/class_screen.h @@ -88,10 +88,10 @@ class DrawSheetStruct; class SCH_SCREEN : public BASE_SCREEN { public: - SCH_SCREEN( int idtype ); + SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); ~SCH_SCREEN(); - void FreeDrawList( void ); // Free EESchema drawing list (does not delete the sub hierarchies) + void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */ @@ -101,7 +101,7 @@ public: EDA_BaseStruct* ExtractWires( bool CreateCopy ); /* full undo redo management : */ - virtual void ClearUndoRedoList( void ); + virtual void ClearUndoRedoList(); virtual void AddItemToUndoList( EDA_BaseStruct* item ); virtual void AddItemToRedoList( EDA_BaseStruct* item ); }; @@ -119,10 +119,10 @@ public: const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); - ~DrawSheetLabelStruct( void ) { } - DrawSheetLabelStruct* GenCopy( void ); + ~DrawSheetLabelStruct() { } + DrawSheetLabelStruct* GenCopy(); - DrawSheetLabelStruct* Next( void ) + DrawSheetLabelStruct* Next() { return (DrawSheetLabelStruct*) Pnext; } void Place( WinEDA_DrawFrame* frame, wxDC* DC ); @@ -147,9 +147,9 @@ public: public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); - ~DrawSheetStruct( void ); + ~DrawSheetStruct(); void Place( WinEDA_DrawFrame* frame, wxDC* DC ); - DrawSheetStruct* GenCopy( void ); + DrawSheetStruct* GenCopy(); void Display_Infos( WinEDA_DrawFrame* frame ); void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, @@ -169,11 +169,11 @@ private: public: EDA_ScreenList( EDA_BaseStruct* DrawStruct ); ~EDA_ScreenList(); - int GetCount( void ) { return m_Count; } - SCH_SCREEN* GetFirst( void ); - SCH_SCREEN* GetNext( void ); + int GetCount() { return m_Count; } + SCH_SCREEN* GetFirst(); + SCH_SCREEN* GetNext(); SCH_SCREEN* GetScreen( int index ); - void UpdateSheetNumberAndDate( void ); + void UpdateSheetNumberAndDate(); private: SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList, diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index 8f74756347..31b0715ddb 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -14,251 +14,286 @@ #include "protos.h" - /************************/ - /* class DrawTextStruct */ - /* class DrawLabelStruct */ - /* class DrawGlobalLabelStruct */ - /************************/ +/************************/ +/* class DrawTextStruct */ +/* class DrawLabelStruct */ +/* class DrawGlobalLabelStruct */ +/************************/ /**************************************************************************/ -DrawTextStruct::DrawTextStruct(const wxPoint & pos, const wxString & text): - EDA_BaseStruct(DRAW_TEXT_STRUCT_TYPE), - EDA_TextStruct(text) +DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) : + EDA_BaseStruct( aType ), + EDA_TextStruct( text ) /**************************************************************************/ { - m_Layer = LAYER_NOTES; - m_Pos = pos; - m_Shape = 0; - m_IsDangling = FALSE; + m_Layer = LAYER_NOTES; + m_Pos = pos; + m_Shape = 0; + m_IsDangling = FALSE; } + /*********************************************/ -DrawTextStruct * DrawTextStruct::GenCopy(void) +DrawTextStruct* DrawTextStruct::GenCopy() /*********************************************/ { -DrawTextStruct * newitem = new DrawTextStruct(m_Pos, m_Text); + DrawTextStruct* newitem; + + switch( Type() ) + { + case DRAW_TEXT_STRUCT_TYPE: + newitem = new DrawTextStruct( m_Pos, m_Text ); + break; + case DRAW_GLOBAL_LABEL_STRUCT_TYPE: + newitem = new DrawGlobalLabelStruct( m_Pos, m_Text ); + break; + case DRAW_LABEL_STRUCT_TYPE: + newitem = new DrawLabelStruct( m_Pos, m_Text ); + break; + default: + newitem = 0; // will crash below + } - newitem->m_StructType = m_StructType; - newitem->m_Layer = m_Layer; - newitem->m_Shape = m_Shape; - newitem->m_Orient = m_Orient; - newitem->m_Size = m_Size; - newitem->m_Width = m_Width; - newitem->m_HJustify = m_HJustify; - newitem->m_VJustify = m_VJustify; - newitem->m_IsDangling = m_IsDangling ; + newitem->m_Layer = m_Layer; + newitem->m_Shape = m_Shape; + newitem->m_Orient = m_Orient; + newitem->m_Size = m_Size; + newitem->m_Width = m_Width; + newitem->m_HJustify = m_HJustify; + newitem->m_VJustify = m_VJustify; + newitem->m_IsDangling = m_IsDangling; - return newitem; + return newitem; } /********************************************************/ -void DrawTextStruct::SwapData(DrawTextStruct * copyitem) +void DrawTextStruct::SwapData( DrawTextStruct* copyitem ) /********************************************************/ { - EXCHG(m_Text, copyitem->m_Text); - EXCHG(m_Pos, copyitem->m_Pos); - EXCHG(m_Size, copyitem->m_Size); - EXCHG(m_Width, copyitem->m_Width); - EXCHG(m_Shape, copyitem->m_Shape); - EXCHG(m_Orient, copyitem->m_Orient); - EXCHG(m_StructType, copyitem->m_StructType); - EXCHG(m_Layer, copyitem->m_Layer); - EXCHG(m_HJustify, copyitem->m_HJustify); - EXCHG(m_VJustify, copyitem->m_VJustify); - EXCHG(m_IsDangling, copyitem->m_IsDangling); + EXCHG( m_Text, copyitem->m_Text ); + EXCHG( m_Pos, copyitem->m_Pos ); + EXCHG( m_Size, copyitem->m_Size ); + EXCHG( m_Width, copyitem->m_Width ); + EXCHG( m_Shape, copyitem->m_Shape ); + EXCHG( m_Orient, copyitem->m_Orient ); + + // EXCHG( m_StructType, copyitem->m_StructType ); + // how can you swap a type, it is what it was created as! + // this is a very bad usage of m_StructType. + KICAD_T aType = copyitem->Type(); + copyitem->SetType( Type() ); + SetType( aType ); + + EXCHG( m_Layer, copyitem->m_Layer ); + EXCHG( m_HJustify, copyitem->m_HJustify ); + EXCHG( m_VJustify, copyitem->m_VJustify ); + EXCHG( m_IsDangling, copyitem->m_IsDangling ); } + /***************************************************************/ -void DrawTextStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC) +void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) /***************************************************************/ { - /* save old text in undo list */ - if ( g_ItemToUndoCopy && ((m_Flags & IS_NEW) == 0) ) - { - /* restore old values and save new ones */ - SwapData( (DrawTextStruct*)g_ItemToUndoCopy); - /* save in undo list */ - ((WinEDA_SchematicFrame*)frame)->SaveCopyInUndoList(this, IS_CHANGED); - /* restore new values */ - SwapData((DrawTextStruct*)g_ItemToUndoCopy); - delete g_ItemToUndoCopy; - g_ItemToUndoCopy = NULL; - } - - EDA_BaseStruct::Place(frame, DC); + /* save old text in undo list */ + if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) + { + /* restore old values and save new ones */ + SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); + + /* save in undo list */ + ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED ); + + /* restore new values */ + SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); + + delete g_ItemToUndoCopy; + g_ItemToUndoCopy = NULL; + } + + EDA_BaseStruct::Place( frame, DC ); } /****************************************************************************/ -DrawLabelStruct::DrawLabelStruct(const wxPoint & pos, const wxString & text): - DrawTextStruct(pos, text) +DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) : + DrawTextStruct( pos, text, DRAW_LABEL_STRUCT_TYPE ) /****************************************************************************/ { - m_StructType = DRAW_LABEL_STRUCT_TYPE; - m_Layer = LAYER_LOCLABEL; - m_IsDangling = TRUE; + m_Layer = LAYER_LOCLABEL; + m_IsDangling = TRUE; } /***********************************************************************************/ -DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint & pos, const wxString & text): - DrawTextStruct(pos, text) +DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) : + DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE ) /***********************************************************************************/ { - m_StructType = DRAW_GLOBAL_LABEL_STRUCT_TYPE; - m_Layer = LAYER_GLOBLABEL; - m_Shape = NET_INPUT; - m_IsDangling = TRUE; + m_Layer = LAYER_GLOBLABEL; + m_Shape = NET_INPUT; + m_IsDangling = TRUE; } /***************************************************************/ -void DrawTextStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, - int DrawMode, int Color) +void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, + int DrawMode, int Color ) /***************************************************************/ + /* Les textes type label ou notes peuvent avoir 4 directions, mais - sont tj cadres par rapport a la 1ere lettre du texte -*/ + * sont tj cadres par rapport a la 1ere lettre du texte + */ { - switch ( m_StructType ) - { - case DRAW_GLOBAL_LABEL_STRUCT_TYPE: - DrawAsGlobalLabel(panel, DC, offset, DrawMode, Color); - break; + switch( Type() ) + { + case DRAW_GLOBAL_LABEL_STRUCT_TYPE: + DrawAsGlobalLabel( panel, DC, offset, DrawMode, Color ); + break; - case DRAW_LABEL_STRUCT_TYPE: - DrawAsLabel(panel, DC, offset, DrawMode, Color); - break; + case DRAW_LABEL_STRUCT_TYPE: + DrawAsLabel( panel, DC, offset, DrawMode, Color ); + break; - default: - DrawAsText(panel, DC, offset, DrawMode, Color); - } + default: + DrawAsText( panel, DC, offset, DrawMode, Color ); + } } + /*******************************************************************************************/ -void DrawTextStruct::DrawAsText(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, - int DrawMode, int Color) +void DrawTextStruct::DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, + int DrawMode, int Color ) /*******************************************************************************************/ + /* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter -*/ + */ { -int color; -int width = MAX(m_Width, g_DrawMinimunLineWidth); - - if( Color >= 0 ) color = Color; - else color = ReturnLayerColor(m_Layer); - GRSetDrawMode(DC, DrawMode); + int color; + int width = MAX( m_Width, g_DrawMinimunLineWidth ); - switch(m_Orient) - { - case 0: /* Orientation horiz normale */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y), - color, - m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width); - break; + if( Color >= 0 ) + color = Color; + else + color = ReturnLayerColor( m_Layer ); + GRSetDrawMode( DC, DrawMode ); - case 1: /* Orientation vert UP */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y), color, - m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width); - break; + switch( m_Orient ) + { + case 0: /* Orientation horiz normale */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ), + color, + m_Text, m_Orient * 900, m_Size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width ); + break; - case 2: /* Orientation horiz inverse */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y), color, - m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width); - break; + case 1: /* Orientation vert UP */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y ), color, + m_Text, m_Orient * 900, m_Size, + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width ); + break; - case 3: /* Orientation vert BOTTOM */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y), color, - m_Text, m_Orient*900, m_Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width); - break; - } - if ( m_IsDangling ) - DrawDanglingSymbol(panel, DC, m_Pos + offset, color); + case 2: /* Orientation horiz inverse */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y ), color, + m_Text, m_Orient * 900, m_Size, + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width ); + break; + + case 3: /* Orientation vert BOTTOM */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y ), color, + m_Text, m_Orient * 900, m_Size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width ); + break; + } + + if( m_IsDangling ) + DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); } + /***************************************************************/ -void DrawTextStruct::DrawAsLabel(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, - int DrawMode, int Color) +void DrawTextStruct::DrawAsLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, + int DrawMode, int Color ) /***************************************************************/ { - DrawAsText(panel, DC, offset, DrawMode, Color); + DrawAsText( panel, DC, offset, DrawMode, Color ); } + /*****************************************************************************/ -void DrawTextStruct::DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint& offset, - int DrawMode, int Color) +void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, + int DrawMode, int Color ) /*****************************************************************************/ + /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon -*/ + */ { -int * Template; -int Poly[12]; -int ii, jj, imax, color, HalfSize; -wxSize Size = m_Size; -int width = MAX(m_Width, g_DrawMinimunLineWidth); + int* Template; + int Poly[12]; + int ii, jj, imax, color, HalfSize; + wxSize Size = m_Size; + int width = MAX( m_Width, g_DrawMinimunLineWidth ); - if( Color >= 0 ) color = Color; - else color = ReturnLayerColor(m_Layer); + if( Color >= 0 ) + color = Color; + else + color = ReturnLayerColor( m_Layer ); - GRSetDrawMode(DC, DrawMode); + GRSetDrawMode( DC, DrawMode ); - HalfSize = Size.x / 2; ii = Size.x + TXTMARGE; + HalfSize = Size.x / 2; ii = Size.x + TXTMARGE; - switch(m_Orient) - { - case 0: /* Orientation horiz normale */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x - ii + offset.x, m_Pos.y + offset.y), color, - m_Text, TEXT_ORIENT_HORIZ, Size, - GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width); - break; + switch( m_Orient ) + { + case 0: /* Orientation horiz normale */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color, + m_Text, TEXT_ORIENT_HORIZ, Size, + GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width ); + break; - case 1: /* Orientation vert UP */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + offset.x, m_Pos.y + ii + offset.y), color, - m_Text, TEXT_ORIENT_VERT, Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width); - break; + case 1: /* Orientation vert UP */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color, + m_Text, TEXT_ORIENT_VERT, Size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width ); + break; - case 2: /* Orientation horiz inverse */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + ii + offset.x, m_Pos.y + offset.y), color, - m_Text, TEXT_ORIENT_HORIZ, Size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); - break; + case 2: /* Orientation horiz inverse */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color, + m_Text, TEXT_ORIENT_HORIZ, Size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width ); + break; - case 3: /* Orientation vert BOTTOM */ - DrawGraphicText(panel, DC, - wxPoint(m_Pos.x + offset.x, m_Pos.y - ii + offset.y), color, - m_Text, TEXT_ORIENT_VERT, Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width); - break; - } + case 3: /* Orientation vert BOTTOM */ + DrawGraphicText( panel, DC, + wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color, + m_Text, TEXT_ORIENT_VERT, Size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width ); + break; + } - Template = TemplateShape[m_Shape][m_Orient]; + Template = TemplateShape[m_Shape][m_Orient]; - imax = *Template; Template++; - for ( ii = 0, jj = 0; ii < imax ; ii++ ) - { - Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x; - jj++; Template++; - Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y; - jj++; Template++; - } + imax = *Template; Template++; + for( ii = 0, jj = 0; ii < imax; ii++ ) + { + Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x; + jj++; Template++; + Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y; + jj++; Template++; + } // GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, width, color, color ); /* Polygne Rempli */ - GRPoly(&panel->m_ClipBox, DC, imax,Poly,0, width, color, color ); /* Polygne Non Rempli */ + GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color ); /* Polygne Non Rempli */ - if ( m_IsDangling ) - DrawDanglingSymbol(panel, DC, m_Pos + offset, color); + if( m_IsDangling ) + DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); } diff --git a/eeschema/cleanup.cpp b/eeschema/cleanup.cpp index 60115e6aa2..fa84f57d18 100644 --- a/eeschema/cleanup.cpp +++ b/eeschema/cleanup.cpp @@ -35,12 +35,12 @@ bool Modify = FALSE; DrawList = EEDrawList; for ( ;DrawList != NULL; DrawList = DrawList->Pnext ) { - if( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) + if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { TstDrawList = DrawList->Pnext; while ( TstDrawList ) { - if( TstDrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) + if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { flag = TstAlignSegment( (EDA_DrawLineStruct*)DrawList, (EDA_DrawLineStruct*)TstDrawList); @@ -82,7 +82,7 @@ EDA_BaseStruct *DrawList; DrawList = Screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE : #undef STRUCT @@ -136,7 +136,7 @@ DrawPickedStruct * List = NULL; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE : segment = (EDA_DrawLineStruct*)DrawList; diff --git a/eeschema/cmpclass.cpp b/eeschema/cmpclass.cpp index 2c06ec54a6..b702b8a88d 100644 --- a/eeschema/cmpclass.cpp +++ b/eeschema/cmpclass.cpp @@ -37,7 +37,7 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) /*************************************/ -wxPoint DrawBusEntryStruct::m_End( void ) +wxPoint DrawBusEntryStruct::m_End() /*************************************/ // retourne la coord de fin du raccord @@ -47,7 +47,7 @@ wxPoint DrawBusEntryStruct::m_End( void ) /***************************************************/ -DrawBusEntryStruct* DrawBusEntryStruct::GenCopy( void ) +DrawBusEntryStruct* DrawBusEntryStruct::GenCopy() /***************************************************/ { DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 ); @@ -75,7 +75,7 @@ DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) : } -DrawJunctionStruct* DrawJunctionStruct::GenCopy( void ) +DrawJunctionStruct* DrawJunctionStruct::GenCopy() { DrawJunctionStruct* newitem = new DrawJunctionStruct( m_Pos ); @@ -97,7 +97,7 @@ DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) : } -DrawNoConnectStruct* DrawNoConnectStruct::GenCopy( void ) +DrawNoConnectStruct* DrawNoConnectStruct::GenCopy() { DrawNoConnectStruct* newitem = new DrawNoConnectStruct( m_Pos ); @@ -121,12 +121,12 @@ DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) : } -DrawMarkerStruct::~DrawMarkerStruct( void ) +DrawMarkerStruct::~DrawMarkerStruct() { } -DrawMarkerStruct* DrawMarkerStruct::GenCopy( void ) +DrawMarkerStruct* DrawMarkerStruct::GenCopy() { DrawMarkerStruct* newitem = new DrawMarkerStruct( m_Pos, m_Comment ); @@ -137,7 +137,7 @@ DrawMarkerStruct* DrawMarkerStruct::GenCopy( void ) } -wxString DrawMarkerStruct::GetComment( void ) +wxString DrawMarkerStruct::GetComment() { return m_Comment; } @@ -175,7 +175,7 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) : /***************************************************/ -EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy( void ) +EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy() /***************************************************/ { EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer ); @@ -234,7 +234,7 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) : /********************************************/ -DrawPolylineStruct::~DrawPolylineStruct( void ) +DrawPolylineStruct::~DrawPolylineStruct() /*********************************************/ { if( m_Points ) @@ -243,7 +243,7 @@ DrawPolylineStruct::~DrawPolylineStruct( void ) /*****************************************************/ -DrawPolylineStruct* DrawPolylineStruct::GenCopy( void ) +DrawPolylineStruct* DrawPolylineStruct::GenCopy() /*****************************************************/ { int memsize; diff --git a/eeschema/component_class.cpp b/eeschema/component_class.cpp index 430301f3e2..0281275a9a 100644 --- a/eeschema/component_class.cpp +++ b/eeschema/component_class.cpp @@ -109,7 +109,7 @@ int ii; /**********************************************************************/ -EDA_Rect EDA_SchComponentStruct::GetBoundaryBox( void ) +EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() /**********************************************************************/ { EDA_LibComponentStruct * Entry = FindLibPart(m_ChipName.GetData(), wxEmptyString, FIND_ROOT); @@ -203,7 +203,7 @@ void EDA_SchComponentStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC) { /* save old text in undo list */ if ( g_ItemToUndoCopy && - (g_ItemToUndoCopy->m_StructType == m_StructType) && + (g_ItemToUndoCopy->Type() == Type()) && ((m_Flags & IS_NEW) == 0) ) { /* restore old values and save new ones */ diff --git a/eeschema/component_class.h b/eeschema/component_class.h index 4e4ebcc6aa..8ec2523749 100644 --- a/eeschema/component_class.h +++ b/eeschema/component_class.h @@ -95,7 +95,7 @@ public: wxPoint GetScreenCoord(const wxPoint & coord); void Display_Infos(WinEDA_DrawFrame * frame); void ClearAnnotation(void); - EDA_Rect GetBoundaryBox( void ); + EDA_Rect GetBoundaryBox(); wxString ReturnFieldName(int FieldNumber); virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1); diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 0e9a7f8e28..8d85b10f07 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -87,7 +87,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) return NULL; /* Cross probing to pcbnew if a pin or a component is found */ - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case COMPONENT_FIELD_DRAW_TYPE: { diff --git a/eeschema/dangling_ends.cpp b/eeschema/dangling_ends.cpp index cf9bfd907a..b0a0c4abc5 100644 --- a/eeschema/dangling_ends.cpp +++ b/eeschema/dangling_ends.cpp @@ -106,7 +106,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC // Controle des elements for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) { - switch( DrawItem->m_StructType ) + switch( DrawItem->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE: @@ -310,7 +310,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) { - switch( DrawItem->m_StructType ) + switch( DrawItem->Type() ) { case DRAW_LABEL_STRUCT_TYPE: break; @@ -402,7 +402,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) LibEDA_BaseStruct* DrawLibItem = Entry->m_Drawings; for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() ) { - if( DrawLibItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) + if( DrawLibItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; LibDrawPin* Pin = (LibDrawPin*) DrawLibItem; diff --git a/eeschema/delete.cpp b/eeschema/delete.cpp index ae3dcfaa89..10973db411 100644 --- a/eeschema/delete.cpp +++ b/eeschema/delete.cpp @@ -36,7 +36,7 @@ int count = 0; if ( Struct->m_Flags & SKIP_STRUCT ) continue; - if ( TstJunction && (Struct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE) ) + if ( TstJunction && (Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE) ) { #define JUNCTION ((DrawJunctionStruct*)Struct) if ( (JUNCTION->m_Pos.x == pos.x) && (JUNCTION->m_Pos.y == pos.y) ) @@ -44,7 +44,7 @@ int count = 0; #undef JUNCTION } - if ( Struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; #define SEGM ((EDA_DrawLineStruct*)Struct) if ( SEGM->IsOneEndPointAt(pos) ) count++; #undef SEGM @@ -68,7 +68,7 @@ EDA_BaseStruct * Struct; for ( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext) { if ( Struct->m_Flags ) continue; - if ( Struct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) + if ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) { #define JUNCTION ((DrawJunctionStruct*)Struct) if ( segment->IsOneEndPointAt(JUNCTION->m_Pos) ) Struct->m_Flags |= CANDIDATE; @@ -76,7 +76,7 @@ EDA_BaseStruct * Struct; #undef JUNCTION } - if ( Struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; #define SEGM ((EDA_DrawLineStruct*)Struct) if ( segment->IsOneEndPointAt(SEGM->m_Start) ) @@ -142,7 +142,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; { if ( ! (DelStruct->m_Flags & SELECTEDNODE) ) continue; #define SEGM ((EDA_DrawLineStruct*)DelStruct) - if ( DelStruct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; MarkConnected(this, GetScreen()->EEDrawList, SEGM); #undef SEGM } @@ -154,7 +154,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; // Already seen if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue; // Already seen - if ( DelStruct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; DelStruct->m_Flags |= SKIP_STRUCT; #define SEGM ((EDA_DrawLineStruct*)DelStruct) /* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire, @@ -163,7 +163,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext) { if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue; - if ( removed_struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; #define WIRE ((EDA_DrawLineStruct*)removed_struct) if ( WIRE->IsOneEndPointAt(SEGM->m_Start) ) break; } @@ -175,7 +175,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext) { if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue; - if ( removed_struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; + if ( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( WIRE->IsOneEndPointAt(SEGM->m_End) ) break; } if ( removed_struct && ! CountConnectedItems(this, GetScreen()->EEDrawList, SEGM->m_End, TRUE) ) @@ -200,7 +200,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; int count; if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue; - if ( DelStruct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) + if ( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) { #define JUNCTION ((DrawJunctionStruct*)DelStruct) count = CountConnectedItems(this, GetScreen()->EEDrawList, JUNCTION->m_Pos, FALSE); @@ -221,7 +221,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; for ( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext) { if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; - if ( DelStruct->m_StructType != DRAW_LABEL_STRUCT_TYPE ) continue; + if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue; GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos; EDA_BaseStruct * TstStruct = PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList,WIREITEM|BUSITEM); @@ -328,13 +328,13 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; Screen->SetModify(); - if (DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE) + if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) { /* Cette stucture est rattachee a une feuille, et n'est pas accessible par la liste globale directement */ DrawList = Screen->EEDrawList; for ( ; DrawList != NULL; DrawList = DrawList->Pnext ) { - if(DrawList->m_StructType != DRAW_SHEET_STRUCT_TYPE) continue; + if(DrawList->Type() != DRAW_SHEET_STRUCT_TYPE) continue; /* Examen de la Sheet */ SheetLabel = ((DrawSheetStruct *) DrawList)->m_Label; if (SheetLabel == NULL) continue; @@ -361,7 +361,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; } - if (DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) + if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE) { PickedList = (DrawPickedStruct *) DrawStruct; while (PickedList) @@ -429,7 +429,7 @@ DrawMarkerStruct * Marker; for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct) { NextStruct = DrawStruct->Pnext; - if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) continue; + if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue; /* Marqueur trouve */ Marker = (DrawMarkerStruct * ) DrawStruct; if( Marker->m_Type != type ) continue; diff --git a/eeschema/delsheet.cpp b/eeschema/delsheet.cpp index 7b2b121ef1..2b90c6a67f 100644 --- a/eeschema/delsheet.cpp +++ b/eeschema/delsheet.cpp @@ -29,7 +29,7 @@ wxString msg; if( FirstSheet == NULL ) return; - if( FirstSheet->m_StructType != DRAW_SHEET_STRUCT_TYPE) + if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE) { DisplayError(NULL, wxT("DeleteSubHierarchy error(): NOT a Sheet")); @@ -54,7 +54,7 @@ wxString msg; { DrawStruct = EEDrawList; EEDrawList = EEDrawList->Pnext; - if( DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) + if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) { DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion); } @@ -76,7 +76,7 @@ EDA_BaseStruct *DrawStruct; DrawStruct = DrawList; DrawList = DrawList->Pnext; - if( DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) + if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) { DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion); } diff --git a/eeschema/dialog_build_BOM.cpp b/eeschema/dialog_build_BOM.cpp index 1db21e63ef..0c8efdc7b6 100644 --- a/eeschema/dialog_build_BOM.cpp +++ b/eeschema/dialog_build_BOM.cpp @@ -641,7 +641,7 @@ BASE_SCREEN * screen; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE : @@ -685,7 +685,7 @@ BASE_SCREEN * screen; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE : ItemCount++; @@ -981,7 +981,7 @@ wxString msg; DrawList = List[ii]; if( DrawList == NULL ) continue; - if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; + if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; DrawLibItem = (EDA_SchComponentStruct *) DrawList; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; @@ -1004,7 +1004,7 @@ wxString msg; { DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent); wxString sheetname; - if( sheet && sheet->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if( sheet && sheet->Type() == DRAW_SHEET_STRUCT_TYPE ) sheetname = sheet->m_SheetName; else sheetname = _("Root"); if ( CompactForm ) @@ -1047,7 +1047,7 @@ wxString msg; DrawList = List[ii]; if( DrawList == NULL ) continue; - if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; + if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; DrawLibItem = (EDA_SchComponentStruct *) DrawList; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; diff --git a/eeschema/dialog_cmp_graphic_properties.cpp b/eeschema/dialog_cmp_graphic_properties.cpp index 39e028088c..39c4f27bed 100644 --- a/eeschema/dialog_cmp_graphic_properties.cpp +++ b/eeschema/dialog_cmp_graphic_properties.cpp @@ -71,7 +71,7 @@ LibEDA_BaseStruct * CurrentItem = CurrentDrawItem; bool show_fill_option = FALSE; int fill_option = 0; if( CurrentItem ) - switch(CurrentItem->m_StructType) + switch(CurrentItem->Type()) { case COMPONENT_ARC_DRAW_TYPE: show_fill_option = TRUE; diff --git a/eeschema/dialog_edit_label.cpp b/eeschema/dialog_edit_label.cpp index bdc926696d..68b74b8b2b 100644 --- a/eeschema/dialog_edit_label.cpp +++ b/eeschema/dialog_edit_label.cpp @@ -64,7 +64,7 @@ wxString msg; Create(parent, id, caption, pos, size, style); m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetFocus(); - switch( m_CurrentText->m_StructType ) + switch( m_CurrentText->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE: SetTitle(_("Global Label properties")); @@ -187,7 +187,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls() m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) ); ////@end WinEDA_LabelPropertiesFrame content construction - if (m_CurrentText->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) + if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) m_TextShape->Show(true); } diff --git a/eeschema/edit_component_in_lib.cpp b/eeschema/edit_component_in_lib.cpp index ab698e5650..4305cf603e 100644 --- a/eeschema/edit_component_in_lib.cpp +++ b/eeschema/edit_component_in_lib.cpp @@ -960,7 +960,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem; for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) { /* Duplication des items pour autres elements */ - if( DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( DrawItem->m_Convert == 1 ) { if( FlagDel == 0 ) diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index c83195bcee..430627c9ef 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -44,7 +44,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, */ { parent->DrawPanel->m_IgnoreMouseEvents = TRUE; - if( cmp->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) { DisplayError( parent, wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); @@ -62,7 +62,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, /*****************************************************/ -void WinEDA_ComponentPropertiesFrame::InitBuffers( void ) +void WinEDA_ComponentPropertiesFrame::InitBuffers() /*****************************************************/ /* Init the buffers to a default value, @@ -105,7 +105,7 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers( void ) /****************************************************************/ -void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField( void ) +void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField() /****************************************************************/ /* Set the values displayed on the panel field according to @@ -153,7 +153,7 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField( void ) /****************************************************************/ -void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData( void ) +void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData() /****************************************************************/ /* Copy the values displayed on the panel field to the buffers according to @@ -172,7 +172,7 @@ void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData( void ) /*************************************************************/ -void WinEDA_ComponentPropertiesFrame::BuildPanelFields( void ) +void WinEDA_ComponentPropertiesFrame::BuildPanelFields() /*************************************************************/ { int ii, FieldId; @@ -226,7 +226,7 @@ void WinEDA_ComponentPropertiesFrame::BuildPanelFields( void ) /**********************************************************/ -void WinEDA_ComponentPropertiesFrame::BuildPanelBasic( void ) +void WinEDA_ComponentPropertiesFrame::BuildPanelBasic() /**********************************************************/ /* create the basic panel for component properties editing @@ -691,7 +691,7 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) m_Parent; /* save old cmp in undo list */ - if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->m_StructType == Cmp->m_StructType) ) + if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Cmp->Type()) ) { Cmp->SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( Cmp, IS_CHANGED ); diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 2b6b10cc64..e40f1db68e 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -82,7 +82,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC TextStruct->m_Flags |= IS_MOVED; - switch( TextStruct->m_StructType ) + switch( TextStruct->Type() ) { case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: @@ -153,7 +153,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); /* Rotation du texte */ - switch( TextStruct->m_StructType ) + switch( TextStruct->Type() ) { case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: @@ -193,10 +193,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) break; case LAYER_LOCLABEL: - { NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur ); NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; - } break; case LAYER_GLOBLABEL: @@ -250,7 +248,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) RedrawOneStruct( panel, DC, TextStruct, g_XorMode ); /* Redessin du texte */ - switch( TextStruct->m_StructType ) + switch( TextStruct->Type() ) { case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: @@ -295,7 +293,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) } else /* Remise a jour des anciens parametres du texte */ { - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: @@ -340,17 +338,17 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text, switch( newtype ) { case DRAW_LABEL_STRUCT_TYPE: - Text->m_StructType = DRAW_LABEL_STRUCT_TYPE; + Text->SetType( DRAW_LABEL_STRUCT_TYPE ); Text->m_Layer = LAYER_LOCLABEL; break; case DRAW_GLOBAL_LABEL_STRUCT_TYPE: - Text->m_StructType = DRAW_GLOBAL_LABEL_STRUCT_TYPE; + Text->SetType( DRAW_GLOBAL_LABEL_STRUCT_TYPE ); Text->m_Layer = LAYER_GLOBLABEL; break; case DRAW_TEXT_STRUCT_TYPE: - Text->m_StructType = DRAW_TEXT_STRUCT_TYPE; + Text->SetType( DRAW_TEXT_STRUCT_TYPE ); Text->m_Layer = LAYER_NOTES; break; diff --git a/eeschema/editpart.cpp b/eeschema/editpart.cpp index 0e0bce060d..49d5a9f9f4 100644 --- a/eeschema/editpart.cpp +++ b/eeschema/editpart.cpp @@ -86,13 +86,13 @@ public: // Constructor and destructor WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, EDA_SchComponentStruct* cmp ); - ~WinEDA_ComponentPropertiesFrame( void ) + ~WinEDA_ComponentPropertiesFrame() { } private: - void BuildPanelBasic( void ); + void BuildPanelBasic(); void ComponentPropertiesAccept( wxCommandEvent& event ); void SetInitCmp( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event ); @@ -116,7 +116,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, */ { parent->DrawPanel->m_IgnoreMouseEvents = TRUE; - if( cmp->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) { DisplayError( parent, wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); @@ -265,7 +265,7 @@ void WinEDA_ComponentPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) /**********************************************************/ -void WinEDA_ComponentPropertiesFrame::BuildPanelBasic( void ) +void WinEDA_ComponentPropertiesFrame::BuildPanelBasic() /**********************************************************/ /* create the basic panel for component properties editing diff --git a/eeschema/eeclass.cpp b/eeschema/eeclass.cpp.notused similarity index 95% rename from eeschema/eeclass.cpp rename to eeschema/eeclass.cpp.notused index 3bce978a29..d91dc81474 100644 --- a/eeschema/eeclass.cpp +++ b/eeschema/eeclass.cpp.notused @@ -18,7 +18,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) /************************************************************/ { - switch( Struct->m_StructType ) + switch( Struct->Type() ) { case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE: @@ -86,7 +86,7 @@ SCH_SCREEN::SCH_SCREEN( EDA_BaseStruct* parent, WinEDA_DrawFrame* frame_source, /****************************/ -SCH_SCREEN::~SCH_SCREEN( void ) +SCH_SCREEN::~SCH_SCREEN() /****************************/ { ClearUndoRedoList(); @@ -95,7 +95,7 @@ SCH_SCREEN::~SCH_SCREEN( void ) /*************************************/ -SCH_SCREEN* SCH_SCREEN::GenCopy( void ) +SCH_SCREEN* SCH_SCREEN::GenCopy() /*************************************/ { // TODO @@ -104,7 +104,7 @@ SCH_SCREEN* SCH_SCREEN::GenCopy( void ) /***********************************/ -void SCH_SCREEN::FreeDrawList( void ) +void SCH_SCREEN::FreeDrawList() /***********************************/ /* Routine to clear EESchema drawing list of a screen. diff --git a/eeschema/eecreate.cpp b/eeschema/eecreate.cpp index 4d884d8da4..118733f691 100644 --- a/eeschema/eecreate.cpp +++ b/eeschema/eecreate.cpp @@ -37,7 +37,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) if( GetScreen()->GetCurItem() ) { - switch( GetScreen()->GetCurItem()->m_StructType ) + switch( GetScreen()->GetCurItem()->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE: @@ -254,7 +254,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) } /* Trace en cours: annulation */ - if( GetScreen()->GetCurItem()->m_StructType == DRAW_POLYLINE_STRUCT_TYPE ) + if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE ) { Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ } @@ -353,7 +353,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) if( g_ItemToRepeat == NULL ) return; - switch( g_ItemToRepeat->m_StructType ) + switch( g_ItemToRepeat->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: #undef STRUCT @@ -534,7 +534,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) return TRUE; item = PickStruct( screen, LABELITEM ); - if( item && (item->m_StructType != DRAW_TEXT_STRUCT_TYPE) + if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) return TRUE; diff --git a/eeschema/eelibs_draw_components.cpp b/eeschema/eelibs_draw_components.cpp index d532a22be4..32cbbeb140 100644 --- a/eeschema/eelibs_draw_components.cpp +++ b/eeschema/eelibs_draw_components.cpp @@ -48,7 +48,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, int Color = -1, bool DrawPinText = TRUE ); /******************************/ -static void CreateDummyCmp( void ) +static void CreateDummyCmp() /******************************/ { DummyCmp = new EDA_LibComponentStruct( NULL ); @@ -433,7 +433,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; LineWidth = MAX( DEntry->m_Width, g_DrawMinimunLineWidth ); - switch( DEntry->m_StructType ) + switch( DEntry->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -925,7 +925,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC, int LineWidth = MAX( DrawItem->m_Width, g_DrawMinimunLineWidth ); - switch( DrawItem->m_StructType ) + switch( DrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index bb60e1d028..305a23934d 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) /******************************/ -const wxChar** GetLibNames( void ) +const wxChar** GetLibNames() /******************************/ /* Routine to return pointers to all library names. @@ -806,7 +806,7 @@ LibraryStruct* FindLibrary( const wxString& Name ) /***************************************************************************** * Routine to find the number of libraries currently loaded. * *****************************************************************************/ -int NumOfLibraries( void ) +int NumOfLibraries() { int ii; LibraryStruct* Lib = g_LibraryList; @@ -1080,7 +1080,7 @@ static bool ReadLibEntryDateAndTime( EDA_LibComponentStruct* LibEntry, char* Lin /*******************************************/ static int SortItemsFct( const void* ref, const void* item ); -void EDA_LibComponentStruct::SortDrawItems( void ) +void EDA_LibComponentStruct::SortDrawItems() /*******************************************/ /* Trie les éléments graphiques d'un composant lib pour améliorer @@ -1130,7 +1130,7 @@ int SortItemsFct( const void* ref, const void* item ) int fill_ref = 0, fill_item = 0; - switch( Ref->m_StructType ) + switch( Ref->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -1161,15 +1161,15 @@ int SortItemsFct( const void* ref, const void* item ) } case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - if( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if( Item->Type() == COMPONENT_PIN_DRAW_TYPE ) return BEFORE; - if( Item->m_StructType == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) + if( Item->Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return 0; return 1; break; case COMPONENT_PIN_DRAW_TYPE: - if( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if( Item->Type() == COMPONENT_PIN_DRAW_TYPE ) { int ii; @@ -1199,7 +1199,7 @@ int SortItemsFct( const void* ref, const void* item ) } /* Test de l'item */ - switch( Item->m_StructType ) + switch( Item->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { diff --git a/eeschema/eeload.cpp b/eeschema/eeload.cpp index aa263b4944..7a019407ee 100644 --- a/eeschema/eeload.cpp +++ b/eeschema/eeload.cpp @@ -182,7 +182,7 @@ void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList ) while( EEDrawList ) { - if( EEDrawList->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if( EEDrawList->Type() == DRAW_SHEET_STRUCT_TYPE ) { #undef STRUCT #define STRUCT ( (DrawSheetStruct*) EEDrawList ) diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 0b35375ac7..ab11fe7ffb 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -154,7 +154,7 @@ void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC, { while (Structs) { - if (Structs->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) + if (Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE) { RedrawOneStruct(panel, DC, ((DrawPickedStruct *) Structs)->m_PickedStruct, @@ -353,7 +353,7 @@ int width = g_DrawMinimunLineWidth; GRSetDrawMode(DC, DrawMode); - switch (DrawStruct->m_StructType) + switch (DrawStruct->Type()) { case DRAW_POLYLINE_STRUCT_TYPE: { diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index f048c91976..358a866286 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -26,7 +26,7 @@ /* Routines locales */ -static void CreateScreens( void ); +static void CreateScreens(); // Global variables wxString g_Main_Title( wxT( "EESchema" ) ); @@ -42,7 +42,7 @@ wxString g_Main_Title( wxT( "EESchema" ) ); // not wxApp) IMPLEMENT_APP( WinEDA_App ) -bool WinEDA_App::OnInit( void ) +bool WinEDA_App::OnInit() { wxString FFileName; @@ -108,7 +108,7 @@ bool WinEDA_App::OnInit( void ) /******************************/ -static void CreateScreens( void ) +static void CreateScreens() /******************************/ /* diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 88a75156da..1bd80eaff0 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -413,7 +413,7 @@ wxClientDC dc(m_Parent->DrawPanel); DrawStruct = m_Parent->GetScreen()->EEDrawList; for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) { - if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) continue; + if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue; /* Marqueur trouve */ Marker = (DrawMarkerStruct * ) DrawStruct; if( Marker->m_Type == MARQ_ERC ) @@ -693,7 +693,7 @@ wxString msg; DrawStruct = Screen->EEDrawList; for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext) { - if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) + if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue; /* Marqueur trouve */ diff --git a/eeschema/fieldedi.cpp b/eeschema/fieldedi.cpp index e6c8e1e858..8ba3f3737f 100644 --- a/eeschema/fieldedi.cpp +++ b/eeschema/fieldedi.cpp @@ -1063,7 +1063,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem; for ( ; DrawItem != NULL; DrawItem = DrawItem->Pnext ) { /* Duplication des items pour autres elements */ - if( DrawItem->m_StructType != PIN_DRAW_TYPE ) continue; + if( DrawItem->Type() != PIN_DRAW_TYPE ) continue; if( DrawItem->m_Convert == 1 ) { if( FlagDel == 0 ) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 12ca5fe80a..32db4ad781 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -128,7 +128,7 @@ int Nb = 0; { for( Phead=Window->EEDrawList; Phead != NULL; Phead=Phead->Pnext) { - if (Phead->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE) + if (Phead->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) { DrawPartStruct * Cmp = (DrawPartStruct *) Phead; if ( Cmp->m_Field[VALUE].m_Text.GetChar(0) != '#' ) Nb++; diff --git a/eeschema/find.cpp b/eeschema/find.cpp index ed65ffd477..596194185b 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -90,7 +90,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) DrawList = Screen->EEDrawList; while( DrawList && NotFound ) { - if( DrawList->m_StructType == DRAW_MARKER_STRUCT_TYPE ) + if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE ) { Marker = (DrawMarkerStruct*) DrawList; NotFound = FALSE; @@ -255,7 +255,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( DrawList = Screen->EEDrawList; while( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE: EDA_SchComponentStruct* pSch; @@ -343,7 +343,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( /* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type, * coordinates must be computed according to its orientation matrix */ - if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) { EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct; diff --git a/eeschema/genliste.cpp b/eeschema/genliste.cpp index 4e818753e0..0830ba8689 100644 --- a/eeschema/genliste.cpp +++ b/eeschema/genliste.cpp @@ -17,7 +17,7 @@ /* Structures pour memo et liste des elements */ typedef struct ListLabel { - int m_StructType; + int Type(); void * m_Label; int m_SheetNumber; } ListLabel; @@ -318,7 +318,7 @@ BASE_SCREEN * screen = ScreenSch; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE : @@ -359,12 +359,12 @@ BASE_SCREEN * screen = ScreenSch; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE : if( List ) { - List->m_StructType = DRAW_TEXT_STRUCT_TYPE; + List->Type() = DRAW_TEXT_STRUCT_TYPE; List->m_SheetNumber = screen->m_SheetNumber; List->m_Label = DrawList; List++; } @@ -379,7 +379,7 @@ BASE_SCREEN * screen = ScreenSch; { if ( List ) { - List->m_StructType = DRAW_SHEETLABEL_STRUCT_TYPE; + List->Type() = DRAW_SHEETLABEL_STRUCT_TYPE; List->m_SheetNumber = screen->m_SheetNumber; List->m_Label = SheetLabel; List++; @@ -487,12 +487,12 @@ static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2) int ii; const wxString * Text1, *Text2; - if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; else Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; - if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; else Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; @@ -523,12 +523,12 @@ const wxString * Text1, *Text2; if ( ii == 0 ) { - if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; else Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; - if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) + if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; else Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; @@ -590,7 +590,7 @@ wxString msg; DrawList = List[ii]; if( DrawList == NULL ) continue; - if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; + if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; DrawLibItem = (EDA_SchComponentStruct *) DrawList; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; @@ -646,7 +646,7 @@ wxString msg; DrawList = List[ii]; if( DrawList == NULL ) continue; - if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; + if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; DrawLibItem = (EDA_SchComponentStruct *) DrawList; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; @@ -689,7 +689,7 @@ wxString msg; { LabelItem = & List[ii]; - switch( LabelItem->m_StructType ) + switch( LabelItem->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE : DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 6d7dfa051b..a59c6d5943 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -466,7 +466,7 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component, { if( Component == NULL ) return; - if( Component->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( Component->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) return; if( Component->m_Flags == 0 ) diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 682189b5d0..71ed2b9e9e 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -206,7 +206,7 @@ SCH_SCREEN * Screen; while( DrawStruct ) { - if(DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) + if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) { #define STRUCT ((DrawSheetStruct*)DrawStruct) nbsheets++; diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 104da0921c..69fe6317b5 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -190,7 +190,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, { if( DrawStruct->m_Flags ) // Item selected and edition in progress { - if( DrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct; if( segment->m_Layer != LAYER_WIRE ) @@ -214,13 +214,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM ); if( DrawStruct == NULL ) break; - if( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) DrawStruct = LocateSmallestComponent( GetScreen() ); if( DrawStruct == NULL ) break; } - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE: if( DrawStruct->m_Flags == 0 ) @@ -368,7 +368,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, case HK_REPEAT_LAST: if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0) - && (LibItemToRepeat->m_StructType == COMPONENT_PIN_DRAW_TYPE) ) + && (LibItemToRepeat->Type() == COMPONENT_PIN_DRAW_TYPE) ) { RepeatPinItem( DC, (LibDrawPin*) LibItemToRepeat ); } diff --git a/eeschema/libclass.cpp b/eeschema/libclass.cpp index eab2db309e..a1fc4bc660 100644 --- a/eeschema/libclass.cpp +++ b/eeschema/libclass.cpp @@ -130,7 +130,7 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) : /******************************/ -LibCmpEntry::~LibCmpEntry( void ) +LibCmpEntry::~LibCmpEntry() /******************************/ { } @@ -159,7 +159,7 @@ EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar* CmpName, } -EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct( void ) +EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct() { } @@ -187,7 +187,7 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) : /******************************************************/ -EDA_LibComponentStruct::~EDA_LibComponentStruct( void ) +EDA_LibComponentStruct::~EDA_LibComponentStruct() /******************************************************/ { LibEDA_BaseStruct* DrawItem, * NextDrawItem; @@ -247,7 +247,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert ) if( (Convert > 0) && (Convert != DrawEntry->m_Convert) ) continue; - switch( DrawEntry->m_StructType ) + switch( DrawEntry->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -403,13 +403,13 @@ LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_D } -LibDrawField::~LibDrawField( void ) +LibDrawField::~LibDrawField() { } // Creation et Duplication d'un field -LibDrawField* LibDrawField::GenCopy( void ) +LibDrawField* LibDrawField::GenCopy() { LibDrawField* newfield = new LibDrawField( m_FieldId ); @@ -447,7 +447,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) : /***************************************************************/ -LibDrawPin::LibDrawPin( void ) : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) +LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) /***************************************************************/ { m_PinLen = 300; /* default Pin len */ @@ -465,7 +465,7 @@ LibDrawPin::LibDrawPin( void ) : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) /******************************************/ -wxPoint LibDrawPin::ReturnPinEndPoint( void ) +wxPoint LibDrawPin::ReturnPinEndPoint() /******************************************/ /* return the pin end position, for a component in normal orient @@ -582,7 +582,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer ) /*************************************/ -LibDrawPin* LibDrawPin::GenCopy( void ) +LibDrawPin* LibDrawPin::GenCopy() /*************************************/ { LibDrawPin* newpin = new LibDrawPin(); @@ -608,7 +608,7 @@ LibDrawPin* LibDrawPin::GenCopy( void ) /**************************************************************/ -LibDrawArc::LibDrawArc( void ) : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE ) +LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE ) /**************************************************************/ { m_Rayon = 0; @@ -619,7 +619,7 @@ LibDrawArc::LibDrawArc( void ) : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE ) /************************************/ -LibDrawArc* LibDrawArc::GenCopy( void ) +LibDrawArc* LibDrawArc::GenCopy() /************************************/ { LibDrawArc* newitem = new LibDrawArc(); @@ -640,7 +640,7 @@ LibDrawArc* LibDrawArc::GenCopy( void ) /**********************************************************************/ -LibDrawCircle::LibDrawCircle( void ) : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE ) +LibDrawCircle::LibDrawCircle() : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE ) /**********************************************************************/ { m_Rayon = 0; @@ -649,7 +649,7 @@ LibDrawCircle::LibDrawCircle( void ) : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_ /*******************************************/ -LibDrawCircle* LibDrawCircle::GenCopy( void ) +LibDrawCircle* LibDrawCircle::GenCopy() /*******************************************/ { LibDrawCircle* newitem = new LibDrawCircle(); @@ -666,7 +666,7 @@ LibDrawCircle* LibDrawCircle::GenCopy( void ) /*****************************************************************/ -LibDrawText::LibDrawText( void ) : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) +LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) /*****************************************************************/ { m_Horiz = TEXT_ORIENT_HORIZ; @@ -677,7 +677,7 @@ LibDrawText::LibDrawText( void ) : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRA /***************************************/ -LibDrawText* LibDrawText::GenCopy( void ) +LibDrawText* LibDrawText::GenCopy() /***************************************/ { LibDrawText* newitem = new LibDrawText(); @@ -695,14 +695,14 @@ LibDrawText* LibDrawText::GenCopy( void ) } -LibDrawSquare::LibDrawSquare( void ) : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE ) +LibDrawSquare::LibDrawSquare() : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE ) { m_Width = 0; m_Fill = NO_FILL; } -LibDrawSquare* LibDrawSquare::GenCopy( void ) +LibDrawSquare* LibDrawSquare::GenCopy() { LibDrawSquare* newitem = new LibDrawSquare(); @@ -717,13 +717,13 @@ LibDrawSquare* LibDrawSquare::GenCopy( void ) } -LibDrawSegment::LibDrawSegment( void ) : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE ) +LibDrawSegment::LibDrawSegment() : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE ) { m_Width = 0; } -LibDrawSegment* LibDrawSegment::GenCopy( void ) +LibDrawSegment* LibDrawSegment::GenCopy() { LibDrawSegment* newitem = new LibDrawSegment(); @@ -737,7 +737,7 @@ LibDrawSegment* LibDrawSegment::GenCopy( void ) } -LibDrawPolyline::LibDrawPolyline( void ) : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE ) +LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE ) { n = 0; PolyList = NULL; @@ -747,7 +747,7 @@ LibDrawPolyline::LibDrawPolyline( void ) : LibEDA_BaseStruct( COMPONENT_POLYLINE /************************************************/ -LibDrawPolyline* LibDrawPolyline::GenCopy( void ) +LibDrawPolyline* LibDrawPolyline::GenCopy() /************************************************/ { LibDrawPolyline* newitem = new LibDrawPolyline(); diff --git a/eeschema/libcmp.h b/eeschema/libcmp.h index 91d3e910a7..10d1c70131 100644 --- a/eeschema/libcmp.h +++ b/eeschema/libcmp.h @@ -177,12 +177,12 @@ public: int m_Width; /* Width of draw lines */ public: - LibEDA_BaseStruct* Next( void ) + LibEDA_BaseStruct* Next() { return (LibEDA_BaseStruct*) Pnext; } LibEDA_BaseStruct( KICAD_T struct_type ); - virtual ~LibEDA_BaseStruct( void ) { } + virtual ~LibEDA_BaseStruct() { } void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ); }; @@ -203,12 +203,12 @@ public: // short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */ public: - LibDrawPin( void ); - ~LibDrawPin( void ) { } - LibDrawPin* GenCopy( void ); + LibDrawPin(); + ~LibDrawPin() { } + LibDrawPin* GenCopy(); bool WriteDescr( FILE* File ); void Display_Infos( WinEDA_DrawFrame* frame ); - wxPoint ReturnPinEndPoint( void ); + wxPoint ReturnPinEndPoint(); int ReturnPinDrawOrient( int TransMat[2][2] ); void ReturnPinStringNum( wxString& buffer ); void SetPinNumFromString( wxString& buffer ); @@ -234,9 +234,9 @@ public: wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ public: - LibDrawArc( void ); - ~LibDrawArc( void ) { } - LibDrawArc* GenCopy( void ); + LibDrawArc(); + ~LibDrawArc() { } + LibDrawArc* GenCopy(); bool WriteDescr( FILE* File ); }; @@ -247,9 +247,9 @@ public: int m_Fill; public: - LibDrawCircle( void ); - ~LibDrawCircle( void ) { } - LibDrawCircle* GenCopy( void ); + LibDrawCircle(); + ~LibDrawCircle() { } + LibDrawCircle* GenCopy(); bool WriteDescr( FILE* File ); }; @@ -262,9 +262,9 @@ public: wxString m_Text; public: - LibDrawText( void ); - ~LibDrawText( void ) { } - LibDrawText* GenCopy( void ); + LibDrawText(); + ~LibDrawText() { } + LibDrawText* GenCopy(); bool WriteDescr( FILE* File ); }; @@ -275,9 +275,9 @@ public: int m_Fill; public: - LibDrawSquare( void ); - ~LibDrawSquare( void ) { } - LibDrawSquare* GenCopy( void ); + LibDrawSquare(); + ~LibDrawSquare() { } + LibDrawSquare* GenCopy(); bool WriteDescr( FILE* File ); }; @@ -287,9 +287,9 @@ public: wxPoint m_End; public: - LibDrawSegment( void ); - ~LibDrawSegment( void ) { } - LibDrawSegment* GenCopy( void ); + LibDrawSegment(); + ~LibDrawSegment() { } + LibDrawSegment* GenCopy(); bool WriteDescr( FILE* File ); }; @@ -300,12 +300,12 @@ public: int m_Fill; public: - LibDrawPolyline( void ); - ~LibDrawPolyline( void ) { + LibDrawPolyline(); + ~LibDrawPolyline() { if( PolyList ) free( PolyList ); } - LibDrawPolyline* GenCopy( void ); + LibDrawPolyline* GenCopy(); void AddPoint( const wxPoint& point ); bool WriteDescr( FILE* File ); }; @@ -327,9 +327,9 @@ public: public: LibDrawField( int idfield = 2 ); - ~LibDrawField( void ); + ~LibDrawField(); - LibDrawField* GenCopy( void ); + LibDrawField* GenCopy(); void Copy( LibDrawField* Target ); bool WriteDescr( FILE* File ); }; @@ -349,7 +349,7 @@ public: public: LibCmpEntry( LibrEntryType CmpType, const wxChar * CmpName ); - virtual ~LibCmpEntry( void ); + virtual ~LibCmpEntry(); bool WriteDescr( FILE* File ); }; @@ -375,8 +375,8 @@ public: EDA_LibComponentStruct( const wxChar * CmpName ); EDA_Rect GetBoundaryBox( int Unit, int Convert );/* return Box around the part. */ - ~EDA_LibComponentStruct( void ); - void SortDrawItems( void ); + ~EDA_LibComponentStruct(); + void SortDrawItems(); }; class EDA_LibCmpAliasStruct : public LibCmpEntry @@ -386,7 +386,7 @@ public: public: EDA_LibCmpAliasStruct( const wxChar * CmpName, const wxChar * CmpRootName ); - ~EDA_LibCmpAliasStruct( void ); + ~EDA_LibCmpAliasStruct(); }; /* Variables */ diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 026fabd8d6..4126a293ec 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -32,7 +32,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; if ( DrawEntry && DrawEntry->m_Flags ) { SaveCopyInUndoList(CurrentLibEntry); - switch (DrawEntry->m_StructType ) + switch (DrawEntry->Type() ) { case COMPONENT_PIN_DRAW_TYPE: PlacePin(DC); @@ -146,7 +146,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; break; } SaveCopyInUndoList(CurrentLibEntry); - if ( DrawEntry->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if ( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) DeletePin(DC, CurrentLibEntry, (LibDrawPin*)DrawEntry); else DeleteOneLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,DrawEntry, TRUE); @@ -233,7 +233,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; CurrentDrawItem = DrawEntry; DrawPanel->m_IgnoreMouseEvents = TRUE; - switch ( DrawEntry->m_StructType ) + switch ( DrawEntry->Type() ) { case COMPONENT_PIN_DRAW_TYPE: if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move @@ -282,7 +282,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; wxString msg; msg.Printf( wxT("WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d"), - DrawEntry->m_StructType); + DrawEntry->Type()); DisplayError(this, msg ); break; } diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index e158235997..30ab8610eb 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -90,7 +90,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); CurrentDrawItem = DrawEntry; - switch ( DrawEntry->m_StructType ) + switch ( DrawEntry->Type() ) { case COMPONENT_PIN_DRAW_TYPE: AddMenusForPin(PopMenu, (LibDrawPin*)DrawEntry, this); @@ -202,7 +202,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); wxString msg; msg.Printf( wxT("WinEDA_LibeditFrame::OnRightClick Error: unknown StructType %d"), - DrawEntry->m_StructType); + DrawEntry->Type()); DisplayError(this, msg ); CurrentDrawItem = NULL; break; diff --git a/eeschema/libedpart.cpp b/eeschema/libedpart.cpp index 0495c82d61..bf492efbfd 100644 --- a/eeschema/libedpart.cpp +++ b/eeschema/libedpart.cpp @@ -1049,7 +1049,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem; for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) { /* Duplication des items pour autres elements */ - if( DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( DrawItem->m_Convert == 1 ) { if( FlagDel == 0 ) diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index 1a6115f350..a07e5074c9 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -531,7 +531,7 @@ wxClientDC dc(DrawPanel); if ( CurrentDrawItem ) { DrawPanel->CursorOff(&dc); - switch ( CurrentDrawItem->m_StructType ) + switch ( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE: @@ -568,7 +568,7 @@ wxClientDC dc(DrawPanel); DrawPanel->MouseToCursorSchema(); DrawPanel->CursorOff(&dc); SaveCopyInUndoList(CurrentLibEntry); - if ( CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) { DeletePin(&dc, CurrentLibEntry, (LibDrawPin*)CurrentDrawItem); } @@ -588,9 +588,9 @@ wxClientDC dc(DrawPanel); case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST: if ( CurrentDrawItem == NULL) break; DrawPanel->MouseToCursorSchema(); - if ( CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE ) + if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) StartMovePin(&dc); - else if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) + else if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) StartMoveField(&dc, (LibDrawField *) CurrentDrawItem); else StartMoveDrawSymbol(&dc); break; @@ -609,7 +609,7 @@ wxClientDC dc(DrawPanel); if ( CurrentDrawItem == NULL) break; DrawPanel->CursorOff(&dc); DrawPanel->MouseToCursorSchema(); - if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) + if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) { SaveCopyInUndoList(CurrentLibEntry); RotateField(&dc, (LibDrawField *) CurrentDrawItem); @@ -620,7 +620,7 @@ wxClientDC dc(DrawPanel); case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: if ( CurrentDrawItem == NULL) break; DrawPanel->CursorOff(&dc); - if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) + if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) { EditField(&dc, (LibDrawField *) CurrentDrawItem); } @@ -631,7 +631,7 @@ wxClientDC dc(DrawPanel); case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: if ( (CurrentDrawItem == NULL) || - (CurrentDrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE) ) + (CurrentDrawItem->Type() != COMPONENT_PIN_DRAW_TYPE) ) break; SaveCopyInUndoList(CurrentLibEntry); GlobalSetPins(&dc, (LibDrawPin *) CurrentDrawItem, id); diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index 3de8204306..4b3f4ed3fe 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -202,7 +202,7 @@ int dx, dy; if(DontSnap) if (DontSnap->m_PickedStruct == DrawList) continue; - switch (DrawList->m_StructType) + switch (DrawList->Type()) { case DRAW_POLYLINE_STRUCT_TYPE: #undef STRUCT @@ -440,7 +440,7 @@ int dx, dy; default: { wxString msg; - msg.Printf(wxT("SnapPoint2() error: unexpected strct type %d ("), DrawList->m_StructType); + msg.Printf(wxT("SnapPoint2() error: unexpected strct type %d ("), DrawList->Type()); msg << DrawList->ReturnClassName() << wxT(")"); DisplayError(NULL, msg); break; @@ -463,7 +463,7 @@ int i, *Points, xt1, yt1, xt2, yt2, NumOfPoints2; int dx, dy; wxString msg; - switch (DrawStruct->m_StructType) + switch (DrawStruct->Type()) { case DRAW_POLYLINE_STRUCT_TYPE: #undef STRUCT @@ -612,7 +612,7 @@ wxString msg; default: msg.Printf( wxT("DrawStructInBox() Err: unexpected StructType %d ("), - DrawStruct->m_StructType ); + DrawStruct->Type() ); msg << DrawStruct->ReturnClassName() << wxT(")"); DisplayError(NULL, msg ); break; @@ -750,7 +750,7 @@ int seuil; if(Convert && DrawItem->m_Convert && (Convert != DrawItem->m_Convert) ) continue; - switch ( DrawItem->m_StructType ) + switch ( DrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -988,7 +988,7 @@ int x1, y1, x2, y2; DrawItem = Entry->m_Drawings; for ( ; DrawItem != NULL; DrawItem = DrawItem->Next()) { - if(DrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE) /* Pin Trouvee */ + if(DrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) /* Pin Trouvee */ { Pin = (LibDrawPin *) DrawItem; @@ -1039,7 +1039,7 @@ int size , dy, minx, maxx; DrawSheetLabelStruct * SheetLabel; SheetLabel = Sheet->m_Label; - while((SheetLabel) && (SheetLabel->m_StructType==DRAW_SHEETLABEL_STRUCT_TYPE)) + while((SheetLabel) && (SheetLabel->Type()==DRAW_SHEETLABEL_STRUCT_TYPE)) { size = ( SheetLabel->GetLength()+1 ) * SheetLabel->m_Size.x; if (SheetLabel->m_Edge) size = -size ; @@ -1067,7 +1067,7 @@ LibDrawPin * Pin = NULL; for(DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) { - if( DrawStruct->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( DrawStruct->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; LibItem = (EDA_SchComponentStruct *) DrawStruct; Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); @@ -1090,7 +1090,7 @@ DrawSheetLabelStruct * PinSheet = NULL; for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) { - if( DrawStruct->m_StructType != DRAW_SHEET_STRUCT_TYPE ) + if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) continue; PinSheet = LocateSheetLabel( (DrawSheetStruct *) DrawStruct, RefPos); diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index f391cb6a57..576fcf6bde 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -123,7 +123,7 @@ LibEDA_BaseStruct *DEntry; for ( ; DrawList != NULL; DrawList = DrawList->Next() ) { - if ( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; + if ( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; Component = (EDA_SchComponentStruct *) DrawList; /* already tested ? : */ @@ -145,7 +145,7 @@ LibEDA_BaseStruct *DEntry; DEntry = Entry->m_Drawings; for ( ;DEntry != NULL; DEntry = DEntry->Next()) { - if ( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; + if ( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( DEntry->m_Unit && (DEntry->m_Unit != Component->m_Multi) ) continue; if( DEntry->m_Convert && @@ -336,7 +336,7 @@ EDA_BaseStruct *DrawList; DrawList = screen->EEDrawList; while ( DrawList ) { - if( DrawList->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE) + if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) { EDA_SchComponentStruct * Component = (EDA_SchComponentStruct *) DrawList; Component->m_FlagControlMulti = 0; @@ -384,7 +384,7 @@ wxChar bufnum[BUFYPOS_LEN+1]; for ( DrawList = screen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) { wxChar ident; - if ( DrawList->m_StructType != DRAW_TEXT_STRUCT_TYPE ) continue; + if ( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE ) continue; #define DRAWTEXT ((DrawTextStruct *) DrawList) text = DRAWTEXT->m_Text; if ( text.IsEmpty() ) continue; ident = text.GetChar(0); @@ -685,7 +685,7 @@ SCH_SCREEN * screen; DrawList = screen->EEDrawList; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_LIB_ITEM_STRUCT_TYPE : Component2 = (EDA_SchComponentStruct *) DrawList; @@ -705,7 +705,7 @@ SCH_SCREEN * screen; DEntry = Entry->m_Drawings; for ( ;DEntry != NULL; DEntry = DEntry->Next()) { - if ( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; + if ( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( DEntry->m_Unit && (DEntry->m_Unit != Component2->m_Multi) ) continue; if( DEntry->m_Convert && diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 78123c6aff..cfd4ba867c 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -353,7 +353,7 @@ int NumInclude; while ( DrawList ) { - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_SEGMENT_STRUCT_TYPE : #undef STRUCT @@ -465,7 +465,7 @@ int NumInclude; for ( ;DEntry != NULL; DEntry = DEntry->Next()) { LibDrawPin * Pin = (LibDrawPin *) DEntry; - if( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; + if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( DEntry->m_Unit && (DEntry->m_Unit != DrawLibItem->m_Multi) ) continue; if( DEntry->m_Convert && @@ -555,7 +555,7 @@ int NumInclude; { wxString msg; msg.Printf( wxT("Netlist: unexpected type struct %d"), - DrawList->m_StructType); + DrawList->Type()); DisplayError(frame, msg); break; } diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 60bcfd1192..2782d594c3 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -35,7 +35,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours { - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: @@ -86,7 +86,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) if( DrawStruct && DrawStruct->m_Flags ) break; DrawStruct = SchematicGeneralLocateAndDisplay(); - if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) + if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) { InstallNextScreen( (DrawSheetStruct*) DrawStruct ); } @@ -229,7 +229,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) if( DrawStruct == NULL ) break; - if( (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) + if( (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) && (DrawStruct->m_Flags == 0) ) { if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT ) @@ -239,7 +239,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) m_CurrentScreen->SetCurItem( Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); } - else if( (DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE) + else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) && (DrawStruct->m_Flags != 0) ) { DrawStruct->Place( this, DC ); @@ -316,7 +316,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) break; // Element localisé - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_SHEET_STRUCT_TYPE: InstallNextScreen( (DrawSheetStruct*) DrawStruct ); diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 429c3deeee..4300974ac3 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -96,7 +96,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) { DrawStruct = SchematicGeneralLocateAndDisplay( FALSE ); - if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) + if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) { DrawSheetLabelStruct* slabel; slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct, @@ -148,7 +148,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, int flags = DrawStruct->m_Flags; bool is_new = (flags & IS_NEW) ? TRUE : FALSE; - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_NOCONNECT_STRUCT_TYPE: @@ -243,7 +243,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, wxString msg; msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; } diff --git a/eeschema/pinedit-dialog.cpp b/eeschema/pinedit-dialog.cpp index e1a09742e7..e1761732ad 100644 --- a/eeschema/pinedit-dialog.cpp +++ b/eeschema/pinedit-dialog.cpp @@ -36,7 +36,7 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint { wxPoint MousePos = parent->GetScreen()->m_Curseur; int accept = TRUE; - if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE) ) + if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) ) { LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem; WinEDA_PinPropertiesFrame * frame = new WinEDA_PinPropertiesFrame(parent); diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 60b1da97a1..a8d4e35db1 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -122,7 +122,7 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) { - if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if ( Pin == CurrentPin ) continue; if( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && @@ -179,7 +179,7 @@ bool status; // Tst for an other pin in same new position: for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) { - if ( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if ( Pin == CurrentPin ) continue; if( newpos != Pin->m_Pos ) continue; if ( Pin->m_Flags ) continue; @@ -213,7 +213,7 @@ bool status; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext) { - if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->m_Flags == 0 ) continue; Pin->m_Pos = CurrentPin->m_Pos; Pin->m_Flags = 0; @@ -270,7 +270,7 @@ wxPoint startPos; for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) { Pin->m_Flags = 0; - if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if ( Pin == CurrentPin) continue; if ( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && (g_EditPinByPinIsOn == FALSE ) ) @@ -345,7 +345,7 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) { - if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->m_Flags == 0 ) continue; if( Pin->m_Convert != CurrentPin->m_Convert ) continue; Pin->m_PinShape = newshape; @@ -373,7 +373,7 @@ LibDrawPin * CurrentPin = (LibDrawPin*)CurrentDrawItem; Pin = (LibDrawPin*)CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) { - if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->m_Flags == 0 ) continue; Pin->m_PinType = newtype; } @@ -404,7 +404,7 @@ wxString buf; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) { - if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; if (newsize >= 0 ) Pin->m_PinNameSize = newsize; Pin->m_PinName = buf; @@ -439,7 +439,7 @@ wxString buf; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) { - if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; if( Pin->m_Unit != CurrentPin->m_Unit ) continue; if ( newsize >= 0) Pin->m_PinNumSize = newsize; @@ -474,7 +474,7 @@ wxPoint PinPos; DrawItem = LibEntry->m_Drawings; for ( ; DrawItem != NULL; ) { - if (DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) + if (DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) { DrawItem = DrawItem->Next(); continue; } @@ -591,7 +591,7 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem; { Pin = (LibDrawPin *)DrawItem; DrawItem = DrawItem->Next(); - if( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; + if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( Pin->m_Flags == 0 ) continue; if( Pin == CurrentPin) continue; if(CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert)) @@ -615,7 +615,7 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem; for ( ; DrawItem != NULL; ) { Pin = (LibDrawPin *)DrawItem; DrawItem = DrawItem->Next(); - if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; + if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue; if( Pin->m_Flags == 0 ) continue; if( Pin == CurrentPin) continue; if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) ) @@ -672,7 +672,7 @@ LibDrawPin * RefPin, * Pin = (LibDrawPin *) CurrentDrawItem; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) { - if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if( Pin->m_Pos != RefPin->m_Pos ) continue; if(Pin->m_Orient != RefPin->m_Orient) continue; if( Pin->m_Convert == RefPin->m_Convert ) Pin->m_PinLen = newsize; @@ -745,14 +745,14 @@ LibDrawPin * Pin; bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) return; - if(MasterPin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) return; + if(MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; GetScreen()->SetModify(); Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; for( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) { - if ( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; + if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue; if ( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) continue; // Is it the "selected mode" ? if (selected && (Pin->m_Selected & IS_SELECTED) == 0 ) continue; @@ -793,7 +793,7 @@ int ox = 0, oy = 0; if(CurrentLibEntry == NULL ) return; if(SourcePin == NULL ) return; - if(SourcePin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) return; + if(SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) return; Pin = SourcePin->GenCopy(); Pin->Pnext = CurrentLibEntry->m_Drawings; @@ -848,13 +848,13 @@ wxString msg; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) { - if ( Pin->m_StructType == COMPONENT_PIN_DRAW_TYPE ) nb_pins++; + if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) nb_pins++; } PinList = (LibDrawPin **) MyZMalloc( (nb_pins+1) * sizeof(LibDrawPin *) ); Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; for( ii = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) { - if ( Pin->m_StructType == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin; + if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin; } // Classement des pins par numero de pin diff --git a/eeschema/plot.cpp b/eeschema/plot.cpp index 313875c334..f18ee56f9d 100644 --- a/eeschema/plot.cpp +++ b/eeschema/plot.cpp @@ -180,7 +180,7 @@ wxPoint pos; if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SetColorMapPS ( ReturnLayerColor(LAYER_DEVICE) ); - switch (DEntry->m_StructType) + switch (DEntry->Type()) { case COMPONENT_ARC_DRAW_TYPE: { @@ -517,7 +517,7 @@ wxString Text; int color = -1; int HalfSize; - switch ( Struct->m_StructType ) + switch ( Struct->Type() ) { case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE: @@ -529,7 +529,7 @@ int HalfSize; pX = ((DrawTextStruct*)Struct)->m_Pos.x; pY = ((DrawTextStruct*)Struct)->m_Pos.y; offset = TXTMARGE; - if ( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) + if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) offset += Size.x; // We must draw the Glabel graphoc symbol if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer); @@ -545,7 +545,7 @@ int HalfSize; switch(Orient) { case 0: /* Orientation horiz normale */ - if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) + if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY), color, Text, TEXT_ORIENT_HORIZ, Size, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); @@ -556,7 +556,7 @@ int HalfSize; break; case 1: /* Orientation vert UP */ - if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) + if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset), color, Text, TEXT_ORIENT_VERT, Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); @@ -567,7 +567,7 @@ int HalfSize; break; case 2: /* Orientation horiz inverse */ - if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) + if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY), color, Text, TEXT_ORIENT_HORIZ, Size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); @@ -578,7 +578,7 @@ int HalfSize; break; case 3: /* Orientation vert BOTTOM */ - if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) + if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset), color, Text, 2700, Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); @@ -590,7 +590,7 @@ int HalfSize; } /* Trace du symbole associe au label global */ - if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) + if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) { int jj, imax; HalfSize = Size.x / 2; diff --git a/eeschema/plothpgl.cpp b/eeschema/plothpgl.cpp index 4ac1cecd67..a5a784d154 100644 --- a/eeschema/plothpgl.cpp +++ b/eeschema/plothpgl.cpp @@ -574,7 +574,7 @@ wxString msg; { Plume('U'); layer = LAYER_NOTES; - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_BUSENTRY_STRUCT_TYPE : #undef STRUCT @@ -585,7 +585,7 @@ wxString msg; case DRAW_SEGMENT_STRUCT_TYPE : #undef STRUCT #define STRUCT ((EDA_DrawLineStruct*)DrawList) - if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) + if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE) { x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; diff --git a/eeschema/plotps.cpp b/eeschema/plotps.cpp index 4626df2bd9..30de46f71a 100644 --- a/eeschema/plotps.cpp +++ b/eeschema/plotps.cpp @@ -415,7 +415,7 @@ wxPoint StartPos, EndPos; { Plume('U'); layer = LAYER_NOTES; - switch( DrawList->m_StructType ) + switch( DrawList->Type() ) { case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ #undef STRUCT @@ -426,7 +426,7 @@ wxPoint StartPos, EndPos; case DRAW_SEGMENT_STRUCT_TYPE : #undef STRUCT #define STRUCT ((EDA_DrawLineStruct*)DrawList) - if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) + if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE) { StartPos = STRUCT->m_Start; EndPos = STRUCT->m_End; diff --git a/eeschema/plugins/netlist_form_pads-pcb.cpp b/eeschema/plugins/netlist_form_pads-pcb.cpp index d7521d99df..ff4bf57155 100644 --- a/eeschema/plugins/netlist_form_pads-pcb.cpp +++ b/eeschema/plugins/netlist_form_pads-pcb.cpp @@ -119,13 +119,13 @@ public: long m_TimeStamp; public: - ComponentDataClass( void ) + ComponentDataClass() { InitData(); } - void InitData( void ) + void InitData() { m_TimeStamp = 0; m_Reference[0] = 0; diff --git a/eeschema/program.h b/eeschema/program.h index 9c84438813..319abd6041 100644 --- a/eeschema/program.h +++ b/eeschema/program.h @@ -74,11 +74,11 @@ public: public: EDA_DrawLineStruct( const wxPoint &pos, int layer ); - ~EDA_DrawLineStruct( void ) { } + ~EDA_DrawLineStruct() { } bool IsOneEndPointAt( const wxPoint& pos ); - EDA_DrawLineStruct* GenCopy( void ); + EDA_DrawLineStruct* GenCopy(); - bool IsNull( void ) + bool IsNull() { return m_Start == m_End; } @@ -98,9 +98,9 @@ public: public: DrawMarkerStruct( const wxPoint &pos, const wxString &text ); - ~DrawMarkerStruct( void ); - DrawMarkerStruct* GenCopy( void ); - wxString GetComment( void ); + ~DrawMarkerStruct(); + DrawMarkerStruct* GenCopy(); + wxString GetComment(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); }; @@ -113,8 +113,8 @@ public: public: DrawNoConnectStruct( const wxPoint &pos ); - ~DrawNoConnectStruct( void ) { } - DrawNoConnectStruct* GenCopy( void ); + ~DrawNoConnectStruct() { } + DrawNoConnectStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); }; @@ -134,9 +134,9 @@ public: public: DrawBusEntryStruct( const wxPoint &pos, int shape, int id ); - ~DrawBusEntryStruct( void ) { } - DrawBusEntryStruct* GenCopy( void ); - wxPoint m_End( void ); // retourne la coord de fin du raccord + ~DrawBusEntryStruct() { } + DrawBusEntryStruct* GenCopy(); + wxPoint m_End(); // retourne la coord de fin du raccord virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); }; @@ -151,8 +151,8 @@ public: public: DrawPolylineStruct( int layer ); - ~DrawPolylineStruct( void ); - DrawPolylineStruct* GenCopy( void ); + ~DrawPolylineStruct(); + DrawPolylineStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); }; @@ -165,28 +165,37 @@ public: public: DrawJunctionStruct( const wxPoint &pos ); - ~DrawJunctionStruct( void ) { } - DrawJunctionStruct* GenCopy( void ); + ~DrawJunctionStruct() { } + DrawJunctionStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); }; + class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct { public: int m_Layer; int m_Shape; - bool m_IsDangling; // TRUE si non connecté + bool m_IsDangling; // TRUE si non connecté public: - DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); - ~DrawTextStruct( void ) { } - DrawTextStruct* GenCopy( void ); + DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, + KICAD_T aType = DRAW_TEXT_STRUCT_TYPE ); + ~DrawTextStruct() { } + + DrawTextStruct* GenCopy(); virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color = -1 ); + void SwapData( DrawTextStruct* copyitem ); + virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); + // selectively give public access to a very dangerous protected function: + void SetType( KICAD_T aType ) { EDA_BaseStruct::SetType( aType ); } + + private: void DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, int Color ); @@ -201,7 +210,7 @@ class DrawLabelStruct : public DrawTextStruct { public: DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); - ~DrawLabelStruct( void ) { } + ~DrawLabelStruct() { } }; @@ -210,7 +219,7 @@ class DrawGlobalLabelStruct : public DrawTextStruct public: DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); - ~DrawGlobalLabelStruct( void ) { } + ~DrawGlobalLabelStruct() { } }; diff --git a/eeschema/protos.h b/eeschema/protos.h index 7c5c0c1cd8..eb54dd3f68 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -297,7 +297,7 @@ void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint &pos); /***************/ /* ANNOTATE.CPP */ /***************/ -void ReAnnotatePowerSymbolsOnly( void ); +void ReAnnotatePowerSymbolsOnly(); void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos); int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); diff --git a/eeschema/save_schemas.cpp b/eeschema/save_schemas.cpp index 24e0b94421..ebe80d2ed7 100644 --- a/eeschema/save_schemas.cpp +++ b/eeschema/save_schemas.cpp @@ -142,7 +142,7 @@ wxString dirbuf; Phead = screen->EEDrawList; while (Phead) { - switch(Phead->m_StructType) + switch(Phead->Type()) { case DRAW_LIB_ITEM_STRUCT_TYPE: /* Its a library item. */ SavePartDescr( f, (EDA_SchComponentStruct *) Phead); diff --git a/eeschema/savelib.cpp b/eeschema/savelib.cpp index d3bf43fcdb..3e3d539a4f 100644 --- a/eeschema/savelib.cpp +++ b/eeschema/savelib.cpp @@ -1,9 +1,9 @@ - /****************************/ - /* EESchema - eesavlib.cpp */ - /****************************/ +/****************************/ +/* EESchema - eesavlib.cpp */ +/****************************/ /* Write Routines to save schematic libraries and library components (::WriteDescr() members) -*/ + */ #include "fctsys.h" #include "gr_basic.h" @@ -20,584 +20,648 @@ /* Variables locales */ -static bool WriteLibEntryDateAndTime(FILE * ExportFile, - EDA_LibComponentStruct * LibEntry); +static bool WriteLibEntryDateAndTime( FILE* ExportFile, + EDA_LibComponentStruct* LibEntry ); -static int fill_tab[3] = { 'N', 'F', 'f' }; +static int fill_tab[3] = { 'N', 'F', 'f' }; /***********************************************/ -bool LibDrawArc::WriteDescr( FILE * ExportFile ) +bool LibDrawArc::WriteDescr( FILE* ExportFile ) /***********************************************/ + /* format -A centre_posx centre_posy rayon start_angle end_angle unit convert fill('N', 'F' ou 'f') startx starty endx endy -*/ -{ -int x1 = t1; if(x1 > 1800) x1 -= 3600; -int x2 = t2; if(x2 > 1800) x2 -= 3600; - - fprintf(ExportFile,"A %d %d %d %d %d %d %d %d %c %d %d %d %d\n", - m_Pos.x, m_Pos.y, - m_Rayon, x1, x2, - m_Unit,m_Convert, - m_Width, fill_tab[m_Fill], - m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y); - return FALSE; -} - -/***************************************************/ -bool LibDrawCircle::WriteDescr( FILE * ExportFile ) -/***************************************************/ -{ - fprintf(ExportFile,"C %d %d %d %d %d %d %c\n", - m_Pos.x, m_Pos.y, - m_Rayon, - m_Unit,m_Convert, - m_Width, fill_tab[m_Fill]); - return FALSE; -} - -/************************************************/ -bool LibDrawText::WriteDescr( FILE * ExportFile ) -/************************************************/ + * A centre_posx centre_posy rayon start_angle end_angle unit convert fill('N', 'F' ou 'f') startx starty endx endy + */ { -wxString text = m_Text; - - text.Replace( wxT(" "), wxT("~") ); // Spaces are not allowed: changed to '~' - - fprintf(ExportFile,"T %d %d %d %d %d %d %d %s\n", - m_Horiz, - m_Pos.x, m_Pos.y, - m_Size.x, m_Type, - m_Unit,m_Convert, - CONV_TO_UTF8(text) ); + int x1 = t1; if( x1 > 1800 ) + x1 -= 3600; + + int x2 = t2; if( x2 > 1800 ) + x2 -= 3600; + + fprintf( ExportFile, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n", + m_Pos.x, m_Pos.y, + m_Rayon, x1, x2, + m_Unit, m_Convert, + m_Width, fill_tab[m_Fill], + m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y ); return FALSE; } + /***************************************************/ -bool LibDrawSquare::WriteDescr( FILE * ExportFile ) +bool LibDrawCircle::WriteDescr( FILE* ExportFile ) /***************************************************/ { - fprintf(ExportFile,"S %d %d %d %d %d %d %d %c\n", - m_Pos.x, m_Pos.y, m_End.x, m_End.y, - m_Unit,m_Convert, - m_Width, fill_tab[m_Fill]); + fprintf( ExportFile, "C %d %d %d %d %d %d %c\n", + m_Pos.x, m_Pos.y, + m_Rayon, + m_Unit, m_Convert, + m_Width, fill_tab[m_Fill] ); return FALSE; } /************************************************/ -bool LibDrawPin::WriteDescr( FILE * ExportFile ) +bool LibDrawText::WriteDescr( FILE* ExportFile ) /************************************************/ { -int Etype = 'I'; -wxString StringPinNum; - - switch(m_PinType) - { - case PIN_INPUT: Etype = 'I'; break; - case PIN_OUTPUT: Etype = 'O'; break; - case PIN_BIDI: Etype = 'B'; break; - case PIN_TRISTATE: Etype = 'T'; break; - case PIN_PASSIVE: Etype = 'P'; break; - case PIN_UNSPECIFIED: Etype = 'U'; break; - case PIN_POWER_IN: Etype = 'W'; break; - case PIN_POWER_OUT: Etype = 'w'; break; - case PIN_OPENCOLLECTOR: Etype = 'C'; break; - case PIN_OPENEMITTER: Etype = 'E'; break; - } - - ReturnPinStringNum(StringPinNum); - if ( StringPinNum.IsEmpty() ) StringPinNum = wxT("~"); - - if( ! m_PinName.IsEmpty() ) - fprintf(ExportFile,"X %s", CONV_TO_UTF8(m_PinName) ); - else fprintf(ExportFile,"X ~"); + wxString text = m_Text; - fprintf(ExportFile," %s %d %d %d %c %d %d %d %d %c", - CONV_TO_UTF8(StringPinNum), - m_Pos.x, m_Pos.y, - (int)m_PinLen, (int)m_Orient, - m_PinNumSize, m_PinNameSize, - m_Unit,m_Convert, Etype); + text.Replace( wxT( " " ), wxT( "~" ) ); // Spaces are not allowed: changed to '~' - if( (m_PinShape) || (m_Attributs & PINNOTDRAW) ) - fprintf(ExportFile," "); - if (m_Attributs & PINNOTDRAW) fprintf(ExportFile,"N"); - if (m_PinShape & INVERT) fprintf(ExportFile,"I"); - if (m_PinShape & CLOCK) fprintf(ExportFile,"C"); - if (m_PinShape & LOWLEVEL_IN) fprintf(ExportFile,"L"); - if (m_PinShape & LOWLEVEL_OUT) fprintf(ExportFile,"V"); - - fprintf(ExportFile,"\n"); + fprintf( ExportFile, "T %d %d %d %d %d %d %d %s\n", + m_Horiz, + m_Pos.x, m_Pos.y, + m_Size.x, m_Type, + m_Unit, m_Convert, + CONV_TO_UTF8( text ) ); return FALSE; } + +/***************************************************/ +bool LibDrawSquare::WriteDescr( FILE* ExportFile ) +/***************************************************/ +{ + fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n", + m_Pos.x, m_Pos.y, m_End.x, m_End.y, + m_Unit, m_Convert, + m_Width, fill_tab[m_Fill] ); + return FALSE; +} + + +/************************************************/ +bool LibDrawPin::WriteDescr( FILE* ExportFile ) +/************************************************/ +{ + int Etype = 'I'; + wxString StringPinNum; + + switch( m_PinType ) + { + case PIN_INPUT: + Etype = 'I'; break; + + case PIN_OUTPUT: + Etype = 'O'; break; + + case PIN_BIDI: + Etype = 'B'; break; + + case PIN_TRISTATE: + Etype = 'T'; break; + + case PIN_PASSIVE: + Etype = 'P'; break; + + case PIN_UNSPECIFIED: + Etype = 'U'; break; + + case PIN_POWER_IN: + Etype = 'W'; break; + + case PIN_POWER_OUT: + Etype = 'w'; break; + + case PIN_OPENCOLLECTOR: + Etype = 'C'; break; + + case PIN_OPENEMITTER: + Etype = 'E'; break; + } + + ReturnPinStringNum( StringPinNum ); + if( StringPinNum.IsEmpty() ) + StringPinNum = wxT( "~" ); + + if( !m_PinName.IsEmpty() ) + fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_PinName ) ); + else + fprintf( ExportFile, "X ~" ); + + fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c", + CONV_TO_UTF8( StringPinNum ), + m_Pos.x, m_Pos.y, + (int) m_PinLen, (int) m_Orient, + m_PinNumSize, m_PinNameSize, + m_Unit, m_Convert, Etype ); + + if( (m_PinShape) || (m_Attributs & PINNOTDRAW) ) + fprintf( ExportFile, " " ); + if( m_Attributs & PINNOTDRAW ) + fprintf( ExportFile, "N" ); + if( m_PinShape & INVERT ) + fprintf( ExportFile, "I" ); + if( m_PinShape & CLOCK ) + fprintf( ExportFile, "C" ); + if( m_PinShape & LOWLEVEL_IN ) + fprintf( ExportFile, "L" ); + if( m_PinShape & LOWLEVEL_OUT ) + fprintf( ExportFile, "V" ); + + fprintf( ExportFile, "\n" ); + return FALSE; +} + + /****************************************************/ -bool LibDrawPolyline::WriteDescr( FILE * ExportFile ) +bool LibDrawPolyline::WriteDescr( FILE* ExportFile ) /****************************************************/ { -int ii, *ptpoly; - - fprintf(ExportFile,"P %d %d %d %d", - n, - m_Unit,m_Convert, - m_Width); - ptpoly = PolyList; - for( ii = n ; ii > 0; ii-- ) - { - fprintf(ExportFile," %d %d", *ptpoly, *(ptpoly+1) ); - ptpoly += 2; - } - fprintf(ExportFile," %c\n", fill_tab[m_Fill]); + int ii, * ptpoly; + + fprintf( ExportFile, "P %d %d %d %d", + n, + m_Unit, m_Convert, + m_Width ); + ptpoly = PolyList; + for( ii = n; ii > 0; ii-- ) + { + fprintf( ExportFile, " %d %d", *ptpoly, *(ptpoly + 1) ); + ptpoly += 2; + } + + fprintf( ExportFile, " %c\n", fill_tab[m_Fill] ); return FALSE; } /**************************************************/ -bool LibDrawField::WriteDescr( FILE * ExportFile ) +bool LibDrawField::WriteDescr( FILE* ExportFile ) /**************************************************/ { -int hjustify, vjustify; -wxString text = m_Text; - - hjustify = 'C'; - if ( m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) hjustify = 'L'; - else if ( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) hjustify = 'R'; - vjustify = 'C'; - if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM) vjustify = 'B'; - else if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP) vjustify = 'T'; - if ( text.IsEmpty() ) text = wxT("~"); - fprintf(ExportFile,"F%d \"%s\" %d %d %d %c %c %c %c", - m_FieldId, CONV_TO_UTF8(text), - m_Pos.x, m_Pos.y, - m_Size.x, - m_Orient == 0 ? 'H' : 'V', - (m_Attributs & TEXT_NO_VISIBLE )? 'I' : 'V', - hjustify, vjustify ); - // Save field name, if necessary - if ( m_FieldId >= FIELD1 && ! m_Name.IsEmpty() ) - fprintf(ExportFile," \"%s\"", CONV_TO_UTF8(m_Name) ); + int hjustify, vjustify; + wxString text = m_Text; - fprintf(ExportFile,"\n"); + hjustify = 'C'; + if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) + hjustify = 'L'; + else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) + hjustify = 'R'; + vjustify = 'C'; + if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) + vjustify = 'B'; + else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) + vjustify = 'T'; + if( text.IsEmpty() ) + text = wxT( "~" ); + fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c", + m_FieldId, CONV_TO_UTF8( text ), + m_Pos.x, m_Pos.y, + m_Size.x, + m_Orient == 0 ? 'H' : 'V', + (m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V', + hjustify, vjustify ); + + // Save field name, if necessary + if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() ) + fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) ); + + fprintf( ExportFile, "\n" ); return FALSE; } + /**********************************************************/ -LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, - LibEDA_BaseStruct * DrawItem) +LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame, + LibEDA_BaseStruct* DrawItem ) /**********************************************************/ + /* Routine de Duplication d'une structure DrawLibItem d'une partlib - Parametres d'entree: - DrawEntry = pointeur sur la structure a dupliquer - La structure nouvelle est creee, mais n'est pas inseree dans le - chainage - Retourne: - Pointeur sur la structure creee -*/ + * Parametres d'entree: + * DrawEntry = pointeur sur la structure a dupliquer + * La structure nouvelle est creee, mais n'est pas inseree dans le + * chainage + * Retourne: + * Pointeur sur la structure creee + */ { -LibEDA_BaseStruct * NewDrawItem = NULL; -wxString msg; + LibEDA_BaseStruct* NewDrawItem = NULL; + wxString msg; - switch(DrawItem->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - NewDrawItem = ((LibDrawArc*)DrawItem)->GenCopy(); - break; + switch( DrawItem->Type() ) + { + case COMPONENT_ARC_DRAW_TYPE: + NewDrawItem = ( (LibDrawArc*) DrawItem )->GenCopy(); + break; - case COMPONENT_CIRCLE_DRAW_TYPE: - NewDrawItem = ((LibDrawCircle*)DrawItem)->GenCopy(); - break; + case COMPONENT_CIRCLE_DRAW_TYPE: + NewDrawItem = ( (LibDrawCircle*) DrawItem )->GenCopy(); + break; - case COMPONENT_RECT_DRAW_TYPE: - NewDrawItem = ((LibDrawSquare*)DrawItem)->GenCopy(); - break; + case COMPONENT_RECT_DRAW_TYPE: + NewDrawItem = ( (LibDrawSquare*) DrawItem )->GenCopy(); + break; - case COMPONENT_PIN_DRAW_TYPE: - NewDrawItem = ((LibDrawPin*)DrawItem)->GenCopy(); - break; + case COMPONENT_PIN_DRAW_TYPE: + NewDrawItem = ( (LibDrawPin*) DrawItem )->GenCopy(); + break; - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - NewDrawItem = ((LibDrawText*)DrawItem)->GenCopy(); - break; + case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: + NewDrawItem = ( (LibDrawText*) DrawItem )->GenCopy(); + break; - case COMPONENT_POLYLINE_DRAW_TYPE: - NewDrawItem = ((LibDrawPolyline*)DrawItem)->GenCopy(); - break; + case COMPONENT_POLYLINE_DRAW_TYPE: + NewDrawItem = ( (LibDrawPolyline*) DrawItem )->GenCopy(); + break; - default: - msg.Printf( wxT("CopyDrawLibEntryStruct: unknown Draw Type %d"), - DrawItem->m_StructType); - DisplayError(frame, msg); - break; - } + default: + msg.Printf( wxT( "CopyDrawLibEntryStruct: unknown Draw Type %d" ), + DrawItem->Type() ); + DisplayError( frame, msg ); + break; + } - return(NewDrawItem); + return NewDrawItem; } + /*************************************************************************************************/ -EDA_LibComponentStruct * CopyLibEntryStruct ( wxWindow * frame, EDA_LibComponentStruct * OldEntry) +EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStruct* OldEntry ) /*************************************************************************************************/ + /* Routine de copie d'une partlib - Parametres d'entree: pointeur sur la structure de depart - Parametres de sortie: pointeur sur la structure creee - Do not copy new items ( i.e. with m_Flag & IS_NEW) -*/ + * Parametres d'entree: pointeur sur la structure de depart + * Parametres de sortie: pointeur sur la structure creee + * Do not copy new items ( i.e. with m_Flag & IS_NEW) + */ { -EDA_LibComponentStruct * NewStruct; -LibEDA_BaseStruct * NewDrawings, * OldDrawings; -LibEDA_BaseStruct * LastItem; -LibDrawField * OldField, * NewField; + EDA_LibComponentStruct* NewStruct; + LibEDA_BaseStruct* NewDrawings, * OldDrawings; + LibEDA_BaseStruct* LastItem; + LibDrawField* OldField, * NewField; - if( OldEntry->Type != ROOT ) - { - DisplayError(frame, wxT("CopyLibEntryStruct(): Type != ROOT")); - return(NULL); - } + if( OldEntry->Type != ROOT ) + { + DisplayError( frame, wxT( "CopyLibEntryStruct(): Type != ROOT" ) ); + return NULL; + } - NewStruct = new EDA_LibComponentStruct(NULL); - OldEntry->m_Prefix.Copy(&NewStruct->m_Prefix); - OldEntry->m_Name.Copy(&NewStruct->m_Name); + NewStruct = new EDA_LibComponentStruct( NULL ); - NewStruct->m_UnitCount = OldEntry->m_UnitCount; - NewStruct->m_TextInside = OldEntry->m_TextInside; - NewStruct->m_DrawPinNum = OldEntry->m_DrawPinNum; - NewStruct->m_DrawPinName = OldEntry->m_DrawPinName; - NewStruct->m_Options = OldEntry->m_Options; - NewStruct->m_UnitSelectionLocked = OldEntry->m_UnitSelectionLocked; + OldEntry->m_Prefix.Copy( &NewStruct->m_Prefix ); + OldEntry->m_Name.Copy( &NewStruct->m_Name ); - /* Copie des sous structures: */ - NewStruct->m_AliasList = OldEntry->m_AliasList; - NewStruct->m_Doc = OldEntry->m_Doc; - NewStruct->m_KeyWord = OldEntry->m_KeyWord; - NewStruct->m_DocFile = OldEntry->m_DocFile; + NewStruct->m_UnitCount = OldEntry->m_UnitCount; + NewStruct->m_TextInside = OldEntry->m_TextInside; + NewStruct->m_DrawPinNum = OldEntry->m_DrawPinNum; + NewStruct->m_DrawPinName = OldEntry->m_DrawPinName; + NewStruct->m_Options = OldEntry->m_Options; + NewStruct->m_UnitSelectionLocked = OldEntry->m_UnitSelectionLocked; - /* Copie des champs */ - for(OldField = OldEntry->Fields; OldField != NULL; - OldField = (LibDrawField*)OldField->Pnext) - { - NewField = OldField->GenCopy(); - NewField->Pnext = NewStruct->Fields; - NewStruct->Fields = NewField; - } + /* Copie des sous structures: */ + NewStruct->m_AliasList = OldEntry->m_AliasList; + NewStruct->m_Doc = OldEntry->m_Doc; + NewStruct->m_KeyWord = OldEntry->m_KeyWord; + NewStruct->m_DocFile = OldEntry->m_DocFile; - /* Copie des elements type Drawing */ - LastItem = NULL; - for(OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL; OldDrawings = OldDrawings->Next()) - { - if ( ( OldDrawings->m_Flags & IS_NEW) != 0 ) continue; - NewDrawings = CopyDrawEntryStruct(frame, OldDrawings); - if ( NewDrawings ) - { - if (LastItem == NULL ) NewStruct->m_Drawings = NewDrawings; - else LastItem->Pnext = NewDrawings; - LastItem = NewDrawings; - NewDrawings->Pnext = NULL; - } - else // Probleme rencontré: arret de copie - { - OldDrawings->m_StructType = TYPE_NOT_INIT; - DisplayError(frame, wxT("CopyLibEntryStruct(): error: aborted")); - break; - } - } + /* Copie des champs */ + for( OldField = OldEntry->Fields; OldField != NULL; + OldField = (LibDrawField*) OldField->Pnext ) + { + NewField = OldField->GenCopy(); + NewField->Pnext = NewStruct->Fields; + NewStruct->Fields = NewField; + } - /* Copy the footprint filter list */ - for ( unsigned ii = 0 ; ii < OldEntry->m_FootprintList.GetCount(); ii++ ) - NewStruct->m_FootprintList.Add(OldEntry->m_FootprintList[ii]); - - return(NewStruct); + /* Copie des elements type Drawing */ + LastItem = NULL; + for( OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL; OldDrawings = OldDrawings->Next() ) + { + if( ( OldDrawings->m_Flags & IS_NEW) != 0 ) + continue; + + NewDrawings = CopyDrawEntryStruct( frame, OldDrawings ); + if( NewDrawings ) + { + if( LastItem == NULL ) + NewStruct->m_Drawings = NewDrawings; + else + LastItem->Pnext = NewDrawings; + + LastItem = NewDrawings; + NewDrawings->Pnext = NULL; + } + else // Probleme rencontré: arret de copie + { + /* why this? m_StructType is not a flag, it is a type indicator! + OldDrawings->Type() = TYPE_NOT_INIT; + */ + + DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) ); + break; + } + } + + /* Copy the footprint filter list */ + for( unsigned ii = 0; ii < OldEntry->m_FootprintList.GetCount(); ii++ ) + NewStruct->m_FootprintList.Add( OldEntry->m_FootprintList[ii] ); + + return NewStruct; } /********************************************************/ -int WriteOneLibEntry(wxWindow * frame, FILE * ExportFile, - EDA_LibComponentStruct * LibEntry) +int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile, + EDA_LibComponentStruct* LibEntry ) /********************************************************/ /* Routine d'ecriture du composant pointe par LibEntry - dans le fichier ExportFile( qui doit etre deja ouvert) - return: 0 si Ok - -1 si err write - 1 si composant non ecrit ( type ALIAS ) -*/ + * dans le fichier ExportFile( qui doit etre deja ouvert) + * return: 0 si Ok + * -1 si err write + * 1 si composant non ecrit ( type ALIAS ) + */ #define UNUSED 0 { -LibEDA_BaseStruct *DrawEntry; -LibDrawField * Field; + LibEDA_BaseStruct* DrawEntry; + LibDrawField* Field; - if( LibEntry->Type != ROOT ) return(1); + if( LibEntry->Type != ROOT ) + return 1; - /* Creation du commentaire donnant le nom du composant */ - fprintf(ExportFile,"#\n# %s\n#\n", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); + /* Creation du commentaire donnant le nom du composant */ + fprintf( ExportFile, "#\n# %s\n#\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); - /* Generation des lignes utiles */ - fprintf(ExportFile,"DEF"); - if( (LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0) - fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); - else fprintf(ExportFile," ~%s", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); + /* Generation des lignes utiles */ + fprintf( ExportFile, "DEF" ); + if( (LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 ) + fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); + else + fprintf( ExportFile, " ~%s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); - if( ! LibEntry->m_Prefix.m_Text.IsEmpty()) - fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_Prefix.m_Text)); - else fprintf(ExportFile," ~"); - fprintf(ExportFile," %d %d %c %c %d %c %c\n", - UNUSED, LibEntry->m_TextInside, - LibEntry->m_DrawPinNum ? 'Y' : 'N', - LibEntry->m_DrawPinName ? 'Y' : 'N', - LibEntry->m_UnitCount, LibEntry->m_UnitSelectionLocked ? 'L' : 'F', - LibEntry->m_Options == ENTRY_POWER ? 'P' : 'N'); + if( !LibEntry->m_Prefix.m_Text.IsEmpty() ) + fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Prefix.m_Text ) ); + else + fprintf( ExportFile, " ~" ); + fprintf( ExportFile, " %d %d %c %c %d %c %c\n", + UNUSED, LibEntry->m_TextInside, + LibEntry->m_DrawPinNum ? 'Y' : 'N', + LibEntry->m_DrawPinName ? 'Y' : 'N', + LibEntry->m_UnitCount, LibEntry->m_UnitSelectionLocked ? 'L' : 'F', + LibEntry->m_Options == ENTRY_POWER ? 'P' : 'N' ); - WriteLibEntryDateAndTime(ExportFile, LibEntry); + WriteLibEntryDateAndTime( ExportFile, LibEntry ); - /* Position / orientation / visibilite des champs */ + /* Position / orientation / visibilite des champs */ LibEntry->m_Prefix.WriteDescr( ExportFile ); LibEntry->m_Name.WriteDescr( ExportFile ); - for ( Field = LibEntry->Fields; Field!= NULL; - Field = (LibDrawField*)Field->Pnext ) - { - if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() ) continue; + for( Field = LibEntry->Fields; Field!= NULL; + Field = (LibDrawField*) Field->Pnext ) + { + if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() ) + continue; Field->WriteDescr( ExportFile ); - } + } - /* Sauvegarde de la ligne "ALIAS" */ - if( LibEntry->m_AliasList.GetCount() != 0) - { - fprintf(ExportFile,"ALIAS"); - unsigned ii; - for ( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) - fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_AliasList[ii])); - fprintf(ExportFile,"\n"); - } + /* Sauvegarde de la ligne "ALIAS" */ + if( LibEntry->m_AliasList.GetCount() != 0 ) + { + fprintf( ExportFile, "ALIAS" ); + unsigned ii; + for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) + fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_AliasList[ii] ) ); - /* Write the footprint filter list */ - if( LibEntry->m_FootprintList.GetCount() != 0) - { - fprintf(ExportFile,"$FPLIST\n"); - unsigned ii; - for ( ii = 0; ii < LibEntry->m_FootprintList.GetCount(); ii++ ) - fprintf(ExportFile," %s\n", CONV_TO_UTF8(LibEntry->m_FootprintList[ii])); - fprintf(ExportFile,"$ENDFPLIST\n"); - } + fprintf( ExportFile, "\n" ); + } - /* Sauvegarde des elements de trace */ - DrawEntry = LibEntry->m_Drawings; - if(LibEntry->m_Drawings) - { - /* we sort the draw items, in order to have an edition more easy, - when a file editing "by hand" is made */ - LibEntry->SortDrawItems(); - - fprintf(ExportFile,"DRAW\n"); - DrawEntry = LibEntry->m_Drawings; - while( DrawEntry ) - { - switch( DrawEntry->m_StructType) - { - case COMPONENT_ARC_DRAW_TYPE: - #define DRAWSTRUCT ((LibDrawArc *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + /* Write the footprint filter list */ + if( LibEntry->m_FootprintList.GetCount() != 0 ) + { + fprintf( ExportFile, "$FPLIST\n" ); + unsigned ii; + for( ii = 0; ii < LibEntry->m_FootprintList.GetCount(); ii++ ) + fprintf( ExportFile, " %s\n", CONV_TO_UTF8( LibEntry->m_FootprintList[ii] ) ); - case COMPONENT_CIRCLE_DRAW_TYPE: - #undef DRAWSTRUCT - #define DRAWSTRUCT ((LibDrawCircle *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + fprintf( ExportFile, "$ENDFPLIST\n" ); + } - case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: - #undef DRAWSTRUCT - #define DRAWSTRUCT ((LibDrawText *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + /* Sauvegarde des elements de trace */ + DrawEntry = LibEntry->m_Drawings; + if( LibEntry->m_Drawings ) + { + /* we sort the draw items, in order to have an edition more easy, + * when a file editing "by hand" is made */ + LibEntry->SortDrawItems(); - case COMPONENT_RECT_DRAW_TYPE: - #undef DRAWSTRUCT - #define DRAWSTRUCT ((LibDrawSquare *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + fprintf( ExportFile, "DRAW\n" ); + DrawEntry = LibEntry->m_Drawings; + while( DrawEntry ) + { + switch( DrawEntry->Type() ) + { + case COMPONENT_ARC_DRAW_TYPE: + #define DRAWSTRUCT ( (LibDrawArc*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - case COMPONENT_PIN_DRAW_TYPE: - #undef DRAWSTRUCT - #define DRAWSTRUCT ((LibDrawPin *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + case COMPONENT_CIRCLE_DRAW_TYPE: + #undef DRAWSTRUCT + #define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - case COMPONENT_POLYLINE_DRAW_TYPE: - #undef DRAWSTRUCT - #define DRAWSTRUCT ((LibDrawPolyline *) DrawEntry) - DRAWSTRUCT->WriteDescr( ExportFile ); - break; + case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: + #undef DRAWSTRUCT + #define DRAWSTRUCT ( (LibDrawText*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - default: DisplayError(frame, wxT("Save Lib: Unknown Draw Type")); - break; - } + case COMPONENT_RECT_DRAW_TYPE: + #undef DRAWSTRUCT + #define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - DrawEntry = DrawEntry->Next(); - } - fprintf(ExportFile,"ENDDRAW\n"); - } + case COMPONENT_PIN_DRAW_TYPE: + #undef DRAWSTRUCT + #define DRAWSTRUCT ( (LibDrawPin*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - fprintf(ExportFile,"ENDDEF\n"); + case COMPONENT_POLYLINE_DRAW_TYPE: + #undef DRAWSTRUCT + #define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry ) + DRAWSTRUCT->WriteDescr( ExportFile ); + break; - return(0); + default: + DisplayError( frame, wxT( "Save Lib: Unknown Draw Type" ) ); + break; + } + + DrawEntry = DrawEntry->Next(); + } + fprintf( ExportFile, "ENDDRAW\n" ); + } + + fprintf( ExportFile, "ENDDEF\n" ); + + return 0; } + /*************************************************************************/ -int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry) +int WriteOneDocLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry ) /*************************************************************************/ /* Routine d'ecriture de la doc du composant pointe par LibEntry - dans le fichier ExportFile( qui doit etre deja ouvert) - return: 0 si Ok - 1 si err write - Cependant, si i tous les Pointeurs sur textes sont nulls ( pas de Doc ) - rien ne sera ecrit. -*/ + * dans le fichier ExportFile( qui doit etre deja ouvert) + * return: 0 si Ok + * 1 si err write + * Cependant, si i tous les Pointeurs sur textes sont nulls ( pas de Doc ) + * rien ne sera ecrit. + */ { + if( ( LibEntry->m_Doc.IsEmpty() ) + && ( LibEntry->m_KeyWord.IsEmpty() ) + && ( LibEntry->m_DocFile.IsEmpty() ) ) + return 0; - if( (LibEntry->m_Doc.IsEmpty() ) && - (LibEntry->m_KeyWord.IsEmpty() ) && - (LibEntry->m_DocFile.IsEmpty() ) ) - return(0); + /* Generation des lignes utiles */ + fprintf( ExportFile, "#\n$CMP %s\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); - /* Generation des lignes utiles */ - fprintf(ExportFile,"#\n$CMP %s\n", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); + if( !LibEntry->m_Doc.IsEmpty() ) + fprintf( ExportFile, "D %s\n", CONV_TO_UTF8( LibEntry->m_Doc ) ); - if( ! LibEntry->m_Doc.IsEmpty()) - fprintf(ExportFile,"D %s\n", CONV_TO_UTF8(LibEntry->m_Doc)); + if( !LibEntry->m_KeyWord.IsEmpty() ) + fprintf( ExportFile, "K %s\n", CONV_TO_UTF8( LibEntry->m_KeyWord ) ); - if( ! LibEntry->m_KeyWord.IsEmpty()) - fprintf(ExportFile,"K %s\n", CONV_TO_UTF8(LibEntry->m_KeyWord)); + if( !LibEntry->m_DocFile.IsEmpty() ) + fprintf( ExportFile, "F %s\n", CONV_TO_UTF8( LibEntry->m_DocFile ) ); - if( ! LibEntry->m_DocFile.IsEmpty()) - fprintf(ExportFile,"F %s\n", CONV_TO_UTF8(LibEntry->m_DocFile)); - - fprintf(ExportFile,"$ENDCMP\n"); - return(0); + fprintf( ExportFile, "$ENDCMP\n" ); + return 0; } + /*********************************************************************************/ -int SaveOneLibrary(wxWindow * frame, const wxString & FullFileName, LibraryStruct * Library) +int SaveOneLibrary( wxWindow* frame, const wxString& FullFileName, LibraryStruct* Library ) /*********************************************************************************/ + /* Sauvegarde en fichier la librairie pointee par Library, sous le nom - FullFileName. - 2 fichiers sont crees - - La librarie - - le fichier de documentation - - une sauvegarde .bak de l'ancien fichier librairie est cree - une sauvegarde .bck de l'ancien fichier documentation est cree - - return: - 0 si OK - 1 si erreur -*/ + * FullFileName. + * 2 fichiers sont crees + * - La librarie + * - le fichier de documentation + * + * une sauvegarde .bak de l'ancien fichier librairie est cree + * une sauvegarde .bck de l'ancien fichier documentation est cree + * + * return: + * 0 si OK + * 1 si erreur + */ { -FILE * SaveFile, * SaveDocFile; -EDA_LibComponentStruct *LibEntry; -char Line[1024]; -int err = 1; -wxString Name,DocName,BakName, msg; + FILE* SaveFile, * SaveDocFile; + EDA_LibComponentStruct* LibEntry; + char Line[1024]; + int err = 1; + wxString Name, DocName, BakName, msg; - if(Library == NULL) return(err); + if( Library == NULL ) + return err; - Name = FullFileName; + Name = FullFileName; - /* L'ancien fichier lib est renomme en .bak */ - if( wxFileExists(Name) ) - { - BakName = Name; ChangeFileNameExt(BakName, wxT(".bak")); - wxRemoveFile(BakName); - if( ! wxRenameFile(Name, BakName) ) - { - msg = wxT("Failed to rename old lib file ") + BakName; - DisplayError(frame, msg, 20); - } - } - + /* L'ancien fichier lib est renomme en .bak */ + if( wxFileExists( Name ) ) + { + BakName = Name; ChangeFileNameExt( BakName, wxT( ".bak" ) ); + wxRemoveFile( BakName ); + if( !wxRenameFile( Name, BakName ) ) + { + msg = wxT( "Failed to rename old lib file " ) + BakName; + DisplayError( frame, msg, 20 ); + } + } - DocName = Name; ChangeFileNameExt(DocName,DOC_EXT); - /* L'ancien fichier doc lib est renomme en .bck */ - if( wxFileExists(DocName) ) - { - BakName = DocName; ChangeFileNameExt(BakName, wxT(".bck") ); - wxRemoveFile(BakName); - if( ! wxRenameFile(DocName, BakName) ) - { - msg = wxT("Failed to save old doc lib file ") + BakName; - DisplayError(frame, msg, 20); - } - } - - SaveFile = wxFopen(Name, wxT("wt") ); - if (SaveFile == NULL) - { - msg = wxT("Failed to create Lib File ") + Name; - DisplayError(frame, msg, 20); - return(err); - } + DocName = Name; ChangeFileNameExt( DocName, DOC_EXT ); + /* L'ancien fichier doc lib est renomme en .bck */ + if( wxFileExists( DocName ) ) + { + BakName = DocName; ChangeFileNameExt( BakName, wxT( ".bck" ) ); + wxRemoveFile( BakName ); + if( !wxRenameFile( DocName, BakName ) ) + { + msg = wxT( "Failed to save old doc lib file " ) + BakName; + DisplayError( frame, msg, 20 ); + } + } - SaveDocFile = wxFopen(DocName, wxT("wt") ); - if (SaveDocFile == NULL) - { - msg = wxT("Failed to create DocLib File ") + DocName; - DisplayError(frame, msg, 20); - return(err); - } - Library->m_Modified = 0; + SaveFile = wxFopen( Name, wxT( "wt" ) ); + if( SaveFile == NULL ) + { + msg = wxT( "Failed to create Lib File " ) + Name; + DisplayError( frame, msg, 20 ); + return err; + } - /* Creation de l'entete de la librairie */ - Library->m_TimeStamp = GetTimeStamp(); - Library->WriteHeader(SaveFile); - fprintf(SaveDocFile,"%s Date: %s\n", DOCFILE_IDENT, - DateAndTime(Line) ); + SaveDocFile = wxFopen( DocName, wxT( "wt" ) ); + if( SaveDocFile == NULL ) + { + msg = wxT( "Failed to create DocLib File " ) + DocName; + DisplayError( frame, msg, 20 ); + return err; + } - - /* Sauvegarde des composant: */ - PQCompFunc((PQCompFuncType) LibraryEntryCompare); - LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE); + Library->m_Modified = 0; - while( LibEntry ) - { - err = WriteOneLibEntry(frame, SaveFile, LibEntry); - err = WriteOneDocLibEntry(SaveDocFile, LibEntry); + /* Creation de l'entete de la librairie */ + Library->m_TimeStamp = GetTimeStamp(); + Library->WriteHeader( SaveFile ); + fprintf( SaveDocFile, "%s Date: %s\n", DOCFILE_IDENT, + DateAndTime( Line ) ); - LibEntry = (EDA_LibComponentStruct *) - PQNext(Library->m_Entries, LibEntry, NULL); - } - fprintf(SaveFile,"#\n#End Library\n"); - fprintf(SaveDocFile,"#\n#End Doc Library\n"); - fclose(SaveFile); - fclose(SaveDocFile); - return(err); + /* Sauvegarde des composant: */ + PQCompFunc( (PQCompFuncType) LibraryEntryCompare ); + LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE ); + + while( LibEntry ) + { + err = WriteOneLibEntry( frame, SaveFile, LibEntry ); + err = WriteOneDocLibEntry( SaveDocFile, LibEntry ); + + LibEntry = (EDA_LibComponentStruct*) + PQNext( Library->m_Entries, LibEntry, NULL ); + } + + fprintf( SaveFile, "#\n#End Library\n" ); + fprintf( SaveDocFile, "#\n#End Doc Library\n" ); + fclose( SaveFile ); + fclose( SaveDocFile ); + return err; } /*************************************************************************************/ -static bool WriteLibEntryDateAndTime(FILE * ExportFile, EDA_LibComponentStruct * LibEntry) +static bool WriteLibEntryDateAndTime( FILE* ExportFile, EDA_LibComponentStruct* LibEntry ) /*************************************************************************************/ + /* lit date et time de modif composant sous le format: - "Ti yy/mm/jj hh:mm:ss" -*/ + * "Ti yy/mm/jj hh:mm:ss" + */ { -int year,mon,day,hour,min,sec; + int year, mon, day, hour, min, sec; - if ( LibEntry->m_LastDate == 0 ) return TRUE; + if( LibEntry->m_LastDate == 0 ) + return TRUE; - sec = LibEntry->m_LastDate & 63; - min = (LibEntry->m_LastDate >> 6) & 63 ; - hour = (LibEntry->m_LastDate >> 12) & 31; - day = (LibEntry->m_LastDate >> 17) & 31; - mon = (LibEntry->m_LastDate >> 22) & 15; - year = (LibEntry->m_LastDate >> 26) + 1990; + sec = LibEntry->m_LastDate & 63; + min = (LibEntry->m_LastDate >> 6) & 63; + hour = (LibEntry->m_LastDate >> 12) & 31; + day = (LibEntry->m_LastDate >> 17) & 31; + mon = (LibEntry->m_LastDate >> 22) & 15; + year = (LibEntry->m_LastDate >> 26) + 1990; - fprintf(ExportFile,"Ti %d/%d/%d %d:%d:%d\n",year,mon,day,hour,min,sec); + fprintf( ExportFile, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec ); - return TRUE; + return TRUE; } - - diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index ca4c202d67..9b25e4dd3f 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -436,7 +436,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) break; // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); case ID_POPUP_SCH_DELETE: @@ -489,7 +489,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_MOVE_CMP_REQUEST: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -502,7 +502,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_EDIT_CMP: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -517,7 +517,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ORIENT_NORMAL_CMP: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -559,7 +559,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_EDIT_VALUE_CMP: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -570,7 +570,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_EDIT_REF_CMP: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -581,7 +581,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_EDIT_CONVERT_CMP: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -595,7 +595,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); { EDA_SchComponentStruct* olditem, * newitem; - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); olditem = (EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(); if( olditem == NULL ) @@ -638,7 +638,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_SELECT_UNIT26: // Ensure the struct is a component (could be a struct of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -652,7 +652,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_DISPLAYDOC_CMP: // Ensure the struct is a component (could be a piece of a component, like Field, text..) - if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) + if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); if( m_CurrentScreen->GetCurItem() == NULL ) break; @@ -669,7 +669,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ENTER_SHEET: { EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); - if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) + if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) { InstallNextScreen( (DrawSheetStruct*) DrawStruct ); } @@ -781,7 +781,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct, DrawPanel->MouseToCursorSchema(); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case DRAW_JUNCTION_STRUCT_TYPE: break; @@ -820,7 +820,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct, wxString msg; msg.Printf( wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; } diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 63227532fc..1a195ef1a6 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -1,6 +1,6 @@ - /********************************************/ - /* library editor: undo and redo functions */ - /********************************************/ +/********************************************/ +/* library editor: undo and redo functions */ +/********************************************/ #include "fctsys.h" #include "gr_basic.h" @@ -14,623 +14,656 @@ #include "protos.h" /* Functions to undo and redo edit commands. -commmands to undo are in CurrentScreen->m_UndoList -commmands to redo are in CurrentScreen->m_RedoList - -m_UndoList and m_RedoList are a linked list of DrawPickedStruct. -each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo, -or to a list of DrawPickedStruct which points (.m_PickedStruct membre) -the items to undo or redo - -there are 3 cases: - - delete item(s) command - - change item(s) command - - add item(s) command - -Undo command -- delete item(s) command: - deleted items are moved in undo list - -- change item(s) command - A copy of item(s) is made (a DrawPickedStruct list of wrappers) - the .m_Image member of each wrapper points the modified item. - -- add item(s) command - A list of item(s) is made - the .m_Image member of each wrapper points the new item. - -Redo command -- delete item(s) old command: - deleted items are moved in EEDrawList list - -- change item(s) command - the copy of item(s) is moved in Undo list - -- add item(s) command - The list of item(s) is used to create a deleted list in undo list - (same as a delete command) - -A problem is the hierarchical sheet handling. - the data associated (subhierarchy, uno/redo list) is deleted only - when the sheet is really deleted (i.e. when deleted from undo or redo list) - and not when it is a copy. -*/ + * commmands to undo are in CurrentScreen->m_UndoList + * commmands to redo are in CurrentScreen->m_RedoList + * + * m_UndoList and m_RedoList are a linked list of DrawPickedStruct. + * each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo, + * or to a list of DrawPickedStruct which points (.m_PickedStruct membre) + * the items to undo or redo + * + * there are 3 cases: + * - delete item(s) command + * - change item(s) command + * - add item(s) command + * + * Undo command + * - delete item(s) command: + * deleted items are moved in undo list + * + * - change item(s) command + * A copy of item(s) is made (a DrawPickedStruct list of wrappers) + * the .m_Image member of each wrapper points the modified item. + * + * - add item(s) command + * A list of item(s) is made + * the .m_Image member of each wrapper points the new item. + * + * Redo command + * - delete item(s) old command: + * deleted items are moved in EEDrawList list + * + * - change item(s) command + * the copy of item(s) is moved in Undo list + * + * - add item(s) command + * The list of item(s) is used to create a deleted list in undo list + * (same as a delete command) + * + * A problem is the hierarchical sheet handling. + * the data associated (subhierarchy, uno/redo list) is deleted only + * when the sheet is really deleted (i.e. when deleted from undo or redo list) + * and not when it is a copy. + */ /************************************/ -void SwapData(EDA_BaseStruct * Item) +void SwapData( EDA_BaseStruct* Item ) /************************************/ + /* Used if undo / redo command: - swap data between Item and its copy, pointed by its .m_Image member -*/ + * swap data between Item and its copy, pointed by its .m_Image member + */ { - if ( Item == NULL ) return; - EDA_BaseStruct * image = Item->m_Image; - if (image == NULL ) return; - - switch ( Item->m_StructType ) - { - case DRAW_POLYLINE_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawPolylineStruct*)Item) - #define DEST ((DrawPolylineStruct*)image) - break; + if( Item == NULL ) + return; + EDA_BaseStruct* image = Item->m_Image; + if( image == NULL ) + return; - case DRAW_JUNCTION_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawJunctionStruct*)Item) - #define DEST ((DrawJunctionStruct*)image) - EXCHG(SOURCE->m_Pos, DEST->m_Pos); - break; + switch( Item->Type() ) + { + case DRAW_POLYLINE_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawPolylineStruct*) Item ) + #define DEST ( (DrawPolylineStruct*) image ) + break; - case DRAW_LABEL_STRUCT_TYPE: - case DRAW_GLOBAL_LABEL_STRUCT_TYPE: - case DRAW_TEXT_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawTextStruct*)Item) - #define DEST ((DrawTextStruct*)image) - DEST->SwapData(SOURCE); - break; + case DRAW_JUNCTION_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawJunctionStruct*) Item ) + #define DEST ( (DrawJunctionStruct*) image ) + EXCHG( SOURCE->m_Pos, DEST->m_Pos ); + break; - case DRAW_LIB_ITEM_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((EDA_SchComponentStruct*)Item) - #define DEST ((EDA_SchComponentStruct*)image) - DEST->SwapData(SOURCE); - break; + case DRAW_LABEL_STRUCT_TYPE: + case DRAW_GLOBAL_LABEL_STRUCT_TYPE: + case DRAW_TEXT_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawTextStruct*) Item ) + #define DEST ( (DrawTextStruct*) image ) + DEST->SwapData( SOURCE ); + break; - case DRAW_SEGMENT_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((EDA_DrawLineStruct*)Item) - #define DEST ((EDA_DrawLineStruct*)image) - EXCHG(SOURCE->m_Start, DEST->m_Start); - EXCHG(SOURCE->m_End, DEST->m_End); - break; + case DRAW_LIB_ITEM_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (EDA_SchComponentStruct*) Item ) + #define DEST ( (EDA_SchComponentStruct*) image ) + DEST->SwapData( SOURCE ); + break; - case DRAW_BUSENTRY_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawBusEntryStruct*)Item) - #define DEST ((DrawBusEntryStruct*)image) - EXCHG(SOURCE->m_Pos, DEST->m_Pos); - EXCHG(SOURCE->m_Size, DEST->m_Size); - break; + case DRAW_SEGMENT_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (EDA_DrawLineStruct*) Item ) + #define DEST ( (EDA_DrawLineStruct*) image ) + EXCHG( SOURCE->m_Start, DEST->m_Start ); + EXCHG( SOURCE->m_End, DEST->m_End ); + break; - case DRAW_SHEET_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawSheetStruct*)Item) - #define DEST ((DrawSheetStruct*)image) - DEST->SwapData(SOURCE); - break; + case DRAW_BUSENTRY_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawBusEntryStruct*) Item ) + #define DEST ( (DrawBusEntryStruct*) image ) + EXCHG( SOURCE->m_Pos, DEST->m_Pos ); + EXCHG( SOURCE->m_Size, DEST->m_Size ); + break; - case DRAW_MARKER_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawMarkerStruct*)Item) - #define DEST ((DrawMarkerStruct*)image) - EXCHG(SOURCE->m_Pos, DEST->m_Pos); - break; + case DRAW_SHEET_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawSheetStruct*) Item ) + #define DEST ( (DrawSheetStruct*) image ) + DEST->SwapData( SOURCE ); + break; - case DRAW_SHEETLABEL_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawSheetLabelStruct*)Item) - #define DEST ((DrawSheetLabelStruct*)image) - EXCHG(SOURCE->m_Edge, DEST->m_Edge); - EXCHG(SOURCE->m_Shape, DEST->m_Shape); - break; + case DRAW_MARKER_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawMarkerStruct*) Item ) + #define DEST ( (DrawMarkerStruct*) image ) + EXCHG( SOURCE->m_Pos, DEST->m_Pos ); + break; - case DRAW_NOCONNECT_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawNoConnectStruct*)Item) - #define DEST ((DrawNoConnectStruct*)image) - EXCHG(SOURCE->m_Pos, DEST->m_Pos); - break; + case DRAW_SHEETLABEL_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawSheetLabelStruct*) Item ) + #define DEST ( (DrawSheetLabelStruct*) image ) + EXCHG( SOURCE->m_Edge, DEST->m_Edge ); + EXCHG( SOURCE->m_Shape, DEST->m_Shape ); + break; - case DRAW_PART_TEXT_STRUCT_TYPE: - #undef SOURCE - #undef DEST - #define SOURCE ((DrawPolylineStruct*)Item) - #define DEST ((DrawPolylineStruct*)image) - break; + case DRAW_NOCONNECT_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawNoConnectStruct*) Item ) + #define DEST ( (DrawNoConnectStruct*) image ) + EXCHG( SOURCE->m_Pos, DEST->m_Pos ); + break; - // not directly used in schematic: - default: - DisplayInfo(NULL, wxT("SwapData() error: unexpected type")); - break; - } + case DRAW_PART_TEXT_STRUCT_TYPE: + #undef SOURCE + #undef DEST + #define SOURCE ( (DrawPolylineStruct*) Item ) + #define DEST ( (DrawPolylineStruct*) image ) + break; + + // not directly used in schematic: + default: + DisplayInfo( NULL, wxT( "SwapData() error: unexpected type" ) ); + break; + } } + + /***********************************************************************/ -void WinEDA_SchematicFrame::SaveCopyInUndoList(EDA_BaseStruct * ItemToCopy, - int flag_type_command) +void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, + int flag_type_command ) /***********************************************************************/ + /* Create a copy of the current schematic draw list, and put it in the undo list. - A DrawPickedStruct wrapper is created to handle the draw list. - the .m_Son of this wrapper points the list of items - - flag_type_command = - 0 (unspecified) - IS_CHANGED - IS_NEW - IS_DELETED - IS_WIRE_IMAGE - - for 0: only a wrapper is created. The used must init the .Flags member of the - wrapper, and add the item list to the wrapper - If it is a delete command, items are put on list with the .Flags member set to IS_DELETED. - When it will be really deleted, the EEDrawList and the subhierarchy will be deleted. - If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted. - - Note: - Edit wires and busses is a bit complex. - because when a new wire is added, modifications in wire list - (wire concatenation) there are modified items, deleted items and new items - so flag_type_command is IS_WIRE_IMAGE: the struct ItemToCopy is a list of wires - saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list -*/ + * A DrawPickedStruct wrapper is created to handle the draw list. + * the .m_Son of this wrapper points the list of items + * + * flag_type_command = + * 0 (unspecified) + * IS_CHANGED + * IS_NEW + * IS_DELETED + * IS_WIRE_IMAGE + * + * for 0: only a wrapper is created. The used must init the .Flags member of the + * wrapper, and add the item list to the wrapper + * If it is a delete command, items are put on list with the .Flags member set to IS_DELETED. + * When it will be really deleted, the EEDrawList and the subhierarchy will be deleted. + * If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted. + * + * Note: + * Edit wires and busses is a bit complex. + * because when a new wire is added, modifications in wire list + * (wire concatenation) there are modified items, deleted items and new items + * so flag_type_command is IS_WIRE_IMAGE: the struct ItemToCopy is a list of wires + * saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list + */ { -EDA_BaseStruct * CopyItem; + EDA_BaseStruct* CopyItem; - DrawPickedStruct * NewList = new DrawPickedStruct(NULL); - NewList->m_Flags = flag_type_command; - - if ( ItemToCopy ) - { - switch ( flag_type_command ) - { - case 0: - break; - - case IS_CHANGED: /* Create a copy of schematic */ - NewList->m_Son = CopyItem = DuplicateStruct(ItemToCopy); - if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) - { - DrawPickedStruct * PickedList = (DrawPickedStruct *) CopyItem; - while (PickedList) - { - CopyItem = PickedList->m_PickedStruct; - CopyItem->m_Flags = flag_type_command; - PickedList->m_Image = CopyItem->m_Image; - PickedList = (DrawPickedStruct *)PickedList->Pnext; - } - } - else - { - CopyItem->m_Flags = flag_type_command; - CopyItem->m_Image = ItemToCopy; - } - break; - - case IS_NEW: - if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) - { - NewList->m_Son = ItemToCopy; - DrawPickedStruct * PickedList = (DrawPickedStruct *) ItemToCopy; - while (PickedList) - { - CopyItem = PickedList->m_PickedStruct; - PickedList->m_Image = CopyItem; - PickedList->m_PickedStruct = NULL; - PickedList->m_Flags = flag_type_command; - PickedList = (DrawPickedStruct *)PickedList->Pnext; - } - } - else - { - NewList->m_Image = ItemToCopy; - } - break; - - case IS_NEW|IS_CHANGED: - case IS_WIRE_IMAGE: - NewList->m_Son = ItemToCopy; - break; - - case IS_DELETED: - NewList->m_Son = ItemToCopy; - ItemToCopy->m_Flags = flag_type_command; - if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) - { - DrawPickedStruct * PickedList = (DrawPickedStruct *) ItemToCopy; - while (PickedList) - { - CopyItem = PickedList->m_PickedStruct; - CopyItem->m_Flags = flag_type_command; - PickedList->m_Flags = flag_type_command; - PickedList = (DrawPickedStruct *)PickedList->Pnext; - } - } - break; - - default: - DisplayError(this, wxT("SaveCopyInUndoList() error")); - break; - } - } - /* Save the copy in undo list */ - GetScreen()->AddItemToUndoList(NewList); + DrawPickedStruct* NewList = new DrawPickedStruct( NULL ); - /* Clear redo list, because after new save there is no redo to do */ - GetScreen()->ClearUndoORRedoList(GetScreen()->m_RedoList); - GetScreen()->m_RedoList = NULL; + NewList->m_Flags = flag_type_command; + + if( ItemToCopy ) + { + switch( flag_type_command ) + { + case 0: + break; + + case IS_CHANGED: /* Create a copy of schematic */ + NewList->m_Son = CopyItem = DuplicateStruct( ItemToCopy ); + if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + DrawPickedStruct* PickedList = (DrawPickedStruct*) CopyItem; + while( PickedList ) + { + CopyItem = PickedList->m_PickedStruct; + CopyItem->m_Flags = flag_type_command; + PickedList->m_Image = CopyItem->m_Image; + PickedList = (DrawPickedStruct*) PickedList->Pnext; + } + } + else + { + CopyItem->m_Flags = flag_type_command; + CopyItem->m_Image = ItemToCopy; + } + break; + + case IS_NEW: + if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + NewList->m_Son = ItemToCopy; + DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy; + while( PickedList ) + { + CopyItem = PickedList->m_PickedStruct; + PickedList->m_Image = CopyItem; + PickedList->m_PickedStruct = NULL; + PickedList->m_Flags = flag_type_command; + PickedList = (DrawPickedStruct*) PickedList->Pnext; + } + } + else + { + NewList->m_Image = ItemToCopy; + } + break; + + case IS_NEW | IS_CHANGED: + case IS_WIRE_IMAGE: + NewList->m_Son = ItemToCopy; + break; + + case IS_DELETED: + NewList->m_Son = ItemToCopy; + ItemToCopy->m_Flags = flag_type_command; + if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy; + while( PickedList ) + { + CopyItem = PickedList->m_PickedStruct; + CopyItem->m_Flags = flag_type_command; + PickedList->m_Flags = flag_type_command; + PickedList = (DrawPickedStruct*) PickedList->Pnext; + } + } + break; + + default: + DisplayError( this, wxT( "SaveCopyInUndoList() error" ) ); + break; + } + } + /* Save the copy in undo list */ + GetScreen()->AddItemToUndoList( NewList ); + + /* Clear redo list, because after new save there is no redo to do */ + GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList ); + GetScreen()->m_RedoList = NULL; } + /**********************************************************/ -void WinEDA_SchematicFrame::GetSchematicFromRedoList(void) +void WinEDA_SchematicFrame::GetSchematicFromRedoList() /**********************************************************/ + /* Redo the last edition: - - Save the current schematic in undo list - - Get the old version -*/ + * - Save the current schematic in undo list + * - Get the old version + */ { - if ( GetScreen()->m_RedoList == NULL ) return; - - /* Get the old wrapper and put it in UndoList */ - DrawPickedStruct * List = (DrawPickedStruct *)GetScreen()->GetItemFromRedoList(); - GetScreen()->AddItemToUndoList(List); - /* Redo the command: */ - PutDataInPreviousState(List); - - CurrentDrawItem = NULL; - GetScreen()->SetModify(); - ReCreateHToolbar(); - SetToolbars(); + if( GetScreen()->m_RedoList == NULL ) + return; + + /* Get the old wrapper and put it in UndoList */ + DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromRedoList(); + GetScreen()->AddItemToUndoList( List ); + /* Redo the command: */ + PutDataInPreviousState( List ); + + CurrentDrawItem = NULL; + GetScreen()->SetModify(); + ReCreateHToolbar(); + SetToolbars(); } /***************************************************************************/ -void WinEDA_SchematicFrame::PutDataInPreviousState(DrawPickedStruct * List) +void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) /***************************************************************************/ + /* Used in undo or redo command. - Put data pointed by List in the previous state, i.e. the state memorised by List -*/ + * Put data pointed by List in the previous state, i.e. the state memorised by List + */ { -EDA_BaseStruct * FirstItem = List->m_Son; -EDA_BaseStruct * item; -DrawPickedStruct * PickedList; - - switch ( List->m_Flags ) - { - case IS_CHANGED: /* Exchange old and new data for each item */ - if ( FirstItem == NULL ) - { - DisplayError(this, wxT("PutDataInPreviousState() error : Null item")); - break; - } - if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) - { - DrawPickedStruct * PickedList = (DrawPickedStruct *) FirstItem; - while ( PickedList ) - { - SwapData(PickedList->m_PickedStruct); - PickedList = PickedList->Next(); - } - } - else - { - SwapData(FirstItem); - } - break; + EDA_BaseStruct* FirstItem = List->m_Son; + EDA_BaseStruct* item; + DrawPickedStruct* PickedList; - case IS_NEW: /* new items are deleted */ - List->m_Flags = IS_DELETED; - if ( FirstItem && FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) - { - PickedList = (DrawPickedStruct *) FirstItem; - while ( PickedList ) - { - item = PickedList->m_Image; - GetScreen()->RemoveFromDrawList(item); - item->m_Flags = IS_DELETED; - PickedList->m_PickedStruct = item; - PickedList->m_Flags = IS_DELETED; - PickedList = PickedList->Next(); - } - } - else - { - FirstItem = List->m_Image; - GetScreen()->RemoveFromDrawList(FirstItem); - FirstItem->m_Flags = IS_DELETED; - List->m_Son = FirstItem; - } - break; + switch( List->m_Flags ) + { + case IS_CHANGED: /* Exchange old and new data for each item */ + if( FirstItem == NULL ) + { + DisplayError( this, wxT( "PutDataInPreviousState() error : Null item" ) ); + break; + } + if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + DrawPickedStruct* PickedList = (DrawPickedStruct*) FirstItem; + while( PickedList ) + { + SwapData( PickedList->m_PickedStruct ); + PickedList = PickedList->Next(); + } + } + else + { + SwapData( FirstItem ); + } + break; - case IS_DELETED: /* deleted items are put in EEdrawList, as new items */ - List->m_Flags = IS_NEW; - if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) - { - PickedList = (DrawPickedStruct *) FirstItem; - while ( PickedList ) - { - item = PickedList->m_PickedStruct; - item->Pnext = GetScreen()->EEDrawList; - GetScreen()->EEDrawList = item; - item->m_Flags = 0; - PickedList->m_PickedStruct = NULL; - PickedList->m_Image = item; - PickedList->m_Flags = IS_NEW; - PickedList = PickedList->Next(); - } - } - else - { - FirstItem->Pnext = GetScreen()->EEDrawList; - GetScreen()->EEDrawList = FirstItem; - FirstItem->m_Flags = 0; - List->m_Image = List->m_Son; - List->m_Son = NULL; - } - break; - - case IS_WIRE_IMAGE: - /* Exchange the current wires and the oild wires */ - List->m_Son = GetScreen()->ExtractWires(FALSE); - while ( FirstItem ) - { - EDA_BaseStruct * nextitem = FirstItem->Pnext; - FirstItem->Pnext = GetScreen()->EEDrawList; - GetScreen()->EEDrawList = FirstItem; - FirstItem->m_Flags = 0; - FirstItem = nextitem; - } - break; + case IS_NEW: /* new items are deleted */ + List->m_Flags = IS_DELETED; + if( FirstItem && FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + PickedList = (DrawPickedStruct*) FirstItem; + while( PickedList ) + { + item = PickedList->m_Image; + GetScreen()->RemoveFromDrawList( item ); + item->m_Flags = IS_DELETED; + PickedList->m_PickedStruct = item; + PickedList->m_Flags = IS_DELETED; + PickedList = PickedList->Next(); + } + } + else + { + FirstItem = List->m_Image; + GetScreen()->RemoveFromDrawList( FirstItem ); + FirstItem->m_Flags = IS_DELETED; + List->m_Son = FirstItem; + } + break; - case IS_NEW|IS_CHANGED: - case IS_DELETED|IS_CHANGED: - if ( !FirstItem || FirstItem->m_StructType != DRAW_PICK_ITEM_STRUCT_TYPE) - { - DisplayError(this, wxT("GetSchematicFromUndoList() error: Pickstruct expected")); - break; - } - PickedList = (DrawPickedStruct *) FirstItem; - while ( PickedList ) - { - switch (PickedList->m_Flags) - { - case IS_CHANGED: - SwapData(PickedList->m_PickedStruct); - break; - - case IS_NEW: - item = PickedList->m_Image; - GetScreen()->RemoveFromDrawList(item); - item->m_Flags = IS_DELETED; - PickedList->m_PickedStruct = item; - PickedList->m_Flags = IS_DELETED; - break; - - case IS_DELETED: - item = PickedList->m_PickedStruct; - item->Pnext = GetScreen()->EEDrawList; - GetScreen()->EEDrawList = item; - item->m_Flags = 0; - PickedList->m_PickedStruct = NULL; - PickedList->m_Image = item; - PickedList->m_Flags = IS_NEW; - break; - } - PickedList = PickedList->Next(); - } - break; + case IS_DELETED: /* deleted items are put in EEdrawList, as new items */ + List->m_Flags = IS_NEW; + if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + PickedList = (DrawPickedStruct*) FirstItem; + while( PickedList ) + { + item = PickedList->m_PickedStruct; + item->Pnext = GetScreen()->EEDrawList; + GetScreen()->EEDrawList = item; + item->m_Flags = 0; + PickedList->m_PickedStruct = NULL; + PickedList->m_Image = item; + PickedList->m_Flags = IS_NEW; + PickedList = PickedList->Next(); + } + } + else + { + FirstItem->Pnext = GetScreen()->EEDrawList; + GetScreen()->EEDrawList = FirstItem; + FirstItem->m_Flags = 0; + List->m_Image = List->m_Son; + List->m_Son = NULL; + } + break; - default: - DisplayError(this, wxT("GetSchematicFromUndoList() error: Unknown cmd")); - break; - } + case IS_WIRE_IMAGE: + /* Exchange the current wires and the oild wires */ + List->m_Son = GetScreen()->ExtractWires( FALSE ); + while( FirstItem ) + { + EDA_BaseStruct* nextitem = FirstItem->Pnext; + FirstItem->Pnext = GetScreen()->EEDrawList; + GetScreen()->EEDrawList = FirstItem; + FirstItem->m_Flags = 0; + FirstItem = nextitem; + } + + break; + + case IS_NEW | IS_CHANGED: + case IS_DELETED | IS_CHANGED: + if( !FirstItem || FirstItem->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) + { + DisplayError( this, wxT( "GetSchematicFromUndoList() error: Pickstruct expected" ) ); + break; + } + PickedList = (DrawPickedStruct*) FirstItem; + while( PickedList ) + { + switch( PickedList->m_Flags ) + { + case IS_CHANGED: + SwapData( PickedList->m_PickedStruct ); + break; + + case IS_NEW: + item = PickedList->m_Image; + GetScreen()->RemoveFromDrawList( item ); + item->m_Flags = IS_DELETED; + PickedList->m_PickedStruct = item; + PickedList->m_Flags = IS_DELETED; + break; + + case IS_DELETED: + item = PickedList->m_PickedStruct; + item->Pnext = GetScreen()->EEDrawList; + GetScreen()->EEDrawList = item; + item->m_Flags = 0; + PickedList->m_PickedStruct = NULL; + PickedList->m_Image = item; + PickedList->m_Flags = IS_NEW; + break; + } + + PickedList = PickedList->Next(); + } + + break; + + default: + DisplayError( this, wxT( "GetSchematicFromUndoList() error: Unknown cmd" ) ); + break; + } } + /**********************************************************/ -void WinEDA_SchematicFrame::GetSchematicFromUndoList(void) +void WinEDA_SchematicFrame::GetSchematicFromUndoList() /**********************************************************/ + /* Undo the last edition: - - Save the current schematic in Redo list - - Get an old version of the schematic -*/ + * - Save the current schematic in Redo list + * - Get an old version of the schematic + */ { - if ( GetScreen()->m_UndoList == NULL ) return; - - /* Get the old wrapper and put it in RedoList (the real data list is the m_Son member) */ - DrawPickedStruct * List = (DrawPickedStruct *)GetScreen()->GetItemFromUndoList(); - GetScreen()->AddItemToRedoList(List); - /* Undo the command */ - PutDataInPreviousState(List); + if( GetScreen()->m_UndoList == NULL ) + return; - CurrentDrawItem = NULL; - GetScreen()->SetModify(); - ReCreateHToolbar(); - SetToolbars(); + /* Get the old wrapper and put it in RedoList (the real data list is the m_Son member) */ + DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromUndoList(); + GetScreen()->AddItemToRedoList( List ); + /* Undo the command */ + PutDataInPreviousState( List ); + + CurrentDrawItem = NULL; + GetScreen()->SetModify(); + ReCreateHToolbar(); + SetToolbars(); } /*********************************************************/ -void SCH_SCREEN::ClearUndoORRedoList(EDA_BaseStruct *List) +void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List ) /*********************************************************/ + /* free the undo or redo list from List element - Wrappers are deleted. - datas pointed by wrappers are deleted if not flagged IS_NEW - because they are copy of used data or they are not in use (DELETED) -*/ + * Wrappers are deleted. + * datas pointed by wrappers are deleted if not flagged IS_NEW + * because they are copy of used data or they are not in use (DELETED) + */ { -EDA_BaseStruct *nextitem; -EDA_BaseStruct * FirstItem; -int CmdType; - - if ( List == NULL ) return; + EDA_BaseStruct* nextitem; + EDA_BaseStruct* FirstItem; + int CmdType; - for ( ; List != NULL; List = nextitem ) - { - nextitem = List->Pnext; - FirstItem = List->m_Son; - CmdType = List->m_Flags; + if( List == NULL ) + return; - delete List; + for( ; List != NULL; List = nextitem ) + { + nextitem = List->Pnext; + FirstItem = List->m_Son; + CmdType = List->m_Flags; - if (FirstItem == NULL ) continue; - - if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) - { - EDA_BaseStruct * item; - DrawPickedStruct * PickedList = (DrawPickedStruct *) FirstItem; - while ( PickedList ) // delete wrapper list and copies - { - item = PickedList->m_PickedStruct; - if ( item ) - { - if ( item->m_StructType == DRAW_SHEET_STRUCT_TYPE ) - { - DrawSheetStruct * sheet = (DrawSheetStruct*)item; - /* Delete sub hierarchy if the sheet must be deleted */ - if ( (sheet->m_Flags & IS_DELETED) != 0 ) - DeleteSubHierarchy(sheet, FALSE); - else /* EEDrawList, UndoList and Redo list are shared, and are deleted - only if sheet is deleted */ - { - if ( (item->m_Flags & IS_NEW) == 0 ) - { - sheet->EEDrawList = NULL; - sheet->m_UndoList = NULL; - sheet->m_RedoList = NULL; - } - } - } - if ( (item->m_Flags & IS_NEW) == 0 ) delete item; - } - DrawPickedStruct * wrapper = PickedList; - PickedList = PickedList->Next(); - delete wrapper; - } - } - else // This is a single item: deleted copy - { - if ( CmdType == IS_WIRE_IMAGE ) - { - while ( FirstItem ) - { - EDA_BaseStruct * nextitem = FirstItem->Pnext; - delete FirstItem; - FirstItem = nextitem; - } - } - else - { - if ( FirstItem->m_StructType == DRAW_SHEET_STRUCT_TYPE ) - { - DrawSheetStruct * sheet = (DrawSheetStruct*)FirstItem; - /* Delete hierarchy if the sheet must be deleted */ - if ( (sheet->m_Flags & IS_DELETED) == IS_DELETED ) - DeleteSubHierarchy(sheet, FALSE); - else - { - if ( (FirstItem->m_Flags & IS_NEW) == 0 ) - { - sheet->EEDrawList = NULL; - sheet->m_UndoList = NULL; - sheet->m_RedoList = NULL; - } - } - } - if ( (FirstItem->m_Flags & IS_NEW) == 0 ) delete FirstItem; - } - } - } + delete List; + + if( FirstItem == NULL ) + continue; + + if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) + { + EDA_BaseStruct* item; + DrawPickedStruct* PickedList = (DrawPickedStruct*) FirstItem; + while( PickedList ) // delete wrapper list and copies + { + item = PickedList->m_PickedStruct; + if( item ) + { + if( item->Type() == DRAW_SHEET_STRUCT_TYPE ) + { + DrawSheetStruct* sheet = (DrawSheetStruct*) item; + /* Delete sub hierarchy if the sheet must be deleted */ + if( (sheet->m_Flags & IS_DELETED) != 0 ) + DeleteSubHierarchy( sheet, FALSE ); + else /* EEDrawList, UndoList and Redo list are shared, and are deleted + * only if sheet is deleted */ + { + if( (item->m_Flags & IS_NEW) == 0 ) + { + sheet->EEDrawList = NULL; + sheet->m_UndoList = NULL; + sheet->m_RedoList = NULL; + } + } + } + if( (item->m_Flags & IS_NEW) == 0 ) + delete item; + } + DrawPickedStruct* wrapper = PickedList; + PickedList = PickedList->Next(); + delete wrapper; + } + } + else // This is a single item: deleted copy + { + if( CmdType == IS_WIRE_IMAGE ) + { + while( FirstItem ) + { + EDA_BaseStruct* nextitem = FirstItem->Pnext; + delete FirstItem; + FirstItem = nextitem; + } + } + else + { + if( FirstItem->Type() == DRAW_SHEET_STRUCT_TYPE ) + { + DrawSheetStruct* sheet = (DrawSheetStruct*) FirstItem; + /* Delete hierarchy if the sheet must be deleted */ + if( (sheet->m_Flags & IS_DELETED) == IS_DELETED ) + DeleteSubHierarchy( sheet, FALSE ); + else + { + if( (FirstItem->m_Flags & IS_NEW) == 0 ) + { + sheet->EEDrawList = NULL; + sheet->m_UndoList = NULL; + sheet->m_RedoList = NULL; + } + } + } + if( (FirstItem->m_Flags & IS_NEW) == 0 ) + delete FirstItem; + } + } + } } + /*****************************************/ -void SCH_SCREEN::ClearUndoRedoList(void) +void SCH_SCREEN::ClearUndoRedoList() /*****************************************/ + /* free the undo and the redo lists -*/ + */ { - ClearUndoORRedoList(m_UndoList); m_UndoList = NULL; - ClearUndoORRedoList(m_RedoList); m_RedoList = NULL; + ClearUndoORRedoList( m_UndoList ); m_UndoList = NULL; + ClearUndoORRedoList( m_RedoList ); m_RedoList = NULL; } + /***********************************************************/ -void SCH_SCREEN::AddItemToUndoList(EDA_BaseStruct * newitem) +void SCH_SCREEN::AddItemToUndoList( EDA_BaseStruct* newitem ) /************************************************************/ + /* Put newitem in head of undo list - Deletes olds items if > count max. -*/ + * Deletes olds items if > count max. + */ { -int ii; -EDA_BaseStruct * item, *nextitem; - - if ( newitem == NULL ) return; - - if ( m_UndoList ) m_UndoList->Pback = newitem; - newitem->Pnext = m_UndoList; - newitem->Pback = NULL; - m_UndoList = newitem; + int ii; + EDA_BaseStruct* item, * nextitem; - /* Free oldest items, if count max reached */ - for ( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ ) - { - if ( item->Pnext == NULL ) return; - item = item->Pnext; - } - - if ( item == NULL ) return; - - nextitem = item->Pnext; - item->Pnext = NULL; // Set end of chain - - // Delete the extra items - ClearUndoORRedoList(nextitem); + if( newitem == NULL ) + return; + + if( m_UndoList ) + m_UndoList->Pback = newitem; + newitem->Pnext = m_UndoList; + newitem->Pback = NULL; + m_UndoList = newitem; + + /* Free oldest items, if count max reached */ + for( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ ) + { + if( item->Pnext == NULL ) + return; + item = item->Pnext; + } + + if( item == NULL ) + return; + + nextitem = item->Pnext; + item->Pnext = NULL; // Set end of chain + + // Delete the extra items + ClearUndoORRedoList( nextitem ); } + /***********************************************************/ -void SCH_SCREEN::AddItemToRedoList(EDA_BaseStruct * newitem) +void SCH_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem ) /***********************************************************/ { -int ii; -EDA_BaseStruct * item, *nextitem; - - if ( newitem == NULL ) return; - - newitem->Pback = NULL; - newitem->Pnext = m_RedoList; - m_RedoList = newitem; - /* Free first items, if count max reached */ - for ( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ ) - { - if ( item->Pnext == NULL ) break; - item = item->Pnext; - } - - if ( item == NULL ) return; - - nextitem = item->Pnext; - item->Pnext = NULL; // Set end of chain - - // Delete the extra items - ClearUndoORRedoList(nextitem); -} + int ii; + EDA_BaseStruct* item, * nextitem; + if( newitem == NULL ) + return; + + newitem->Pback = NULL; + newitem->Pnext = m_RedoList; + m_RedoList = newitem; + /* Free first items, if count max reached */ + for( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ ) + { + if( item->Pnext == NULL ) + break; + item = item->Pnext; + } + + if( item == NULL ) + return; + + nextitem = item->Pnext; + item->Pnext = NULL; // Set end of chain + + // Delete the extra items + ClearUndoORRedoList( nextitem ); +} diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 14dc8c2d99..ed0ce14732 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -385,7 +385,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ) if( Sheet->m_Flags & IS_NEW ) return; - if( Sheet->m_StructType != DRAW_SHEET_STRUCT_TYPE ) + if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE ) { DisplayError( this, wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) ); return; @@ -420,7 +420,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC ) /*********************************************************************************/ { - if( (Sheet == NULL) || ( Sheet->m_StructType != DRAW_SHEET_STRUCT_TYPE) ) + if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) ) return; DrawPanel->CursorOff( DC ); @@ -573,7 +573,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ) DrawGlobalLabelStruct* GLabel = NULL; for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) { - if( DrawStruct->m_StructType != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) + if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) continue; GLabel = (DrawGlobalLabelStruct*) DrawStruct; if( Pinsheet->m_Text.CmpNoCase( GLabel->m_Text ) == 0 ) diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 74a23060e7..b0668e4f72 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -54,7 +54,7 @@ public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent, DrawSheetLabelStruct* curr_pinsheet, const wxPoint& framepos = wxPoint( -1, -1 ) ); - ~WinEDA_PinSheetPropertiesFrame( void ) { }; + ~WinEDA_PinSheetPropertiesFrame() { }; private: void PinSheetPropertiesAccept( wxCommandEvent& event ); @@ -371,7 +371,7 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S GLabel = NULL; for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) { - if( DrawStruct->m_StructType != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) + if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) continue; GLabel = (DrawGlobalLabelStruct*) DrawStruct; @@ -437,7 +437,7 @@ void WinEDA_SchematicFrame::DeleteSheetLabel( wxDC* DC, if( DrawStruct ) // Modification du chainage { - if( DrawStruct->m_StructType != DRAW_SHEET_STRUCT_TYPE ) + if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) { DisplayError( this, wxT( "DeleteSheetLabel error: m_Parent != DRAW_SHEET_STRUCT_TYPE" ) ); diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index c24fbb9e5e..1e8b36334d 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -71,7 +71,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) CurrentDrawItem->m_Convert = 0; if( m_Filled ) { - switch( CurrentDrawItem->m_StructType ) + switch( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: ( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; @@ -143,7 +143,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) if( CurrentDrawItem->m_Flags & IS_NEW ) { - if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) + if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) { Panel->m_Parent->RedrawActiveWindow( DC, TRUE ); } @@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC ) if( CurrentDrawItem == NULL ) return; - switch( CurrentDrawItem->m_StructType ) + switch( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: if( StateDrawArc == 1 ) @@ -414,7 +414,7 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) int mx = newpos.x, my = newpos.y; wxSize size; - switch( DrawItem->m_StructType ) + switch( DrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: { @@ -485,7 +485,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC ) CurrentDrawItem->m_Flags |= IS_MOVED; StartCursor = m_CurrentScreen->m_Curseur; - switch( CurrentDrawItem->m_StructType ) + switch( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: InitPosition = ( (LibDrawArc*) CurrentDrawItem )->m_Pos; @@ -548,7 +548,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentDrawItem, CurrentUnit, DrawMode ); - if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) + if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) { int Color = ReturnLayerColor( LAYER_DEVICE ); GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, @@ -563,7 +563,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } } - switch( CurrentDrawItem->m_StructType ) + switch( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: if( StateDrawArc == 1 ) @@ -620,7 +620,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentDrawItem, CurrentUnit, DrawMode ); - if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) + if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) { int Color = ReturnLayerColor( LAYER_DEVICE ); GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, @@ -652,7 +652,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC ) if( CurrentDrawItem == NULL ) return; - if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) + if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) { if( StateDrawArc == 1 ) /* Trace d'arc en cours: doit etre termine */ { @@ -673,7 +673,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC ) CurrentDrawItem->Pnext = CurrentLibEntry->m_Drawings; CurrentLibEntry->m_Drawings = CurrentDrawItem; - switch( CurrentDrawItem->m_StructType ) + switch( CurrentDrawItem->Type() ) { case COMPONENT_ARC_DRAW_TYPE: ( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; @@ -821,7 +821,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) { if( CurrentDrawItem == NULL ) return; - if( CurrentDrawItem->m_StructType != COMPONENT_POLYLINE_DRAW_TYPE ) + if( CurrentDrawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE ) return; int* ptpoly; diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index e5b13f62eb..ca3f5c0210 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -127,7 +127,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC ) /********************************************/ -void WinEDA_LibeditFrame::SaveOneSymbol( void ) +void WinEDA_LibeditFrame::SaveOneSymbol() /********************************************/ /* Save in file the current symbol @@ -218,7 +218,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol( void ) if( SymbConvert > 1 ) SymbConvert = 1; - switch( DrawEntry->m_StructType ) + switch( DrawEntry->Type() ) { case COMPONENT_ARC_DRAW_TYPE: #define DRAWSTRUCT ( (LibDrawArc*) DrawEntry ) @@ -323,14 +323,14 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef, int* ptref, * ptcomp; /* Comparaison des proprietes generales */ - if( DEntryRef->m_StructType != DEntryCompare->m_StructType ) + if( DEntryRef->Type() != DEntryCompare->Type() ) return FALSE; if( DEntryRef->m_Unit != DEntryCompare->m_Unit ) return FALSE; if( DEntryRef->m_Convert != DEntryCompare->m_Convert ) return FALSE; - switch( DEntryRef->m_StructType ) + switch( DEntryRef->Type() ) { case COMPONENT_ARC_DRAW_TYPE: #undef REFSTRUCT @@ -427,7 +427,7 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef, /* d'ancrage ( coord 0,0 ). */ /***************************************************************************/ -void WinEDA_LibeditFrame::PlaceAncre( void ) +void WinEDA_LibeditFrame::PlaceAncre() { int ii, * ptsegm; int dx, dy; /* Offsets de deplacement */ @@ -449,7 +449,7 @@ void WinEDA_LibeditFrame::PlaceAncre( void ) DrawEntry = LibEntry->m_Drawings; while( DrawEntry ) { - switch( DrawEntry->m_StructType ) + switch( DrawEntry->Type() ) { case COMPONENT_ARC_DRAW_TYPE: #undef STRUCT diff --git a/eeschema/symbtext.cpp b/eeschema/symbtext.cpp index 8ed7a1dc83..8b0b1b4cbc 100644 --- a/eeschema/symbtext.cpp +++ b/eeschema/symbtext.cpp @@ -282,7 +282,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, int DrawMode = g_XorMode; if ( DrawItem == NULL ) return; - if ( DrawItem->m_StructType != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return; + if ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return; /* Effacement ancien texte */ if( ((LibDrawText*)DrawItem)->m_Text && DC) diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 4805824e30..8f964774d0 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -35,7 +35,7 @@ /****************************************************/ -void WinEDA_LibeditFrame::ReCreateVToolbar( void ) +void WinEDA_LibeditFrame::ReCreateVToolbar() /****************************************************/ { if( m_VToolBar == NULL ) @@ -100,7 +100,7 @@ void WinEDA_LibeditFrame::ReCreateVToolbar( void ) /*************************************************/ -void WinEDA_LibeditFrame::ReCreateHToolbar( void ) +void WinEDA_LibeditFrame::ReCreateHToolbar() /*************************************************/ /* Create or update the main Horizontal Toolbar for the schematic library editor diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index a1d0fda630..8ab2667f84 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -37,7 +37,7 @@ /**************************************************************/ -void WinEDA_SchematicFrame::ReCreateHToolbar( void ) +void WinEDA_SchematicFrame::ReCreateHToolbar() /**************************************************************/ /* Create the main Horizontal Toolbar for the schematic editor @@ -144,7 +144,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar( void ) /*************************************************/ -void WinEDA_SchematicFrame::ReCreateVToolbar( void ) +void WinEDA_SchematicFrame::ReCreateVToolbar() /*************************************************/ /* Create Vertical Right Toolbar @@ -239,7 +239,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar( void ) /****************************************************************/ -void WinEDA_SchematicFrame::ReCreateOptToolbar( void ) +void WinEDA_SchematicFrame::ReCreateOptToolbar() /****************************************************************/ /* Create Vertical Left Toolbar (Option Toolbar) diff --git a/gerbview/affiche.cpp b/gerbview/affiche.cpp index 6c0f05a998..1c76a6b7d2 100644 --- a/gerbview/affiche.cpp +++ b/gerbview/affiche.cpp @@ -25,7 +25,7 @@ void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte ) frame->MsgPanel->EraseMsgBox(); - if( pt_texte->m_StructType == TYPECOTATION ) + if( pt_texte->Type() == TYPECOTATION ) Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN ); else @@ -74,7 +74,7 @@ void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste ) d_index = pt_piste->m_NetCode; pt_D_code = ReturnToolDescr( layer, d_index, &ii ); - switch( pt_piste->m_StructType ) + switch( pt_piste->Type() ) { case TYPETRACK: if( pt_piste->m_Shape < S_SPOT_CIRCLE ) diff --git a/gerbview/deltrack.cpp b/gerbview/deltrack.cpp index 9721117c89..bcbdaccefa 100644 --- a/gerbview/deltrack.cpp +++ b/gerbview/deltrack.cpp @@ -62,7 +62,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track ) g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; delete Track; g_TrackSegmentCount--; - if( g_TrackSegmentCount && (g_CurrentTrackSegment->m_StructType == TYPEVIA) ) + if( g_TrackSegmentCount && (g_CurrentTrackSegment->Type() == TYPEVIA) ) { Track = g_CurrentTrackSegment; g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; diff --git a/gerbview/edit.cpp b/gerbview/edit.cpp index b8d39e3d49..0bdbe853b2 100644 --- a/gerbview/edit.cpp +++ b/gerbview/edit.cpp @@ -30,12 +30,12 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours { - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { default: msg.Printf( wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ), - (unsigned) DrawStruct->m_StructType, + (unsigned) DrawStruct->Type(), (unsigned) DrawStruct->m_Flags ); DisplayError( this, msg ); } @@ -60,7 +60,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct = GerberGeneralLocateAndDisplay(); if( DrawStruct == NULL ) break; - if( DrawStruct->m_StructType == TYPETRACK ) + if( DrawStruct->Type() == TYPETRACK ) { Delete_Segment( DC, (TRACK*) DrawStruct ); GetScreen()->SetCurItem( NULL ); @@ -309,13 +309,13 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame, frame->DrawPanel->MouseToCursorSchema(); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { default: wxString msg; msg.Printf( wxT( "WinEDA_LibeditFrame::Move_Item Error: Bad DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( frame, msg ); break; } @@ -350,7 +350,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) break; // Element localisé - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { default: break; diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 57fb344117..b9c89db647 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -1,7 +1,7 @@ /* export_to_pcbnew.cpp */ /* - * Export des couches vers pcbnew + * Export the layers to pcbnew */ #include "fctsys.h" @@ -119,7 +119,8 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, */ { char Line[256]; - TRACK* track, * next_track; + TRACK* track; + TRACK* next_track; BOARD_ITEM* PtStruct; BOARD_ITEM* NextStruct; BOARD* GerberPcb = frame->m_Pcb; @@ -136,6 +137,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, int pcb_layer_number = LayerLookUpTable[layer]; if( pcb_layer_number < 0 ) continue; + if( pcb_layer_number > CMP_N ) { DRAWSEGMENT* drawitem = new DRAWSEGMENT( NULL, TYPEDRAWSEGMENT ); @@ -149,47 +151,57 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, } else { - TRACK* newtrack = new TRACK( * track ); + TRACK* newtrack; + + // replace spots with vias when possible + if( (track->m_Shape == S_SPOT_CIRCLE) + || (track->m_Shape == S_SPOT_RECT) + || (track->m_Shape == S_SPOT_OVALE) ) + { + newtrack = new SEGVIA( (const SEGVIA&) *track ); - newtrack->SetLayer( pcb_layer_number ); + // A spot is found, and can be a via: change it to via, and delete other + // spots at same location + newtrack->m_Shape = VIA_NORMALE; + + newtrack->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp) + + newtrack->m_Drill = -1; + + // Compute the via position from track position ( Via position is the + // position of the middle of the track segment ) + newtrack->m_Start.x = (newtrack->m_Start.x + newtrack->m_End.x) / 2; + newtrack->m_Start.y = (newtrack->m_Start.y + newtrack->m_End.y) / 2; + newtrack->m_End = newtrack->m_Start; + } + else // a true TRACK + { + newtrack = new TRACK( *track ); + newtrack->SetLayer( pcb_layer_number ); + } + newtrack->Insert( Pcb, NULL ); } } - /* replace spots by vias when possible */ - for( track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext ) - { - if( (track->m_Shape != S_SPOT_CIRCLE) && (track->m_Shape != S_SPOT_RECT) && - (track->m_Shape != S_SPOT_OVALE) ) - continue; - - /* A spot is found, and can be a via: change it for via, and delete others - * spots at same location */ - track->m_Shape = VIA_NORMALE; - track->m_StructType = TYPEVIA; - track->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp) - track->m_Drill = -1; - /* Compute the via position from track position ( Via position is the position of the middle of the track segment */ - track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2; - track->m_Start.y = (track->m_Start.y + track->m_End.y) / 2; - track->m_End = track->m_Start; - } - - /* delete redundant vias */ + // delete redundant vias for( track = Pcb->m_Track; track != NULL; track = track->Next() ) { if( track->m_Shape != VIA_NORMALE ) continue; - /* Search and delete others vias*/ + + // Search and delete others vias TRACK* alt_track = track->Next(); for( ; alt_track != NULL; alt_track = next_track ) { - next_track = (TRACK*) alt_track->Pnext; + next_track = alt_track->Next(); if( alt_track->m_Shape != VIA_NORMALE ) continue; + if( alt_track->m_Start != track->m_Start ) continue; - /* delete track */ + + // delete track alt_track->UnLink(); delete alt_track; } @@ -197,17 +209,18 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, // Switch the locale to standard C (needed to print floating point numbers like 1.3) setlocale( LC_NUMERIC, "C" ); - /* Ecriture de l'entete PCB : */ + + // write the PCB heading fprintf( File, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB, DateAndTime( Line ) ); WriteGeneralDescrPcb( Pcb, File ); WriteSetup( File, Pcb ); - /* Ecriture des donnes utiles du pcb */ + // write the useful part of the pcb PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTE: ( (TEXTE_PCB*) PtStruct )->WriteTextePcbDescr( File ); @@ -232,7 +245,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, fprintf( File, "$EndBOARD\n" ); - /* Delete the copy */ + // Delete the copy for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct ) { NextStruct = PtStruct->Next(); diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 43449824c9..fc2325ff43 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -115,7 +115,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( wxDC* DC, { PtNext = PtStruct->Next(); - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: case TYPETEXTE: @@ -179,7 +179,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( wxDC* DC, bool query ) for( ; PtStruct != NULL; PtStruct = PtNext ) { PtNext = PtStruct->Next(); - if( PtStruct->m_StructType == TYPETEXTE ) + if( PtStruct->Type() == TYPETEXTE ) DeleteStructure( PtStruct ); } diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index aedc66708c..595bd68de2 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -57,7 +57,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc ) while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL ) { Track = TrackLocate; - if( TrackLocate->m_StructType == TYPEVIA ) + if( TrackLocate->Type() == TYPEVIA ) break; TrackLocate = (TRACK*) TrackLocate->Pnext; } @@ -112,7 +112,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc ) PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; pts = (DRAWSEGMENT*) PtStruct; ux0 = pts->m_Start.x; uy0 = pts->m_Start.y; @@ -198,7 +198,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer ) dx -= ux0; dy -= uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; - if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */ + if( Track->Type() == TYPEVIA ) /* VIA rencontree */ { if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) ) { @@ -289,7 +289,7 @@ TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc ) PtStruct = (EDA_BaseStruct*) pt_txt_pcb; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPETEXTE ) + if( PtStruct->Type() != TYPETEXTE ) continue; pt_txt_pcb = (TEXTE_PCB*) PtStruct; diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index fb4eeb1843..3f841c19eb 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -71,7 +71,7 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu GetScreen()->SetCurItem( DrawStruct ); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPETRACK: @@ -84,7 +84,7 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu default: msg.Printf( wxT( "WinEDA_GerberFrame::OnRightClick Error: illegal or unknown DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; } diff --git a/gerbview/protos.h b/gerbview/protos.h index 7e5f24c6c9..277220332b 100644 --- a/gerbview/protos.h +++ b/gerbview/protos.h @@ -8,7 +8,7 @@ int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent); /****************/ /* undelete.cpp */ /****************/ -EDA_BaseStruct * SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems); +BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ); /***********/ diff --git a/gerbview/struct.cpp b/gerbview/struct.cpp index e0bcd9aae5..382460f7e9 100644 --- a/gerbview/struct.cpp +++ b/gerbview/struct.cpp @@ -28,7 +28,7 @@ wxString msg; PtNext = PtStruct->Pnext; PtBack = PtStruct->Pback; - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPE_NOT_INIT: DisplayError(NULL, wxT("DeleteStruct: Type NOT_INIT")); @@ -69,7 +69,7 @@ wxString msg; case TYPEPCB: default: msg.Printf( wxT("DeleteStructure: unexpected %d type"), - PtStruct->m_StructType); + PtStruct->Type()); DisplayError(NULL, msg); break; } diff --git a/gerbview/undelete.cpp b/gerbview/undelete.cpp index ce6628d239..debfd8b851 100644 --- a/gerbview/undelete.cpp +++ b/gerbview/undelete.cpp @@ -1,6 +1,6 @@ - /********************************************************/ - /* Effacements : Routines de sauvegarde et d'effacement */ - /********************************************************/ +/********************************************************/ +/* Effacements : Routines de sauvegarde et d'effacement */ +/********************************************************/ #include "fctsys.h" @@ -14,95 +14,104 @@ /* Routines Locales */ /***********************************************/ -void WinEDA_GerberFrame::UnDeleteItem(wxDC * DC) +void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC ) /***********************************************/ + /* Restitution d'un element (MODULE ou TRACK ) Efface -*/ + */ { -EDA_BaseStruct * PtStruct, *PtNext; -TRACK * pt_track; -int net_code; + EDA_BaseStruct* PtStruct, * PtNext; + TRACK* pt_track; + int net_code; - if( ! g_UnDeleteStackPtr ) return; + if( !g_UnDeleteStackPtr ) + return; - g_UnDeleteStackPtr --; - PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; - if ( PtStruct == NULL ) return; // Ne devrait pas se produire + g_UnDeleteStackPtr--; + PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; + if( PtStruct == NULL ) + return; // Ne devrait pas se produire - switch(PtStruct->m_StructType) - { - case TYPEVIA: - case TYPETRACK: - for( ; PtStruct != NULL; PtStruct = PtNext) - { - PtNext = PtStruct->Pnext; - PtStruct->SetState(DELETED,OFF); /* Effacement du bit DELETED */ - Trace_Segment(DrawPanel, DC, (TRACK*) PtStruct, GR_OR); - } + switch( PtStruct->Type() ) + { + case TYPEVIA: + case TYPETRACK: + for( ; PtStruct != NULL; PtStruct = PtNext ) + { + PtNext = PtStruct->Pnext; + PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ + Trace_Segment( DrawPanel, DC, (TRACK*) PtStruct, GR_OR ); + } - PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; - net_code = ((TRACK*)PtStruct)->m_NetCode; - pt_track = ( (TRACK*) PtStruct)->GetBestInsertPoint(m_Pcb); - ((TRACK*)PtStruct)->Insert(m_Pcb, pt_track); + PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; + net_code = ( (TRACK*) PtStruct )->m_NetCode; + pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb ); + ( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track ); - g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; - break; + g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; + break; - default: - DisplayError(this, wxT("Undelete struct: type Struct inattendu")); - break; - } + default: + DisplayError( this, wxT( "Undelete struct: type Struct inattendu" ) ); + break; + } } /********************************************************************/ -EDA_BaseStruct * SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems) +BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ) /********************************************************************/ + /* Sauvegarde d'un element aux fins de restitution par Undelete - Supporte actuellement : Module et segments de piste -*/ + * Supporte actuellement : Module et segments de piste + */ { -EDA_BaseStruct * NextS, * PtStruct = PtItem; -int ii; - if( (PtItem == NULL) || (nbitems == 0) ) return NULL; + BOARD_ITEM* NextS, * PtStruct = PtItem; + int ii; - if (g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE ) - { - /* Delete last deleted item, and shift stack. */ - DeleteStructure(g_UnDeleteStack[0]); - for (ii = 0; ii < (g_UnDeleteStackPtr-1); ii++) - { - g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1]; - } - g_UnDeleteStackPtr--;; - } - g_UnDeleteStack[g_UnDeleteStackPtr++] = PtItem; + if( (PtItem == NULL) || (nbitems == 0) ) + return NULL; - switch ( PtStruct->m_StructType ) - { - case TYPEVIA: - case TYPETRACK: - { - EDA_BaseStruct * Back = NULL; - g_UnDeleteStack[g_UnDeleteStackPtr-1] = PtStruct; + if( g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE ) + { + /* Delete last deleted item, and shift stack. */ + DeleteStructure( g_UnDeleteStack[0] ); + for( ii = 0; ii < (g_UnDeleteStackPtr - 1); ii++ ) + { + g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1]; + } - for ( ; nbitems > 0; nbitems--, PtStruct = NextS) - { - NextS = PtStruct->Pnext; - ((TRACK*)PtStruct)->UnLink(); - PtStruct->SetState(DELETED, ON); - if( nbitems <= 1 ) NextS = NULL; /* fin de chaine */ - PtStruct->Pnext = NextS; - PtStruct->Pback = Back; Back = PtStruct; - if(NextS == NULL) break; - } - } - break; + g_UnDeleteStackPtr--;; + } + g_UnDeleteStack[g_UnDeleteStackPtr++] = PtItem; - default: break; - } + switch( PtStruct->Type() ) + { + case TYPEVIA: + case TYPETRACK: + { + EDA_BaseStruct* Back = NULL; + g_UnDeleteStack[g_UnDeleteStackPtr - 1] = PtStruct; - return(g_UnDeleteStack[g_UnDeleteStackPtr-1]); + for( ; nbitems > 0; nbitems--, PtStruct = NextS ) + { + NextS = PtStruct->Next(); + ( (TRACK*) PtStruct )->UnLink(); + + PtStruct->SetState( DELETED, ON ); + if( nbitems <= 1 ) + NextS = NULL; /* fin de chaine */ + PtStruct->Pnext = NextS; + PtStruct->Pback = Back; Back = PtStruct; + if( NextS == NULL ) + break; + } + } + break; + + default: + break; + } + + return g_UnDeleteStack[g_UnDeleteStackPtr - 1]; } - - diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index 0220ba9d7c..66880056fe 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -60,21 +60,21 @@ public: bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used) public: - WinEDA_App( void ); - ~WinEDA_App( void ); - bool OnInit( void ); - int OnRun( void ); + WinEDA_App(); + ~WinEDA_App(); + bool OnInit(); + int OnRun(); - bool SetBinDir( void ); + bool SetBinDir(); void InitEDA_Appl( const wxString& name ); bool SetLanguage( bool first_time = FALSE ); wxMenu* SetLanguageList( wxMenu* MasterMenu ); void SetLanguageIdentifier( int menu_id ); - void InitOnLineHelp( void ); + void InitOnLineHelp(); // Sauvegarde de configurations et options: - void GetSettings( void ); - void SaveSettings( void ); + void GetSettings(); + void SaveSettings(); void SetLastProject( const wxString& FullFileName ); void WriteProjectConfig( const wxString& local_config_filename, const wxString& GroupName, PARAM_CFG_BASE** List ); @@ -83,8 +83,8 @@ public: const wxString& GroupName, PARAM_CFG_BASE** List, bool Load_Only_if_New ); - void ReadPdfBrowserInfos( void ); - void WritePdfBrowserInfos( void ); + void ReadPdfBrowserInfos(); + void WritePdfBrowserInfos(); }; diff --git a/include/base_struct.h b/include/base_struct.h index 57b51d0665..b9f5fac8b9 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -126,8 +126,14 @@ public: class EDA_BaseStruct /* Basic class, not directly used */ { +private: + /** + * Run time identification, _keep private_ so it can never be changed after + * a constructor sets it. See comment near SetType() regarding virtual functions. + */ + KICAD_T m_StructType; + public: - KICAD_T m_StructType; /* Struct ident for run time identification */ EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */ EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */ EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */ @@ -161,23 +167,44 @@ private: private: void InitVars(); + + +protected: + /** + * Function SetType + * is dangerous and should not be used. It is here to work around a design + * issue in the DrawTextStruct -> DrawLabelStruct and + * DrawTextStruct -> DrawGlobalLabelStruct class hierarchy of eeschema. + * Only constructors should set m_StructType and once set, there should be + * no reason to change an object's type. For if you do, you risk mis-matching + * the virtual functions of the object with its Type() function, because the + * virtual function table is set in the call to a constructor and cannot be + * changed later without doing an "in place constructor" call (ugly and dangerous). + */ + void SetType( KICAD_T aType ) { m_StructType = aType; } public: EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType ); EDA_BaseStruct( KICAD_T struct_type ); virtual ~EDA_BaseStruct() { }; + + /** + * Function Type + * returns the type of object. This attribute should never be changed after + * a constructor sets it, so there is no public "setter" method. + * @return KICAD_T - the type of object. + */ + KICAD_T Type() const { return m_StructType; } + - EDA_BaseStruct* Next() { return Pnext; } + EDA_BaseStruct* Next() const { return Pnext; } /* Gestion de l'etat (status) de la structure (active, deleted..) */ int GetState( int type ); void SetState( int type, int state ); - int ReturnStatus() const - { - return m_Status; - } + int ReturnStatus() const { return m_Status; } void SetStatus( int new_status ) { @@ -389,12 +416,14 @@ public: } BOARD_ITEM( const BOARD_ITEM& src ) : - EDA_BaseStruct( src.m_Parent, src.m_StructType ), + EDA_BaseStruct( src.m_Parent, src.Type() ), m_Layer( src.m_Layer ) { } BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } + BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; } + BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } /** diff --git a/include/drawpanel_wxstruct.h b/include/drawpanel_wxstruct.h index 46d5a6de2a..1d6b75b90d 100644 --- a/include/drawpanel_wxstruct.h +++ b/include/drawpanel_wxstruct.h @@ -57,16 +57,16 @@ public: // Constructor and destructor WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); - ~WinEDA_DrawPanel( void ) { } + ~WinEDA_DrawPanel() { } /****************************/ - BASE_SCREEN* GetScreen( void ) { return m_Parent->m_CurrentScreen; } + BASE_SCREEN* GetScreen() { return m_Parent->m_CurrentScreen; } void PrepareGraphicContext( wxDC* DC ); wxPoint CalcAbsolutePosition( const wxPoint& rel_pos ); bool IsPointOnDisplay( wxPoint ref_pos ); void OnPaint( wxPaintEvent& event ); void OnSize( wxSizeEvent& event ); - void SetBoundaryBox( void ); + void SetBoundaryBox(); void ReDraw( wxDC* DC, bool erasebg = TRUE ); void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ); void DrawBackGround( wxDC* DC ); @@ -86,18 +86,18 @@ public: void OnScroll( wxScrollWinEvent& event ); void SetZoom( int mode ); - int GetZoom( void ); + int GetZoom(); void SetGrid( const wxSize& size ); - wxSize GetGrid( void ); + wxSize GetGrid(); void AddMenuZoom( wxMenu* MasterMenu ); void OnRightClick( wxMouseEvent& event ); void Process_Popup_Zoom( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event ); wxPoint CursorRealPosition( const wxPoint& ScreenPos ); - wxPoint CursorScreenPosition( void ); - wxPoint GetScreenCenterRealPosition( void ); - void MouseToCursorSchema( void ); + wxPoint CursorScreenPosition(); + wxPoint GetScreenCenterRealPosition(); + void MouseToCursorSchema(); void MouseTo( const wxPoint& Mouse ); /* Cursor functions */ @@ -156,8 +156,8 @@ public: * = 0,0 in block paste */ public: - DrawBlockStruct( void ); - ~DrawBlockStruct( void ); + DrawBlockStruct(); + ~DrawBlockStruct(); void SetMessageBlock( WinEDA_DrawFrame* frame ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC ); }; @@ -229,32 +229,32 @@ public: int m_Zoom; /* coeff de ZOOM */ public: - BASE_SCREEN( int idscreen ); - ~BASE_SCREEN( void ); + BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE ); + ~BASE_SCREEN(); - void InitDatas( void );/* Inits completes des variables */ - wxSize ReturnPageSize( void ); - int GetInternalUnits( void ); + void InitDatas();/* Inits completes des variables */ + wxSize ReturnPageSize(); + int GetInternalUnits(); wxPoint CursorRealPosition( const wxPoint& ScreenPos ); /* general Undo/Redo command control */ - virtual void ClearUndoRedoList( void ); + virtual void ClearUndoRedoList(); virtual void AddItemToUndoList( EDA_BaseStruct* item ); virtual void AddItemToRedoList( EDA_BaseStruct* item ); - virtual EDA_BaseStruct* GetItemFromUndoList( void ); - virtual EDA_BaseStruct* GetItemFromRedoList( void ); + virtual EDA_BaseStruct* GetItemFromUndoList(); + virtual EDA_BaseStruct* GetItemFromRedoList(); /* Manipulation des flags */ - void SetRefreshReq( void ) { m_FlagRefreshReq = 1; } - void ClrRefreshReq( void ) { m_FlagRefreshReq = 0; } - void SetModify( void ) { m_FlagModified = 1; m_FlagSave = 0; } - void ClrModify( void ) { m_FlagModified = 0; m_FlagSave = 1; } - void SetSave( void ) { m_FlagSave = 1; } - void ClrSave( void ) { m_FlagSave = 0; } - int IsModify( void ) { return m_FlagModified & 1; } - int IsRefreshReq( void ) { return m_FlagRefreshReq & 1; } - int IsSave( void ) { return m_FlagSave & 1; } + void SetRefreshReq() { m_FlagRefreshReq = 1; } + void ClrRefreshReq() { m_FlagRefreshReq = 0; } + void SetModify() { m_FlagModified = 1; m_FlagSave = 0; } + void ClrModify() { m_FlagModified = 0; m_FlagSave = 1; } + void SetSave() { m_FlagSave = 1; } + void ClrSave() { m_FlagSave = 0; } + int IsModify() { return m_FlagModified & 1; } + int IsRefreshReq() { return m_FlagRefreshReq & 1; } + int IsSave() { return m_FlagSave & 1; } /** @@ -268,22 +268,22 @@ public: EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; } /* fonctions relatives au zoom */ - int GetZoom( void ); /* retourne le coeff de zoom */ + int GetZoom(); /* retourne le coeff de zoom */ void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */ void SetZoomList( int* zoomlist ); /* init liste des zoom (NULL terminated) */ - void SetNextZoom( void ); /* ajuste le prochain coeff de zoom */ - void SetPreviousZoom( void ); /* ajuste le precedent coeff de zoom */ - void SetFirstZoom( void ); /* ajuste le coeff de zoom a 1*/ - void SetLastZoom( void ); /* ajuste le coeff de zoom au max */ + void SetNextZoom(); /* ajuste le prochain coeff de zoom */ + void SetPreviousZoom(); /* ajuste le precedent coeff de zoom */ + void SetFirstZoom(); /* ajuste le coeff de zoom a 1*/ + void SetLastZoom(); /* ajuste le coeff de zoom au max */ /* fonctions relatives a la grille */ - wxSize GetGrid( void ); /* retourne la grille */ + wxSize GetGrid(); /* retourne la grille */ void SetGrid( const wxSize& size ); void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */ - void SetNextGrid( void ); /* ajuste le prochain coeff de grille */ - void SetPreviousGrid( void ); /* ajuste le precedent coeff de grille */ - void SetFirstGrid( void ); /* ajuste la grille au mini*/ - void SetLastGrid( void ); /* ajuste la grille au max */ + void SetNextGrid(); /* ajuste le prochain coeff de grille */ + void SetPreviousGrid(); /* ajuste le precedent coeff de grille */ + void SetFirstGrid(); /* ajuste la grille au mini*/ + void SetLastGrid(); /* ajuste la grille au max */ /** diff --git a/include/wxstruct.h b/include/wxstruct.h index ad2c3fac47..d5185b3396 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -169,13 +169,13 @@ public: WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!! WinEDA_BasicFrame() { } // Should throw!! #endif - ~WinEDA_BasicFrame( void ); + ~WinEDA_BasicFrame(); void GetKicadHelp( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event ); void PrintMsg( const wxString& text ); - void GetSettings( void ); - void SaveSettings( void ); + void GetSettings(); + void SaveSettings(); int WriteHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose); int ReadHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose); void SetLanguage( wxCommandEvent& event ); @@ -184,7 +184,7 @@ public: wxString GetLastProject( int rang ); void SetLastProject( const wxString& FullFileName ); void DisplayActivity( int PerCent, const wxString& Text ); - virtual void ReCreateMenuBar( void ); + virtual void ReCreateMenuBar(); }; @@ -233,9 +233,9 @@ public: const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_DrawFrame( void ); + ~WinEDA_DrawFrame(); - BASE_SCREEN* GetScreen( void ) { return m_CurrentScreen; } + BASE_SCREEN* GetScreen() { return m_CurrentScreen; } void OnMenuOpen( wxMenuEvent& event ); void OnMouseEvent( wxMouseEvent& event ); @@ -244,15 +244,15 @@ public: void ProcessFontPreferences( wxCommandEvent& event ); void Affiche_Message( const wxString& message ); - void EraseMsgBox( void ); + void EraseMsgBox(); void Process_PageSettings( wxCommandEvent& event ); void SetDrawBgColor( int color_num ); - virtual void SetToolbars( void ); + virtual void SetToolbars(); void SetLanguage( wxCommandEvent& event ); - virtual void ReCreateHToolbar( void ) = 0; - virtual void ReCreateVToolbar( void ) = 0; - virtual void ReCreateMenuBar( void ); - virtual void ReCreateAuxiliaryToolbar( void ); + virtual void ReCreateHToolbar() = 0; + virtual void ReCreateVToolbar() = 0; + virtual void ReCreateMenuBar(); + virtual void ReCreateAuxiliaryToolbar(); void SetToolID( int id, int new_cursor_id, const wxString& title ); virtual void OnSelectGrid( wxCommandEvent& event ); @@ -279,13 +279,13 @@ public: /* Recalcule le zoom et les offsets pour que l'affichage se fasse dans la * fenetre de coord x0, y0 a x1, y1 */ - virtual int BestZoom( void ) = 0; // Retourne le meilleur zoom + virtual int BestZoom() = 0; // Retourne le meilleur zoom void ToPrinter( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event ); void OnActivate( wxActivateEvent& event ); - void ReDrawPanel( void ); + void ReDrawPanel(); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void DisplayToolMsg( const wxString msg ); void Process_Zoom( wxCommandEvent& event ); @@ -296,9 +296,9 @@ public: virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual void ToolOnRightClick( wxCommandEvent& event ); - void AdjustScrollBars( void ); - void Affiche_Status_Box( void );/* Affichage des coord curseur, zoom .. */ - void DisplayUnitsMsg( void ); + void AdjustScrollBars(); + void Affiche_Status_Box();/* Affichage des coord curseur, zoom .. */ + void DisplayUnitsMsg(); /* Gestion generale des operations sur block */ virtual int ReturnBlockCommand( int key ); @@ -343,21 +343,21 @@ public: const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_BasePcbFrame( void ); + ~WinEDA_BasePcbFrame(); // General virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void Process_Special_Functions( wxCommandEvent& event ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; - virtual void ReCreateHToolbar( void ) = 0; - virtual void ReCreateVToolbar( void ) = 0; + virtual void ReCreateHToolbar() = 0; + virtual void ReCreateVToolbar() = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; - virtual void ReCreateMenuBar( void ); + virtual void ReCreateMenuBar(); - PCB_SCREEN* GetScreen( void ) { return (PCB_SCREEN*) m_CurrentScreen; } - int BestZoom( void ); // Retourne le meilleur zoom + PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; } + int BestZoom(); // Retourne le meilleur zoom void Show3D_Frame( wxCommandEvent& event ); @@ -369,8 +369,8 @@ public: int flag_type_command = 0 ); private: - virtual void GetComponentFromUndoList( void ); - virtual void GetComponentFromRedoList( void ); + virtual void GetComponentFromUndoList(); + virtual void GetComponentFromRedoList(); #if defined(DEBUG) protected: @@ -409,7 +409,7 @@ public: bool Overwrite, bool DisplayDialog ); void Archive_Modules( const wxString& LibName, bool NewModulesOnly ); MODULE* Select_1_Module_From_BOARD( BOARD* Pcb ); - MODULE* GetModuleByName( void ); + MODULE* GetModuleByName(); // Modules MODULE* Create_1_Module( wxDC* DC, const wxString& module_name ); @@ -459,9 +459,9 @@ public: void Build_Board_Ratsnest( wxDC* DC ); void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); void trace_ratsnest_pad( wxDC* DC ); - void recalcule_pad_net_code( void );/* Routine de + void recalcule_pad_net_code();/* Routine de * calcul et de mise a jour des net_codes des PADS */ - void build_liste_pads( void ); + void build_liste_pads(); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); void Tst_Ratsnest( wxDC* DC, int ref_netcode ); @@ -497,7 +497,7 @@ public: // Gestion des layers: int SelectLayer( int default_layer, int min_layer, int max_layer ); - void SelectLayerPair( void ); + void SelectLayerPair(); virtual void SwitchLayer( wxDC* DC, int layer ); // divers @@ -526,7 +526,7 @@ public: WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_PcbFrame( void ); + ~WinEDA_PcbFrame(); // Configurations: void InstallConfigFrame( const wxPoint& pos ); @@ -541,14 +541,14 @@ public: void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar( void ); - void ReCreateAuxiliaryToolbar( void ); - void ReCreateVToolbar( void ); - void ReCreateAuxVToolbar( void ); - void ReCreateOptToolbar( void ); - void ReCreateMenuBar( void ); + void ReCreateHToolbar(); + void ReCreateAuxiliaryToolbar(); + void ReCreateVToolbar(); + void ReCreateAuxVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); - void PrepareLayerIndicator( void ); + void PrepareLayerIndicator(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); @@ -560,7 +560,7 @@ public: void HandleBlockPlace( wxDC* DC ); int HandleBlockEnd( wxDC* DC ); - void SetToolbars( void ); + void SetToolbars(); void Process_Settings( wxCommandEvent& event ); void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); @@ -576,12 +576,12 @@ public: bool SavePcbFile( const wxString& FileName ); int SavePcbFormatAscii( FILE* File ); bool WriteGeneralDescrPcb( FILE* File ); - bool RecreateCmpFileFromBoard( void ); + bool RecreateCmpFileFromBoard(); void ExportToGenCAD( wxCommandEvent& event ); /* Fonctions specifiques */ - MODULE* ListAndSelectModuleName( void ); + MODULE* ListAndSelectModuleName(); void Liste_Equipot( wxCommandEvent& event ); void Swap_Layers( wxCommandEvent& event ); int Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ); @@ -614,7 +614,7 @@ public: void Erase_Pistes( wxDC* DC, int masque_type, bool query ); void Erase_Modules( wxDC* DC, bool query ); void Erase_Textes_Pcb( wxDC* DC, bool query ); - void Erase_Marqueurs( void ); + void Erase_Marqueurs(); void UnDeleteItem( wxDC* DC ); void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via ); @@ -625,7 +625,7 @@ public: void DrawHightLight( wxDC* DC, int NetCode ); // Track and via edition: - void DisplayTrackSettings( void ); + void DisplayTrackSettings(); void Other_Layer_Route( TRACK* track, wxDC* DC ); void Affiche_PadsNoConnect( wxDC* DC ); void Affiche_Status_Net( wxDC* DC ); @@ -653,7 +653,7 @@ public: // Edition des zones EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone ); void CaptureNetName( wxDC* DC ); - EDGE_ZONE* Begin_Zone( void ); + EDGE_ZONE* Begin_Zone(); void End_Zone( wxDC* DC ); void Fill_Zone( wxDC* DC ); @@ -686,12 +686,12 @@ public: bool include_fixe, wxDC* DC ); void FixeModule( MODULE* Module, bool Fixe ); void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ); - bool SetBoardBoundaryBoxFromEdgesOnly( void ); + bool SetBoardBoundaryBoxFromEdgesOnly(); void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); int RecherchePlacementModule( MODULE* Module, wxDC* DC ); void GenModuleOnBoard( MODULE* Module ); float Compute_Ratsnest_PlaceModule( wxDC* DC ); - int GenPlaceBoard( void ); + int GenPlaceBoard(); void DrawInfoPlace( wxDC* DC ); // Autoroutage: @@ -705,7 +705,7 @@ public: void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); void Ratsnest_On_Off( wxDC* DC ); void Clean_Pcb( wxDC* DC ); - EDA_BaseStruct* SaveItemEfface( EDA_BaseStruct* PtItem, int nbitems ); + BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ); // divers void InstallFindFrame( const wxPoint& pos, wxDC* DC ); @@ -746,26 +746,26 @@ public: WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_GerberFrame( void ); + ~WinEDA_GerberFrame(); - void Update_config( void ); + void Update_config(); void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar( void ); - void ReCreateVToolbar( void ); - void ReCreateOptToolbar( void ); - void ReCreateMenuBar( void ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - int BestZoom( void ); // Retourne le meilleur zoom + int BestZoom(); // Retourne le meilleur zoom void OnSelectOptionToolbar( wxCommandEvent& event ); - EDA_BaseStruct* GerberGeneralLocateAndDisplay( void ); + EDA_BaseStruct* GerberGeneralLocateAndDisplay(); EDA_BaseStruct* Locate( int typeloc ); - void SetToolbars( void ); + void SetToolbars(); void Process_Settings( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event ); void InstallConfigFrame( const wxPoint& pos ); @@ -798,7 +798,7 @@ public: const wxString& D_Code_FullFileName ); bool SaveGerberFile( const wxString& FileName, wxDC* DC ); int Read_D_Code_File( const wxString& D_Code_FullFileName ); - void CopyDCodesSizeToItems( void ); + void CopyDCodesSizeToItems(); void Liste_D_Codes( wxDC* DC ); /* Fonctions specifiques */ @@ -849,22 +849,22 @@ public: const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_ModuleEditFrame( void ); + ~WinEDA_ModuleEditFrame(); void InstallOptionsFrame( const wxPoint& pos ); void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar( void ); - void ReCreateVToolbar( void ); - void ReCreateOptToolbar( void ); - void ReCreateAuxiliaryToolbar( void ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateAuxiliaryToolbar(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - void SetToolbars( void ); - void ReCreateMenuBar( void ); + void SetToolbars(); + void ReCreateMenuBar(); void ToolOnRightClick( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); @@ -874,14 +874,14 @@ public: virtual void HandleBlockPlace( wxDC* DC ); virtual int HandleBlockEnd( wxDC* DC ); - EDA_BaseStruct* ModeditLocateAndDisplay( void ); + EDA_BaseStruct* ModeditLocateAndDisplay(); public: void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); private: - void GetComponentFromUndoList( void ); - void GetComponentFromRedoList( void ); + void GetComponentFromUndoList(); + void GetComponentFromRedoList(); public: @@ -908,7 +908,7 @@ public: // Gestion des librairies: void Delete_Module_In_Library( const wxString& libname ); int Create_Librairie( const wxString& LibName ); - void Select_Active_Library( void ); + void Select_Active_Library(); DECLARE_EVENT_TABLE() }; @@ -944,7 +944,7 @@ public: const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_SchematicFrame( void ); + ~WinEDA_SchematicFrame(); void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); @@ -953,13 +953,13 @@ public: void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - void ReCreateHToolbar( void ); - void ReCreateVToolbar( void ); - void ReCreateOptToolbar( void ); - void ReCreateMenuBar( void ); - void SetToolbars( void ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); + void SetToolbars(); - SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } + SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; } void InstallConfigFrame( const wxPoint& pos ); @@ -968,17 +968,17 @@ public: void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnSelectOptionToolbar( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event ); - int BestZoom( void ); // Retourne le meilleur zoom + int BestZoom(); // Retourne le meilleur zoom EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE ); EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ); /* netlist generation */ - void* BuildNetListBase( void ); + void* BuildNetListBase(); // FUnctions used for hierarchy handling - void InstallPreviousScreen( void ); + void InstallPreviousScreen(); void InstallNextScreen( DrawSheetStruct* Sheet ); void ToPlot_PS( wxCommandEvent& event ); @@ -1095,8 +1095,8 @@ public: private: void PutDataInPreviousState( DrawPickedStruct* List ); - void GetSchematicFromRedoList( void ); - void GetSchematicFromUndoList( void ); + void GetSchematicFromRedoList(); + void GetSchematicFromUndoList(); public: @@ -1135,32 +1135,32 @@ public: const wxString& title, const wxPoint& pos, const wxSize& size ); - ~WinEDA_LibeditFrame( void ); + ~WinEDA_LibeditFrame(); void Process_Special_Functions( wxCommandEvent& event ); - void DisplayLibInfos( void ); + void DisplayLibInfos(); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void OnCloseWindow( wxCloseEvent& Event ); - void ReCreateHToolbar( void ); - void ReCreateVToolbar( void ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - int BestZoom( void ); // Retourne le meilleur zoom - void SetToolbars( void ); + int BestZoom(); // Retourne le meilleur zoom + void SetToolbars(); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); - SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } + SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; } void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); private: // General: - void CreateNewLibraryPart( void ); - void DeleteOnePart( void ); - void SaveOnePartInMemory( void ); - void SelectActiveLibrary( void ); - bool LoadOneLibraryPart( void ); - void SaveActiveLibrary( void ); - void ImportOnePart( void ); + void CreateNewLibraryPart(); + void DeleteOnePart(); + void SaveOnePartInMemory(); + void SelectActiveLibrary(); + bool LoadOneLibraryPart(); + void SaveActiveLibrary(); + void ImportOnePart(); void ExportOnePart( bool create_lib ); int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry, LibraryStruct* Library, int noMsg = 0 ); @@ -1173,8 +1173,8 @@ public: void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); private: - void GetComponentFromUndoList( void ); - void GetComponentFromRedoList( void ); + void GetComponentFromUndoList(); + void GetComponentFromRedoList(); // Edition des Pins: void CreatePin( wxDC* DC ); @@ -1187,7 +1187,7 @@ private: bool TestPins( EDA_LibComponentStruct* LibEntry ); // Edition de l'ancre - void PlaceAncre( void ); + void PlaceAncre(); // Edition des graphismes: LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC ); @@ -1195,7 +1195,7 @@ private: void StartMoveDrawSymbol( wxDC* DC ); void EndDrawGraphicItem( wxDC* DC ); void LoadOneSymbol( wxDC* DC ); - void SaveOneSymbol( void ); + void SaveOneSymbol(); void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void RotateSymbolText( wxDC* DC ); @@ -1214,7 +1214,7 @@ public: void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry ); void PlacePin( wxDC* DC ); - void InitEditOnePin( void ); + void InitEditOnePin(); void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id ); // Repetition automatique de placement de pins @@ -1241,26 +1241,26 @@ public: LibraryStruct* Library = NULL, wxSemaphore* semaphore = NULL ); - ~WinEDA_ViewlibFrame( void ); + ~WinEDA_ViewlibFrame(); void OnSize( wxSizeEvent& event ); - void ReCreateListLib( void ); - void ReCreateListCmp( void ); + void ReCreateListLib(); + void ReCreateListCmp(); void Process_Special_Functions( wxCommandEvent& event ); - void DisplayLibInfos( void ); + void DisplayLibInfos(); void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void OnCloseWindow( wxCloseEvent& Event ); - void ReCreateHToolbar( void ); - void ReCreateVToolbar( void ); + void ReCreateHToolbar(); + void ReCreateVToolbar(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - int BestZoom( void ); // Retourne le meilleur zoom + int BestZoom(); // Retourne le meilleur zoom void ClickOnLibList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event ); - SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } + SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; } private: - void SelectCurrentLibrary( void ); + void SelectCurrentLibrary(); void SelectAndViewLibraryPart( int option ); void ExportToSchematicLibraryPart( wxCommandEvent& event ); void ViewOneLibraryContent( LibraryStruct* Lib, int Flag ); @@ -1291,10 +1291,10 @@ public: // Constructor and destructor WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); - ~WinEDA_MsgPanel( void ); + ~WinEDA_MsgPanel(); void OnPaint( wxPaintEvent& event ); - void EraseMsgBox( void ); + void EraseMsgBox(); void EraseMsgBox( wxDC* DC ); void Affiche_1_Parametre( int pos_X, const wxString& texte_H, const wxString& texte_L, int color ); @@ -1324,17 +1324,17 @@ public: const wxString& TextToEdit, wxBoxSizer* BoxSizer, const wxSize& Size ); - ~WinEDA_EnterText( void ) + ~WinEDA_EnterText() { } - wxString GetValue( void ); + wxString GetValue(); void GetValue( char* buffer, int lenmax ); void SetValue( const wxString& new_text ); void Enable( bool enbl ); - void SetFocus( void ) { m_FrameText->SetFocus(); } + void SetFocus() { m_FrameText->SetFocus(); } void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); } void SetSelection( int n, int m ) { @@ -1363,14 +1363,14 @@ public: int units, wxBoxSizer* BoxSizer, int framelen = 200, int internal_unit = EESCHEMA_INTERNAL_UNIT ); - ~WinEDA_GraphicTextCtrl( void ); + ~WinEDA_GraphicTextCtrl(); - wxString GetText( void ); - int GetTextSize( void ); + wxString GetText(); + int GetTextSize(); void Enable( bool state ); void SetTitle( const wxString& title ); - void SetFocus( void ) { m_FrameText->SetFocus(); } + void SetFocus() { m_FrameText->SetFocus(); } void SetValue( const wxString& value ); void SetValue( int value ); }; @@ -1398,11 +1398,11 @@ public: int units, wxBoxSizer* BoxSizer, int internal_unit = EESCHEMA_INTERNAL_UNIT ); - ~WinEDA_PositionCtrl( void ); + ~WinEDA_PositionCtrl(); void Enable( bool x_win_on, bool y_win_on ); void SetValue( int x_value, int y_value ); - wxPoint GetValue( void ); + wxPoint GetValue(); }; /*****************************************************************/ @@ -1418,8 +1418,8 @@ public: int units, wxBoxSizer* BoxSizer, int internal_unit = EESCHEMA_INTERNAL_UNIT ); - ~WinEDA_SizeCtrl( void ) { } - wxSize GetValue( void ); + ~WinEDA_SizeCtrl() { } + wxSize GetValue(); }; @@ -1448,9 +1448,9 @@ public: int units, wxBoxSizer* BoxSizer, int internal_unit = EESCHEMA_INTERNAL_UNIT ); - ~WinEDA_ValueCtrl( void ); + ~WinEDA_ValueCtrl(); - int GetValue( void ); + int GetValue(); void SetValue( int new_value ); void Enable( bool enbl ); @@ -1477,9 +1477,9 @@ public: WinEDA_DFloatValueCtrl( wxWindow* parent, const wxString& title, double value, wxBoxSizer* BoxSizer ); - ~WinEDA_DFloatValueCtrl( void ); + ~WinEDA_DFloatValueCtrl(); - double GetValue( void ); + double GetValue(); void SetValue( double new_value ); void Enable( bool enbl ); @@ -1506,7 +1506,7 @@ public: public: WinEDA_Toolbar( id_toolbar type, wxWindow* parent, wxWindowID id, bool horizontal ); - WinEDA_Toolbar* Next( void ) { return Pnext; } + WinEDA_Toolbar* Next() { return Pnext; } }; @@ -1532,13 +1532,13 @@ public: void (* movefct)(wxString& Text) = NULL, const wxColour& colour = wxNullColour, wxPoint dialog_position = wxDefaultPosition ); - ~WinEDAListBox( void ); + ~WinEDAListBox(); - void SortList( void ); + void SortList(); void Append( const wxString& item ); void InsertItems( const wxArrayString& itemlist, int position = 0 ); - void MoveMouseToOrigin( void ); - wxString GetTextSelection( void ); + void MoveMouseToOrigin(); + wxString GetTextSelection(); private: void OnClose( wxCloseEvent& event ); @@ -1586,7 +1586,7 @@ public: } - int GetChoice( void ) + int GetChoice() { return GetCurrentSelection(); } diff --git a/pcbnew/affiche.cpp b/pcbnew/affiche.cpp index 999eae9aa3..c57f2619d0 100644 --- a/pcbnew/affiche.cpp +++ b/pcbnew/affiche.cpp @@ -54,7 +54,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext ) { ii++; - if( Struct->m_StructType == TYPEVIA ) + if( Struct->Type() == TYPEVIA ) if( ( (SEGVIA*) Struct )->m_NetCode == netcode ) nb_vias++; } diff --git a/pcbnew/ar_protos.h b/pcbnew/ar_protos.h index 530c3766a4..271ea815d3 100644 --- a/pcbnew/ar_protos.h +++ b/pcbnew/ar_protos.h @@ -50,18 +50,18 @@ void TraceArc(int ux0,int uy0,int ux1,int uy1, int ArcAngle, int lg,int layer, /* QUEUE.CPP */ void FreeQueue(void); /* Libere la memoire de la queue de recherche */ -void InitQueue( void ); +void InitQueue(); void GetQueue( int *, int *, int *, int *, int * ); int SetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int ); /* WORK.CPP */ -void InitWork( void ); -void ReInitWork( void ); +void InitWork(); +void ReInitWork(); int SetWork( int, int, int , int, int, CHEVELU *, int ); void GetWork( int *, int *, int *, int *, int *, CHEVELU ** ); -void SortWork( void ); /* order the work items; shortest first */ +void SortWork(); /* order the work items; shortest first */ /* DIST.CPP */ int GetApxDist( int, int, int, int ); diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 186499890d..7c90bbecd4 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -41,7 +41,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) TRACK* Track; int nb_segm; - if( (track == NULL ) || (track->m_StructType == TYPEZONE) ) + if( (track == NULL ) || (track->Type() == TYPEZONE) ) return; DrawPanel->CursorOff( DC ); // Erase cursor shape diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index 1aad6a4b4a..883690e627 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -368,7 +368,7 @@ void WinEDA_PcbFrame::DrawInfoPlace( wxDC* DC ) /***************************************/ -int WinEDA_PcbFrame::GenPlaceBoard( void ) +int WinEDA_PcbFrame::GenPlaceBoard() /***************************************/ /* Routine de generation du board ( cote composant + cote cuivre ) : @@ -455,7 +455,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void ) { DRAWSEGMENT* DrawSegm; - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: DrawSegm = (DRAWSEGMENT*) PtStruct; @@ -1181,7 +1181,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) /*******************************************************/ -bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) +bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() /*******************************************************/ /* Determine le rectangle d'encadrement du pcb, selon les contours @@ -1207,7 +1207,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; succes = TRUE; ptr = (DRAWSEGMENT*) PtStruct; diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index 1f671f3998..dfe83101da 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -36,7 +36,7 @@ wxString msg; case ROUTE_NET: if ( GetScreen()->GetCurItem() ) { - switch ( GetScreen()->GetCurItem()->m_StructType ) + switch ( GetScreen()->GetCurItem()->Type() ) { case TYPEPAD: Pad = (D_PAD*) GetScreen()->GetCurItem(); @@ -55,7 +55,7 @@ wxString msg; case ROUTE_MODULE: Module = (MODULE*) GetScreen()->GetCurItem(); - if( (Module == NULL) || (Module->m_StructType != TYPEMODULE) ) + if( (Module == NULL) || (Module->Type() != TYPEMODULE) ) { DisplayError(this, _("Module not selected") ); return; } @@ -63,7 +63,7 @@ wxString msg; case ROUTE_PAD: Pad = (D_PAD*) GetScreen()->GetCurItem(); - if( (Pad == NULL) || (Pad->m_StructType != TYPEPAD) ) + if( (Pad == NULL) || (Pad->Type() != TYPEPAD) ) { DisplayError(this, _("Pad not selected") ); return; } diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 16bb1d19f7..02bb9fe87c 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -59,7 +59,7 @@ public: // Constructor and destructor WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent, const wxString& title ); - ~WinEDA_ExecBlockCmdFrame( void ) + ~WinEDA_ExecBlockCmdFrame() { } @@ -490,7 +490,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC ) { NextS = PtStruct->Next(); - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: #undef STRUCT @@ -678,7 +678,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: #undef STRUCT @@ -851,7 +851,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC ) track->Draw( DrawPanel, DC, GR_XOR ); // effacement INVERT( track->m_Start.y ); INVERT( track->m_End.y ); - if( track->m_StructType != TYPEVIA ) + if( track->Type() != TYPEVIA ) { track->SetLayer( ChangeSideNumLayer( track->GetLayer() ) ); } @@ -893,7 +893,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: #undef STRUCT @@ -1107,7 +1107,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: #undef STRUCT @@ -1311,7 +1311,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: { @@ -1427,7 +1427,7 @@ static EDA_BaseStruct* IsStructInBox( DrawBlockStruct& blocklocate, /* Teste si la structure PtStruct est inscrite dans le block selectionne */ { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: #undef STRUCT diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 9537cadf5c..bc6826ac67 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -317,7 +317,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPETEXTEMODULE: ( (TEXTE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode ); @@ -362,7 +362,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPETEXTEMODULE: ( (TEXTE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode ); @@ -424,7 +424,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) item->m_Selected = 0; NewStruct = NULL; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPETEXTEMODULE: NewStruct = new TEXTE_MODULE( module ); @@ -483,7 +483,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPETEXTEMODULE: ( (TEXTE_MODULE*) item )->m_Pos.x += offset.x; @@ -519,8 +519,10 @@ void DeleteMarkedItems( MODULE* module ) /* Delete marked items */ { - EDA_BaseStruct* item, * next_item; - D_PAD* pad, * next_pad; + BOARD_ITEM* item; + BOARD_ITEM* next_item; + D_PAD* pad; + D_PAD* next_pad; if( module == NULL ) return; @@ -577,7 +579,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPEEDGEMODULE: SETMIRROR( ( (EDGE_MODULE*) item )->m_Start.x ); @@ -631,7 +633,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) if( item->m_Selected == 0 ) continue; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPEEDGEMODULE: ROTATE( ( (EDGE_MODULE*) item )->m_Start ); @@ -707,7 +709,7 @@ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ) { item->m_Selected = 0; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPEEDGEMODULE: pos = ( (EDGE_MODULE*) item )->m_Start; diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 451a2398a7..7958667918 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -19,7 +19,7 @@ /* Routines definies ici: */ int Build_Work( BOARD* Pcb, CHEVELU* pt_base_chevelu ); void PlaceCells( BOARD* Pcb, int net_code, int flag ); -int InitBoard( void ); +int InitBoard(); BoardCell GetCell( int, int, int ); void SetCell( int row, int col, int side, BoardCell x ); void OrCell( int, int, int, BoardCell ); @@ -67,7 +67,7 @@ bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize ) /* class BOARDHEAD */ /*******************/ -BOARDHEAD::BOARDHEAD( void ) +BOARDHEAD::BOARDHEAD() { m_BoardSide[0] = m_BoardSide[1] = NULL; m_DistSide[0] = m_DistSide[1] = NULL; @@ -79,13 +79,13 @@ BOARDHEAD::BOARDHEAD( void ) } -BOARDHEAD::~BOARDHEAD( void ) +BOARDHEAD::~BOARDHEAD() { } /******************************/ -int BOARDHEAD::InitBoard( void ) +int BOARDHEAD::InitBoard() /*****************************/ /* initialize the data structures @@ -132,7 +132,7 @@ int BOARDHEAD::InitBoard( void ) /*********************************/ -void BOARDHEAD::UnInitBoard( void ) +void BOARDHEAD::UnInitBoard() /*********************************/ /* deallocation de la memoire */ { @@ -216,7 +216,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) BOARD_ITEM* PtModStruct = ( (MODULE*) PtStruct )->m_Drawings; for( ; PtModStruct != NULL; PtModStruct = PtModStruct->Next() ) { - switch( PtModStruct->m_StructType ) + switch( PtModStruct->Type() ) { case TYPEEDGEMODULE: { @@ -251,7 +251,7 @@ void PlaceCells( BOARD* Pcb, int net_code, int flag ) PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: { diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 2e2c0073b7..c02c2d4398 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -56,7 +56,7 @@ void BOARD::UnLink() /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType == TYPEPCB ) + if( Pback->Type() == TYPEPCB ) { Pback->Pnext = Pnext; } @@ -149,7 +149,7 @@ bool BOARD::ComputeBoundaryBox() PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; ptr = (DRAWSEGMENT*) PtStruct; @@ -280,7 +280,7 @@ void BOARD::Display_Infos( WinEDA_DrawFrame* frame ) for( ii = 0, Struct = m_Track; Struct != NULL; Struct = Struct->Pnext ) { ii++; - if( Struct->m_StructType == TYPEVIA ) + if( Struct->Type() == TYPEVIA ) nb_vias++; } @@ -459,7 +459,7 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) BOARD_ITEM* item = (BOARD_ITEM*) testItem; const wxPoint& refPos = *(const wxPoint*) testData; - if( item->m_StructType == TYPEPAD ) + if( item->Type() == TYPEPAD ) { D_PAD* pad = (D_PAD*) item; if( pad->HitTest( refPos ) ) @@ -478,7 +478,7 @@ EDA_BaseStruct* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) } } - else if( item->m_StructType == TYPEMODULE ) + else if( item->Type() == TYPEMODULE ) { MODULE* module = (MODULE*) item; diff --git a/pcbnew/class_cotation.cpp b/pcbnew/class_cotation.cpp index 4ed652acc0..46ddaad33d 100644 --- a/pcbnew/class_cotation.cpp +++ b/pcbnew/class_cotation.cpp @@ -33,12 +33,12 @@ COTATION::~COTATION() /* supprime du chainage la structure Struct * les structures arrieres et avant sont chainees directement */ -void COTATION::UnLink( void ) +void COTATION::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } diff --git a/pcbnew/class_cotation.h b/pcbnew/class_cotation.h index 319f29690f..22a637b848 100644 --- a/pcbnew/class_cotation.h +++ b/pcbnew/class_cotation.h @@ -32,7 +32,7 @@ public: bool WriteCotationDescr( FILE* File ); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); /* Modification du texte de la cotation */ void SetText( const wxString& NewText ); diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index e8b5510c1e..465638b840 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -80,13 +80,13 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure /********************************/ -void EDGE_MODULE::UnLink( void ) +void EDGE_MODULE::UnLink() /********************************/ { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEMODULE ) + if( Pback->Type() != TYPEMODULE ) { Pback->Pnext = Pnext; } @@ -105,7 +105,7 @@ void EDGE_MODULE::UnLink( void ) /***********************************/ -void EDGE_MODULE::SetDrawCoord( void ) +void EDGE_MODULE::SetDrawCoord() /***********************************/ { MODULE* Module = (MODULE*) m_Parent; @@ -147,7 +147,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, WinEDA_BasePcbFrame* frame; MODULE* Module = NULL; - if( m_Parent && (m_Parent->m_StructType == TYPEMODULE) ) + if( m_Parent && (m_Parent->Type() == TYPEMODULE) ) Module = (MODULE*) m_Parent; color = g_DesignSettings.m_LayerColor[m_Layer]; diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index 4ddecfad26..f948926312 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -30,7 +30,7 @@ public: ~EDGE_MODULE(); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); void Copy( EDGE_MODULE* source ); // copy structure @@ -39,7 +39,7 @@ public: int ReadDescr( char* Line, FILE* File, int* LineNum = NULL ); // Mise a jour des coordon�s pour l'affichage - void SetDrawCoord( void ); + void SetDrawCoord(); /* drawing functions */ void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, diff --git a/pcbnew/class_equipot.cpp b/pcbnew/class_equipot.cpp index 4733c2c01d..583d41fda0 100644 --- a/pcbnew/class_equipot.cpp +++ b/pcbnew/class_equipot.cpp @@ -44,12 +44,12 @@ EQUIPOT::~EQUIPOT() } -void EQUIPOT::UnLink( void ) +void EQUIPOT::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } diff --git a/pcbnew/class_equipot.h b/pcbnew/class_equipot.h index dd9b054a75..a42c703cb9 100644 --- a/pcbnew/class_equipot.h +++ b/pcbnew/class_equipot.h @@ -26,7 +26,7 @@ public: ~EQUIPOT(); /* Effacement memoire de la structure */ - void UnLink( void ); + void UnLink(); /* Readind and writing data on files */ int ReadEquipotDescr( FILE* File, int* LineNum ); diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 588cbdb75d..390b2304e8 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -23,7 +23,7 @@ MIREPCB::~MIREPCB() /***************************/ -void MIREPCB::UnLink( void ) +void MIREPCB::UnLink() /***************************/ /* supprime du chainage la structure Struct @@ -33,7 +33,7 @@ void MIREPCB::UnLink( void ) /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index fa193b6214..cfc7daf600 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -23,7 +23,7 @@ public: bool ReadMirePcbDescr( FILE* File, int* LineNum ); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); void Copy( MIREPCB* source ); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index b13d670fc6..72077ed8bc 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -82,7 +82,7 @@ MODULE::MODULE( BOARD* parent ) : /* Destructeur */ -MODULE::~MODULE( void ) +MODULE::~MODULE() { D_PAD* Pad; EDA_BaseStruct* Struct, * NextStruct; @@ -107,7 +107,7 @@ MODULE::~MODULE( void ) { NextStruct = Struct->Pnext; - switch( (Struct->m_StructType) ) + switch( (Struct->Type()) ) { case TYPEEDGEMODULE: delete (EDGE_MODULE*) Struct; @@ -175,7 +175,7 @@ void MODULE::Copy( MODULE* Module ) { NewStruct = NULL; - switch( OldStruct->m_StructType ) + switch( OldStruct->Type() ) { case TYPETEXTEMODULE: NewStruct = new TEXTE_MODULE( this ); @@ -232,12 +232,12 @@ void MODULE::Copy( MODULE* Module ) /* supprime du chainage la structure Struct * les structures arrieres et avant sont chainees directement */ -void MODULE::UnLink( void ) +void MODULE::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } @@ -246,7 +246,7 @@ void MODULE::UnLink( void ) if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete { if( g_UnDeleteStack ) - g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Pnext; + g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Next(); } else ( (BOARD*) Pback )->m_Modules = (MODULE*) Pnext; @@ -303,7 +303,7 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( PtStruct->m_Flags & IS_MOVED ) continue; - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTEMODULE: PtTexte = (TEXTE_MODULE*) PtStruct; @@ -332,7 +332,7 @@ void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: ( (EDGE_MODULE*) PtStruct )->Draw( panel, DC, offset, draw_mode ); @@ -443,7 +443,7 @@ int MODULE::WriteDescr( FILE* File ) PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTEMODULE: PtText = ( (TEXTE_MODULE*) PtStruct ); @@ -465,7 +465,7 @@ int MODULE::WriteDescr( FILE* File ) default: msg.Printf( wxT( "Type (%d) Draw Module inconnu" ), - PtStruct->m_StructType ); + PtStruct->Type() ); DisplayError( NULL, msg ); break; } @@ -841,7 +841,7 @@ void MODULE::SetPosition( const wxPoint& newpos ) EDA_BaseStruct* PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: { @@ -904,12 +904,12 @@ void MODULE::SetOrientation( int newangle ) EDA_BaseStruct* PtStruct = m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType == TYPEEDGEMODULE ) + if( PtStruct->Type() == TYPEEDGEMODULE ) { EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) PtStruct; pt_edgmod->SetDrawCoord(); } - if( PtStruct->m_StructType == TYPETEXTEMODULE ) + if( PtStruct->Type() == TYPETEXTEMODULE ) { /* deplacement des inscriptions : */ TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct; @@ -923,7 +923,7 @@ void MODULE::SetOrientation( int newangle ) /************************************************/ -void MODULE::Set_Rectangle_Encadrement( void ) +void MODULE::Set_Rectangle_Encadrement() /************************************************/ /* Mise a jour du rectangle d'encadrement du module @@ -952,7 +952,7 @@ void MODULE::Set_Rectangle_Encadrement( void ) /* Contours: Recherche des coord min et max et mise a jour du cadre */ for( ; pt_edge_mod != NULL; pt_edge_mod = (EDGE_MODULE*) pt_edge_mod->Pnext ) { - if( pt_edge_mod->m_StructType != TYPEEDGEMODULE ) + if( pt_edge_mod->Type() != TYPEEDGEMODULE ) continue; width = pt_edge_mod->m_Width / 2; @@ -1002,7 +1002,7 @@ void MODULE::Set_Rectangle_Encadrement( void ) /****************************************/ -void MODULE::SetRectangleExinscrit( void ) +void MODULE::SetRectangleExinscrit() /****************************************/ /* Analogue a MODULE::Set_Rectangle_Encadrement() mais en coord reelles: @@ -1026,7 +1026,7 @@ void MODULE::SetRectangleExinscrit( void ) EdgeMod = (EDGE_MODULE*) m_Drawings; for( ; EdgeMod != NULL; EdgeMod = (EDGE_MODULE*) EdgeMod->Pnext ) { - if( EdgeMod->m_StructType != TYPEEDGEMODULE ) + if( EdgeMod->Type() != TYPEEDGEMODULE ) continue; width = EdgeMod->m_Width / 2; diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 56364dee55..1d8e3c6e8a 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -70,16 +70,16 @@ public: public: MODULE( BOARD* parent ); MODULE( MODULE* module ); - ~MODULE( void ); + ~MODULE(); void Copy( MODULE* Module ); // Copy structure MODULE* Next() { return (MODULE*) Pnext; } - void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement + void Set_Rectangle_Encadrement();/* mise a jour du rect d'encadrement * en coord locales (orient 0 et origine = pos module) */ - void SetRectangleExinscrit( void );/* mise a jour du rect d'encadrement + void SetRectangleExinscrit();/* mise a jour du rect d'encadrement * et de la surface en coord reelles */ // deplacements @@ -87,7 +87,7 @@ public: void SetOrientation( int newangle ); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); /** diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index d9b70d76b8..9e334ce96c 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -35,7 +35,7 @@ D_PAD::D_PAD( MODULE* parent ) : m_Size.x = m_Size.y = 500; - if( m_Parent && (m_Parent->m_StructType == TYPEMODULE) ) + if( m_Parent && (m_Parent->Type() == TYPEMODULE) ) { m_Pos = ( (MODULE*) m_Parent )->m_Pos; } @@ -50,13 +50,13 @@ D_PAD::D_PAD( MODULE* parent ) : } -D_PAD::~D_PAD( void ) +D_PAD::~D_PAD() { } /****************************/ -void D_PAD::ComputeRayon( void ) +void D_PAD::ComputeRayon() /****************************/ /* met a jour m_Rayon, rayon du cercle exinscrit @@ -82,7 +82,7 @@ void D_PAD::ComputeRayon( void ) /*********************************************/ -const wxPoint D_PAD::ReturnShapePos( void ) +const wxPoint D_PAD::ReturnShapePos() /*********************************************/ // retourne la position de la forme (pastilles excentrees) @@ -106,7 +106,7 @@ const wxPoint D_PAD::ReturnShapePos( void ) /****************************************/ -wxString D_PAD::ReturnStringPadName( void ) +wxString D_PAD::ReturnStringPadName() /****************************************/ /* Return pad name as string in a wxString @@ -188,7 +188,7 @@ void D_PAD::Copy( D_PAD* source ) /**************************/ -void D_PAD::UnLink( void ) +void D_PAD::UnLink() /**************************/ /* supprime du chainage la structure Struct @@ -198,7 +198,7 @@ void D_PAD::UnLink( void ) /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEMODULE ) + if( Pback->Type() != TYPEMODULE ) { Pback->Pnext = Pnext; } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 506b990300..fc27c9b2e2 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -64,14 +64,14 @@ public: public: D_PAD( MODULE* parent ); D_PAD( D_PAD* pad ); - ~D_PAD( void ); + ~D_PAD(); void Copy( D_PAD* source ); - D_PAD* Next( void ) { return (D_PAD*) Pnext; } + D_PAD* Next() { return (D_PAD*) Pnext; } /* remove from linked list */ - void UnLink( void ); + void UnLink(); /* Reading and writing data on files */ int ReadDescr( FILE* File, int* LineNum = NULL ); @@ -83,10 +83,10 @@ public: // others void SetPadName( const wxString& name ); // Change pad name - wxString ReturnStringPadName( void ); // Return pad name as string in a wxString + wxString ReturnStringPadName(); // Return pad name as string in a wxString void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer - void ComputeRayon( void ); // compute m_Rayon, rayon du cercle exinscrit - const wxPoint ReturnShapePos( void ); // retourne la position + void ComputeRayon(); // compute m_Rayon, rayon du cercle exinscrit + const wxPoint ReturnShapePos(); // retourne la position /** * Function Display_Infos diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 63f746a553..1c86e2a02d 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -48,12 +48,12 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) } -void TEXTE_PCB::UnLink( void ) +void TEXTE_PCB::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } @@ -159,7 +159,7 @@ void TEXTE_PCB::Display_Infos( WinEDA_DrawFrame* frame ) frame->MsgPanel->EraseMsgBox(); - if( m_Parent && m_Parent->m_StructType == TYPECOTATION ) + if( m_Parent && m_Parent->Type() == TYPECOTATION ) Affiche_1_Parametre( frame, 1, _( "COTATION" ), m_Text, DARKGREEN ); else Affiche_1_Parametre( frame, 1, _( "PCB Text" ), m_Text, DARKGREEN ); diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 7243a55f96..94088b5433 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -14,7 +14,7 @@ public: ~TEXTE_PCB(); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); /* duplicate structure */ void Copy( TEXTE_PCB* source ); diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index b42e31f2c3..38e8b4f0fb 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -43,7 +43,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : m_Unused = 0; SetLayer( SILKSCREEN_N_CMP ); - if( Module && (Module->m_StructType == TYPEMODULE) ) + if( Module && (Module->Type() == TYPEMODULE) ) { m_Pos = Module->m_Pos; @@ -66,7 +66,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : } -TEXTE_MODULE::~TEXTE_MODULE( void ) +TEXTE_MODULE::~TEXTE_MODULE() { } @@ -95,12 +95,12 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure /* supprime du chainage la structure Struct * les structures arrieres et avant sont chainees directement */ -void TEXTE_MODULE::UnLink( void ) +void TEXTE_MODULE::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEMODULE ) + if( Pback->Type() != TYPEMODULE ) { Pback->Pnext = Pnext; } @@ -119,7 +119,7 @@ void TEXTE_MODULE::UnLink( void ) /******************************************/ -int TEXTE_MODULE:: GetLength( void ) +int TEXTE_MODULE:: GetLength() /******************************************/ { return m_Text.Len(); @@ -135,7 +135,7 @@ void TEXTE_MODULE:: SetWidth( int new_width ) // mise a jour des coordonn�s absolues pour affichage -void TEXTE_MODULE:: SetDrawCoord( void ) +void TEXTE_MODULE:: SetDrawCoord() { MODULE* Module = (MODULE*) m_Parent; @@ -154,7 +154,7 @@ void TEXTE_MODULE:: SetDrawCoord( void ) // mise a jour des coordonn�s relatives au module -void TEXTE_MODULE:: SetLocalCoord( void ) +void TEXTE_MODULE:: SetLocalCoord() { MODULE* Module = (MODULE*) m_Parent; @@ -235,6 +235,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int orient = GetDrawRotation(); miroir = m_Miroir & 1; // = 0 si vu en miroir width = m_Width; + if( (frame->m_DisplayModText == FILAIRE) || ( (width / zoom) < L_MIN_DESSIN ) ) width = 0; else if( frame->m_DisplayModText == SKETCH ) @@ -267,6 +268,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int if( m_NoShow ) color = g_ModuleTextNOVColor; + if( (color & ITEM_NOT_SHOW) != 0 ) return; @@ -281,7 +283,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int /******************************************/ -int TEXTE_MODULE::GetDrawRotation( void ) +int TEXTE_MODULE::GetDrawRotation() /******************************************/ /* Return text rotation for drawings and plotting diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 529cdf8374..867868470f 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -29,23 +29,23 @@ public: public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); - ~TEXTE_MODULE( void ); + ~TEXTE_MODULE(); /* supprime du chainage la structure Struct */ - void UnLink( void ); + void UnLink(); void Copy( TEXTE_MODULE* source ); // copy structure /* Gestion du texte */ void SetWidth( int new_width ); - int GetLength( void ); /* text length */ - int Pitch( void ); /* retourne le pas entre 2 caracteres */ - int GetDrawRotation( void ); // Return text rotation for drawings and plotting + int GetLength(); /* text length */ + int Pitch(); /* retourne le pas entre 2 caracteres */ + int GetDrawRotation(); // Return text rotation for drawings and plotting - void SetDrawCoord( void ); // mise a jour des coordonn�s absolues de trac� + void SetDrawCoord(); // mise a jour des coordonn�s absolues de trac� // a partir des coord relatives - void SetLocalCoord( void ); // mise a jour des coordonn�s relatives + void SetLocalCoord(); // mise a jour des coordonn�s relatives // a partir des coord absolues de trac� /* Reading and writing data on files */ diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 7a13d20128..83b909d970 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -48,14 +48,10 @@ SEGVIA::SEGVIA( BOARD_ITEM* StructFather ) : } - -/* Copy constructor */ +// Copy constructor TRACK::TRACK( const TRACK& Source ) : - BOARD_ITEM( (const BOARD_ITEM&) Source ) + BOARD_ITEM( Source ) { -// m_StructType = Source.m_StructType; -// m_Layer = Source.m_Layer; - m_Shape = Source.m_Shape; m_NetCode = Source.m_NetCode; m_Flags = Source.m_Flags; @@ -70,13 +66,34 @@ TRACK::TRACK( const TRACK& Source ) : } +/* Because of the way SEGVIA is derived from TRACK and because there are + virtual functions being used, we can no longer simply copy a TRACK and + expect it to be a via. We must construct a true SEGVIA so its constructor + can initialize the virtual function table properly. So this constructor + is being retired in favor of a factory type function called Copy() + which can duplicate either a TRACK or a SEGVIA. +*/ + +TRACK* TRACK::Copy() const +{ + if( Type() == TYPETRACK ) + return new TRACK(*this); + + if( Type() == TYPEVIA ) + return new SEGVIA( (const SEGVIA&) *this ); + + return NULL; // should never happen +} + + + /***********************/ bool TRACK::IsNull() /***********************/ // return TRUE if segment length = 0 { - if( ( m_StructType != TYPEVIA ) && ( m_Start == m_End ) ) + if( ( Type() != TYPEVIA ) && ( m_Start == m_End ) ) return TRUE; else return FALSE; @@ -147,7 +164,7 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData, #endif // If caller wants to inspect my type - if( stype == m_StructType ) + if( stype == Type() ) { if( SEARCH_QUIT == inspector->Inspect( this, testData ) ) return SEARCH_QUIT; @@ -192,7 +209,7 @@ int TRACK::ReturnMaskLayer() * Si PtSegm pointe une via, il y a plusieurs couches occupees */ { - if( m_StructType == TYPEVIA ) + if( Type() == TYPEVIA ) { int via_type = m_Shape & 15; if( via_type == VIA_NORMALE ) @@ -265,7 +282,7 @@ void TRACK::UnLink() /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } @@ -274,11 +291,11 @@ void TRACK::UnLink() if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete { if( g_UnDeleteStack ) - g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Pnext; + g_UnDeleteStack[g_UnDeleteStackPtr - 1] = (BOARD_ITEM*)Pnext; } else { - if( m_StructType == TYPEZONE ) + if( Type() == TYPEZONE ) { ( (BOARD*) Pback )->m_Zone = (TRACK*) Pnext; } @@ -299,29 +316,27 @@ void TRACK::UnLink() /************************************************************/ -void TRACK::Insert( BOARD* Pcb, EDA_BaseStruct* InsertPoint ) +void TRACK::Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint ) /************************************************************/ - -/* Ajoute un element ou une liste a une liste de base - * Si Insertpoint == NULL: insertion en debut de - * liste Pcb->Track ou Pcb->Zone - * Insertion a la suite de InsertPoint - * Si InsertPoint == NULL, insertion en tete de liste - */ { - TRACK* track, * NextS; + TRACK* track; + TRACK* NextS; /* Insertion du debut de la chaine a greffer */ if( InsertPoint == NULL ) { Pback = Pcb; - if( m_StructType == TYPEZONE ) + + if( Type() == TYPEZONE ) // put SEGZONE on front of m_Zone list { - NextS = Pcb->m_Zone; Pcb->m_Zone = this; + NextS = Pcb->m_Zone; + Pcb->m_Zone = this; } - else + + else // put TRACK or SEGVIA on front of m_Track list { - NextS = Pcb->m_Track; Pcb->m_Track = this; + NextS = Pcb->m_Track; + Pcb->m_Track = this; } } else @@ -356,7 +371,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb ) { TRACK* track, * NextTrack; - if( m_StructType == TYPEZONE ) + if( Type() == TYPEZONE ) track = Pcb->m_Zone; else track = Pcb->m_Track; @@ -462,8 +477,11 @@ TRACK* TRACK:: Copy( int NbSegm ) Source = Source->Next(); if( Source == NULL ) break; + OldTrack = NewTrack; - NewTrack = new TRACK( *Source ); + + NewTrack = Source->Copy(); + NewTrack->Insert( NULL, OldTrack ); } @@ -477,7 +495,7 @@ bool TRACK::WriteTrackDescr( FILE* File ) { int type = 0; - if( m_StructType == TYPEVIA ) + if( Type() == TYPEVIA ) type = 1; if( GetState( DELETED ) ) @@ -509,12 +527,12 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) int rayon; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - if( m_StructType == TYPEZONE && (!DisplayOpt.DisplayZones) ) + if( Type() == TYPEZONE && (!DisplayOpt.DisplayZones) ) return; GRSetDrawMode( DC, draw_mode ); - if( m_StructType == TYPEVIA ) /* VIA rencontree */ + if( Type() == TYPEVIA ) /* VIA rencontree */ color = g_DesignSettings.m_ViaColor[m_Shape]; else color = g_DesignSettings.m_LayerColor[m_Layer]; @@ -545,7 +563,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) l_piste = m_Width >> 1; - if( m_StructType == TYPEVIA ) /* VIA rencontree */ + if( Type() == TYPEVIA ) /* VIA rencontree */ { rayon = l_piste; if( rayon < zoom ) rayon = zoom; @@ -629,7 +647,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) /* Trace de l'isolation (pour segments type CUIVRE et TRACK uniquement */ if( (DisplayOpt.DisplayTrackIsol) && (m_Layer <= CMP_N ) - && ( m_StructType == TYPETRACK) ) + && ( Type() == TYPETRACK) ) { GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, m_End.x, m_End.y, @@ -646,7 +664,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) frame->MsgPanel->EraseMsgBox(); - switch( m_StructType ) + switch( Type() ) { case TYPEVIA: msg = g_ViaType_Name[m_Shape & 255]; @@ -668,9 +686,9 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) /* Affiche NetName pour les segments de piste type cuivre */ text_pos += 15; - if( m_StructType == TYPETRACK - || m_StructType == TYPEZONE - || m_StructType == TYPEVIA ) + if( Type() == TYPETRACK + || Type() == TYPEZONE + || Type() == TYPEVIA ) { EQUIPOT* equipot = ((WinEDA_PcbFrame*)frame)->m_Pcb->FindNet( m_NetCode ); if( equipot ) @@ -707,7 +725,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) Affiche_1_Parametre( frame, text_pos, _( "Stat" ), msg, MAGENTA ); /* Affiche Layer(s) */ - if( m_StructType == TYPEVIA ) + if( Type() == TYPEVIA ) { SEGVIA* Via = (SEGVIA*) this; int top_layer, bottom_layer; @@ -726,7 +744,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) valeur_param( (unsigned) m_Width, msg ); text_pos += 11; - if( m_StructType == TYPEVIA ) // Display Diam and Drill values + if( Type() == TYPEVIA ) // Display Diam and Drill values { Affiche_1_Parametre( frame, text_pos, _( "Diam" ), msg, DARKCYAN ); @@ -775,7 +793,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos ) spot_cX = ref_pos.x - ux0; spot_cY = ref_pos.y - uy0; - if( m_StructType == TYPEVIA ) /* VIA rencontree */ + if( Type() == TYPEVIA ) /* VIA rencontree */ { if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) ) return true; diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 9777760ba4..0aca7d0ffc 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -39,13 +39,22 @@ public: // chain = 0 indique une connexion non encore traitee int m_Param; // Auxiliary variable ( used in some computations ) + public: TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK ); - TRACK( const TRACK& track ); + TRACK( const TRACK& track ); - TRACK* Next() { return (TRACK*) Pnext; } + /** + * Function Copy + * will copy this object whether it is a TRACK or a SEGVIA returning + * the corresponding type. + * @return - TRACK* or SEGVIA*, typed as the least common demoninator: TRACK + */ + TRACK* Copy() const; - TRACK* Back() { return (TRACK*) Pback; } + TRACK* Next() const { return (TRACK*) Pnext; } + + TRACK* Back() const { return (TRACK*) Pback; } /* supprime du chainage la structure Struct */ @@ -54,8 +63,16 @@ public: // Read/write data bool WriteTrackDescr( FILE* File ); - /* Ajoute un element a la liste */ - void Insert( BOARD* Pcb, EDA_BaseStruct* InsertPoint ); + /** + * Function Insert + * inserts a TRACK, SEGVIA or SEGZONE into its proper list, either at the + * list's front or immediately after the InsertPoint. + * If Insertpoint == NULL, then insert at the beginning of the proper list. + * If InsertPoint != NULL, then insert immediately after InsertPoint. + * TRACKs and SEGVIAs are put on the m_Track list, SEGZONE on the m_Zone list. + * @param InsertPoint See above + */ + void Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint ); /* Recherche du meilleur point d'insertion */ TRACK* GetBestInsertPoint( BOARD* Pcb ); @@ -140,6 +157,7 @@ public: }; + class SEGZONE : public TRACK { public: @@ -159,10 +177,17 @@ public: }; + class SEGVIA : public TRACK { public: SEGVIA( BOARD_ITEM* StructFather ); + + SEGVIA( const SEGVIA& source ) : + TRACK( source ) + { + } + /** * Function IsOnLayer diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index 9f64597f40..4e72c51811 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -42,7 +42,7 @@ EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) : /* Effacement memoire de la structure */ -EDGE_ZONE:: ~EDGE_ZONE( void ) +EDGE_ZONE:: ~EDGE_ZONE() { } @@ -60,17 +60,17 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype ) : /* Effacement memoire de la structure */ -DRAWSEGMENT:: ~DRAWSEGMENT( void ) +DRAWSEGMENT:: ~DRAWSEGMENT() { } -void DRAWSEGMENT::UnLink( void ) +void DRAWSEGMENT::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } @@ -272,7 +272,7 @@ MARQUEUR::MARQUEUR( BOARD_ITEM* StructFather ) : /* Effacement memoire de la structure */ -MARQUEUR:: ~MARQUEUR( void ) +MARQUEUR:: ~MARQUEUR() { } @@ -280,12 +280,12 @@ MARQUEUR:: ~MARQUEUR( void ) /* supprime du chainage la structure Struct * les structures arrieres et avant sont chainees directement */ -void MARQUEUR::UnLink( void ) +void MARQUEUR::UnLink() { /* Modification du chainage arriere */ if( Pback ) { - if( Pback->m_StructType != TYPEPCB ) + if( Pback->Type() != TYPEPCB ) { Pback->Pnext = Pnext; } @@ -319,14 +319,14 @@ PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPESCREEN ) /***************************/ -PCB_SCREEN::~PCB_SCREEN( void ) +PCB_SCREEN::~PCB_SCREEN() /***************************/ { } /*************************/ -void PCB_SCREEN::Init( void ) +void PCB_SCREEN::Init() /*************************/ { InitDatas(); @@ -346,7 +346,7 @@ void PCB_SCREEN::Init( void ) * Options diverses d'affichage �l'�ran: */ -DISPLAY_OPTIONS::DISPLAY_OPTIONS( void ) +DISPLAY_OPTIONS::DISPLAY_OPTIONS() { DisplayPadFill = TRUE; DisplayPadNum = TRUE; @@ -370,7 +370,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS( void ) /*****************************************************/ -EDA_BoardDesignSettings::EDA_BoardDesignSettings( void ) +EDA_BoardDesignSettings::EDA_BoardDesignSettings() /*****************************************************/ // Default values for designing boards diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index d815aa29b7..c12ffc9ac0 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -169,7 +169,7 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) { frame->m_Pcb->m_NbSegmTrack++; NextS = PtSegm->Pnext; - if( PtSegm->m_StructType == TYPEVIA ) + if( PtSegm->Type() == TYPEVIA ) { if( (PtSegm->m_Start.x != PtSegm->m_End.x ) || (PtSegm->m_Start.y != PtSegm->m_End.y ) ) @@ -245,7 +245,7 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) else /* Segment ou via connectee a cette extremite */ { PtSegm->start = pt_other; - if( pt_other->m_StructType == TYPEVIA ) /* recherche d'un autre segment */ + if( pt_other->Type() == TYPEVIA ) /* recherche d'un autre segment */ { PtSegm->SetState( BUSY, ON ); pt_via = pt_other; @@ -267,7 +267,7 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) else /* Segment ou via connectee a cette extremite */ { PtSegm->end = pt_other; - if( pt_other->m_StructType == TYPEVIA ) /* recherche d'un autre segment */ + if( pt_other->Type() == TYPEVIA ) /* recherche d'un autre segment */ { PtSegm->SetState( BUSY, ON ); pt_via = pt_other; @@ -377,7 +377,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) int erase = 0; NextS = pt_aux->Pnext; - if( PtSegm->m_StructType != pt_aux->m_StructType ) + if( PtSegm->Type() != pt_aux->Type() ) continue; if( PtSegm->GetLayer() != pt_aux->GetLayer() ) continue; @@ -443,7 +443,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) return -1; } - if( PtSegm->m_StructType != TYPETRACK ) + if( PtSegm->Type() != TYPETRACK ) continue; flag = no_inc = 0; @@ -460,7 +460,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) break; /* Ce ne peut etre une via */ - if( pt_segm_s->m_StructType != TYPETRACK ) + if( pt_segm_s->Type() != TYPETRACK ) break; /* On ne peut avoir que 1 seul segment connecte */ @@ -497,7 +497,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) if( PtSegm->m_Width != pt_segm_e->m_Width ) break; /* Ce ne peut etre une via */ - if( pt_segm_e->m_StructType != TYPETRACK ) + if( pt_segm_e->Type() != TYPETRACK ) break; /* On ne peut avoir que 1 seul segment connecte */ @@ -675,7 +675,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) /* Calcul du net_code des elements raccordes sur le point de debut */ net_code_s = -1; if( (PtSegm->start != NULL) - && ( ( (EDA_BaseStruct*) (PtSegm->start) )->m_StructType == TYPEPAD ) ) + && ( ( (EDA_BaseStruct*) (PtSegm->start) )->Type() == TYPEPAD ) ) net_code_s = ( (D_PAD*) (PtSegm->start) )->m_NetCode; else @@ -691,7 +691,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) /* Calcul du net_code des elements raccordes sur le point de fin */ net_code_e = -1; if( (PtSegm->end != NULL) - && ( ( (EDA_BaseStruct*) (PtSegm->end) )->m_StructType == TYPEPAD ) ) + && ( ( (EDA_BaseStruct*) (PtSegm->end) )->Type() == TYPEPAD ) ) net_code_e = ( (D_PAD*) (PtSegm->end) )->m_NetCode; else @@ -795,7 +795,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) break; if( pt_aux == PtSegm ) continue; - if( pt_aux->m_StructType == TYPEVIA ) + if( pt_aux->Type() == TYPEVIA ) continue; if( PtSegm->m_Start == pt_aux->m_Start ) continue; @@ -829,7 +829,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) break; if( pt_aux == PtSegm ) continue; - if( pt_aux->m_StructType == TYPEVIA ) + if( pt_aux->Type() == TYPEVIA ) continue; if( (PtSegm->m_End.x == pt_aux->m_Start.x) && (PtSegm->m_End.y == pt_aux->m_Start.y) ) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 936f3dcd8e..65ddbe6358 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -65,7 +65,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* #if 1 // debugging static int breakhere = 0; - switch( item->m_StructType ) + switch( item->Type() ) { case TYPEPAD: breakhere++; @@ -88,7 +88,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* case TYPETEXTEMODULE: TEXTE_MODULE* tm; tm = (TEXTE_MODULE*) item; - if( tm->m_Text == wxT("U5") ) + if( tm->m_Text == wxT("10uH") ) { breakhere++; } diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 8eddfacded..001002d65c 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -103,7 +103,6 @@ public: */ virtual bool IgnoreLockedItems() const = 0; - /** * Function IncludeSecondary * determines if the secondary criteria, or 2nd choice items should be @@ -111,7 +110,42 @@ public: * @return bool - true if should include, else false. */ virtual bool IncludeSecondary() const = 0; + + /** + * Function IgnoreMTextsMarkedNoShow + * @return bool -true if MTexts marked as "no show" should be ignored. + */ + virtual bool IgnoreMTextsMarkedNoShow() const = 0; + /** + * Function IgnoreZones + * @return bool - true if should ignore zones. + virtual bool IgnoreZones() const = 0; + can simply omit from scanTypes[] TYPEZONE */ + + /** + * Function IgnoreMTextsOnCu + * @return bool - true if should ignore MTexts on copper layer. + */ + virtual bool IgnoreMTextsOnCopper() const = 0; + + /** + * Function IgnoreMTextsOnCmp + * @return bool - true if should ignore MTexts on component layer. + */ + virtual bool IgnoreMTextsOnCmp() const = 0; + + /** + * Function IgnoreModulesOnCu + * @return bool - true if should ignore MODULEs on copper layer. + */ + virtual bool IgnoreModulesOnCu() const = 0; + + /** + * Function IgnoreModulesOnCmp + * @return bool - ture if should ignore MODULEs on component layer. + */ + virtual bool IgnoreModulesOnCmp() const = 0; /** * Function UseHitTesting @@ -119,7 +153,6 @@ public: * or false if Inspect() should use BOARD_ITEM::BoundsTest(). virtual bool UseHitTesting() const = 0; */ - }; @@ -278,6 +311,12 @@ private: bool m_IgnoreLockedItems; bool m_IncludeSecondary; + bool m_IgnoreMTextsMarkedNoShow; + bool m_IgnoreMTextsOnCopper; + bool m_IgnoreMTextsOnCmp; + bool m_IgnoreModulesOnCu; + bool m_IgnoreModulesOnCmp; + public: /** @@ -301,7 +340,14 @@ public: #else m_IncludeSecondary = true; #endif + +// m_IgnoreMTextsMarkedNoShow = g_ModuleTextNOVColor; + m_IgnoreMTextsOnCopper; + m_IgnoreMTextsOnCmp; + m_IgnoreModulesOnCu; +// m_IgnoreModulesOnCmp = !settings->Show_Modules_Cmp; } + /** * Function IsLayerLocked @@ -380,8 +426,43 @@ public: * @return bool - true if should include, else false. */ bool IncludeSecondary() const { return m_IncludeSecondary; } - void SetIncludeSecondary( bool include ) { m_IncludeSecondary = include; } + void SetIncludeSecondary( bool include ) { m_IncludeSecondary = include; } + + /** + * Function IgnoreMTextsMarkedNoShow + * @return bool -true if MTexts marked as "no show" should be ignored. + */ + bool IgnoreMTextsMarkedNoShow() const { return m_IgnoreMTextsMarkedNoShow; } + void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_IgnoreMTextsMarkedNoShow = ignore; } + + /** + * Function IgnoreMTextsOnCu + * @return bool - true if should ignore MTexts on copper layer. + */ + bool IgnoreMTextsOnCopper() const { return m_IgnoreMTextsOnCopper; } + void SetIgnoreMTextsOnCopper( bool ignore ) { m_IgnoreMTextsOnCopper = ignore; } + + /** + * Function IgnoreMTextsOnCmp + * @return bool - true if should ignore MTexts on component layer. + */ + bool IgnoreMTextsOnCmp() const { return m_IgnoreMTextsOnCmp; } + void SetIgnoreMTextsOnCmp( bool ignore ) { m_IgnoreMTextsOnCmp = ignore; } + + /** + * Function IgnoreModulesOnCu + * @return bool - true if should ignore MODULEs on copper layer. + */ + bool IgnoreModulesOnCu() const { return m_IgnoreModulesOnCu; } + void SetIgnoreModulesOnCu( bool ignore ) { m_IgnoreModulesOnCu = ignore; } + + /** + * Function IgnoreModulesOnCmp + * @return bool - ture if should ignore MODULEs on component layer. + */ + bool IgnoreModulesOnCmp() const { return m_IgnoreModulesOnCmp; } + void SetIgnoreModulesOnCmp( bool ignore ) { m_IgnoreModulesOnCmp = ignore; } }; #endif // COLLECTORS_H diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 9db61a1ca0..01c3b9cb18 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -61,14 +61,14 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn, nb_change++; pt_conn->m_Sous_Netcode = new_val; - if( pt_conn->start && ( pt_conn->start->m_StructType == TYPEPAD) ) + if( pt_conn->start && ( pt_conn->start->Type() == TYPEPAD) ) { pt_pad = (D_PAD*) (pt_conn->start); if( pt_pad->m_physical_connexion == old_val ) pt_pad->m_physical_connexion = pt_conn->m_Sous_Netcode; } - if( pt_conn->end && (pt_conn->end->m_StructType == TYPEPAD) ) + if( pt_conn->end && (pt_conn->end->Type() == TYPEPAD) ) { pt_pad = (D_PAD*) (pt_conn->end); if( pt_pad->m_physical_connexion == old_val ) @@ -107,11 +107,11 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn ) { pt_conn->m_Sous_Netcode = 0; PtStruct = pt_conn->start; - if( PtStruct && (PtStruct->m_StructType == TYPEPAD) ) + if( PtStruct && (PtStruct->Type() == TYPEPAD) ) ( (D_PAD*) PtStruct )->m_physical_connexion = 0; PtStruct = pt_conn->end; - if( PtStruct && (PtStruct->m_StructType == TYPEPAD) ) + if( PtStruct && (PtStruct->Type() == TYPEPAD) ) ( (D_PAD*) PtStruct )->m_physical_connexion = 0; if( pt_conn == pt_end_conn ) @@ -127,7 +127,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn ) { /* Traitement des connexions a pads */ PtStruct = pt_conn->start; - if( PtStruct && (PtStruct->m_StructType == TYPEPAD) ) + if( PtStruct && (PtStruct->Type() == TYPEPAD) ) /* la connexion debute sur 1 pad */ { pt_pad = (D_PAD*) PtStruct; @@ -157,7 +157,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn ) } PtStruct = pt_conn->end; - if( PtStruct && (PtStruct->m_StructType == TYPEPAD) ) + if( PtStruct && (PtStruct->Type() == TYPEPAD) ) /* la connexion finit sur 1 pad */ { pt_pad = (D_PAD*) PtStruct; @@ -188,7 +188,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn ) /* traitement des connexions entre segments */ PtStruct = pt_conn->start; - if( PtStruct && (PtStruct->m_StructType != TYPEPAD) ) + if( PtStruct && (PtStruct->Type() != TYPEPAD) ) { /* debut sur une autre piste */ pt_autre_piste = (TRACK*) PtStruct; @@ -220,7 +220,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn ) } PtStruct = pt_conn->end; - if( PtStruct && (PtStruct->m_StructType != TYPEPAD) ) + if( PtStruct && (PtStruct->Type() != TYPEPAD) ) { /* fin connectee a une autre piste */ pt_autre_piste = (TRACK*) PtStruct; @@ -426,7 +426,7 @@ static void calcule_connexite_1_net( TRACK* pt_start_conn, TRACK* pt_end_conn ) /* calcul des connexions */ for( Track = pt_start_conn; Track != NULL; Track = (TRACK*) Track->Pnext ) { - if( Track->m_StructType == TYPEVIA ) + if( Track->Type() == TYPEVIA ) { TRACK* pt_segm; int layermask = Track->ReturnMaskLayer(); @@ -708,7 +708,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche ) /* look for vias which could be connect many tracks */ for( TRACK* via = m_Pcb->m_Track; via != NULL; via = via->Next() ) { - if( via->m_StructType != TYPEVIA ) + if( via->Type() != TYPEVIA ) continue; if( via->m_NetCode > 0 ) continue; // Netcode already known @@ -736,7 +736,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche ) { /* Traitement du point de debut */ PtStruct = (BOARD_ITEM*) pt_piste->start; - if( PtStruct && (PtStruct->m_StructType != TYPEPAD) ) + if( PtStruct && (PtStruct->Type() != TYPEPAD) ) { // Begin on an other track segment pt_next = (TRACK*) PtStruct; if( pt_piste->m_NetCode ) @@ -759,7 +759,7 @@ void WinEDA_BasePcbFrame::reattribution_reference_piste( int affiche ) /* Localisation du point de fin */ PtStruct = pt_piste->end; - if( PtStruct &&(PtStruct->m_StructType != TYPEPAD) ) + if( PtStruct &&(PtStruct->Type() != TYPEPAD) ) { // End sur piste pt_next = (TRACK*) PtStruct; if( pt_piste->m_NetCode ) diff --git a/pcbnew/copy_track.cpp b/pcbnew/copy_track.cpp index 2b53538c89..98cc06ad7e 100644 --- a/pcbnew/copy_track.cpp +++ b/pcbnew/copy_track.cpp @@ -66,7 +66,7 @@ wxDC * DC = Cmd->DC; LockPoint = LocateLockPoint(pt_track->m_Start.x,pt_track->m_Start.y,masquelayer); if( LockPoint ) { - if ( LockPoint->m_StructType == TYPEPAD ) + if ( LockPoint->Type() == TYPEPAD ) { pt_pad = (D_PAD*) LockPoint; new_net_code = pt_pad->net_code; @@ -82,7 +82,7 @@ wxDC * DC = Cmd->DC; LockPoint = LocateLockPoint(pt_track->m_End.x,pt_track->m_End.y,masquelayer); if( LockPoint ) { - if ( LockPoint->m_StructType == TYPEPAD ) + if ( LockPoint->Type() == TYPEPAD ) { pt_pad = (D_PAD*) LockPoint; new_net_code = pt_pad->net_code; @@ -151,7 +151,7 @@ wxDC * DC = Cmd->DC; if( LockPoint ) { pt_track->start = LockPoint; - if ( LockPoint->m_StructType == TYPEPAD ) + if ( LockPoint->Type() == TYPEPAD ) { /* fin de piste sur un pad */ pt_pad = (D_PAD*) LockPoint; pt_track->SetState(BEGIN_ONPAD, ON); @@ -168,7 +168,7 @@ wxDC * DC = Cmd->DC; if( LockPoint ) { pt_track->end = LockPoint; - if ( LockPoint->m_StructType == TYPEPAD ) + if ( LockPoint->Type() == TYPEPAD ) { /* fin de piste sur un pad */ pt_pad = (D_PAD*) LockPoint; pt_track->SetState(END_ONPAD, ON); diff --git a/pcbnew/cotation.cpp b/pcbnew/cotation.cpp index 81d8b69dca..daf92a85f7 100644 --- a/pcbnew/cotation.cpp +++ b/pcbnew/cotation.cpp @@ -63,7 +63,7 @@ public: // Constructor and destructor WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* parent, COTATION* Cotation, wxDC* DC, const wxPoint& pos ); - ~WinEDA_CotationPropertiesFrame( void ) + ~WinEDA_CotationPropertiesFrame() { } diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index db15c27785..5ee619a815 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -50,8 +50,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) if( g_TwoSegmentTrackBuild ) { // g_CurrentTrackSegment->Pback must not be a via, or we want delete also the via if( (g_TrackSegmentCount >= 2) - && (g_CurrentTrackSegment->m_StructType != TYPEVIA) - && (g_CurrentTrackSegment->Pback->m_StructType == TYPEVIA) ) + && (g_CurrentTrackSegment->Type() != TYPEVIA) + && (g_CurrentTrackSegment->Pback->Type() == TYPEVIA) ) { Track = g_CurrentTrackSegment; g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; @@ -61,13 +61,13 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) } while( g_TrackSegmentCount && g_CurrentTrackSegment - && (g_CurrentTrackSegment->m_StructType == TYPEVIA) ) + && (g_CurrentTrackSegment->Type() == TYPEVIA) ) { Track = g_CurrentTrackSegment; g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; delete Track; g_TrackSegmentCount--; - if( g_CurrentTrackSegment && (g_CurrentTrackSegment->m_StructType != TYPEVIA) ) + if( g_CurrentTrackSegment && (g_CurrentTrackSegment->Type() != TYPEVIA) ) previous_layer = g_CurrentTrackSegment->GetLayer(); } @@ -82,7 +82,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) if( g_TwoSegmentTrackBuild ) // We must have 2 segments or more, or 0 { if( ( g_TrackSegmentCount == 1 ) - && (g_CurrentTrackSegment->m_StructType != TYPEVIA) ) + && (g_CurrentTrackSegment->Type() != TYPEVIA) ) { delete g_CurrentTrackSegment; g_TrackSegmentCount = 0; diff --git a/pcbnew/dialog_edit_module.cpp b/pcbnew/dialog_edit_module.cpp index b9dff9e033..e1e2625d6a 100644 --- a/pcbnew/dialog_edit_module.cpp +++ b/pcbnew/dialog_edit_module.cpp @@ -69,7 +69,7 @@ WinEDA_ModulePropertiesFrame::WinEDA_ModulePropertiesFrame( WinEDA_BasePcbFrame* /*****************************************************/ -void WinEDA_ModulePropertiesFrame::CreateControls( void ) +void WinEDA_ModulePropertiesFrame::CreateControls() /*****************************************************/ { wxPoint pos; @@ -443,7 +443,7 @@ Panel3D_Ctrl::Panel3D_Ctrl( WinEDA_ModulePropertiesFrame* parentframe, /********************************/ -Panel3D_Ctrl::~Panel3D_Ctrl( void ) +Panel3D_Ctrl::~Panel3D_Ctrl() /********************************/ { delete m_3D_ShapeName; @@ -670,7 +670,7 @@ void WinEDA_ModulePropertiesFrame::SelectTextListBox( wxCommandEvent& event ) /*************************************************************************/ -void WinEDA_ModulePropertiesFrame::SetTextListButtons( void ) +void WinEDA_ModulePropertiesFrame::SetTextListButtons() /*************************************************************************/ { int choice = m_TextListBox->GetChoice(); @@ -688,7 +688,7 @@ void WinEDA_ModulePropertiesFrame::SetTextListButtons( void ) /***********************************************************/ -void WinEDA_ModulePropertiesFrame::ReCreateFieldListBox( void ) +void WinEDA_ModulePropertiesFrame::ReCreateFieldListBox() /***********************************************************/ { m_TextListBox->Clear(); @@ -699,7 +699,7 @@ void WinEDA_ModulePropertiesFrame::ReCreateFieldListBox( void ) EDA_BaseStruct* item = m_CurrentModule->m_Drawings; while( item ) { - if( item->m_StructType == TYPETEXTEMODULE ) + if( item->Type() == TYPETEXTEMODULE ) m_TextListBox->Append( ( (TEXTE_MODULE*) item )->m_Text ); item = item->Pnext; } @@ -753,7 +753,7 @@ void WinEDA_ModulePropertiesFrame::EditOrDelTextModule( wxCommandEvent& event ) int jj = 2; while( item ) { - if( item->m_StructType == TYPETEXTEMODULE ) + if( item->Type() == TYPETEXTEMODULE ) { if( jj == TextType ) // Texte trouvé { diff --git a/pcbnew/dialog_graphic_items_options.cpp b/pcbnew/dialog_graphic_items_options.cpp index 12cdd58d9f..4ec0131933 100644 --- a/pcbnew/dialog_graphic_items_options.cpp +++ b/pcbnew/dialog_graphic_items_options.cpp @@ -25,7 +25,7 @@ /**************************************************************/ -void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue( void ) +void WinEDA_GraphicItemsOptionsDialog::SetDisplayValue() /**************************************************************/ { /* Drawings width */ diff --git a/pcbnew/dialog_graphic_items_options.h b/pcbnew/dialog_graphic_items_options.h index 20bb5796c7..88b596ca0c 100644 --- a/pcbnew/dialog_graphic_items_options.h +++ b/pcbnew/dialog_graphic_items_options.h @@ -101,7 +101,7 @@ public: /// Should we show tooltips? static bool ShowToolTips(); void AcceptOptions(wxCommandEvent& event); - void SetDisplayValue( void ); + void SetDisplayValue(); ////@begin WinEDA_GraphicItemsOptionsDialog member variables wxStaticText* m_GraphicSegmWidthTitle; diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index f058cdf19e..5c8695338a 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -614,7 +614,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, w_dist += g_DesignSettings.m_TrackClearence; /* si le segment de reference est une via, le traitement est ici */ - if( pt_segment->m_StructType == TYPEVIA ) + if( pt_segment->Type() == TYPEVIA ) { int orgx, orgy; // origine du repere d'axe X = segment a comparer int angle = 0; // angle du segment a tester; @@ -622,7 +622,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, dx = pttrack->m_End.x - orgx; dy = pttrack->m_End.y - orgy; x0 = pt_segment->m_Start.x - orgx; y0 = pt_segment->m_Start.y - orgy; - if( pttrack->m_StructType == TYPEVIA ) /* Tst distance entre 2 vias */ + if( pttrack->Type() == TYPEVIA ) /* Tst distance entre 2 vias */ { if( (int) hypot( (float) x0, (float) y0 ) < w_dist ) { @@ -669,7 +669,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, RotatePoint( &x0, &y0, segm_angle ); RotatePoint( &xf, &yf, segm_angle ); - if( pttrack->m_StructType == TYPEVIA ) + if( pttrack->Type() == TYPEVIA ) { if( TestMarginToCircle( x0, y0, w_dist, segm_long ) == OK_DRC ) continue; @@ -1305,13 +1305,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, netname2 = wxT( "" ); tracktype = wxT( "Track" ); - if( pt_ref->m_StructType == TYPEVIA ) + if( pt_ref->Type() == TYPEVIA ) tracktype = wxT( "Via" ); - if( pt_ref->m_StructType == TYPEZONE ) + if( pt_ref->Type() == TYPEZONE ) tracktype = wxT( "Zone" ); - if( ( (EDA_BaseStruct*) pt_item )->m_StructType == TYPEPAD ) + if( ( (EDA_BaseStruct*) pt_item )->Type() == TYPEPAD ) { D_PAD* pad = (D_PAD*) pt_item; equipot = Pcb->FindNet( pad->m_NetCode ); @@ -1334,7 +1334,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, if( equipot ) netname2 = equipot->m_Netname; erc_pos = pt_segm->m_Start; - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { msg.Printf( _( "%d Err type %d: %s (net %s) and VIA (net %s) @ %d,%d\n" ), ErrorsDRC_Count, errnumber, tracktype.GetData(), diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 55bc07b75f..edec02fbaa 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -161,7 +161,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) Edge = (EDGE_MODULE*) Module->m_Drawings; for( ; Edge != NULL; Edge = (EDGE_MODULE*) Edge->Pnext ) { - if( Edge->m_StructType != TYPEEDGEMODULE ) + if( Edge->Type() != TYPEEDGEMODULE ) continue; Edge->m_Width = ModuleSegmentWidth; } @@ -198,7 +198,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ) Edge = (EDGE_MODULE*) Module->m_Drawings; for( ; Edge != NULL; Edge = (EDGE_MODULE*) Edge->Pnext ) { - if( Edge->m_StructType != TYPEEDGEMODULE ) + if( Edge->Type() != TYPEEDGEMODULE ) continue; Edge->SetLayer( new_layer ); } @@ -254,7 +254,7 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) { if( Edge == NULL ) return; - if( Edge->m_StructType != TYPEEDGEMODULE ) + if( Edge->Type() != TYPEEDGEMODULE ) { DisplayError( this, wxT( "StructType error: TYPEEDGEMODULE expected" ) ); return; @@ -277,7 +277,7 @@ static void Exit_EditEdge_Module( WinEDA_DrawPanel* Panel, wxDC* DC ) { EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem(); - if( Edge && (Edge->m_StructType == TYPEEDGEMODULE) ) /* error si non */ + if( Edge && (Edge->Type() == TYPEEDGEMODULE) ) /* error si non */ { if( Edge->m_Flags & IS_NEW ) /* effacement du nouveau contour */ { diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 81b93f982e..7ca2a7aabc 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -39,7 +39,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawPanel->m_AutoPAN_Request = FALSE; if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours { - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPETRACK: case TYPEVIA: @@ -142,7 +142,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) GetScreen()->SetCurItem( Create_Mire( DC ) ); DrawPanel->MouseToCursorSchema(); } - else if( DrawStruct->m_StructType == TYPEMIRE ) + else if( DrawStruct->Type() == TYPEMIRE ) { Place_Mire( (MIREPCB*) DrawStruct, DC ); } @@ -172,7 +172,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawPanel->m_AutoPAN_Request = TRUE; } else if( DrawStruct - && (DrawStruct->m_StructType == TYPEDRAWSEGMENT) + && (DrawStruct->Type() == TYPEDRAWSEGMENT) && (DrawStruct->m_Flags & IS_NEW) ) { DrawStruct = Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, DC ); @@ -198,7 +198,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) } else if( DrawStruct && -// (DrawStruct->m_StructType == TYPETRACK) && +// (DrawStruct->Type() == TYPETRACK) && (DrawStruct->m_Flags & IS_NEW) ) { TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC ); @@ -215,7 +215,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) GetScreen()->SetCurItem( DrawStruct = Begin_Zone() ); } else if( DrawStruct - && (DrawStruct->m_StructType == TYPEEDGEZONE) + && (DrawStruct->Type() == TYPEEDGEZONE) && (DrawStruct->m_Flags & IS_NEW) ) { GetScreen()->SetCurItem( DrawStruct = Begin_Zone() ); @@ -231,7 +231,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawPanel->MouseToCursorSchema(); DrawPanel->m_AutoPAN_Request = TRUE; } - else if( DrawStruct->m_StructType == TYPETEXTE ) + else if( DrawStruct->Type() == TYPETEXTE ) { Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC ); DrawPanel->m_AutoPAN_Request = FALSE; @@ -249,7 +249,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) if( DrawStruct ) StartMove_Module( (MODULE*) DrawStruct, DC ); } - else if( DrawStruct->m_StructType == TYPEMODULE ) + else if( DrawStruct->Type() == TYPEMODULE ) { Place_Module( (MODULE*) DrawStruct, DC ); DrawPanel->m_AutoPAN_Request = FALSE; @@ -271,7 +271,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawPanel->m_AutoPAN_Request = TRUE; } else if( DrawStruct - && (DrawStruct->m_StructType == TYPECOTATION) + && (DrawStruct->Type() == TYPECOTATION) && (DrawStruct->m_Flags & IS_NEW) ) { DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC ); @@ -320,11 +320,11 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( EDA_BaseStruct* objectToSync ) char cmd[1024]; MODULE* module = NULL; - if( objectToSync->m_StructType == TYPEMODULE ) + if( objectToSync->Type() == TYPEMODULE ) module = (MODULE*) objectToSync; - else if( objectToSync->m_StructType == TYPEPAD ) + else if( objectToSync->Type() == TYPEPAD ) module = (MODULE*) objectToSync->m_Parent; - else if( objectToSync->m_StructType == TYPETEXTEMODULE ) + else if( objectToSync->Type() == TYPETEXTEMODULE ) module = (MODULE*) objectToSync->m_Parent; // ask only for the reference for now, maybe pins later. @@ -785,9 +785,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_MOVE_MODULE_REQUEST: // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) { g_Drag_Pistes_On = FALSE; break; @@ -809,10 +809,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) break; if( Delete_Module( (MODULE*) CURRENT_ITEM, &dc ) ) { @@ -824,10 +824,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) break; Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, -900, TRUE ); break; @@ -836,10 +836,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) break; Rotate_Module( &dc, (MODULE*) CURRENT_ITEM, 900, TRUE ); break; @@ -848,18 +848,18 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) break; Change_Side_Module( (MODULE*) CURRENT_ITEM, &dc ); break; case ID_POPUP_PCB_EDIT_MODULE: // If the current Item is a pad, text module ...: Get the parent - if( CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( CURRENT_ITEM->Type() != TYPEMODULE ) GetScreen()->SetCurItem( CURRENT_ITEM->m_Parent ); - if( !CURRENT_ITEM || CURRENT_ITEM->m_StructType != TYPEMODULE ) + if( !CURRENT_ITEM || CURRENT_ITEM->Type() != TYPEMODULE ) break; InstallModuleOptionsFrame( (MODULE*) CURRENT_ITEM, &dc, pos ); DrawPanel->MouseToCursorSchema(); @@ -1207,7 +1207,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, frame->DrawPanel->MouseToCursorSchema(); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPETEXTE: frame->StartMoveTextePcb( (TEXTE_PCB*) DrawStruct, DC ); @@ -1217,7 +1217,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, wxString msg; msg.Printf( wxT( "WinEDA_PcbFrame::Move_Item Error: Bad DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( frame, msg ); break; } @@ -1255,7 +1255,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) // Element localis� GetScreen()->SetCurItem( DrawStruct ); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPETRACK: case TYPEVIA: @@ -1328,7 +1328,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) case ID_PCB_CIRCLE_BUTT: if( DrawStruct == NULL ) break; - if( DrawStruct->m_StructType != TYPEDRAWSEGMENT ) + if( DrawStruct->Type() != TYPEDRAWSEGMENT ) { DisplayError( this, wxT( "DrawStruct Type error" ) ); DrawPanel->m_AutoPAN_Request = FALSE; @@ -1352,7 +1352,7 @@ void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) if( Item == NULL ) return; - switch( Item->m_StructType ) + switch( Item->Type() ) { case TYPEMODULE: Delete_Module( (MODULE*) Item, DC ); @@ -1401,7 +1401,7 @@ void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) { wxString Line; Line.Printf( wxT( "Remove: StructType %d Inattendu" ), - Item->m_StructType ); + Item->Type() ); DisplayError( this, Line ); } break; @@ -1430,7 +1430,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) //see if we are drawing a segment; if so, add a via? if( m_ID_current_state == ID_TRACK_BUTT && current != NULL ) { - if( current->m_StructType == TYPETRACK && (current->m_Flags & IS_NEW) ) + if( current->Type() == TYPETRACK && (current->m_Flags & IS_NEW) ) { //want to set the routing layers so that it switches properly - //see the implementation of Other_Layer_Route - the working diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index b5f8c42ff9..6187ddca6f 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -30,7 +30,7 @@ int old_w, consigne ; /* Test DRC and width change */ old_w = pt_segm->m_Width; consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth; - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize; } @@ -130,7 +130,7 @@ int nb_segm_non_modifies = 0; pt_segm = m_Pcb->m_Track ; for ( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) { - if( pt_segm->m_StructType == TYPEVIA ) /* mise a jour du diametre de la via */ + if( pt_segm->Type() == TYPEVIA ) /* mise a jour du diametre de la via */ { if ( Via ) { diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 7c836819fe..67a6bb0352 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -110,7 +110,7 @@ void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) Trace_DrawSegmentPcb( DrawPanel, DC, Segment, GR_XOR ); PtStruct = Segment->Pback; DeleteStructure( Segment ); - if( PtStruct && (PtStruct->m_StructType == TYPEDRAWSEGMENT ) ) + if( PtStruct && (PtStruct->Type() == TYPEDRAWSEGMENT ) ) Segment = (DRAWSEGMENT*) PtStruct; DisplayOpt.DisplayDrawItems = track_fill_copy; GetScreen()->SetCurItem( NULL ); @@ -157,7 +157,8 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC { DRAWSEGMENT* pt_segm; TEXTE_PCB* pt_txt; - EDA_BaseStruct* PtStruct, * PtNext; + BOARD_ITEM* PtStruct; + BOARD_ITEM* PtNext; COTATION* Cotation; int layer = Segment->GetLayer(); @@ -181,9 +182,9 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC for( ; PtStruct != NULL; PtStruct = PtNext ) { GetScreen()->SetModify(); - PtNext = PtStruct->Pnext; + PtNext = PtStruct->Next(); - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: pt_segm = (DRAWSEGMENT*) PtStruct; diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index c894ca18e9..98ec5f0e5b 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -98,7 +98,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) PtStruct = pt_mod->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: #undef STRUCT @@ -130,7 +130,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) if( Item == NULL ) return; - switch( Item->m_StructType ) + switch( Item->Type() ) { case TYPEPAD: DeletePad( (D_PAD*) Item, DC ); @@ -164,7 +164,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) { wxString Line; Line.Printf( wxT( " Remove: StructType %d Inattendu" ), - Item->m_StructType ); + Item->Type() ); DisplayError( this, Line ); } break; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 385c8ec12e..fbadf53bdd 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -18,7 +18,7 @@ /* variables locales */ /***********************************************/ -void WinEDA_PcbFrame::DisplayTrackSettings( void ) +void WinEDA_PcbFrame::DisplayTrackSettings() /***********************************************/ /* Display the current track width and via diameter @@ -93,7 +93,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) TRACK* pt_track; int l1, l2, nb_segm; - if( (pt_segm == NULL ) || ( pt_segm->m_StructType == TYPEZONE ) ) + if( (pt_segm == NULL ) || ( pt_segm->Type() == TYPEZONE ) ) { return; } @@ -114,7 +114,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) ii = 0; pt_segm = pt_track; for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) { - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) continue; /* inversion des couches */ @@ -183,7 +183,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) pt_segm = g_FirstTrackSegment; for( ii = 0; ii < g_TrackSegmentCount - 1; ii++, pt_segm = (TRACK*) pt_segm->Pnext ) { - if( (pt_segm->m_StructType == TYPEVIA) + if( (pt_segm->Type() == TYPEVIA) && (g_CurrentTrackSegment->m_End == pt_segm->m_Start) ) return; } @@ -240,18 +240,27 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) Via->Pback = g_CurrentTrackSegment; g_CurrentTrackSegment->Pnext = Via; g_TrackSegmentCount++; - g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment ); + + // @todo: is this a memory leak bug? is g_CurrentTrackSegment's original lost or is it on some list? + g_CurrentTrackSegment = g_CurrentTrackSegment->Copy(); + g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); + g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->m_End = Via->m_Start; + g_TrackSegmentCount++; + g_CurrentTrackSegment->Pback = Via; + Via->Pnext = g_CurrentTrackSegment; if( g_TwoSegmentTrackBuild ) { // Create a second segment (we must have 2 track segments to adjust) TRACK* track = g_CurrentTrackSegment; - g_CurrentTrackSegment = new TRACK( *track ); + + g_CurrentTrackSegment = track->Copy(); + g_TrackSegmentCount++; g_CurrentTrackSegment->Pback = track; track->Pnext = g_CurrentTrackSegment; @@ -310,7 +319,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) if( item ) { - if( item->m_StructType == TYPEPAD ) + if( item->Type() == TYPEPAD ) { pt_pad = (D_PAD*) item; Module = (MODULE*) pt_pad->m_Parent; @@ -342,13 +351,13 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) } else { - if( item->m_StructType == TYPETEXTEMODULE ) + if( item->Type() == TYPETEXTEMODULE ) { - if( item->m_Parent && (item->m_Parent->m_StructType == TYPEMODULE) ) + if( item->m_Parent && (item->m_Parent->Type() == TYPEMODULE) ) Module = (MODULE*) item->m_Parent; } - else if( item->m_StructType == TYPEMODULE ) + else if( item->Type() == TYPEMODULE ) { Module = (MODULE*) item; } diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index a865b80917..b3169d0aa4 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -111,7 +111,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) if( LockPoint ) { - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { pt_pad = (D_PAD*) LockPoint; @@ -252,8 +252,8 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm Previous = (TRACK*) pt_segm->Pback; // pointe le segment precedent // Test s'il y a 2 segments consecutifs a raccorder - if( (pt_segm->m_StructType != TYPETRACK ) - || (Previous->m_StructType != TYPETRACK) ) + if( (pt_segm->Type() != TYPETRACK ) + || (Previous->Type() != TYPETRACK) ) { return 0; } @@ -407,7 +407,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) if( LockPoint ) /* La fin de la piste est sur un PAD */ { - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { EnsureEndTrackOnPad( (D_PAD*) LockPoint ); } @@ -509,7 +509,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase if( g_TwoSegmentTrackBuild ) { TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback; - if( previous_track && (previous_track->m_StructType == TYPETRACK) ) + if( previous_track && (previous_track->Type() == TYPETRACK) ) { previous_track->SetLayer( screen->m_Active_Layer ); previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; @@ -752,7 +752,7 @@ TRACK* DeleteNullTrackSegments( BOARD* pcb, TRACK* track, int* segmcount ) } firsttrack->start = LockPoint; - if( LockPoint && (LockPoint->m_StructType == TYPEPAD ) ) + if( LockPoint && (LockPoint->Type() == TYPEPAD ) ) firsttrack->SetState( BEGIN_ONPAD, ON ); track = firsttrack; diff --git a/pcbnew/editrout.cpp b/pcbnew/editrout.cpp index ff725d43c4..e545be01c0 100644 --- a/pcbnew/editrout.cpp +++ b/pcbnew/editrout.cpp @@ -29,7 +29,7 @@ int old_w, consigne ; /* Test DRC et mise a la largeur */ old_w = pt_segm->m_Width; consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth; - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize; } @@ -129,7 +129,7 @@ int nb_segm_non_modifies = 0; pt_segm = m_Pcb->m_Track ; for ( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) { - if( pt_segm->m_StructType == TYPEVIA ) /* mise a jour du diametre de la via */ + if( pt_segm->Type() == TYPEVIA ) /* mise a jour du diametre de la via */ { if ( Via ) { diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 0bfc03f9bc..88419b7406 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -580,7 +580,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) for( track = pcb->m_Zone; track != NULL; track = (TRACK*) track->Pnext ) { - if( track->m_StructType == TYPEZONE ) + if( track->Type() == TYPEZONE ) nbitems++; } @@ -592,7 +592,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) for( track = pcb->m_Zone; track != NULL; track = (TRACK*) track->Pnext ) { - if( track->m_StructType == TYPEZONE ) + if( track->Type() == TYPEZONE ) tracklist[nbitems++] = track; } @@ -624,7 +624,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) fprintf( file, "TRACK TRACK%d\n", track->m_Width ); } - if( (track->m_StructType == TYPETRACK) || (track->m_StructType == TYPEZONE) ) + if( (track->Type() == TYPETRACK) || (track->Type() == TYPEZONE) ) { if( old_layer != track->GetLayer() ) { @@ -637,7 +637,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) mapXto( track->m_Start.x ), mapYto( track->m_Start.y ), mapXto( track->m_End.x ), mapYto( track->m_End.y ) ); } - if( track->m_StructType == TYPEVIA ) + if( track->Type() == TYPEVIA ) { fprintf( file, "VIA viapad%d %d %d ALL %d via%d\n", track->m_Width, @@ -830,7 +830,7 @@ void ModuleWriteShape( FILE* file, MODULE* module ) PtStruct = module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTEMODULE: break; diff --git a/pcbnew/find.cpp b/pcbnew/find.cpp index 856f33c4d4..8e5c7447b1 100644 --- a/pcbnew/find.cpp +++ b/pcbnew/find.cpp @@ -76,7 +76,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) MARQUEUR* Marker = (MARQUEUR*) m_Parent->m_Pcb->m_Drawings; for( ; Marker != NULL; Marker = (MARQUEUR*) Marker->Pnext ) { - if( Marker->m_StructType != TYPEMARQUEUR ) + if( Marker->Type() != TYPEMARQUEUR ) continue; StartCount++; if( StartCount > s_MarkerCount ) diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 1de92407d3..745f4e05e7 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -369,7 +369,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event ) EDA_BaseStruct* PtStruct; for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N ) continue; diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp index f6150ab260..ce3e02beab 100644 --- a/pcbnew/gendrill.cpp +++ b/pcbnew/gendrill.cpp @@ -468,7 +468,7 @@ char line[1024]; pt_piste = m_Parent->m_Pcb->m_Track; for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext) { - if(pt_piste->m_StructType != TYPEVIA) continue; + if(pt_piste->Type() != TYPEVIA) continue; if ( pt_piste->m_Drill == 0 ) continue; int via_drill = ( pt_piste->m_Drill < 0 ) ? g_DesignSettings.m_ViaDrill : pt_piste->m_Drill; if ( foret->m_Diameter != via_drill ) @@ -706,7 +706,7 @@ char line[1024]; TRACK * pt_piste = m_Parent->m_Pcb->m_Track; for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext ) { - if(pt_piste->m_StructType != TYPEVIA) continue; + if(pt_piste->Type() != TYPEVIA) continue; if ( pt_piste->m_Drill == 0 ) continue; int via_drill = g_DesignSettings.m_ViaDrill; if ( pt_piste->m_Drill > 0 ) // Drill value is not the default value @@ -972,7 +972,7 @@ wxString msg; PtStruct = m_Parent->m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format, EDGE_LAYER ); @@ -1224,7 +1224,7 @@ wxSize size; pt_piste = m_Parent->m_Pcb->m_Track; for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext) { - if(pt_piste->m_StructType != TYPEVIA) continue; + if(pt_piste->Type() != TYPEVIA) continue; if(pt_piste->m_Drill == 0) continue; int via_drill = g_DesignSettings.m_ViaDrill; diff --git a/pcbnew/graphpcb.cpp b/pcbnew/graphpcb.cpp index bbfe3a1431..544c57bcfe 100644 --- a/pcbnew/graphpcb.cpp +++ b/pcbnew/graphpcb.cpp @@ -266,7 +266,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l layer = -1; /* Test si VIA (cercle plein a tracer) */ - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { TraceFilledCercle( Pcb, pt_segm->m_Start.x, pt_segm->m_Start.y, demi_largeur, 0x0000FFFF, color, op_logique ); diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 269a7342bd..ba1a505cf2 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -267,12 +267,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, DrawStruct = PcbGeneralLocateAndDisplay(); // don't let backspace delete modules!! - if( DrawStruct && (DrawStruct->m_StructType == TYPETRACK - || DrawStruct->m_StructType == TYPEVIA) ) + if( DrawStruct && (DrawStruct->Type() == TYPETRACK + || DrawStruct->Type() == TYPEVIA) ) Delete_Segment( DC, (TRACK*) DrawStruct ); GetScreen()->SetModify(); } - else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK ) + else if( GetScreen()->GetCurItem()->Type() == TYPETRACK ) { // then an element is being edited - remove the last segment. GetScreen()->SetCurItem( Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ) ); @@ -320,7 +320,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, Other_Layer_Route( NULL, DC ); break; } - if( GetScreen()->GetCurItem()->m_StructType != TYPETRACK ) + if( GetScreen()->GetCurItem()->Type() != TYPETRACK ) return; if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) == 0 ) return; @@ -334,7 +334,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, // get any module, locked or not locked and toggle its locked status if( ItemFree ) module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); - else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE ) + else if( GetScreen()->GetCurItem()->Type() == TYPEMODULE ) module = (MODULE*) GetScreen()->GetCurItem(); if( module ) { @@ -378,7 +378,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, } } } - else if( GetScreen()->GetCurItem()->m_StructType == TYPEMODULE ) + else if( GetScreen()->GetCurItem()->Type() == TYPEMODULE ) { module = (MODULE*) GetScreen()->GetCurItem(); @@ -510,11 +510,11 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) if( ItemFree ) { DrawStruct = PcbGeneralLocateAndDisplay(); - if( DrawStruct && DrawStruct->m_StructType != TYPETRACK ) + if( DrawStruct && DrawStruct->Type() != TYPETRACK ) return FALSE; Delete_Track( DC, (TRACK*) DrawStruct ); } - else if( GetScreen()->GetCurItem()->m_StructType == TYPETRACK ) + else if( GetScreen()->GetCurItem()->Type() == TYPETRACK ) { GetScreen()->SetCurItem( Delete_Segment( DC, (TRACK*) GetScreen()->GetCurItem() ) ); diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 64e21d8384..7f6e850c48 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -250,7 +250,7 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( wxDC* DC, bool is_edges, bool query ) { PtNext = PtStruct->Next(); - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: case TYPETEXTE: @@ -325,16 +325,16 @@ void WinEDA_PcbFrame::Erase_Modules( wxDC* DC, bool query ) void WinEDA_PcbFrame::Erase_Textes_Pcb( wxDC* DC, bool query ) /************************************************************/ { - EDA_BaseStruct* PtStruct, * PtNext; + BOARD_ITEM* PtStruct, * PtNext; if( query && !IsOK( this, _( "Delete Pcb Texts" ) ) ) return; - PtStruct = (EDA_BaseStruct*) m_Pcb->m_Drawings; + PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtNext ) { - PtNext = PtStruct->Pnext; - if( PtStruct->m_StructType == TYPETEXTE ) + PtNext = PtStruct->Next(); + if( PtStruct->Type() == TYPETEXTE ) DeleteStructure( PtStruct ); } @@ -343,16 +343,16 @@ void WinEDA_PcbFrame::Erase_Textes_Pcb( wxDC* DC, bool query ) /*******************************************/ -void WinEDA_PcbFrame::Erase_Marqueurs( void ) +void WinEDA_PcbFrame::Erase_Marqueurs() /*******************************************/ { - EDA_BaseStruct* PtStruct, * PtNext; + BOARD_ITEM* PtStruct, * PtNext; PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtNext ) { - PtNext = PtStruct->Pnext; - if( PtStruct->m_StructType == TYPEMARQUEUR ) + PtNext = PtStruct->Next(); + if( PtStruct->Type() == TYPEMARQUEUR ) DeleteStructure( PtStruct ); } diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 1af839f53c..936952d3e7 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -1131,7 +1131,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* File ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTE: ( (TEXTE_PCB*) PtStruct )->WriteTextePcbDescr( File ); diff --git a/pcbnew/lay2plot.cpp b/pcbnew/lay2plot.cpp index af0ddcadbf..bf759208d4 100644 --- a/pcbnew/lay2plot.cpp +++ b/pcbnew/lay2plot.cpp @@ -58,7 +58,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: if( (g_TabOneLayerMask[ PtStruct->GetLayer()] & printmasklayer) == 0 ) @@ -100,7 +100,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl { if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue; - if( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */ + if( pt_piste->Type() == TYPEVIA ) /* VIA rencontree */ { int rayon = pt_piste->m_Width >> 1; int color = g_DesignSettings.m_ViaColor[pt_piste->m_Shape]; @@ -136,7 +136,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl { if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 ) continue; - if( pt_piste->m_StructType == TYPEVIA ) /* VIA rencontree */ + if( pt_piste->Type() == TYPEVIA ) /* VIA rencontree */ { GRSetDrawMode( DC, drawmode ); GRFilledCircle( &m_ClipBox, DC, pt_piste->m_Start.x, pt_piste->m_Start.y, @@ -199,7 +199,7 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC, for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPETEXTEMODULE: if( (mlayer & masklayer ) == 0 ) diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 6aee99a6cd..0c8ba72788 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -17,13 +17,13 @@ public: wxString m_Name, m_Doc, m_KeyWord; public: - ModList( void ) + ModList() { Next = NULL; } - ~ModList( void ) + ~ModList() { } }; diff --git a/pcbnew/locate.cpp b/pcbnew/locate.cpp index f7dc3ab3b8..492a4dfd8b 100644 --- a/pcbnew/locate.cpp +++ b/pcbnew/locate.cpp @@ -140,7 +140,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch ) masque_layer, typeloc ) ) != NULL ) { Track = TrackLocate; - if( TrackLocate->m_StructType == TYPEVIA ) + if( TrackLocate->Type() == TYPEVIA ) break; TrackLocate = (TRACK*) TrackLocate->Pnext; @@ -232,7 +232,7 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer ) for( Track = Pcb->m_Track; Track != NULL; Track = Track->Next() ) { - if( Track->m_StructType != TYPEVIA ) + if( Track->Type() != TYPEVIA ) continue; if( Track->m_Start != pos ) continue; @@ -311,7 +311,7 @@ EDGE_MODULE* Locate_Edge_Module( MODULE* module, int typeloc ) EDA_BaseStruct* PtStruct = module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPEEDGEMODULE ) + if( PtStruct->Type() != TYPEEDGEMODULE ) continue; // calls virtual EDGE_MODULE::HitTest() @@ -337,7 +337,7 @@ COTATION* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc ) BOARD_ITEM* PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - if( PtStruct->m_StructType != TYPECOTATION ) + if( PtStruct->Type() != TYPECOTATION ) continue; // calls virtual COTATION::HitTest() @@ -369,7 +369,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc ) EDA_BaseStruct* PtStruct = Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; DRAWSEGMENT* pts = (DRAWSEGMENT*) PtStruct; @@ -643,7 +643,7 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc ) PtStruct = module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPETEXTEMODULE ) + if( PtStruct->Type() != TYPETEXTEMODULE ) continue; pt_txt_mod = (TEXTE_MODULE*) PtStruct; @@ -746,7 +746,7 @@ suite: suite1: if( PtSegmB == pt_base ) PtSegmB = NULL; - else if( PtSegmB->m_StructType != TYPEPCB ) + else if( PtSegmB->Type() != TYPEPCB ) PtSegmB = (TRACK*) PtSegmB->Pback; else PtSegmB = NULL; @@ -820,7 +820,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa if( (g_DesignSettings.m_LayerColor[Track->GetLayer()] & ITEM_NOT_SHOW) ) continue; - if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */ + if( Track->Type() == TYPEVIA ) /* VIA rencontree */ { if( Track->HitTest( ref_pos ) ) return Track; @@ -893,7 +893,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPETEXTE ) + if( PtStruct->Type() != TYPETEXTE ) continue; TEXTE_PCB* pt_txt_pcb = (TEXTE_PCB*) PtStruct; @@ -1006,7 +1006,7 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, for( PtSegm = start_adr; PtSegm != NULL; PtSegm = (TRACK*) PtSegm->Pnext ) { - if( PtSegm->m_StructType == TYPEVIA ) + if( PtSegm->Type() == TYPEVIA ) { if( pos == PtSegm->m_Start ) { @@ -1042,7 +1042,7 @@ MIREPCB* Locate_MirePcb( BOARD_ITEM* PtStruct, int LayerSearch, int typeloc ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - if( PtStruct->m_StructType != TYPEMIRE ) + if( PtStruct->Type() != TYPEMIRE ) continue; if( LayerSearch != -1 && PtStruct->GetLayer() != LayerSearch ) diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index 0b093bf671..9ed1b9e769 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -46,7 +46,7 @@ public: // Constructor and destructor WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent, MIREPCB* Mire, wxDC* DC, const wxPoint& pos ); - ~WinEDA_MirePropertiesFrame( void ) + ~WinEDA_MirePropertiesFrame() { } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 280d205047..0e847cd68c 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -19,7 +19,7 @@ /*********************************************************************/ -EDA_BaseStruct* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( void ) +EDA_BaseStruct* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay() /*********************************************************************/ { EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); @@ -441,7 +441,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) EDGE_MODULE* edge = NULL; if( GetScreen()->GetCurItem() && ( GetScreen()->GetCurItem()->m_Flags & IS_NEW) - && (GetScreen()->GetCurItem()->m_StructType == TYPEEDGEMODULE) ) + && (GetScreen()->GetCurItem()->Type() == TYPEEDGEMODULE) ) { edge = (EDGE_MODULE*) GetScreen()->GetCurItem(); } @@ -602,13 +602,13 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, wxDC* DC, int transform /* Rectification des contours et textes de l'empreinte : */ for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType == TYPEEDGEMODULE ) + if( PtStruct->Type() == TYPEEDGEMODULE ) { edgemod = (EDGE_MODULE*) PtStruct; edgemod->m_Start0 = edgemod->m_Start; edgemod->m_End0 = edgemod->m_End; } - if( PtStruct->m_StructType == TYPETEXTEMODULE ) + if( PtStruct->Type() == TYPETEXTEMODULE ) { /* deplacement des inscriptions : */ textmod = (TEXTE_MODULE*) PtStruct; @@ -648,7 +648,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, wxDC* DC, int transform PtStruct = module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: edgemod = (EDGE_MODULE*) PtStruct; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 38c0d06ac9..1f61b6056e 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -41,7 +41,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours { - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPETEXTEMODULE: SaveCopyInUndoList( m_Pcb->m_Modules ); @@ -63,7 +63,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) msg.Printf( wxT( "WinEDA_ModEditFrame::ProcessCommand err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), - DrawStruct, DrawStruct->m_StructType, DrawStruct->m_Flags ); + DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags ); DisplayError( this, msg ); DrawStruct->m_Flags = 0; break; @@ -241,7 +241,7 @@ void WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, int flags = DrawStruct->m_Flags; - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPEMODULE: { @@ -343,14 +343,14 @@ void WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, case PCB_EQUIPOT_STRUCT_TYPE: msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; default: msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; } @@ -398,7 +398,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) // Element localisé m_CurrentScreen->SetCurItem( DrawStruct ); - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPEPAD: InstallPadOptionsFrame( diff --git a/pcbnew/modedit_undo_redo.cpp b/pcbnew/modedit_undo_redo.cpp index eb3ac61e45..f42a086bef 100644 --- a/pcbnew/modedit_undo_redo.cpp +++ b/pcbnew/modedit_undo_redo.cpp @@ -40,7 +40,7 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, /*********************************************************/ -void WinEDA_ModuleEditFrame::GetComponentFromRedoList( void ) +void WinEDA_ModuleEditFrame::GetComponentFromRedoList() /*********************************************************/ /* Redo the last edition: @@ -64,7 +64,7 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList( void ) /*********************************************************/ -void WinEDA_ModuleEditFrame::GetComponentFromUndoList( void ) +void WinEDA_ModuleEditFrame::GetComponentFromUndoList() /*********************************************************/ /* Undo the last edition: diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 104b9e8ccc..91f3733c98 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -160,7 +160,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* pa /****************************************************/ -WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame( void ) +WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame() /****************************************************/ { m_Parent->m_ModuleEditFrame = NULL; @@ -192,7 +192,7 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event ) /*********************************************/ -void WinEDA_ModuleEditFrame::SetToolbars( void ) +void WinEDA_ModuleEditFrame::SetToolbars() /*********************************************/ { bool active, islib = TRUE; diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 59b12381f2..907cd87170 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -69,7 +69,7 @@ void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) /***************************************************/ -MODULE* WinEDA_BasePcbFrame::GetModuleByName( void ) +MODULE* WinEDA_BasePcbFrame::GetModuleByName() /***************************************************/ /* Get a module name from user and return a pointer to the corresponding module @@ -435,7 +435,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC ) PtStruct = Module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: pt_edgmod = (EDGE_MODULE*) PtStruct; diff --git a/pcbnew/move_copy_track.cpp b/pcbnew/move_copy_track.cpp index 1b3b9d39c1..5c81456ac0 100644 --- a/pcbnew/move_copy_track.cpp +++ b/pcbnew/move_copy_track.cpp @@ -190,7 +190,7 @@ void WinEDA_PcbFrame::Start_MoveOneTrackSegment( TRACK* track, wxDC* DC, bool Dr if( g_HightLigt_Status ) Hight_Light( DC ); - if( Drag && track->m_StructType == TYPEVIA ) + if( Drag && track->Type() == TYPEVIA ) { track->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT; Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start, @@ -320,7 +320,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC ) LockPoint = LocateLockPoint( pt_track->m_Start.x, pt_track->m_Start.y, masquelayer ); if( LockPoint ) { - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { pt_pad = (D_PAD*) LockPoint; new_net_code = pt_pad->net_code; @@ -338,7 +338,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC ) LockPoint = LocateLockPoint( pt_track->m_End.x, pt_track->m_End.y, masquelayer ); if( LockPoint ) { - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { pt_pad = (D_PAD*) LockPoint; new_net_code = pt_pad->net_code; @@ -414,7 +414,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC ) if( LockPoint ) { pt_track->start = LockPoint; - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { /* fin de piste sur un pad */ pt_pad = (D_PAD*) LockPoint; pt_track->SetState( BEGIN_ONPAD, ON ); @@ -431,7 +431,7 @@ void WinEDA_PcbFrame::Place_Dupl_Route( Track* Track, wxDC* DC ) if( LockPoint ) { pt_track->end = LockPoint; - if( LockPoint->m_StructType == TYPEPAD ) + if( LockPoint->Type() == TYPEPAD ) { /* fin de piste sur un pad */ pt_pad = (D_PAD*) LockPoint; pt_track->SetState( END_ONPAD, ON ); @@ -627,7 +627,7 @@ TRACK* CreateLockPoint( int* pX, int* pY, TRACK* ptsegm, TRACK* refsegm ) return NULL; /* le point n'est pas sur une extremite de piste */ - if( ptsegm->m_StructType == TYPEVIA ) + if( ptsegm->Type() == TYPEVIA ) { *pX = ptsegm->m_Start.x; *pY = ptsegm->m_Start.y; return ptsegm; diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index cddb107cfa..9f556be89e 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -21,7 +21,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC ); -static bool InitialiseDragParameters( void ); +static bool InitialiseDragParameters(); /* variables locales */ static wxPoint PosInit, s_LastPos; @@ -427,7 +427,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel, /**********************************/ -bool InitialiseDragParameters( void ) +bool InitialiseDragParameters() /**********************************/ /* Init variables (slope, Y intersect point, flags) for Show_Drag_Track_Segment_With_Cte_Slope() @@ -613,7 +613,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co Hight_Light( DC ); PosInit = GetScreen()->m_Curseur; - if( track->m_StructType == TYPEVIA ) + if( track->Type() == TYPEVIA ) { track->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT; if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) @@ -681,7 +681,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC s_StartSegmentPresent = s_EndSegmentPresent = TRUE; - if( (track->start == NULL) || (track->start->m_StructType == TYPETRACK) ) + if( (track->start == NULL) || (track->start->Type() == TYPETRACK) ) TrackToStartPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, START ); // Test if more than one segment is connected to this point @@ -693,7 +693,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC TrackToStartPoint->SetState( BUSY, OFF ); } - if( (track->end == NULL) || (track->end->m_StructType == TYPETRACK) ) + if( (track->end == NULL) || (track->end->Type() == TYPETRACK) ) TrackToEndPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, END ); // Test if more than one segment is connected to this point @@ -711,10 +711,10 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC return; } - if( !TrackToStartPoint || (TrackToStartPoint->m_StructType != TYPETRACK) ) + if( !TrackToStartPoint || (TrackToStartPoint->Type() != TYPETRACK) ) s_StartSegmentPresent = FALSE; - if( !TrackToEndPoint || (TrackToEndPoint->m_StructType != TYPETRACK) ) + if( !TrackToEndPoint || (TrackToEndPoint->Type() != TYPETRACK) ) s_EndSegmentPresent = FALSE; /* Change hight light net: the new one will be hightlighted */ @@ -902,7 +902,7 @@ TRACK* CreateLockPoint( int* pX, int* pY, TRACK* ptsegm, TRACK* refsegm ) return NULL; /* le point n'est pas sur une extremite de piste */ - if( ptsegm->m_StructType == TYPEVIA ) + if( ptsegm->Type() == TYPEVIA ) { *pX = ptsegm->m_Start.x; *pY = ptsegm->m_Start.y; return ptsegm; diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 07180d6c3b..3f105a79d7 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -306,7 +306,7 @@ public: // Constructor and destructor WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent, const wxPoint& pos ); - ~WinEDA_SetParamShapeFrame( void ) { }; + ~WinEDA_SetParamShapeFrame() { }; private: void OnCloseWindow( wxCloseEvent& event ); diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 7e16554da6..280e7f4a87 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -39,8 +39,8 @@ public: public: MODULEtoLOAD( const wxString& libname, const wxString& cmpname, int timestamp ); - ~MODULEtoLOAD( void ) { }; - MODULEtoLOAD* Next( void ) { return (MODULEtoLOAD*) Pnext; } + ~MODULEtoLOAD() { }; + MODULEtoLOAD* Next() { return (MODULEtoLOAD*) Pnext; } }; /* Fonctions locales : */ @@ -496,7 +496,7 @@ int WinEDA_NetlistFrame::SetPadNetName( char* Text, MODULE* Module ) /*****************************************************/ -MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void ) +MODULE* WinEDA_PcbFrame::ListAndSelectModuleName() /*****************************************************/ /* liste les noms des modules du PCB diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 6c5199f619..bcc2f50ffa 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -70,7 +70,7 @@ static void CreatePopUpBlockMenu( wxMenu* menu ); /********************************************/ -static wxMenu* Append_Track_Width_List( void ) +static wxMenu* Append_Track_Width_List() /********************************************/ /* Ajoute au menu wxMenu * menu un sous-menu liste des epaisseurs de pistes @@ -205,7 +205,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) if( DrawStruct ) { - switch( DrawStruct->m_StructType ) + switch( DrawStruct->Type() ) { case TYPEMODULE: if( !flags ) @@ -343,14 +343,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) case PCB_EQUIPOT_STRUCT_TYPE: msg.Printf( wxT( "WinEDA_PcbFrame::OnRightClick() Error: illegal DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; default: msg.Printf( wxT( "WinEDA_PcbFrame::OnRightClick() Error: unknown DrawType %d" ), - DrawStruct->m_StructType ); + DrawStruct->Type() ); DisplayError( this, msg ); break; } @@ -367,9 +367,9 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) PopMenu->Append( ID_POPUP_PCB_FILL_ZONE, _( "Fill zone" ) ); if( DrawStruct - && ( (DrawStruct->m_StructType == TYPEPAD) - || (DrawStruct->m_StructType == TYPETRACK) - || (DrawStruct->m_StructType == TYPEVIA) ) ) + && ( (DrawStruct->Type() == TYPEPAD) + || (DrawStruct->Type() == TYPETRACK) + || (DrawStruct->Type() == TYPEVIA) ) ) { add_separator = TRUE; PopMenu->Append( ID_POPUP_PCB_SELECT_NET_ZONE, _( "Select Net" ) ); @@ -512,7 +512,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition, if( flags == 0 ) { - if( Track->m_StructType == TYPEVIA ) + if( Track->Type() == TYPEVIA ) { ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), move_xpm ); wxMenu* via_mnu = new wxMenu(); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index c4d8b558d4..df8955b126 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -237,7 +237,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, } -WinEDA_PcbFrame::~WinEDA_PcbFrame( void ) +WinEDA_PcbFrame::~WinEDA_PcbFrame() { m_Parent->m_PcbFrame = NULL; m_CurrentScreen = ScreenPcb; @@ -312,7 +312,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event ) /***************************************/ -void WinEDA_PcbFrame::SetToolbars( void ) +void WinEDA_PcbFrame::SetToolbars() /***************************************/ /* diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 2a200a03fb..aedb320306 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -29,7 +29,7 @@ wxString g_Main_Title( wxT( "PCBNEW" ) ); IMPLEMENT_APP( WinEDA_App ) /****************************/ -bool WinEDA_App::OnInit( void ) +bool WinEDA_App::OnInit() /****************************/ { wxString FFileName; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index b425d4dfb6..b469441774 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -60,7 +60,7 @@ eda_global wxSize g_GridList[] ; #define UNDELETE_STACK_SIZE 10 -eda_global EDA_BaseStruct* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Liste des elements supprimes +eda_global BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Liste des elements supprimes eda_global int g_UnDeleteStackPtr; eda_global bool g_ShowGrid diff --git a/pcbnew/pcbpiste.cpp b/pcbnew/pcbpiste.cpp index fee1cd45e2..999df09726 100644 --- a/pcbnew/pcbpiste.cpp +++ b/pcbnew/pcbpiste.cpp @@ -185,7 +185,7 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this); for ( ; pt_segm != NULL;pt_segm = (TRACK*)pt_segm->Pnext ) { m_CurrentScreen->SetModify(); - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { SEGVIA * Via = (SEGVIA *) pt_segm; if ( Via->Shape() == VIA_NORMALE ) continue; @@ -217,7 +217,7 @@ WinEDA_SwapLayerFrame * frame = new WinEDA_SwapLayerFrame(this); PtStruct = m_Pcb->m_Drawings; for ( ; PtStruct != NULL ; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType == TYPEDRAWSEGMENT ) + if( PtStruct->Type() == TYPEDRAWSEGMENT ) { m_CurrentScreen->SetModify(); pt_drawsegm = (DRAWSEGMENT *) PtStruct; diff --git a/pcbnew/pcbtexte.cpp b/pcbnew/pcbtexte.cpp index 10fca1ce3d..c68ba1b4c6 100644 --- a/pcbnew/pcbtexte.cpp +++ b/pcbnew/pcbtexte.cpp @@ -50,7 +50,7 @@ public: // Constructor and destructor WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, TEXTE_PCB* TextPCB, wxDC* DC, const wxPoint& pos ); - ~WinEDA_TextPCBPropertiesFrame( void ) + ~WinEDA_TextPCBPropertiesFrame() { } diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index 368fa3badb..66942342b7 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -44,7 +44,7 @@ wxString msg; PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: PlotDrawSegment( (DRAWSEGMENT*) PtStruct, format_plot, masque_layer ); @@ -71,7 +71,7 @@ wxString msg; break; default: - DisplayError(this, wxT("Plot_Serigraphie() error: unexpected m_StructType")); + DisplayError(this, wxT("Plot_Serigraphie() error: unexpected Type()")); break; } } @@ -234,7 +234,7 @@ wxString msg; pt_texte = (TEXTE_MODULE *) Module->m_Drawings; for( ;pt_texte != NULL ; pt_texte = (TEXTE_MODULE*)pt_texte->Pnext) { - if(pt_texte->m_StructType != TYPETEXTEMODULE ) continue; + if(pt_texte->Type() != TYPETEXTEMODULE ) continue; if( !Sel_Texte_Divers ) continue; if( (pt_texte->m_NoShow) && !Sel_Texte_Invisible ) @@ -386,7 +386,7 @@ wxString msg; PtEdge = (EDGE_MODULE*) Module->m_Drawings; for ( ;PtEdge != NULL; PtEdge = (EDGE_MODULE*)PtEdge->Pnext) { - if(PtEdge->m_StructType != TYPEEDGEMODULE) continue; + if(PtEdge->Type() != TYPEEDGEMODULE) continue; if( (g_TabOneLayerMask[PtEdge->GetLayer()] & masque_layer) == 0) continue; Plot_1_EdgeModule(format_plot, PtEdge); } @@ -407,7 +407,7 @@ int rayon; /* rayon des cercles a tracer */ int StAngle, EndAngle; wxPoint pos, end; /* Coord des segments a tracer */ - if(PtEdge->m_StructType != TYPEEDGEMODULE) return; + if(PtEdge->Type() != TYPEEDGEMODULE) return; type_trace = PtEdge->m_Shape; epaisseur = PtEdge->m_Width; if ( Plot_Mode == FILAIRE ) epaisseur = g_PlotLine_Width; @@ -453,7 +453,7 @@ wxPoint pos, end; /* Coord des segments a tracer */ // which are relative to module position, orientation 0 int ii, * source, * ptr, * ptr_base; MODULE * Module = NULL; - if ( PtEdge->m_Parent && (PtEdge->m_Parent->m_StructType == TYPEMODULE) ) + if ( PtEdge->m_Parent && (PtEdge->m_Parent->Type() == TYPEMODULE) ) Module = (MODULE*) PtEdge->m_Parent; ptr = ptr_base = (int*) MyMalloc( 2 * PtEdge->m_PolyCount * sizeof(int) ); source = PtEdge->m_PolyList; diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index aa5504a07e..d0842de4cc 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -157,7 +157,7 @@ wxString msg; PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: PlotDrawSegment( (DRAWSEGMENT*) PtStruct, PLOT_FORMAT_GERBER, @@ -197,7 +197,7 @@ wxString msg; PtStruct = Module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: if( masque_layer & g_TabOneLayerMask[((EDGE_MODULE*)PtStruct)->GetLayer()] ) @@ -268,7 +268,7 @@ wxString msg; Affiche_1_Parametre(this, 56, wxT("Vias"), wxEmptyString,RED) ; for( track = m_Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext) { - if( track->m_StructType != TYPEVIA ) continue; + if( track->Type() != TYPEVIA ) continue; SEGVIA * Via = (SEGVIA *) track; /* vias not plotted if not on selected layer, but if layer == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn , @@ -294,7 +294,7 @@ wxString msg; { wxPoint end; - if ( track->m_StructType == TYPEVIA ) continue ; + if ( track->Type() == TYPEVIA ) continue ; if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) continue; size.x = size.y = track->m_Width; diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index ff84d939ca..9dc2dbc2d0 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -213,7 +213,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_HPGL( FILE* File, int masque_layer, PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: PlotDrawSegment( (DRAWSEGMENT*) PtStruct, PLOT_FORMAT_HPGL, @@ -253,7 +253,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_HPGL( FILE* File, int masque_layer, PtStruct = Module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: if( masque_layer & @@ -330,7 +330,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_HPGL( FILE* File, int masque_layer, for( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext ) { - if( pts->m_StructType != TYPEVIA ) + if( pts->Type() != TYPEVIA ) continue; SEGVIA* Via = (SEGVIA*) pts; @@ -362,7 +362,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_HPGL( FILE* File, int masque_layer, Affiche_1_Parametre( this, 64, wxT( "Tracks " ), wxEmptyString, YELLOW ); for( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext ) { - if( pts->m_StructType == TYPEVIA ) + if( pts->Type() == TYPEVIA ) continue; if( (g_TabOneLayerMask[pts->GetLayer()] & masque_layer) == 0 ) diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 9b8b2d69bb..1cb8827265 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -251,7 +251,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_PS( FILE* File, int masque_layer, PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEDRAWSEGMENT: PlotDrawSegment( (DRAWSEGMENT*) PtStruct, PLOT_FORMAT_POST, @@ -292,7 +292,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_PS( FILE* File, int masque_layer, PtStruct = Module->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEEDGEMODULE: if( masque_layer & g_TabOneLayerMask[ PtStruct->GetLayer() ] ) @@ -361,7 +361,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_PS( FILE* File, int masque_layer, Affiche_1_Parametre( this, 56, _( "Vias" ), wxEmptyString, RED ); for( pts = m_Pcb->m_Track; pts != NULL; pts = pts->Next() ) { - if( pts->m_StructType != TYPEVIA ) + if( pts->Type() != TYPEVIA ) continue; SEGVIA* Via = (SEGVIA*) pts; @@ -391,7 +391,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_PS( FILE* File, int masque_layer, for( pts = m_Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext ) { - if( pts->m_StructType == TYPEVIA ) + if( pts->Type() == TYPEVIA ) continue; if( (g_TabOneLayerMask[pts->GetLayer()] & masque_layer) == 0 ) @@ -458,7 +458,7 @@ static void PrintDrillMark( BOARD* Pcb ) for( pts = Pcb->m_Track; pts != NULL; pts = (TRACK*) pts->Pnext ) { - if( pts->m_StructType != TYPEVIA ) + if( pts->Type() != TYPEVIA ) continue; pos = pts->m_Start; if( g_DrillShapeOpt == DRILL_MARK ) diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 9a8b230f2a..6824f5e311 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -375,8 +375,8 @@ void RemoteCommand( const char* cmdline ); /*************/ /* STRUCT.CPP */ /*************/ -void DeleteStructure(EDA_BaseStruct * Struct); -void DeleteStructList( EDA_BaseStruct * Struct); +void DeleteStructure( BOARD_ITEM* Struct ); +void DeleteStructList( BOARD_ITEM* Struct ); /***************/ diff --git a/pcbnew/queue.cpp b/pcbnew/queue.cpp index 70940fef82..479f2637f6 100644 --- a/pcbnew/queue.cpp +++ b/pcbnew/queue.cpp @@ -29,7 +29,7 @@ static struct PcbQueue *Tail = NULL; static struct PcbQueue *Save = NULL; /* hold empty queue structs */ /* Routines definies ici : */ -void InitQueue( void ); +void InitQueue(); void GetQueue( int *, int *, int *, int *, int * ); int SetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int ); diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 1b0f0f096b..6fab12f784 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -712,7 +712,7 @@ int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode ) /*****************************************************/ -void WinEDA_BasePcbFrame::recalcule_pad_net_code( void ) +void WinEDA_BasePcbFrame::recalcule_pad_net_code() /*****************************************************/ /* @@ -826,7 +826,7 @@ void WinEDA_BasePcbFrame::recalcule_pad_net_code( void ) /***********************************************/ -void WinEDA_BasePcbFrame::build_liste_pads( void ) +void WinEDA_BasePcbFrame::build_liste_pads() /***********************************************/ /* @@ -1238,7 +1238,7 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref, if( ref == NULL ) return NULL; - switch( ref->m_StructType ) + switch( ref->Type() ) { case TYPEPAD: pad_ref = (D_PAD*) ref; diff --git a/pcbnew/router.cpp b/pcbnew/router.cpp index 85e7e09bdd..7a0023556f 100644 --- a/pcbnew/router.cpp +++ b/pcbnew/router.cpp @@ -336,9 +336,9 @@ static void ReturnNbViasAndTracks( BOARD* Pcb, int netcode, int* nb_vias, return; if( track->m_NetCode != netcode ) continue; - if( track->m_StructType == TYPEVIA ) + if( track->Type() == TYPEVIA ) (*nb_vias)++; - if( track->m_StructType == TYPETRACK ) + if( track->Type() == TYPETRACK ) (*nb_tracks)++; } } @@ -370,10 +370,10 @@ static void GenExistantTracks( BOARD* Pcb, FILE* outfile, plink = track->m_Sous_Netcode; via_min_layer = track->GetLayer(); - if( track->m_StructType != type ) + if( track->Type() != type ) continue; - if( track->m_StructType == TYPEVIA ) + if( track->Type() == TYPEVIA ) { via_min_layer &= 15; via_max_layer = (track->GetLayer() >> 4) & 15; @@ -406,7 +406,7 @@ static void GenExistantTracks( BOARD* Pcb, FILE* outfile, fprintf( outfile, "q c 0 %d 0 0 0\n", track->m_Width / PSCALE ); } - if( track->m_StructType == TYPETRACK ) + if( track->Type() == TYPETRACK ) { fprintf( outfile, "t 0 %d", track->m_Width / PSCALE ); fprintf( outfile, " %d %d", track->m_Start.x / PSCALE, track->m_Start.y / PSCALE ); @@ -449,7 +449,7 @@ static int GenEdges( BOARD* Pcb, FILE* outfile ) /* impression des contours */ for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; PtDrawSegment = (DRAWSEGMENT*) PtStruct; diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index c66fa6ac5b..1609246dd3 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -39,7 +39,7 @@ public: // Constructor and destructor WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, int default_layer, int min_layer, int max_layer ); - ~WinEDA_SelLayerFrame( void ) { }; + ~WinEDA_SelLayerFrame() { }; private: void Sel_Layer( wxCommandEvent& event ); @@ -176,7 +176,7 @@ public: // Constructor and destructor WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent ); - ~WinEDA_SelLayerPairFrame( void ) { }; + ~WinEDA_SelLayerPairFrame() { }; private: void Sel_Layer( wxCommandEvent& event ); @@ -194,7 +194,7 @@ EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerPairFrame::Sel_Layer ) END_EVENT_TABLE() /***********************************************/ -void WinEDA_BasePcbFrame::SelectLayerPair( void ) +void WinEDA_BasePcbFrame::SelectLayerPair() /***********************************************/ /* Affiche une double liste de layers cuivre pour selection d'une paire de layers diff --git a/pcbnew/set_color.cpp b/pcbnew/set_color.cpp index e9e45f0b5b..50f6ed22d3 100644 --- a/pcbnew/set_color.cpp +++ b/pcbnew/set_color.cpp @@ -35,16 +35,16 @@ struct ColorButton { const wxString m_Title; int m_LayerNumber; - int* m_Color; // Pointeur sur la variable couleur - bool m_NoDisplayIsColor; // TRUE si bit ITEM_NOT_SHOW de la variable Color - bool* m_NoDisplay; // Pointeur sur la variable Display on/off si ce n'est pas la var - // Color + int* m_Color; ///< pointer to color variable to manipulate + bool m_NoDisplayIsColor; ///< TRUE if bit ITEM_NOT_SHOW of the color variable should be manipulated + bool* m_NoDisplay; ///< pointer to the on/off display control variable, if it is not the color variable int m_Id; wxBitmapButton* m_Button; int m_State; - wxCheckBox* m_CheckBox; // Option Display ON/OFF + wxCheckBox* m_CheckBox; ///< Display ON/OFF toggle }; + static ColorButton Msg_Layers_Cu = { _( "Copper Layers" ), -1 /* Title */ @@ -60,7 +60,7 @@ static ColorButton Layer_1_Butt = wxEmptyString, CUIVRE_N, /* Title */ ADR( CUIVRE_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_2_Butt = @@ -68,7 +68,7 @@ static ColorButton Layer_2_Butt = wxEmptyString, 1, /* Title */ ADR( 1 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_3_Butt = @@ -76,7 +76,7 @@ static ColorButton Layer_3_Butt = wxEmptyString, 2, /* Title */ ADR( 2 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_4_Butt = @@ -84,7 +84,7 @@ static ColorButton Layer_4_Butt = wxEmptyString, 3, /* Title */ ADR( 3 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_5_Butt = @@ -92,7 +92,7 @@ static ColorButton Layer_5_Butt = wxEmptyString, 4, /* Title */ ADR( 4 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_6_Butt = @@ -100,7 +100,7 @@ static ColorButton Layer_6_Butt = wxEmptyString, 5, /* Title */ ADR( 5 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_7_Butt = @@ -108,7 +108,7 @@ static ColorButton Layer_7_Butt = wxEmptyString, 6, /* Title */ ADR( 6 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_8_Butt = @@ -116,7 +116,7 @@ static ColorButton Layer_8_Butt = wxEmptyString, 7, /* Title */ ADR( 7 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_9_Butt = @@ -124,7 +124,7 @@ static ColorButton Layer_9_Butt = wxEmptyString, 8, /* Title */ ADR( 8 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_10_Butt = @@ -132,7 +132,7 @@ static ColorButton Layer_10_Butt = wxEmptyString, 9, /* Title */ ADR( 9 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_11_Butt = @@ -140,7 +140,7 @@ static ColorButton Layer_11_Butt = wxEmptyString, 10, /* Title */ ADR( 10 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_12_Butt = @@ -148,7 +148,7 @@ static ColorButton Layer_12_Butt = wxEmptyString, 11, /* Title */ ADR( 11 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_13_Butt = @@ -156,7 +156,7 @@ static ColorButton Layer_13_Butt = wxEmptyString, 12, /* Title */ ADR( 12 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_14_Butt = @@ -164,7 +164,7 @@ static ColorButton Layer_14_Butt = wxEmptyString, 13, /* Title */ ADR( 13 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_15_Butt = @@ -172,7 +172,7 @@ static ColorButton Layer_15_Butt = wxEmptyString, 14, /* Title */ ADR( 14 ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_16_Butt = @@ -180,7 +180,7 @@ static ColorButton Layer_16_Butt = wxEmptyString, CMP_N, /* Title */ ADR( CMP_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_17_Butt = @@ -188,7 +188,7 @@ static ColorButton Layer_17_Butt = wxEmptyString, ADHESIVE_N_CU, /* Title */ ADR( ADHESIVE_N_CU ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_18_Butt = @@ -196,7 +196,7 @@ static ColorButton Layer_18_Butt = wxEmptyString, ADHESIVE_N_CMP, /* Title */ ADR( ADHESIVE_N_CMP ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_19_Butt = @@ -204,7 +204,7 @@ static ColorButton Layer_19_Butt = wxEmptyString, SOLDERPASTE_N_CU, /* Title */ ADR( SOLDERPASTE_N_CU ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_20_Butt = @@ -212,7 +212,7 @@ static ColorButton Layer_20_Butt = wxEmptyString, SOLDERPASTE_N_CMP, /* Title */ ADR( SOLDERPASTE_N_CMP ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_21_Butt = @@ -220,7 +220,7 @@ static ColorButton Layer_21_Butt = wxEmptyString, SILKSCREEN_N_CU, /* Title */ ADR( SILKSCREEN_N_CU ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_22_Butt = @@ -228,7 +228,7 @@ static ColorButton Layer_22_Butt = wxEmptyString, SILKSCREEN_N_CMP, /* Title */ ADR( SILKSCREEN_N_CMP ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_23_Butt = @@ -244,7 +244,7 @@ static ColorButton Layer_24_Butt = wxEmptyString, SOLDERMASK_N_CMP, /* Title */ ADR( SOLDERMASK_N_CMP ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_25_Butt = @@ -252,7 +252,7 @@ static ColorButton Layer_25_Butt = wxEmptyString, DRAW_N, /* Title */ ADR( DRAW_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_26_Butt = @@ -260,7 +260,7 @@ static ColorButton Layer_26_Butt = wxEmptyString, COMMENT_N, /* Title */ ADR( COMMENT_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_27_Butt = @@ -268,7 +268,7 @@ static ColorButton Layer_27_Butt = wxEmptyString, ECO1_N, /* Title */ ADR( ECO1_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_28_Butt = @@ -276,7 +276,7 @@ static ColorButton Layer_28_Butt = wxEmptyString, ECO2_N, /* Title */ ADR( ECO2_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Layer_29_Butt = @@ -284,7 +284,7 @@ static ColorButton Layer_29_Butt = wxEmptyString, EDGE_N, /* Title */ ADR( EDGE_N ), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; @@ -298,7 +298,7 @@ static ColorButton Via_Normale_Butt = wxT( "*" ), VIA_NORMALE, /* Title */ &g_DesignSettings.m_ViaColor[VIA_NORMALE], /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Via_Aveugle_Butt = @@ -306,7 +306,7 @@ static ColorButton Via_Aveugle_Butt = wxT( "*" ), VIA_ENTERREE, /* Title */ &g_DesignSettings.m_ViaColor[VIA_ENTERREE], /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Via_Borgne_Butt = @@ -314,7 +314,7 @@ static ColorButton Via_Borgne_Butt = wxT( "*" ), VIA_BORGNE, /* Title */ &g_DesignSettings.m_ViaColor[VIA_BORGNE], /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Ratsnest_Butt = @@ -322,7 +322,7 @@ static ColorButton Ratsnest_Butt = _( "Ratsnest" ), /* Title */ -1, &g_DesignSettings.m_RatsnestColor, /* adr du parametre optionnel */ - FALSE, &g_Show_Ratsnest /* adr du parametre avec flag ITEM_NOT_SHOW */ + FALSE, &g_Show_Ratsnest // address of boolean display control parameter to toggle }; static ColorButton Pad_Cu_Butt = @@ -330,7 +330,7 @@ static ColorButton Pad_Cu_Butt = _( "Pad Cu" ), /* Title */ -1, &g_PadCUColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Pad_Cmp_Butt = @@ -338,7 +338,7 @@ static ColorButton Pad_Cmp_Butt = _( "Pad Cmp" ), /* Title */ -1, &g_PadCMPColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Text_Mod_Cu_Butt = @@ -346,7 +346,7 @@ static ColorButton Text_Mod_Cu_Butt = _( "Text Module Cu" ), /* Title */ -1, &g_ModuleTextCUColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Text_Mod_Cmp_Butt = @@ -354,7 +354,7 @@ static ColorButton Text_Mod_Cmp_Butt = _( "Text Module Cmp" ), /* Title */ -1, &g_ModuleTextCMPColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Text_Mod_NoVisible_Butt = @@ -362,7 +362,7 @@ static ColorButton Text_Mod_NoVisible_Butt = _( "Text Module invisible" ), /* Title */ -1, &g_ModuleTextNOVColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Anchors_Butt = @@ -370,7 +370,7 @@ static ColorButton Anchors_Butt = _( "Anchors" ), /* Title */ -1, &g_AnchorColor, /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NOT_SHOW */ + TRUE // toggle bit ITEM_NOT_SHOW of the color variable }; static ColorButton Grid_Butt = @@ -379,7 +379,7 @@ static ColorButton Grid_Butt = -1, &g_PcbGridColor, /* adr du parametre optionnel */ FALSE, - &g_ShowGrid /* parametre display on/off = bit ITEM_NOT_SHOW */ + &g_ShowGrid // address of boolean display control parameter to toggle }; static ColorButton Show_Zones_Butt = @@ -388,7 +388,7 @@ static ColorButton Show_Zones_Butt = -1, NULL, /* adr du parametre optionnel */ FALSE, - &DisplayOpt.DisplayZones /* adr du parametre avec flag ITEM_NOT_SHOW */ + &DisplayOpt.DisplayZones // address of boolean display control parameter to toggle }; static ColorButton Show_Pads_Noconnect_Butt = @@ -397,7 +397,7 @@ static ColorButton Show_Pads_Noconnect_Butt = -1, NULL, /* adr du parametre optionnel */ FALSE, - &DisplayOpt.DisplayPadNoConn /* adr du parametre avec flag ITEM_NOT_SHOW */ + &DisplayOpt.DisplayPadNoConn // address of boolean display control parameter to toggle }; static ColorButton Show_Modules_Cmp_Butt = @@ -406,7 +406,7 @@ static ColorButton Show_Modules_Cmp_Butt = -1, NULL, /* adr du parametre optionnel */ FALSE, - &DisplayOpt.Show_Modules_Cmp /* adr du parametre avec flag ITEM_NOT_SHOW */ + &DisplayOpt.Show_Modules_Cmp // address of boolean display control parameter to toggle }; static ColorButton Show_Modules_Cu_Butt = @@ -415,7 +415,7 @@ static ColorButton Show_Modules_Cu_Butt = -1, NULL, /* adr du parametre optionnel */ FALSE, - &DisplayOpt.Show_Modules_Cu /* adr du parametre avec flag ITEM_NOT_SHOW */ + &DisplayOpt.Show_Modules_Cu // address of boolean display control parameter to toggle }; @@ -490,7 +490,7 @@ public: // Constructor and destructor WinEDA_SetColorsFrame( WinEDA_DrawFrame * parent, const wxPoint &framepos ); - ~WinEDA_SetColorsFrame( void ) { }; + ~WinEDA_SetColorsFrame() { }; private: void OnQuit( wxCommandEvent& event ); @@ -568,11 +568,9 @@ void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, /**********************************************************************/ -WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, - const wxPoint& framepos ) : - wxDialog( parent, -1, _( "Colors:" ), framepos, - wxSize( -1, -1 ), - DIALOG_STYLE ) +WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( + WinEDA_DrawFrame* parent, const wxPoint& framepos ) : + wxDialog( parent, -1, _( "Colors:" ), framepos, wxSize( -1, -1 ), DIALOG_STYLE ) /**********************************************************************/ { #define START_Y 25 @@ -585,6 +583,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, wxString msg; m_Parent = parent; + SetFont( *g_DialogFont ); pos.x = 5; @@ -759,11 +758,13 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event ) wxBitmap ButtBitmap = Button->GetBitmapLabel(); iconDC.SelectObject( ButtBitmap ); + int buttcolor = *laytool_list[ii]->m_Color; wxBrush Brush; iconDC.SetPen( *wxBLACK_PEN ); + Brush.SetColour( ColorRefs[buttcolor].m_Red, ColorRefs[buttcolor].m_Green, @@ -775,8 +776,11 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event ) iconDC.SetBrush( Brush ); iconDC.DrawRectangle( 0, 0, w, h ); Button->SetBitmapLabel( ButtBitmap ); + Button->Refresh(); + SetDisplayOnOff( event ); + m_Parent->m_CurrentScreen->SetRefreshReq(); } @@ -807,6 +811,11 @@ void WinEDA_SetColorsFrame::SetDisplayOnOff( wxCommandEvent& event ) else { *laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue(); + + // a hack, we have g_DrawGrid and m_Parent->m_Draw_Grid both. + // show me a better way, please. + if( laytool_list[ii]->m_NoDisplay == &g_ShowGrid ) + m_Parent->m_Draw_Grid = g_ShowGrid; } m_Parent->m_CurrentScreen->SetRefreshReq(); diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index e900010acf..b870be490e 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -1008,7 +1008,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, { /* Reduction des segments alignes a 1 seul */ OldTrack = (TRACK*) g_CurrentTrackSegment->Pback; - if( OldTrack && (OldTrack->m_StructType != TYPEVIA) ) + if( OldTrack && (OldTrack->Type() != TYPEVIA) ) { dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x; dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y; diff --git a/pcbnew/struct.cpp b/pcbnew/struct.cpp index 037907f11a..6f06c10a55 100644 --- a/pcbnew/struct.cpp +++ b/pcbnew/struct.cpp @@ -1,6 +1,6 @@ - /***********************************************/ - /* Routines d'effacement et copie de structures*/ - /***********************************************/ +/***********************************************/ +/* Routines d'effacement et copie de structures*/ +/***********************************************/ #include "fctsys.h" #include "gr_basic.h" @@ -13,148 +13,152 @@ /**************************************************/ -void DeleteStructure( EDA_BaseStruct * PtStruct ) +void DeleteStructure( BOARD_ITEM* PtStruct ) /**************************************************/ + /* Supprime de la liste chainee la stucture pointee par GenericStructure - et libere la memoire correspondante -*/ + * et libere la memoire correspondante + */ { -EDA_BaseStruct *PtNext, *PtBack; -int IsDeleted; -int typestruct; -wxString Line; + BOARD_ITEM* PtNext; + BOARD_ITEM* PtBack; + int IsDeleted; + wxString Line; - if( PtStruct == NULL) return ; + if( PtStruct == NULL ) + return; - typestruct = (int)PtStruct->m_StructType; - IsDeleted = PtStruct->GetState(DELETED); + IsDeleted = PtStruct->GetState( DELETED ); - PtNext = PtStruct->Pnext; - PtBack = PtStruct->Pback; + PtNext = PtStruct->Next(); + PtBack = PtStruct->Back(); - switch( typestruct ) - { - case TYPE_NOT_INIT: - DisplayError(NULL, wxT("DeleteStruct: Type Not Init")); - break; + KICAD_T typestruct = PtStruct->Type(); - case PCB_EQUIPOT_STRUCT_TYPE: - #undef Struct - #define Struct ((EQUIPOT*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + switch( typestruct ) + { + case TYPE_NOT_INIT: + DisplayError( NULL, wxT( "DeleteStruct: Type Not Init" ) ); + break; - case TYPEMODULE: - #undef Struct - #define Struct ((MODULE*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case PCB_EQUIPOT_STRUCT_TYPE: + #undef Struct + #define Struct ( (EQUIPOT*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; + + case TYPEMODULE: + #undef Struct + #define Struct ( (MODULE*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEPAD: - #undef Struct - #define Struct ((D_PAD*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEPAD: + #undef Struct + #define Struct ( (D_PAD*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPECOTATION: - #undef Struct - #define Struct ((COTATION*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPECOTATION: + #undef Struct + #define Struct ( (COTATION*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEMIRE: - #undef Struct - #define Struct ((MIREPCB*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEMIRE: + #undef Struct + #define Struct ( (MIREPCB*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEDRAWSEGMENT: - #undef Struct - #define Struct ((DRAWSEGMENT*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEDRAWSEGMENT: + #undef Struct + #define Struct ( (DRAWSEGMENT*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPETEXTE: - #undef Struct - #define Struct ((TEXTE_PCB*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPETEXTE: + #undef Struct + #define Struct ( (TEXTE_PCB*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPETEXTEMODULE: - #undef Struct - #define Struct ((TEXTE_MODULE*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPETEXTEMODULE: + #undef Struct + #define Struct ( (TEXTE_MODULE*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEEDGEMODULE: - #undef Struct - #define Struct ((EDGE_MODULE*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEEDGEMODULE: + #undef Struct + #define Struct ( (EDGE_MODULE*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPETRACK: - #undef Struct - #define Struct ((TRACK*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPETRACK: + #undef Struct + #define Struct ( (TRACK*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEVIA: - #undef Struct - #define Struct ((SEGVIA*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEVIA: + #undef Struct + #define Struct ( (SEGVIA*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEZONE: - #undef Struct - #define Struct ((SEGZONE*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEZONE: + #undef Struct + #define Struct ( (SEGZONE*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEMARQUEUR: - #undef Struct - #define Struct ((MARQUEUR*)PtStruct) - Struct->UnLink(); - delete Struct; - break; + case TYPEMARQUEUR: + #undef Struct + #define Struct ( (MARQUEUR*) PtStruct ) + Struct->UnLink(); + delete Struct; + break; - case TYPEPCB: + case TYPEPCB: - default: - Line.Printf( wxT(" DeleteStructure: unexpected Type %d"), - PtStruct->m_StructType); - DisplayError(NULL, Line); - break; - } + default: + Line.Printf( wxT( " DeleteStructure: unexpected Type %d" ), + PtStruct->Type() ); + DisplayError( NULL, Line ); + break; + } } /**************************************************/ -void DeleteStructList( EDA_BaseStruct * PtStruct ) +void DeleteStructList( BOARD_ITEM* PtStruct ) /**************************************************/ + /* Supprime la liste chainee pointee par PtStruct - et libere la memoire correspondante -*/ + * et libere la memoire correspondante + */ { -EDA_BaseStruct *PtNext; - while (PtStruct) - { - PtNext = PtStruct->Pnext; - delete PtStruct; - PtStruct = PtNext; - } -} + BOARD_ITEM* PtNext; + while( PtStruct ) + { + PtNext = PtStruct->Next(); + delete PtStruct; + PtStruct = PtNext; + } +} diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 9431ed529b..d4211d9ba5 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -36,7 +36,7 @@ public: // Constructor and destructor WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame * parent ); - ~WinEDA_SwapLayerFrame( void ) { }; + ~WinEDA_SwapLayerFrame() { }; private: void Sel_Layer( wxCommandEvent& event ); @@ -196,7 +196,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) for( ; pt_segm != NULL; pt_segm = (TRACK*) pt_segm->Pnext ) { m_CurrentScreen->SetModify(); - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { SEGVIA* Via = (SEGVIA*) pt_segm; if( Via->Shape() == VIA_NORMALE ) @@ -231,7 +231,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) PtStruct = m_Pcb->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) { - if( PtStruct->m_StructType == TYPEDRAWSEGMENT ) + if( PtStruct->Type() == TYPEDRAWSEGMENT ) { m_CurrentScreen->SetModify(); pt_drawsegm = (DRAWSEGMENT*) PtStruct; diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index d3b87753e8..a4a3d12e5b 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -34,7 +34,7 @@ #endif /***************************************************/ -void WinEDA_ModuleEditFrame::ReCreateHToolbar( void ) +void WinEDA_ModuleEditFrame::ReCreateHToolbar() /***************************************************/ /* Create the main horizontal toolbar for the footprint editor */ { @@ -144,7 +144,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar( void ) /********************************************************/ -void WinEDA_ModuleEditFrame::ReCreateVToolbar( void ) +void WinEDA_ModuleEditFrame::ReCreateVToolbar() /********************************************************/ { if( m_VToolBar ) @@ -196,7 +196,7 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar( void ) /*********************************************************/ -void WinEDA_ModuleEditFrame::ReCreateOptToolbar( void ) +void WinEDA_ModuleEditFrame::ReCreateOptToolbar() /*********************************************************/ { if( m_OptionsToolBar ) @@ -258,7 +258,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar( void ) /*********************************************************/ -void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar( void ) +void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() /*********************************************************/ { int ii; diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 2f97a5743b..9d5ba27567 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -78,7 +78,7 @@ static const char s_BitmapLayerIcon[16][16] = { /************************************************************/ -void WinEDA_PcbFrame::PrepareLayerIndicator( void ) +void WinEDA_PcbFrame::PrepareLayerIndicator() /************************************************************/ /* Draw the icon for the "Select layet pair" bitmap tool @@ -198,7 +198,7 @@ void WinEDA_PcbFrame::PrepareLayerIndicator( void ) /******************************************/ -void WinEDA_PcbFrame::ReCreateHToolbar( void ) +void WinEDA_PcbFrame::ReCreateHToolbar() /******************************************/ /* Create the main horizontal toolbar for the board editor */ @@ -317,7 +317,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar( void ) /*********************************************/ -void WinEDA_PcbFrame::ReCreateOptToolbar( void ) +void WinEDA_PcbFrame::ReCreateOptToolbar() /*********************************************/ // Create the left vertical toolbar (option selections) @@ -391,7 +391,7 @@ void WinEDA_PcbFrame::ReCreateOptToolbar( void ) /********************************************/ -void WinEDA_PcbFrame::ReCreateVToolbar( void ) +void WinEDA_PcbFrame::ReCreateVToolbar() /********************************************/ /* Create the main vertical right toolbar, showing usual tools @@ -471,7 +471,7 @@ void WinEDA_PcbFrame::ReCreateVToolbar( void ) /*********************************************/ -void WinEDA_PcbFrame::ReCreateAuxVToolbar( void ) +void WinEDA_PcbFrame::ReCreateAuxVToolbar() /*********************************************/ /* Create the auxiliary vertical right toolbar, showing tools fo microwave applications @@ -523,7 +523,7 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar( void ) /****************************************************/ -void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar( void ) +void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() /****************************************************/ /* Create auxiliary horizontal toolbar diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 84aed9e82e..82e69fd9c4 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -42,7 +42,7 @@ TRACK * BufDeb, *BufEnd; /* Pointeurs de debut et de fin de la zone la piste complete en utilisant le segment suivant comme reference, car une via est souvent sur un carrefour de segments, et ne caracterise pas une piste */ - if( pt_new_track->m_StructType == TYPEVIA && (nbptnewpiste > 1 ) ) + if( pt_new_track->Type() == TYPEVIA && (nbptnewpiste > 1 ) ) pt_new_track = (TRACK *) pt_new_track->Pnext; pt_new_track = Marque_Une_Piste(frame, DC, pt_new_track, &nbptnewpiste, 0); @@ -85,7 +85,7 @@ TRACK * BufDeb, *BufEnd; /* Pointeurs de debut et de fin de la zone /* Il peut y avoir une via ou un pad sur les extremites: */ pt_segm = Fast_Locate_Via(Pcb->m_Track, NULL, start, startmasklayer); if( pt_segm ) startmasklayer |= pt_segm->ReturnMaskLayer(); - if( StartTrack->start && (StartTrack->start->m_StructType == TYPEPAD) ) + if( StartTrack->start && (StartTrack->start->Type() == TYPEPAD) ) { /* start sur pad */ D_PAD * pt_pad = (D_PAD*) (StartTrack->start) ; startmasklayer |= pt_pad->m_Masque_Layer; @@ -93,7 +93,7 @@ TRACK * BufDeb, *BufEnd; /* Pointeurs de debut et de fin de la zone pt_segm = Fast_Locate_Via(Pcb->m_Track, NULL, end, endmasklayer); if( pt_segm ) endmasklayer |= pt_segm->ReturnMaskLayer(); - if( EndTrack->end && ( EndTrack->end->m_StructType == TYPEPAD) ) + if( EndTrack->end && ( EndTrack->end->Type() == TYPEPAD) ) { D_PAD * pt_pad = (D_PAD*) (EndTrack->end) ; endmasklayer |= pt_pad->m_Masque_Layer; @@ -123,7 +123,7 @@ TRACK * BufDeb, *BufEnd; /* Pointeurs de debut et de fin de la zone pt_segm = Fast_Locate_Piste( pt_del,BufEnd, end, endmasklayer ); if( pt_segm == NULL) break; - if(pt_segm->m_StructType != TYPEVIA) + if(pt_segm->Type() != TYPEVIA) { /* Segment trouve */ if( pt_segm->GetState(CHAIN) == 0 ) { diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index ab4e332236..a53d332365 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -148,7 +148,7 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) if( PtStruct->m_Flags & IS_MOVED ) continue; - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPECOTATION: ( (COTATION*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), mode ); @@ -204,7 +204,7 @@ void WinEDA_PcbFrame::Trace_PcbEdges( wxDC* DC, int mode_color ) { if( PtStruct->m_Flags & IS_MOVED ) continue; - if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) + if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue; Trace_DrawSegmentPcb( DrawPanel, DC, (DRAWSEGMENT*) PtStruct, mode_color ); } diff --git a/pcbnew/track.cpp b/pcbnew/track.cpp index c0fd838c71..468f1a147b 100644 --- a/pcbnew/track.cpp +++ b/pcbnew/track.cpp @@ -68,7 +68,7 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, * Si c'est une via, on doit examiner le nombre de segments connectes. * Si <=2, on doit detecter une piste, si > 2 seule la via est marquee */ - if( pt_segm->m_StructType == TYPEVIA ) + if( pt_segm->Type() == TYPEVIA ) { TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL; Segm1 = Fast_Locate_Piste( frame->m_Pcb->m_Track, NULL, @@ -108,7 +108,7 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, for( Segm = ListSegm; Segm != NULL; Segm = Segm->Pnext ) { int layer; - if( Segm->RefTrack->m_StructType != TYPEVIA ) + if( Segm->RefTrack->Type() != TYPEVIA ) continue; if( Segm->RefTrack == pt_segm ) continue; @@ -317,7 +317,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, NbEnds = 0; Track = RefTrack; ii = 0; for( ; (Track != NULL) && (ii < NbSegm); ii++, Track = (TRACK*) Track->Pnext ) { - if( Track->m_StructType == TYPEVIA ) + if( Track->Type() == TYPEVIA ) continue; masque_layer = Track->ReturnMaskLayer(); diff --git a/pcbnew/undelete.cpp b/pcbnew/undelete.cpp index 4d638b1eb9..71dad628ba 100644 --- a/pcbnew/undelete.cpp +++ b/pcbnew/undelete.cpp @@ -21,7 +21,7 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC ) /* Restitution d'un element (MODULE ou TRACK ) Efface */ { - EDA_BaseStruct* PtStruct, * PtNext; + BOARD_ITEM* PtStruct, * PtNext; TRACK* pt_track; int net_code; @@ -33,13 +33,13 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC ) if( PtStruct == NULL ) return; // Ne devrait pas se produire - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEVIA: case TYPETRACK: for( ; PtStruct != NULL; PtStruct = PtNext ) { - PtNext = PtStruct->Pnext; + PtNext = PtStruct->Next(); PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ ( (TRACK*) PtStruct )->Draw( DrawPanel, DC, GR_OR ); } @@ -92,9 +92,9 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC ) /* Sauvegarde d'un element aux fins de restitution par Undelete * Supporte actuellement : Module et segments de piste */ -EDA_BaseStruct* WinEDA_PcbFrame::SaveItemEfface( EDA_BaseStruct* PtItem, int nbitems ) +BOARD_ITEM* WinEDA_PcbFrame::SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ) { - EDA_BaseStruct* NextS, * PtStruct = PtItem; + BOARD_ITEM* NextS, * PtStruct = PtItem; int ii; if( (PtItem == NULL) || (nbitems == 0) ) @@ -112,21 +112,23 @@ EDA_BaseStruct* WinEDA_PcbFrame::SaveItemEfface( EDA_BaseStruct* PtItem, int nbi g_UnDeleteStackPtr--;; } - switch( PtStruct->m_StructType ) + switch( PtStruct->Type() ) { case TYPEVIA: case TYPETRACK: { - EDA_BaseStruct* Back = NULL; + BOARD_ITEM* Back = NULL; g_UnDeleteStack[g_UnDeleteStackPtr++] = PtStruct; for( ; nbitems > 0; nbitems--, PtStruct = NextS ) { - NextS = PtStruct->Pnext; + NextS = PtStruct->Next(); ( (TRACK*) PtStruct )->UnLink(); + PtStruct->SetState( DELETED, ON ); if( nbitems <= 1 ) NextS = NULL; /* fin de chaine */ + PtStruct->Pnext = NextS; PtStruct->Pback = Back; Back = PtStruct; if( NextS == NULL ) diff --git a/pcbnew/via_edit.cpp b/pcbnew/via_edit.cpp index 9be4f6402e..8fd943e6fd 100644 --- a/pcbnew/via_edit.cpp +++ b/pcbnew/via_edit.cpp @@ -61,7 +61,7 @@ TRACK * via_struct ; via_struct = m_Pcb->m_Track ; for ( ; via_struct != NULL; via_struct = (TRACK*) via_struct->Pnext ) { - if( via_struct->m_StructType == TYPEVIA ) /* mise a jour du diametre de la via */ + if( via_struct->Type() == TYPEVIA ) /* mise a jour du diametre de la via */ { if ( via_struct->m_Width != via->m_Width ) continue; via_struct->Draw(DrawPanel, DC, GR_XOR); @@ -83,7 +83,7 @@ TRACK * via_struct ; via_struct = m_Pcb->m_Track ; for ( ; via_struct != NULL; via_struct = (TRACK*) via_struct->Pnext ) { - if( via_struct->m_StructType == TYPEVIA ) /* mise a jour du diametre de la via */ + if( via_struct->Type() == TYPEVIA ) /* mise a jour du diametre de la via */ { if( via_struct->m_Drill != -1 ) { diff --git a/pcbnew/work.cpp b/pcbnew/work.cpp index 1b7917d644..d46efed673 100644 --- a/pcbnew/work.cpp +++ b/pcbnew/work.cpp @@ -40,7 +40,7 @@ void InitWork(void); void ReInitWork(void); int SetWork( int, int, int, int, int, CHEVELU *, int ); void GetWork( int *, int *, int *, int *, int *, CHEVELU ** ); -void SortWork( void ); +void SortWork(); /************************/ diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index e9ba72d6a6..67b8687101 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -44,7 +44,7 @@ public: // Constructor and destructor WinEDA_ExchangeModuleFrame( WinEDA_BasePcbFrame * parent, MODULE * Module, wxDC * DC, const wxPoint &pos ); - ~WinEDA_ExchangeModuleFrame( void ) + ~WinEDA_ExchangeModuleFrame() { } @@ -522,7 +522,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, D_PAD* pt_pad, * pt_old_pad; - if( (OldModule->m_StructType != TYPEMODULE) || (NewModule->m_StructType != TYPEMODULE) ) + if( (OldModule->Type() != TYPEMODULE) || (NewModule->Type() != TYPEMODULE) ) { DisplayError( winaff, wxT( "WinEDA_BasePcbFrame::Exchange_Module() StuctType error" ) ); } @@ -600,7 +600,7 @@ void WinEDA_ExchangeModuleFrame::Sel_NewMod_By_Liste( wxCommandEvent& event ) /***************************************************/ -bool WinEDA_PcbFrame::RecreateCmpFileFromBoard( void ) +bool WinEDA_PcbFrame::RecreateCmpFileFromBoard() /***************************************************/ { wxString FullFileNameCmp, mask; diff --git a/pcbnew/zones.cpp b/pcbnew/zones.cpp index c805b189e9..49b9ec8edc 100644 --- a/pcbnew/zones.cpp +++ b/pcbnew/zones.cpp @@ -662,7 +662,7 @@ void WinEDA_BasePcbFrame::DelLimitesZone( wxDC* DC, bool Redraw ) /********************************************/ -EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( void ) +EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone() /********************************************/ /* @@ -924,7 +924,7 @@ void WinEDA_PcbFrame::Fill_Zone( wxDC* DC ) continue; if( pt_segm->GetLayer() != GetScreen()->m_Active_Layer ) continue; - if( pt_segm->m_StructType != TYPETRACK ) + if( pt_segm->Type() != TYPETRACK ) continue; TraceSegmentPcb( m_Pcb, pt_segm, CELL_is_FRIEND, 0, WRITE_CELL ); } diff --git a/share/drawframe.cpp b/share/drawframe.cpp index 9a1ae50159..4e2d46993b 100644 --- a/share/drawframe.cpp +++ b/share/drawframe.cpp @@ -108,7 +108,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, /****************************************/ -WinEDA_DrawFrame::~WinEDA_DrawFrame( void ) +WinEDA_DrawFrame::~WinEDA_DrawFrame() /****************************************/ { if( DrawPanel ) // for WinEDA3D_DrawFrame DrawPanel == NULL ! @@ -185,7 +185,7 @@ void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) /****************************************/ -void WinEDA_DrawFrame::EraseMsgBox( void ) +void WinEDA_DrawFrame::EraseMsgBox() /****************************************/ { if( MsgPanel ) @@ -216,14 +216,14 @@ void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) /*******************************************************/ -void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar( void ) // fonction virtuelle +void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar() // fonction virtuelle /*******************************************************/ { } /********************************************/ -void WinEDA_DrawFrame::ReCreateMenuBar( void ) // fonction virtuelle +void WinEDA_DrawFrame::ReCreateMenuBar() // fonction virtuelle /********************************************/ { } @@ -342,7 +342,7 @@ void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) /***************************************/ -void WinEDA_DrawFrame::SetToolbars( void ) +void WinEDA_DrawFrame::SetToolbars() /***************************************/ { DisplayUnitsMsg(); @@ -358,7 +358,7 @@ void WinEDA_DrawFrame::DisplayToolMsg( const wxString msg ) /*******************************************/ -void WinEDA_DrawFrame::DisplayUnitsMsg( void ) +void WinEDA_DrawFrame::DisplayUnitsMsg() /********************************************/ /* Display current unit Selection on Statusbar @@ -386,7 +386,7 @@ void WinEDA_DrawFrame::DisplayUnitsMsg( void ) /***************************************/ -void WinEDA_DrawFrame::ReDrawPanel( void ) +void WinEDA_DrawFrame::ReDrawPanel() /***************************************/ { if( DrawPanel == NULL ) @@ -710,7 +710,7 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) /*********************************************/ -void WinEDA_DrawFrame::AdjustScrollBars( void ) +void WinEDA_DrawFrame::AdjustScrollBars() /*********************************************/ { wxSize draw_size, panel_size; @@ -834,7 +834,7 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) /***********************************************/ -void WinEDA_DrawFrame::Affiche_Status_Box( void ) +void WinEDA_DrawFrame::Affiche_Status_Box() /***********************************************/ /* Routine d'affichage du zoom et des coord curseur. diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index 6fe6c28da6..9832f56f43 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -143,7 +143,7 @@ void WinEDA_DrawPanel::CursorOn( wxDC* DC ) /***********************************/ -int WinEDA_DrawPanel::GetZoom( void ) +int WinEDA_DrawPanel::GetZoom() /***********************************/ { return GetScreen()->GetZoom(); @@ -159,7 +159,7 @@ void WinEDA_DrawPanel::SetZoom( int zoom ) /************************************/ -wxSize WinEDA_DrawPanel::GetGrid( void ) +wxSize WinEDA_DrawPanel::GetGrid() /************************************/ { return GetScreen()->GetGrid(); @@ -258,7 +258,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) /********************************************************/ -wxPoint WinEDA_DrawPanel::CursorScreenPosition( void ) +wxPoint WinEDA_DrawPanel::CursorScreenPosition() /********************************************************/ /* retourne la position sur l'ecran,en pixels, du curseur @@ -278,7 +278,7 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition( void ) /*********************************************************/ -wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) +wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() /*********************************************************/ { wxSize size; @@ -298,7 +298,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) /**********************************************/ -void WinEDA_DrawPanel::MouseToCursorSchema( void ) +void WinEDA_DrawPanel::MouseToCursorSchema() /**********************************************/ /* place le curseur souris sur la position du curseur schema @@ -401,7 +401,7 @@ void WinEDA_DrawPanel::OnSize( wxSizeEvent& event ) /******************************************/ -void WinEDA_DrawPanel::SetBoundaryBox( void ) +void WinEDA_DrawPanel::SetBoundaryBox() /******************************************/ { BASE_SCREEN* Screen = GetScreen();; @@ -566,10 +566,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) double pasx, pasy; color = g_GridColor; + GRSetDrawMode( DC, GR_COPY ); /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ drawgrid = m_Parent->m_Draw_Grid; + pas_grille_affichee = screen->GetGrid(); ii = pas_grille_affichee.x / zoom; @@ -579,6 +581,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) } if( ii < 5 ) drawgrid = FALSE; // grille trop petite + ii = pas_grille_affichee.y / zoom; if( ii < 5 ) { @@ -592,16 +595,24 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) org.x *= ii; org.y *= jj; screen->m_StartVisu = org; - org.x *= zoom; org.y *= zoom; - org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y; + org.x *= zoom; + org.y *= zoom; + + org.x += screen->m_DrawOrg.x; + org.y += screen->m_DrawOrg.y; size = GetClientSize(); - size.x *= zoom; size.y *= zoom; + + size.x *= zoom; + size.y *= zoom; + pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits; pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits; + if( screen->m_UserGridUnit != INCHES ) { - pasx /= 25.4; pasy /= 25.4; + pasx /= 25.4; + pasy /= 25.4; } if( drawgrid ) @@ -613,7 +624,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) { xg = screen->m_UserGridIsON ? (int) ( (ii * pasx) + 0.5 ) : ii * pas_grille_affichee.x; + int xpos = org.x + xg; + for( jj = 0; ; jj++ ) { yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 ) diff --git a/share/selcolor.cpp b/share/selcolor.cpp index 397c189681..6c6f567559 100644 --- a/share/selcolor.cpp +++ b/share/selcolor.cpp @@ -1,9 +1,10 @@ - /************************/ - /* SETCOLOR.CPP */ - /************************/ +/************************/ +/* SETCOLOR.CPP */ +/************************/ + /* Affichage et selection de la palette des couleurs disponibles -dans une frame -*/ + * dans une frame + */ #include "fctsys.h" #include "gr_basic.h" @@ -13,150 +14,153 @@ dans une frame enum colors_id { - ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 + ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 }; /*******************************************/ -class WinEDA_SelColorFrame: public wxDialog +class WinEDA_SelColorFrame : public wxDialog /*******************************************/ + /* Frame d'affichage de la palette des couleurs disponibles -*/ + */ { private: public: - // Constructor and destructor - WinEDA_SelColorFrame(wxWindow *parent, const wxPoint& framepos); - ~WinEDA_SelColorFrame(void) {}; + // Constructor and destructor + WinEDA_SelColorFrame( wxWindow * parent, const wxPoint &framepos ); + ~WinEDA_SelColorFrame( void ) { }; private: - void SelColor(wxCommandEvent& event); - - DECLARE_EVENT_TABLE() + void SelColor( wxCommandEvent& event ); + DECLARE_EVENT_TABLE() }; + + /* Construction de la table des evenements pour FrameClassMain */ -BEGIN_EVENT_TABLE(WinEDA_SelColorFrame, wxDialog) - EVT_BUTTON(ID_COLOR_BLACK, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+1, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+2, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+3, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+4, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+5, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+6, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+7, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+8, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+9, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+10, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+11, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+12, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+13, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+14, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+15, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+16, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+17, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+18, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+19, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+20, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+21, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+22, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+23, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+24, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+25, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+26, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+27, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+28, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+29, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+30, WinEDA_SelColorFrame::SelColor) - EVT_BUTTON(ID_COLOR_BLACK+31, WinEDA_SelColorFrame::SelColor) +BEGIN_EVENT_TABLE( WinEDA_SelColorFrame, wxDialog ) +EVT_BUTTON( ID_COLOR_BLACK, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 1, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 2, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 3, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 4, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 5, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 6, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 7, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 8, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 9, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 10, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 11, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 12, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 13, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 14, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 15, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 16, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 17, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 18, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 19, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 20, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 21, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 22, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 23, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 24, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 25, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 26, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 27, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 28, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 29, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 30, WinEDA_SelColorFrame::SelColor ) +EVT_BUTTON( ID_COLOR_BLACK + 31, WinEDA_SelColorFrame::SelColor ) END_EVENT_TABLE() /***************************************/ -int DisplayColorFrame(wxWindow * parent) +int DisplayColorFrame( wxWindow* parent ) /***************************************/ { -wxPoint framepos; -int color; + wxPoint framepos; + int color; - wxGetMousePosition(&framepos.x, &framepos.y); + wxGetMousePosition( &framepos.x, &framepos.y ); - WinEDA_SelColorFrame * frame = new WinEDA_SelColorFrame(parent,framepos); - color = frame->ShowModal(); frame->Destroy(); - if (color > NBCOLOR) color = -1; - return color; + WinEDA_SelColorFrame* frame = new WinEDA_SelColorFrame( parent, framepos ); + + color = frame->ShowModal(); frame->Destroy(); + if( color > NBCOLOR ) + color = -1; + return color; } + /*******************************************************************/ -WinEDA_SelColorFrame::WinEDA_SelColorFrame(wxWindow *parent, - const wxPoint& framepos): - wxDialog(parent, -1, _("Colors"), framepos, wxSize(375, 240), - DIALOG_STYLE ) +WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent, + const wxPoint& framepos ) : + wxDialog( parent, -1, _( "Colors" ), framepos, wxSize( 375, 240 ), + DIALOG_STYLE ) /*******************************************************************/ { #define START_Y 10 -wxBitmapButton * Button; -int ii, yy, butt_ID, buttcolor; -wxPoint pos; -int w = 20, h = 20; + wxBitmapButton* Button; + int ii, yy, butt_ID, buttcolor; + wxPoint pos; + int w = 20, h = 20; - SetFont(*g_DialogFont); + SetFont( *g_DialogFont ); - SetReturnCode(-1); + SetReturnCode( -1 ); - pos.x = 5; pos.y = START_Y; - for ( ii = 0; ColorRefs[ii].m_Name != NULL ; ii++ ) - { - butt_ID = ID_COLOR_BLACK + ii; - wxMemoryDC iconDC; - wxBitmap ButtBitmap(w,h); - wxBrush Brush; - iconDC.SelectObject( ButtBitmap ); - buttcolor = ColorRefs[ii].m_Numcolor; - iconDC.SetPen(*wxBLACK_PEN); - Brush.SetColour( - ColorRefs[buttcolor].m_Red, - ColorRefs[buttcolor].m_Green, - ColorRefs[buttcolor].m_Blue - ); - Brush.SetStyle(wxSOLID); + pos.x = 5; pos.y = START_Y; + for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) + { + butt_ID = ID_COLOR_BLACK + ii; + wxMemoryDC iconDC; + wxBitmap ButtBitmap( w, h ); - iconDC.SetBrush(Brush); - iconDC.SetBackground(*wxGREY_BRUSH); - iconDC.Clear(); - iconDC.DrawRoundedRectangle(0,0, w, h, (double)h/3); + wxBrush Brush; + iconDC.SelectObject( ButtBitmap ); + buttcolor = ColorRefs[ii].m_Numcolor; + iconDC.SetPen( *wxBLACK_PEN ); + Brush.SetColour( + ColorRefs[buttcolor].m_Red, + ColorRefs[buttcolor].m_Green, + ColorRefs[buttcolor].m_Blue + ); + Brush.SetStyle( wxSOLID ); - Button = new wxBitmapButton(this, butt_ID, - ButtBitmap, - wxPoint(pos.x, pos.y), wxSize(w,h) ); + iconDC.SetBrush( Brush ); + iconDC.SetBackground( *wxGREY_BRUSH ); + iconDC.Clear(); + iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 ); - new wxStaticText(this,-1, - ColorRefs[ii].m_Name, - wxPoint(pos.x + 2 + w , pos.y + 4 ), - wxSize(-1,-1), 0 ); + Button = new wxBitmapButton( this, butt_ID, + ButtBitmap, + wxPoint (pos.x, pos.y), wxSize (w, h) ); - yy = h + 5; - pos.y += yy; - if ( ii == 7 ) - { - pos.x += w + 80; pos.y = START_Y; - } - else if ( (ii == 15) || (ii == 23) ) - { - pos.x += w + 110; pos.y = START_Y; - } - } + new wxStaticText( this, -1, + ColorRefs[ii].m_Name, + wxPoint (pos.x + 2 + w, pos.y + 4 ), + wxSize( -1, -1 ), 0 ); + + yy = h + 5; + pos.y += yy; + if( ii == 7 ) + { + pos.x += w + 80; pos.y = START_Y; + } + else if( (ii == 15) || (ii == 23) ) + { + pos.x += w + 110; pos.y = START_Y; + } + } } /*********************************************************/ -void WinEDA_SelColorFrame::SelColor(wxCommandEvent& event) +void WinEDA_SelColorFrame::SelColor( wxCommandEvent& event ) /*********************************************************/ { -int id = event.GetId(); + int id = event.GetId(); - EndModal(id - ID_COLOR_BLACK); + EndModal( id - ID_COLOR_BLACK ); } - - - diff --git a/todo.txt b/todo.txt index d027124c67..69856fceed 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,15 @@ Here are some source code maintenance tasks that need to be done, and maybe some -folks will see these items and volunteer to to them. +folks will see these items and volunteer to do them. +*** Look at @todo in editrack-part2.cpp. Is this is a bug? +Concerns: +a) Isn't there a problem with losing the memory of the original? +b) If this is supposed to duplicate a SEGVIA to, then this call should be changed + to the new TRACK::Copy(), i.e. g_CurrentTrackSegment->Copy() + + *** Set up a DOXYGEN environment starting with a configuration file that: - understands the JavaDoc style comments that we have started using - gives preference to comments in header files over *.cpp files