From 0409bc8d1b70a8266afac7c9a01617f9697561ee Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 18 Oct 2011 19:28:49 +0200 Subject: [PATCH] Fix very minor issues and code cleaning --- eeschema/dialogs/dialog_lib_edit_pin.cpp | 2 + pcbnew/dialogs/dialog_edit_module_text.cpp | 140 ++++---- .../dialog_graphic_item_properties.cpp | 7 +- pcbnew/menubar_modedit.cpp | 312 +++++++----------- 4 files changed, 197 insertions(+), 264 deletions(-) diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index 34bc22d4c8..d674dd1d55 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -125,6 +125,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinLength = ReturnValueFromString( g_UserUnit, GetLength(), units ); int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); + int pinType = GetElectricalType(); m_dummyPin->SetName( GetName() ); m_dummyPin->SetNameTextSize( pinNameSize ); @@ -134,6 +135,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) m_dummyPin->SetLength( pinLength ); m_dummyPin->SetShape( pinShape ); m_dummyPin->SetVisible( GetVisible() ); + m_dummyPin->SetType( pinType ); m_panelShowPin->Refresh(); } diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 7c80f4471f..49e3cd4d40 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -30,17 +30,17 @@ extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod class DialogEditModuleText : public DialogEditModuleText_base { private: - PCB_BASE_FRAME* m_Parent; - wxDC* m_DC; - MODULE* m_Module; - TEXTE_MODULE* m_CurrentTextMod; + PCB_BASE_FRAME* m_parent; + wxDC* m_dc; + MODULE* m_module; + TEXTE_MODULE* m_currentText; public: - DialogEditModuleText( PCB_BASE_FRAME* parent, TEXTE_MODULE* TextMod, wxDC* DC ); + DialogEditModuleText( PCB_BASE_FRAME* aParent, TEXTE_MODULE* aTextMod, wxDC* aDC ); ~DialogEditModuleText() {}; private: - void Init( ); + void initDlg( ); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); }; @@ -56,24 +56,26 @@ void PCB_BASE_FRAME::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC } -DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* parent, - TEXTE_MODULE* TextMod, wxDC* DC ) : - DialogEditModuleText_base(parent) +DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent, + TEXTE_MODULE* aTextMod, wxDC* aDC ) : + DialogEditModuleText_base( aParent ) { - m_Parent = parent; - m_DC = DC; - m_Module = NULL; - m_CurrentTextMod = TextMod; + m_parent = aParent; + m_dc = aDC; + m_module = NULL; + m_currentText = aTextMod; - if( m_CurrentTextMod ) - m_Module = (MODULE*) m_CurrentTextMod->GetParent(); + if( m_currentText ) + m_module = (MODULE*) m_currentText->GetParent(); - Init( ); + initDlg( ); m_buttonOK->SetDefault(); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); + + Centre(); } @@ -84,20 +86,20 @@ void DialogEditModuleText::OnCancelClick( wxCommandEvent& event ) /********************************************************/ -void DialogEditModuleText::Init( ) +void DialogEditModuleText::initDlg( ) /********************************************************/ { SetFocus(); wxString msg; - if( m_Module ) + if( m_module ) { wxString format = m_ModuleInfoText->GetLabel(); msg.Printf( format, - GetChars( m_Module->m_Reference->m_Text ), - GetChars( m_Module->m_Value->m_Text ), - (float) m_Module->m_Orient / 10 ); + GetChars( m_module->m_Reference->m_Text ), + GetChars( m_module->m_Value->m_Text ), + (float) m_module->m_Orient / 10 ); } else @@ -106,43 +108,43 @@ void DialogEditModuleText::Init( ) m_ModuleInfoText->SetLabel( msg ); - if( m_CurrentTextMod->m_Type == TEXT_is_VALUE ) + if( m_currentText->m_Type == TEXT_is_VALUE ) m_TextDataTitle->SetLabel( _( "Value:" ) ); - else if( m_CurrentTextMod->m_Type == TEXT_is_DIVERS ) + else if( m_currentText->m_Type == TEXT_is_DIVERS ) m_TextDataTitle->SetLabel( _( "Text:" ) ); - else if( m_CurrentTextMod->m_Type != TEXT_is_REFERENCE ) + else if( m_currentText->m_Type != TEXT_is_REFERENCE ) m_TextDataTitle->SetLabel( wxT( "???" ) ); - m_Name->SetValue( m_CurrentTextMod->m_Text ); + m_Name->SetValue( m_currentText->m_Text ); - m_Style->SetSelection( m_CurrentTextMod->m_Italic ? 1 : 0 ); + m_Style->SetSelection( m_currentText->m_Italic ? 1 : 0 ); AddUnitSymbol( *m_SizeXTitle ); - PutValueInLocalUnits( *m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x, - m_Parent->m_InternalUnits ); + PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->m_Size.x, + m_parent->m_InternalUnits ); AddUnitSymbol( *m_SizeYTitle ); - PutValueInLocalUnits( *m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y, - m_Parent->m_InternalUnits ); + PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->m_Size.y, + m_parent->m_InternalUnits ); AddUnitSymbol( *m_PosXTitle ); - PutValueInLocalUnits( *m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x, - m_Parent->m_InternalUnits ); + PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->m_Pos0.x, + m_parent->m_InternalUnits ); AddUnitSymbol( *m_PosYTitle ); - PutValueInLocalUnits( *m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y, - m_Parent->m_InternalUnits ); + PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->m_Pos0.y, + m_parent->m_InternalUnits ); AddUnitSymbol( *m_WidthTitle ); - PutValueInLocalUnits( *m_TxtWidthCtlr, m_CurrentTextMod->m_Thickness, - m_Parent->m_InternalUnits ); + PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->m_Thickness, + m_parent->m_InternalUnits ); - int text_orient = m_CurrentTextMod->m_Orient; + int text_orient = m_currentText->m_Orient; NORMALIZE_ANGLE_90(text_orient) if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); - if( m_CurrentTextMod->m_NoShow ) + if( m_currentText->m_NoShow ) m_Show->SetSelection( 1 );; } @@ -154,65 +156,65 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) { wxString msg; - if ( m_Module) - m_Parent->SaveCopyInUndoList( m_Module, UR_CHANGED ); - if( m_DC ) //Erase old text on screen + if ( m_module) + m_parent->SaveCopyInUndoList( m_module, UR_CHANGED ); + if( m_dc ) //Erase old text on screen { - m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR, - (m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) ); + m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR, + (m_currentText->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) ); } - m_CurrentTextMod->m_Text = m_Name->GetValue(); + m_currentText->m_Text = m_Name->GetValue(); - m_CurrentTextMod->m_Italic = m_Style->GetSelection() == 1 ? true : false; + m_currentText->m_Italic = m_Style->GetSelection() == 1 ? true : false; msg = m_TxtPosCtrlX->GetValue(); - m_CurrentTextMod->m_Pos0.x = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_currentText->m_Pos0.x = ReturnValueFromString( g_UserUnit, msg, + m_parent->m_InternalUnits ); msg = m_TxtPosCtrlY->GetValue(); - m_CurrentTextMod->m_Pos0.y = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_currentText->m_Pos0.y = ReturnValueFromString( g_UserUnit, msg, + m_parent->m_InternalUnits ); msg = m_TxtSizeCtrlX->GetValue(); - m_CurrentTextMod->m_Size.x = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg, + m_parent->m_InternalUnits ); msg = m_TxtSizeCtrlY->GetValue(); - m_CurrentTextMod->m_Size.y = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg, + m_parent->m_InternalUnits ); // Test for a reasonnable size: - if( m_CurrentTextMod->m_Size.x< TEXTS_MIN_SIZE ) - m_CurrentTextMod->m_Size.x = TEXTS_MIN_SIZE; - if( m_CurrentTextMod->m_Size.y< TEXTS_MIN_SIZE ) - m_CurrentTextMod->m_Size.y = TEXTS_MIN_SIZE; + if( m_currentText->m_Size.x< TEXTS_MIN_SIZE ) + m_currentText->m_Size.x = TEXTS_MIN_SIZE; + if( m_currentText->m_Size.y< TEXTS_MIN_SIZE ) + m_currentText->m_Size.y = TEXTS_MIN_SIZE; msg = m_TxtWidthCtlr->GetValue(); - int width = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + int width = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits ); // Test for a reasonnable width: if( width <= 1 ) width = 1; - int maxthickness = Clamp_Text_PenSize(width, m_CurrentTextMod->m_Size ); + int maxthickness = Clamp_Text_PenSize(width, m_currentText->m_Size ); if( width > maxthickness ) { DisplayError(NULL, _("The text thickness is too large for the text size. It will be clamped")); width = maxthickness; } - m_CurrentTextMod->SetThickness( width ); + m_currentText->SetThickness( width ); - m_CurrentTextMod->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1; + m_currentText->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1; int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900; - m_CurrentTextMod->m_Orient = text_orient; + m_currentText->m_Orient = text_orient; - m_CurrentTextMod->SetDrawCoord(); - if( m_DC ) // Display new text + m_currentText->SetDrawCoord(); + if( m_dc ) // Display new text { - m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR, - (m_CurrentTextMod->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) ); + m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR, + (m_currentText->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) ); } - m_Parent->OnModify(); - if( m_Module ) - m_Module->m_LastEdit_Time = time( NULL ); + m_parent->OnModify(); + if( m_module ) + m_module->m_LastEdit_Time = time( NULL ); EndModal(1); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 5f0f4a7c28..b3503e6422 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -40,7 +40,7 @@ public: ~DialogGraphicItemProperties() {}; private: - void Init( ); + void initDlg( ); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); void OnLayerChoice( wxCommandEvent& event ); @@ -54,9 +54,10 @@ DialogGraphicItemProperties::DialogGraphicItemProperties( PCB_EDIT_FRAME* aParen m_DC = aDC; m_Item = aItem; m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings(); - Init(); + initDlg(); Layout(); GetSizer()->SetSizeHints( this ); + Centre(); } @@ -78,7 +79,7 @@ void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxD } /**************************************************************************/ -void DialogGraphicItemProperties::Init( ) +void DialogGraphicItemProperties::initDlg( ) /**************************************************************************/ /* Initialize messages and values in text control, * according to the item parameters values diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index bd58ae5704..f84c67b802 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -15,10 +15,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() { // Create and try to get the current menubar - wxMenuBar* menuBar = GetMenuBar(); - wxMenuItem* item; + wxMenuBar* menuBar = GetMenuBar(); - if( ! menuBar ) + if( !menuBar ) menuBar = new wxMenuBar(); // Delete all existing menus so they can be rebuilt. @@ -26,7 +25,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() menuBar->Freeze(); while( menuBar->GetMenuCount() ) - delete menuBar->Remove(0); + delete menuBar->Remove( 0 ); // Recreate all menus: @@ -34,264 +33,195 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() wxMenu* fileMenu = new wxMenu; // New module - item = new wxMenuItem( fileMenu, - ID_MODEDIT_NEW_MODULE, - _( "New Module" ), - _( "Create new module" ) ); - SET_BITMAP( KiBitmap( new_footprint_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, ID_MODEDIT_NEW_MODULE, + _( "New Module" ), _( "Create new module" ), + KiBitmap( new_footprint_xpm ) ); // Open submenu wxMenu* openSubmenu = new wxMenu; // from File - item = new wxMenuItem( openSubmenu, - ID_MODEDIT_IMPORT_PART, - _( "Load from File (Import)" ), - _( "Import a footprint from an existing file" ) ); - SET_BITMAP( KiBitmap( import_module_xpm ) ); - openSubmenu->Append( item ); + AddMenuItem( openSubmenu, ID_MODEDIT_IMPORT_PART, + _( "Load from File (Import)" ), + _( "Import a footprint from an existing file" ), + KiBitmap( import_module_xpm ) ); // from Library - item = new wxMenuItem( openSubmenu, - ID_MODEDIT_LOAD_MODULE, - _( "Load from Library" ), - _( "Open a footprint module from a Library" ) ); - SET_BITMAP( KiBitmap( module_xpm ) ); - openSubmenu->Append( item ); + AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE, + _( "Load from Library" ), + _( "Open a footprint module from a Library" ), + KiBitmap( module_xpm ) ); // from current Board - item = new wxMenuItem( openSubmenu, - ID_MODEDIT_LOAD_MODULE_FROM_BOARD, - _( "Load from Current Board" ), - _( "Load a footprint module from the current loaded board" ) ); - SET_BITMAP( KiBitmap( load_module_board_xpm ) ); - openSubmenu->Append( item ); + AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD, + _( "Load from Current Board" ), + _( "Load a footprint module from the current loaded board" ), + KiBitmap( load_module_board_xpm ) ); /* Append openSubmenu to fileMenu */ AddMenuItem( fileMenu, openSubmenu, -1, - _( "&Load Module" ), - _( "Load a footprint module" ), - KiBitmap( open_document_xpm ) ); + _( "&Load Module" ), + _( "Load a footprint module" ), + KiBitmap( open_document_xpm ) ); // Save module - item = new wxMenuItem( fileMenu, - ID_MODEDIT_SAVE_LIBMODULE, - _( "&Save Module in Active Library" ), - _( "Save module in active library" ) ); - SET_BITMAP( KiBitmap( save_library_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, + _( "&Save Module in Active Library" ), + _( "Save module in active library" ), + KiBitmap( save_library_xpm ) ); // Save module in new lib - item = new wxMenuItem( fileMenu, - ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, - _( "&Save Module in a New Lib" ), - _( "Create new library and save current module" ) ); - SET_BITMAP( KiBitmap( new_library_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, + _( "&Save Module in a New Lib" ), + _( "Create new library and save current module" ), + KiBitmap( new_library_xpm ) ); // Export module - item = new wxMenuItem( fileMenu, - ID_MODEDIT_EXPORT_PART, - _( "&Export Module" ), - _( "Save the current loaded module to a file" ) ); - SET_BITMAP( KiBitmap( export_module_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, ID_MODEDIT_EXPORT_PART, + _( "&Export Module" ), + _( "Save the current loaded module to a file" ), + KiBitmap( export_module_xpm ) ); // Separator fileMenu->AppendSeparator(); // Print - item = new wxMenuItem( fileMenu, - wxID_PRINT, - _( "&Print\tCtrl+P" ), - _( "Print the current module" ) ); - SET_BITMAP( KiBitmap( plot_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, wxID_PRINT, + _( "&Print" ), + _( "Print the current module" ), + KiBitmap( plot_xpm ) ); // Separator fileMenu->AppendSeparator(); // Close editor - item = new wxMenuItem( fileMenu, - wxID_EXIT, - _( "Close" ), - _( "Close the footprint editor" ) ); - SET_BITMAP( KiBitmap( exit_xpm ) ); - fileMenu->Append( item ); + AddMenuItem( fileMenu, wxID_EXIT, + _( "Close" ), + _( "Close the footprint editor" ), + KiBitmap( exit_xpm ) ); // Menu Edit: wxMenu* editMenu = new wxMenu; // Undo - item = new wxMenuItem( editMenu, - wxID_UNDO, - _( "Undo" ), - _( "Undo last edit" ) ); - SET_BITMAP( KiBitmap( undo_xpm ) ); - editMenu->Append( item ); + AddMenuItem( editMenu, wxID_UNDO, + _( "Undo" ), _( "Undo last edit" ), + KiBitmap( undo_xpm ) ); // Redo - item = new wxMenuItem( editMenu, - wxID_REDO, - _( "Redo" ), - _( "Redo the last undo action" ) ); - SET_BITMAP( KiBitmap( redo_xpm ) ); - editMenu->Append( item ); + AddMenuItem( editMenu, wxID_REDO, + _( "Redo" ), _( "Redo the last undo action" ), + KiBitmap( redo_xpm ) ); // Delete items - item = new wxMenuItem( editMenu, - ID_MODEDIT_DELETE_TOOL, - _( "Delete" ), - _( "Delete objects with the eraser" ) ); - SET_BITMAP( KiBitmap( delete_body_xpm ) ); - editMenu->Append( item ); + AddMenuItem( editMenu, ID_MODEDIT_DELETE_TOOL, + _( "Delete" ), _( "Delete objects with the eraser" ), + KiBitmap( delete_body_xpm ) ); // Separator editMenu->AppendSeparator(); // Properties - item = new wxMenuItem( editMenu, - ID_MODEDIT_EDIT_MODULE_PROPERTIES, - _( "Properties" ), - _( "Edit module properties" ) ); - SET_BITMAP( KiBitmap( module_options_xpm ) ); - editMenu->Append( item ); + AddMenuItem( editMenu, ID_MODEDIT_EDIT_MODULE_PROPERTIES, + _( "Properties" ), + _( "Edit module properties" ), + KiBitmap( module_options_xpm ) ); // Dimensions submenu wxMenu* dimensions_Submenu = new wxMenu; // Sizes and Widths - item = new wxMenuItem( dimensions_Submenu, - ID_PCB_DRAWINGS_WIDTHS_SETUP, - _( "Sizes and Widths" ), - _( "Adjust width for texts and drawings" ) ); - SET_BITMAP( KiBitmap( options_text_xpm ) ); - dimensions_Submenu->Append( item ); + AddMenuItem( dimensions_Submenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, + _( "Sizes and Widths" ), + _( "Adjust width for texts and drawings" ), + KiBitmap( options_text_xpm ) ); // Pad settings - item = new wxMenuItem( dimensions_Submenu, - ID_MODEDIT_PAD_SETTINGS, - _( "Pad Settings" ), - _( "Edit the settings for new pads" ) ); - SET_BITMAP( KiBitmap( options_pad_xpm ) ); - dimensions_Submenu->Append( item ); + AddMenuItem( dimensions_Submenu, ID_MODEDIT_PAD_SETTINGS, + _( "Pad Settings" ), _( "Edit the settings for new pads" ), + KiBitmap( options_pad_xpm ) ); // User grid size - item = new wxMenuItem( dimensions_Submenu, - ID_PCB_USER_GRID_SETUP, - _( "User Grid Size" ), - _( "Adjust user grid" ) ); - SET_BITMAP( KiBitmap( grid_xpm ) ); - dimensions_Submenu->Append( item ); + AddMenuItem( dimensions_Submenu, ID_PCB_USER_GRID_SETUP, + _( "User Grid Size" ), _( "Adjust user grid" ), + KiBitmap( grid_xpm ) ); // Append dimensions_Submenu to editMenu AddMenuItem( editMenu, - dimensions_Submenu, -1, - _( "&Dimensions" ), - _( "Edit dimensions preferences" ), - KiBitmap( add_dimension_xpm ) ); + dimensions_Submenu, -1, + _( "&Dimensions" ), + _( "Edit dimensions preferences" ), + KiBitmap( add_dimension_xpm ) ); // View menu wxMenu* viewMenu = new wxMenu; // Zoom In - item = new wxMenuItem( viewMenu, - ID_ZOOM_IN, - _( "Zoom In" ), - _( "Zoom in on the module" ) ); - SET_BITMAP( KiBitmap( zoom_in_xpm ) ); - viewMenu->Append( item ); + AddMenuItem( viewMenu, ID_ZOOM_IN, + _( "Zoom In" ), _( "Zoom in on the module" ), + KiBitmap( zoom_in_xpm ) ); // Zoom Out - item = new wxMenuItem( viewMenu, - ID_ZOOM_OUT, - _( "Zoom Out" ), - _( "Zoom out on the module" ) ); - SET_BITMAP( KiBitmap( zoom_out_xpm ) ); - viewMenu->Append( item ); + AddMenuItem( viewMenu, ID_ZOOM_OUT, + _( "Zoom Out" ), _( "Zoom out on the module" ), + KiBitmap( zoom_out_xpm ) ); // Fit on Screen - item = new wxMenuItem( viewMenu, - ID_ZOOM_PAGE, - _( "Fit on Screen" ), - _( "Zoom and fit the module in the window" ) ); - SET_BITMAP( KiBitmap( zoom_fit_in_page_xpm ) ); - viewMenu->Append( item ); + AddMenuItem( viewMenu, ID_ZOOM_PAGE, + _( "Fit on Screen" ), + _( "Zoom and fit the module in the window" ), + KiBitmap( zoom_fit_in_page_xpm ) ); - // Separator viewMenu->AppendSeparator(); // Redraw - item = new wxMenuItem( viewMenu, - ID_ZOOM_REDRAW, - _( "Redraw" ), - _( "Redraw the window's viewport" ) ); - SET_BITMAP( KiBitmap( zoom_redraw_xpm ) ); - viewMenu->Append( item ); + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, + _( "Redraw" ), _( "Redraw the window's viewport" ), + KiBitmap( zoom_redraw_xpm ) ); // 3D view - item = new wxMenuItem( viewMenu, - ID_MENU_PCB_SHOW_3D_FRAME, - _( "3D View" ), - _( "Show board in 3D viewer" ) ); - SET_BITMAP( KiBitmap( three_d_xpm ) ); - viewMenu->Append( item ); + AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, + _( "3D View" ), + _( "Show board in 3D viewer" ), + KiBitmap( three_d_xpm ) ); // Menu Place: wxMenu* placeMenu = new wxMenu; // Pad - item = new wxMenuItem( placeMenu, - ID_MODEDIT_PAD_TOOL, - _( "Pad" ), - _( "Add pad" ) ); - SET_BITMAP( KiBitmap( pad_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_PAD_TOOL, + _( "Pad" ), _( "Add pad" ), + KiBitmap( pad_xpm ) ); - // Separator placeMenu->AppendSeparator(); // Circle - item = new wxMenuItem( placeMenu, - ID_MODEDIT_CIRCLE_TOOL, - _( "Circle" ), - _( "Add graphic circle" ) ); - SET_BITMAP( KiBitmap( add_circle_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_CIRCLE_TOOL, + _( "Circle" ), _( "Add graphic circle" ), + KiBitmap( add_circle_xpm ) ); // Line or Polygon - item = new wxMenuItem( placeMenu, - ID_MODEDIT_LINE_TOOL, - _( "Line or Polygon" ), - _( "Add graphic line or polygon" ) ); - SET_BITMAP( KiBitmap( add_polygon_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_LINE_TOOL, + _( "Line or Polygon" ), + _( "Add graphic line or polygon" ), + KiBitmap( add_polygon_xpm ) ); // Arc - item = new wxMenuItem( placeMenu, - ID_MODEDIT_ARC_TOOL, - _( "Arc" ), - _( "Add graphic arc" ) ); - SET_BITMAP( KiBitmap( add_arc_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_ARC_TOOL, + _( "Arc" ), _( "Add graphic arc" ), + KiBitmap( add_arc_xpm ) ); // Text - item = new wxMenuItem( placeMenu, - ID_MODEDIT_TEXT_TOOL, - _( "Text" ), - _( "Add graphic text" ) ); - SET_BITMAP( KiBitmap( add_text_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_TEXT_TOOL, + _( "Text" ), _( "Add graphic text" ), + KiBitmap( add_text_xpm ) ); // Anchor placeMenu->AppendSeparator(); - item = new wxMenuItem( placeMenu, - ID_MODEDIT_ANCHOR_TOOL, - _( "Anchor" ), - _( "Place the footprint module reference anchor" ) ); - SET_BITMAP( KiBitmap( anchor_xpm ) ); - placeMenu->Append( item ); + AddMenuItem( placeMenu, ID_MODEDIT_ANCHOR_TOOL, + _( "Anchor" ), + _( "Place the footprint module reference anchor" ), + KiBitmap( anchor_xpm ) ); // Menu Help: wxMenu* helpMenu = new wxMenu; @@ -300,30 +230,28 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - AddMenuItem( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the Pcbnew handbook" ), - KiBitmap( online_help_xpm ) ); - AddMenuItem( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); + AddMenuItem( helpMenu, wxID_HELP, + _( "&Contents" ), + _( "Open the Pcbnew handbook" ), + KiBitmap( online_help_xpm ) ); + AddMenuItem( helpMenu, wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + KiBitmap( help_xpm ) ); // About Pcbnew helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Pcbnew" ), - _( "About Pcbnew PCB designer" ), - KiBitmap( info_xpm ) ); + _( "&About Pcbnew" ), + _( "About Pcbnew PCB designer" ), + KiBitmap( info_xpm ) ); // Append menus to the menubar - menuBar->Append( fileMenu, _( "&File" ) ); - menuBar->Append( editMenu, _( "&Edit" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( fileMenu, _( "&File" ) ); + menuBar->Append( editMenu, _( "&Edit" ) ); + menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw();