diff --git a/3d-viewer/3d_toolbar.cpp b/3d-viewer/3d_toolbar.cpp index e3c8a54aef..e34782ed6b 100644 --- a/3d-viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_toolbar.cpp @@ -3,8 +3,6 @@ /********************/ #include "fctsys.h" -#include "macros.h" -#include "bitmaps.h" #include "3d_viewer.h" @@ -128,7 +126,7 @@ void EDA_3D_FRAME::ReCreateMenuBar() // Does not work properly under linux fileMenu->AppendSeparator(); fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, - _( "Copy 3D Image to Clipboard" ) ); + _( "Copy 3D Image to Clipboard" ) ); #endif fileMenu->AppendSeparator(); fileMenu->Append( wxID_EXIT, _( "&Exit" ) ); @@ -136,31 +134,31 @@ void EDA_3D_FRAME::ReCreateMenuBar() wxMenu* referencesMenu = new wxMenu; menuBar->Append( referencesMenu, _( "&Preferences" ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_BGCOLOR_SELECTION, - _( "Choose background color" ), KiBitmap( palette_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_BGCOLOR_SELECTION, + _( "Choose background color" ), KiBitmap( palette_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF, - _( "3D Axis On/Off" ), KiBitmap( axis3d_front_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_AXIS_ONOFF, + _( "3D Axis On/Off" ), KiBitmap( axis3d_front_xpm ) ); if( full_options ) { - ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF, - _( "3D Footprints Shapes On/Off" ), KiBitmap( shape_3d_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_MODULE_ONOFF, + _( "3D Footprints Shapes On/Off" ), KiBitmap( shape_3d_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF, - _( "Zone Filling On/Off" ), KiBitmap( add_zone_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_ZONE_ONOFF, + _( "Zone Filling On/Off" ), KiBitmap( add_zone_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF, - _( "Comments Layer On/Off" ), KiBitmap( edit_sheet_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_COMMENTS_ONOFF, + _( "Comments Layer On/Off" ), KiBitmap( edit_sheet_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF, - _( "Drawings Layer On/Off" ), KiBitmap( add_polygon_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF, + _( "Drawings Layer On/Off" ), KiBitmap( add_polygon_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF, - _( "Eco1 Layer On/Off" ), KiBitmap( tools_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_ECO1_ONOFF, + _( "Eco1 Layer On/Off" ), KiBitmap( tools_xpm ) ); - ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF, - _( "Eco2 Layer On/Off" ), KiBitmap( tools_xpm ) ); + AddMenuItem( referencesMenu, ID_MENU3D_ECO2_ONOFF, + _( "Eco2 Layer On/Off" ), KiBitmap( tools_xpm ) ); } SetMenuBar( menuBar ); diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 35b0022a4a..162d09db6a 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -12,14 +12,13 @@ #include "build_version.h" #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "online_help.h" #include "id.h" #include "confirm.h" #include "eda_doc.h" #include "wxstruct.h" #include "macros.h" -#include "bitmaps.h" + /* * Class constructor for EDA_BASE_FRAME general options @@ -364,10 +363,10 @@ void EDA_BASE_FRAME::AddHelpVersionInfoMenuEntry( wxMenu* aMenu ) wxASSERT( aMenu != NULL ); // Copy version string to clipboard for bug report purposes. - ADD_MENUITEM_WITH_HELP( aMenu, ID_HELP_COPY_VERSION_STRING, - _( "Copy &Version Information" ), - _( "Copy the version string to clipboard to send with bug reports" ), - KiBitmap( copy_button_xpm ) ); + AddMenuItem( aMenu, ID_HELP_COPY_VERSION_STRING, + _( "Copy &Version Information" ), + _( "Copy the version string to clipboard to send with bug reports" ), + KiBitmap( copy_button_xpm ) ); } diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 2fb0ffec23..f423eda434 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -1,7 +1,3 @@ -/***************/ -/* edaappl.cpp */ -/***************/ - /*** * @file edaapl.cpp * @@ -21,15 +17,14 @@ #include #include "appl_wxstruct.h" -#include "common.h" +#include "wxstruct.h" +#include "macros.h" #include "param_config.h" #include "worksheet.h" #include "id.h" #include "build_version.h" #include "hotkeys_basic.h" -#include "macros.h" #include "online_help.h" -#include "bitmaps.h" #include "gestfich.h" @@ -242,15 +237,12 @@ static struct LANGUAGE_DESCR s_Language_List[] = }; -/** - * WinEDA_App Constructor - */ WinEDA_App::WinEDA_App() { m_Checker = NULL; m_HtmlCtrl = NULL; m_EDA_Config = NULL; - m_Env_Defined = FALSE; + m_Env_Defined = false; m_LanguageId = wxLANGUAGE_DEFAULT; m_PdfBrowserIsDefault = true; m_Locale = NULL; @@ -259,9 +251,6 @@ WinEDA_App::WinEDA_App() } -/** - * WinEDA_App Destructor - */ WinEDA_App::~WinEDA_App() { SaveSettings(); @@ -269,11 +258,15 @@ WinEDA_App::~WinEDA_App() /* delete user datas */ if( m_ProjectConfig ) delete m_ProjectConfig; + if( m_EDA_CommonConfig ) delete m_EDA_CommonConfig; + delete m_EDA_Config; + if( m_Checker ) delete m_Checker; + delete m_Locale; } @@ -848,11 +841,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu ) menu->Append( item ); } - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, menu, - ID_LANGUAGE_CHOICE, - _( "Language" ), - _( "Select application language (only for testing!)" ), - KiBitmap( language_xpm ) ); + AddMenuItem( MasterMenu, menu, + ID_LANGUAGE_CHOICE, + _( "Language" ), + _( "Select application language (only for testing!)" ), + KiBitmap( language_xpm ) ); // Set Check mark on current selected language for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index e0a367650a..dde2a5378f 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -7,15 +7,13 @@ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "hotkeys_basic.h" -#include "macros.h" -#include "bitmaps.h" #include "id.h" #include "confirm.h" #include "kicad_string.h" #include "gestfich.h" #include "wxstruct.h" +#include "macros.h" #include "dialog_hotkeys_editor.h" #include @@ -133,8 +131,10 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) if( (aKeycode & GR_KB_CTRL) != 0 ) modifier << MODIFIER_CTRL; + if( (aKeycode & GR_KB_ALT) != 0 ) modifier << MODIFIER_ALT; + if( (aKeycode & GR_KB_SHIFT) != 0 ) modifier << MODIFIER_SHIFT; @@ -143,7 +143,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) if( (aKeycode > ' ') && (aKeycode < 0x7F ) ) { found = true; - keyname.Append((wxChar)aKeycode); + keyname.Append( (wxChar)aKeycode ); } else { @@ -165,6 +165,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) if( aIsFound ) *aIsFound = found; + fullkeyname = modifier + keyname; return fullkeyname; } @@ -195,6 +196,7 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, else msg << wxT( " <" ) << keyname << wxT( ">" ); } + return msg; } @@ -223,12 +225,14 @@ wxString AddHotkeyName( const wxString& aText, { List = aDescList->m_HK_InfoList; keyname = ReturnKeyNameFromCommandId( List, aCommandId ); + if( !keyname.IsEmpty() ) { if( aIsShortCut ) msg << wxT( "\t" ) << keyname; else msg << wxT( " <" ) << keyname << wxT( ">" ); + break; } } @@ -252,6 +256,7 @@ wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ) for( ; *aList != NULL; aList++ ) { Ki_HotkeyInfo* hk_decr = *aList; + if( hk_decr->m_Idcommand == aCommandId ) { keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); @@ -285,7 +290,6 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ) modifier |= GR_KB_CTRL; key.Remove( 0, 5 ); } - else if( key.StartsWith( MODIFIER_ALT ) ) { modifier |= GR_KB_ALT; @@ -297,7 +301,9 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ) key.Remove( 0, 6 ); } else + { break; + } } if( (key.length() == 1) && (key[0] > ' ') && (key[0] < 0x7F) ) @@ -338,6 +344,7 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, for( ; aDescList->m_HK_InfoList != NULL; aDescList++ ) { List = aDescList->m_HK_InfoList; + for( ; *List != NULL; List++ ) { Ki_HotkeyInfo* hk_decr = *List; @@ -392,6 +399,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD /* Print the current hotkey list */ Ki_HotkeyInfo** List; + for( ; aDescList->m_HK_InfoList != NULL; aDescList++ ) { if( aDescList->m_Comment ) @@ -400,10 +408,12 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD msg += wxString( aDescList->m_Comment ); msg += wxT( "\n" ); } + msg += *aDescList->m_SectionTag; msg += wxT( "\n" ); List = aDescList->m_HK_InfoList; + for( ; *List != NULL; List++ ) { Ki_HotkeyInfo* hk_decr = *List; @@ -421,8 +431,11 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD if( aFullFileName ) { FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) ); + if( file ) + { fputs( TO_UTF8( msg ), file ); + } else { msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) ); @@ -504,9 +517,8 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDe * lines starting by # are ignored (comments) * lines like [xxx] are tags (example: [common] or [libedit] which identify sections */ -void ParseHotkeyConfig( - const wxString& data, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ) +void ParseHotkeyConfig( const wxString& data, + struct Ki_HotkeyInfoSectionDescriptor* aDescList ) { /* Read the config */ wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK ); @@ -525,6 +537,7 @@ void ParseHotkeyConfig( { CurrentHotkeyList = 0; Ki_HotkeyInfoSectionDescriptor* DList = aDescList; + for( ; DList->m_HK_InfoList; DList++ ) { if( *DList->m_SectionTag == line_type ) @@ -536,10 +549,13 @@ void ParseHotkeyConfig( continue; } + if( line_type == wxT( "$Endlist" ) ) break; + if( line_type != wxT( "shortcut" ) ) continue; + if( CurrentHotkeyList == NULL ) continue; @@ -559,6 +575,7 @@ void ParseHotkeyConfig( if( hk_decr->m_InfoMsg == fctname ) { int code = ReturnKeyCodeFromKeyName( keyname ); + if( code ) hk_decr->m_KeyCode = code; @@ -635,36 +652,35 @@ void AddHotkeyConfigMenu( wxMenu* aMenu ) wxMenu* HotkeySubmenu = new wxMenu(); /* List existing hotkey menu*/ - ADD_MENUITEM_WITH_HELP( HotkeySubmenu, - ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - _( "List Current Keys" ), - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( info_xpm ) ); + AddMenuItem( HotkeySubmenu, + ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, + _( "List Current Keys" ), + _( "Displays the current hotkeys list and corresponding commands" ), + KiBitmap( info_xpm ) ); /* Call hotkeys editor*/ - ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR, - _( "Edit Hotkeys" ), - _( "Call the hotkeys editor" ), - KiBitmap( editor_xpm ) ); + AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR, + _( "Edit Hotkeys" ), + _( "Call the hotkeys editor" ), + KiBitmap( editor_xpm ) ); HotkeySubmenu->AppendSeparator(); /* create hotkey file to export current hotkeys config */ - ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG, - _( "Export Hotkeys Config" ), - _( "Create a hotkey configuration file to export the current hotkey config" ), - KiBitmap( save_setup_xpm ) ); + AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG, + _( "Export Hotkeys Config" ), + _( "Create a hotkey configuration file to export the current hotkey config" ), + KiBitmap( save_setup_xpm ) ); /* Reload hotkey file */ - ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG, - _( "Import Hotkeys Config" ), - _( "Load an existing hotkey configuration file" ), - KiBitmap( reload_xpm ) ); + AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG, + _( "Import Hotkeys Config" ), + _( "Load an existing hotkey configuration file" ), + KiBitmap( reload_xpm ) ); /* Append HotkeySubmenu to menu */ - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( aMenu, HotkeySubmenu, - ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ), - _( "Hotkeys configuration and preferences" ), - KiBitmap( hotkeys_xpm ) ); + AddMenuItem( aMenu, HotkeySubmenu, + ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ), + _( "Hotkeys configuration and preferences" ), + KiBitmap( hotkeys_xpm ) ); } - diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index 3705574319..0c30659c92 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -97,7 +97,7 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper, text = ( textUpper.Len() > textLower.Len() ) ? textUpper : textLower; text.Append( ' ', pad ); - MsgItem item; + EDA_MSG_ITEM item; /* Don't put the first message a window client position 0. Offset by * one 'W' character width. */ @@ -133,7 +133,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText, else pos.x = m_last_x; - MsgItem item; + EDA_MSG_ITEM item; item.m_X = pos.x; @@ -174,7 +174,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText, } -void EDA_MSG_PANEL::showItem( wxDC& dc, const MsgItem& aItem ) +void EDA_MSG_PANEL::showItem( wxDC& dc, const EDA_MSG_ITEM& aItem ) { int color = aItem.m_Color; @@ -205,6 +205,7 @@ void EDA_MSG_PANEL::EraseMsgBox() Refresh(); } + void EDA_MSG_PANEL::erase( wxDC* DC ) { wxPen pen; diff --git a/common/zoom.cpp b/common/zoom.cpp index d6719dc29e..b81f375778 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -7,9 +7,7 @@ */ #include "fctsys.h" -#include "common.h" #include "macros.h" -#include "bitmaps.h" #include "id.h" #include "class_drawpanel.h" #include "class_base_screen.h" @@ -154,21 +152,21 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) BASE_SCREEN * screen = DrawPanel->GetScreen(); msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER ); - ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) ); msg = AddHotkeyName( _( "Zoom in" ), m_HotkeysZoomAndGridList, HK_ZOOM_IN ); - ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) ); msg = AddHotkeyName( _( "Zoom out" ), m_HotkeysZoomAndGridList, HK_ZOOM_OUT ); - ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) ); msg = AddHotkeyName( _( "Redraw view" ), m_HotkeysZoomAndGridList, HK_ZOOM_REDRAW ); - ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) ); + AddMenuItem( MasterMenu, ID_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) ); msg = AddHotkeyName( _( "Zoom auto" ), m_HotkeysZoomAndGridList, HK_ZOOM_AUTO ); - ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) ); + AddMenuItem( MasterMenu, ID_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) ); wxMenu* zoom_choice = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice, - ID_POPUP_ZOOM_SELECT, _( "Zoom select" ), - KiBitmap( zoom_selection_xpm ) ); + AddMenuItem( MasterMenu, zoom_choice, + ID_POPUP_ZOOM_SELECT, _( "Zoom select" ), + KiBitmap( zoom_selection_xpm ) ); zoom = screen->GetZoom(); maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START; @@ -190,8 +188,8 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) if( screen->GetGridCount() ) { wxMenu* gridMenu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT, - _( "Grid Select" ), KiBitmap( grid_select_xpm ) ); + AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT, + _( "Grid Select" ), KiBitmap( grid_select_xpm ) ); GRID_TYPE tmp; wxRealPoint grid = screen->GetGridSize(); @@ -234,5 +232,5 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) } MasterMenu->AppendSeparator(); - ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) ); + AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) ); } diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index d35728b089..c2cda32bb9 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -4,7 +4,6 @@ */ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "confirm.h" #include "gestfich.h" @@ -12,7 +11,6 @@ #include "cvpcb_mainframe.h" #include "cvpcb_id.h" -#include "bitmaps.h" /** * @brief (Re)Create the menubar for the cvpcb mainframe @@ -39,11 +37,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() wxMenu* filesMenu = new wxMenu; // Open - ADD_MENUITEM_WITH_HELP( filesMenu, - ID_LOAD_PROJECT, - _( "&Open" ), - _( "Open a net list file" ), - open_document_xpm ); + AddMenuItem( filesMenu, + ID_LOAD_PROJECT, + _( "&Open" ), + _( "Open a net list file" ), + open_document_xpm ); // Open Recent submenu static wxMenu* openRecentMenu; @@ -56,51 +54,51 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu(); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1, - _( "Open &Recent" ), - _( "Open a recent opened netlist document" ), - open_project_xpm ); + AddMenuItem( filesMenu, openRecentMenu, -1, + _( "Open &Recent" ), + _( "Open a recent opened netlist document" ), + open_project_xpm ); // Separator filesMenu->AppendSeparator(); // Save - ADD_MENUITEM_WITH_HELP( filesMenu, - wxID_SAVE, - _( "&Save\tCtrl+S" ), - _( "Save net list and footprint list files" ), - save_xpm ); + AddMenuItem( filesMenu, + wxID_SAVE, + _( "&Save\tCtrl+S" ), + _( "Save net list and footprint list files" ), + save_xpm ); // Save as - ADD_MENUITEM_WITH_HELP( filesMenu, - wxID_SAVEAS, - _( "Save &As..." ), - _( "Save new net list and footprint list files" ), - save_xpm ); + AddMenuItem( filesMenu, + wxID_SAVEAS, + _( "Save &As..." ), + _( "Save new net list and footprint list files" ), + save_xpm ); // Separator filesMenu->AppendSeparator(); // Quit - ADD_MENUITEM_WITH_HELP( filesMenu, - wxID_EXIT, - _( "&Quit" ), - _( "Quit CvPcb" ), - exit_xpm ); + AddMenuItem( filesMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit CvPcb" ), + exit_xpm ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Options (Preferences on WXMAC) - ADD_MENUITEM_WITH_HELP( preferencesMenu, - wxID_PREFERENCES, + AddMenuItem( preferencesMenu, + wxID_PREFERENCES, #ifdef __WXMAC__ - _( "&Preferences..." ), + _( "&Preferences..." ), #else - _( "&Options" ), + _( "&Options" ), #endif // __WXMAC__ - _( "Set libraries and library search paths" ), - config_xpm ); + _( "Set libraries and library search paths" ), + config_xpm ); // Language submenu wxGetApp().AddMenuLanguageList( preferencesMenu ); @@ -115,14 +113,14 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Separator preferencesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_SAVE_PROJECT, - _( "&Save Project File" ), - _( "Save changes to the project configuration file" ), - save_setup_xpm ); - ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_SAVE_PROJECT_AS, - _( "&Save Project File As" ), - _( "Save changes to the project configuration to a new file" ), - save_setup_xpm ); + AddMenuItem( preferencesMenu, ID_SAVE_PROJECT, + _( "&Save Project File" ), + _( "Save changes to the project configuration file" ), + save_setup_xpm ); + AddMenuItem( preferencesMenu, ID_SAVE_PROJECT_AS, + _( "&Save Project File As" ), + _( "Save changes to the project configuration to a new file" ), + save_setup_xpm ); // Menu Help: wxMenu* helpMenu = new wxMenu; @@ -131,15 +129,15 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, wxID_HELP, _( "&Contents" ), - _( "Open the CvPcb handbook" ), - online_help_xpm ); + AddMenuItem( helpMenu, wxID_HELP, _( "&Contents" ), + _( "Open the CvPcb handbook" ), + online_help_xpm ); // About - ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, - _( "&About CvPcb" ), - _( "About CvPcb schematic to pcb converter" ), - info_xpm ); + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About CvPcb" ), + _( "About CvPcb schematic to pcb converter" ), + info_xpm ); // Create the menubar and append all submenus menuBar->Append( filesMenu, _( "&File" ) ); diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 3351613f33..7decac145a 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -4,7 +4,6 @@ #include "fctsys.h" #include "gr_basic.h" -#include "common.h" #include "class_drawpanel.h" #include "eda_dde.h" #include "wxEeschemaStruct.h" @@ -144,7 +143,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF { wxString text = m_collectedItems[i]->GetSelectMenuText(); BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage(); - ADD_MENUITEM( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm ); + AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm ); } // Set to NULL in case user aborts the clarification context menu. diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index 179e55ebf4..5e47f1298b 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -6,11 +6,7 @@ */ #include "fctsys.h" -//#include "gr_basic.h" -#include "common.h" -#include "macros.h" #include "confirm.h" -#include "bitmaps.h" #include "eeschema_id.h" #include "hotkeys.h" #include "class_drawpanel.h" @@ -47,7 +43,7 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) // If Command in progress, put menu "cancel" if( item && item->GetFlags() ) { - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), cancel_xpm ); PopMenu->AppendSeparator(); } else @@ -64,8 +60,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) if( GetToolId() != ID_NO_TOOL_SELECTED ) { // If a tool is active, put menu "end tool" - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), - cancel_tool_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), + cancel_tool_xpm ); PopMenu->AppendSeparator(); } } @@ -89,18 +85,18 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_arc_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_arc_xpm ); msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_arc_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_arc_xpm ); } msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_arc_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_arc_xpm ); if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Delete Arc" ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_arc_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_arc_xpm ); } break; @@ -109,22 +105,22 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_circle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_circle_xpm ); } if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm ); } msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_circle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_circle_xpm ); if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Delete Circle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_circle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_circle_xpm ); } break; @@ -133,22 +129,22 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_rectangle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_rectangle_xpm ); } msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_rectangle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_rectangle_xpm ); if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_rectangle_xpm ); } if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_rectangle_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_rectangle_xpm ); } break; @@ -158,19 +154,19 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_text_xpm ); } msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, edit_text_xpm ); msg = AddHotkeyName( _( "Rotate Text" ), s_Libedit_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, edit_text_xpm ); if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Delete Text" ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_text_xpm ); } break; @@ -179,31 +175,31 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_line_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_line_xpm ); msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_line_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, move_line_xpm ); } if( item->IsNew() ) { - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ), apply_xpm ); } msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, options_segment_xpm ); if( item->GetFlags() == 0 ) { msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_segment_xpm ); } else if( item->IsNew() ) { if( ( (LIB_POLYLINE*) item )->GetCornerCount() > 2 ) { msg = AddHotkeyName( _( "Delete Segment" ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, - msg, delete_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, + msg, delete_segment_xpm ); } } @@ -214,12 +210,13 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_field_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_field_xpm ); } + msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, rotate_field_xpm ); + AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, rotate_field_xpm ); msg = AddHotkeyName( _( "Field Edit" ), s_Libedit_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, edit_text_xpm ); break; @@ -245,37 +242,37 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ) { msg = AddHotkeyName( _( "Move Pin " ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_xpm ); } msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT); - ADD_MENUITEM( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, edit_xpm ); + AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, edit_xpm ); msg = AddHotkeyName( _( "Rotate Pin " ), s_Libedit_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, rotate_pin_xpm ); + AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, rotate_pin_xpm ); if( not_in_move ) { msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_pin_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_pin_xpm ); } wxMenu* global_pin_change = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, global_pin_change, - ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, - _( "Global" ), pin_to_xpm ); - ADD_MENUITEM( global_pin_change, - ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM, - selected ? _( "Pin Size to selected pins" ) : - _( "Pin Size to Others" ), pin_size_to_xpm ); - ADD_MENUITEM( global_pin_change, - ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM, - selected ? _( "Pin Name Size to selected pin" ) : - _( "Pin Name Size to Others" ), pin_name_to_xpm ); - ADD_MENUITEM( global_pin_change, - ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM, - selected ? _( "Pin Num Size to selected pin" ) : - _( "Pin Num Size to Others" ), pin_number_to_xpm ); + AddMenuItem( PopMenu, global_pin_change, + ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, + _( "Global" ), pin_to_xpm ); + AddMenuItem( global_pin_change, + ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM, + selected ? _( "Pin Size to selected pins" ) : + _( "Pin Size to Others" ), pin_size_to_xpm ); + AddMenuItem( global_pin_change, + ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM, + selected ? _( "Pin Name Size to selected pin" ) : + _( "Pin Name Size to Others" ), pin_name_to_xpm ); + AddMenuItem( global_pin_change, + ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM, + selected ? _( "Pin Num Size to selected pin" ) : + _( "Pin Num Size to Others" ), pin_number_to_xpm ); } @@ -283,24 +280,24 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ) void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame ) { - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ), cancel_xpm ); if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) - ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, - _( "Zoom Block (drag middle mouse)" ), - zoom_area_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, + _( "Zoom Block (drag middle mouse)" ), + zoom_area_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) { - ADD_MENUITEM( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), green_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_h_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_v_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_ccw_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), green_xpm ); + AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); + AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_h_xpm ); + AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_v_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_ccw_xpm ); + AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); } } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 64017c8c9c..8eb6266397 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -6,12 +6,9 @@ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" -#include "macros.h" #include "class_drawpanel.h" #include "confirm.h" #include "eda_doc.h" -#include "bitmaps.h" #include "gr_basic.h" #include "class_sch_screen.h" #include "wxEeschemaStruct.h" @@ -745,11 +742,14 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: if( m_drawItem == NULL ) break; + DrawPanel->CrossHairOff( &dc ); + if( m_drawItem->Type() == LIB_FIELD_T ) { EditField( &dc, (LIB_FIELD*) m_drawItem ); } + DrawPanel->MoveCursorToCrossHair(); DrawPanel->CrossHairOn( &dc ); break; @@ -759,6 +759,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: if( ( m_drawItem == NULL ) || ( m_drawItem->Type() != LIB_PIN_T ) ) break; + SaveCopyInUndoList( m_component ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); DrawPanel->MoveCursorToCrossHair(); @@ -1130,7 +1131,7 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF { wxString text = m_collectedItems[i]->GetSelectMenuText(); BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage(); - ADD_MENUITEM( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm ); + AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, xpm ); } // Set to NULL in case user aborts the clarification context menu. diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index a4fe572943..5b1cc18a2f 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -318,7 +318,7 @@ private: * * @param aLibEntry A pointer to the LIB_ALIAS object to load. * @param aLibrary A pointer to the CMP_LIBRARY object to load \a aLibEntry from. - * @returns True if a copy of \a aLibEntry was successfully loaded from \aLibrary. + * @return True if a copy of \a aLibEntry was successfully loaded from \a aLibrary. */ bool LoadOneLibraryPartAux( LIB_ALIAS* aLibEntry, CMP_LIBRARY* aLibrary ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index c01230933f..fef72125f9 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -7,16 +7,13 @@ #endif #include "fctsys.h" -#include "common.h" #include "appl_wxstruct.h" -#include "bitmaps.h" #include "wxEeschemaStruct.h" #include "general.h" #include "protos.h" #include "eeschema_id.h" #include "hotkeys.h" -#include "macros.h" #include "help_common_strings.h" @@ -44,18 +41,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() wxMenu* fileMenu = new wxMenu; // New - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_NEW_PROJECT, - _( "&New\tCtrl+N" ), - _( "New schematic project" ), - new_xpm ); + AddMenuItem( fileMenu, + ID_NEW_PROJECT, + _( "&New\tCtrl+N" ), + _( "New schematic project" ), + new_xpm ); // Open - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LOAD_PROJECT, - _( "&Open\tCtrl+O" ), - _( "Open an existing schematic project" ), - open_document_xpm ); + AddMenuItem( fileMenu, + ID_LOAD_PROJECT, + _( "&Open\tCtrl+O" ), + _( "Open an existing schematic project" ), + open_document_xpm ); // Open Recent submenu static wxMenu* openRecentMenu; @@ -64,110 +61,111 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // (the file history will be updated when adding/removing files in history if( openRecentMenu ) wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu, - wxID_ANY, _( "Open &Recent" ), - _( "Open a recent opened schematic project" ), - open_project_xpm ); + AddMenuItem( fileMenu, openRecentMenu, + wxID_ANY, _( "Open &Recent" ), + _( "Open a recent opened schematic project" ), + open_project_xpm ); // Separator fileMenu->AppendSeparator(); // Save schematic project - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SAVE_PROJECT, - _( "&Save Whole Schematic Project\tCtrl+S" ), - _( "Save all sheets in the schematic project" ), - save_project_xpm ); + AddMenuItem( fileMenu, + ID_SAVE_PROJECT, + _( "&Save Whole Schematic Project\tCtrl+S" ), + _( "Save all sheets in the schematic project" ), + save_project_xpm ); // Save current sheet - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SAVE_ONE_SHEET, - _( "Save &Current Sheet Only" ), - _( "Save only current schematic sheet" ), - save_xpm ); + AddMenuItem( fileMenu, + ID_SAVE_ONE_SHEET, + _( "Save &Current Sheet Only" ), + _( "Save only current schematic sheet" ), + save_xpm ); // Save current sheet as - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SAVE_ONE_SHEET_AS, - _( "Save Current Sheet &as" ), - _( "Save current schematic sheet as..." ), - save_as_xpm ); + AddMenuItem( fileMenu, + ID_SAVE_ONE_SHEET_AS, + _( "Save Current Sheet &as" ), + _( "Save current schematic sheet as..." ), + save_as_xpm ); // Separator fileMenu->AppendSeparator(); // Page settings - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SHEET_SET, - _( "P&age Settings" ), - _( "Settigns for page size and information" ), - sheetset_xpm ); + AddMenuItem( fileMenu, + ID_SHEET_SET, + _( "P&age Settings" ), + _( "Settigns for page size and information" ), + sheetset_xpm ); // Print - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_PRINT, - _( "P&rint" ), - _( "Print schematic" ), - print_button_xpm ); + AddMenuItem( fileMenu, + wxID_PRINT, + _( "P&rint" ), + _( "Print schematic" ), + print_button_xpm ); // Plot submenu wxMenu* choice_plot_fmt = new wxMenu; // Plot PostScript - ADD_MENUITEM_WITH_HELP( choice_plot_fmt, ID_GEN_PLOT_PS, - _( "Plot PostScript" ), - _( "Plot schematic sheet in PostScript format" ), - plot_ps_xpm ); + AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, + _( "Plot PostScript" ), + _( "Plot schematic sheet in PostScript format" ), + plot_ps_xpm ); // Plot HPGL - ADD_MENUITEM_WITH_HELP( choice_plot_fmt, - ID_GEN_PLOT_HPGL, - _( "Plot HPGL" ), - _( "Plot schematic sheet in HPGL format" ), - plot_hpg_xpm ); + AddMenuItem( choice_plot_fmt, + ID_GEN_PLOT_HPGL, + _( "Plot HPGL" ), + _( "Plot schematic sheet in HPGL format" ), + plot_hpg_xpm ); // Plot SVG - ADD_MENUITEM_WITH_HELP( choice_plot_fmt, - ID_GEN_PLOT_SVG, - _( "Plot SVG" ), - _( "Plot schematic sheet in SVG format" ), - plot_xpm ); + AddMenuItem( choice_plot_fmt, + ID_GEN_PLOT_SVG, + _( "Plot SVG" ), + _( "Plot schematic sheet in SVG format" ), + plot_xpm ); // Plot DXF - ADD_MENUITEM_WITH_HELP( choice_plot_fmt, - ID_GEN_PLOT_DXF, - _( "Plot DXF" ), - _( "Plot schematic sheet in DXF format" ), - plot_xpm ); + AddMenuItem( choice_plot_fmt, + ID_GEN_PLOT_DXF, + _( "Plot DXF" ), + _( "Plot schematic sheet in DXF format" ), + plot_xpm ); // Plot to Clipboard (Windows only) #ifdef __WINDOWS__ - ADD_MENUITEM_WITH_HELP( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, - _( "Plot to Clipboard" ), - _( "Export drawings to clipboard" ), - copy_button_xpm ); + AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, + _( "Plot to Clipboard" ), + _( "Export drawings to clipboard" ), + copy_button_xpm ); #endif // __WINDOWS__ // Plot submenu - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, choice_plot_fmt, - ID_GEN_PLOT, _( "&Plot" ), - _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), - plot_xpm ); + AddMenuItem( fileMenu, choice_plot_fmt, + ID_GEN_PLOT, _( "&Plot" ), + _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), + plot_xpm ); // Separator fileMenu->AppendSeparator(); // Quit - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_EXIT, - _( "&Quit" ), - _( "Quit EESchema" ), - exit_xpm ); + AddMenuItem( fileMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit EESchema" ), + exit_xpm ); // Menu Edit: wxMenu* editMenu = new wxMenu; @@ -175,37 +173,31 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Undo text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO ); - ADD_MENUITEM_WITH_HELP( editMenu, wxID_UNDO, text, HELP_UNDO, - undo_xpm ); + AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, undo_xpm ); // Redo text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); - ADD_MENUITEM_WITH_HELP( editMenu, wxID_REDO, text, HELP_REDO, - redo_xpm ); + AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, redo_xpm ); // Delete editMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, - _( "Delete" ), HELP_DELETE_ITEMS, - delete_body_xpm ); + AddMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, + _( "Delete" ), HELP_DELETE_ITEMS, + delete_body_xpm ); // Find editMenu->AppendSeparator(); text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); - ADD_MENUITEM_WITH_HELP( editMenu, ID_FIND_ITEMS, text, HELP_FIND, - find_xpm ); + AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, find_xpm ); // Backannotate editMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( editMenu, - ID_BACKANNO_ITEMS, - _( "&Backannotate" ), - _( "Back annotate the footprint fields" ), - import_footprint_names_xpm ); - - - + AddMenuItem( editMenu, + ID_BACKANNO_ITEMS, + _( "&Backannotate" ), + _( "Back annotate the footprint fields" ), + import_footprint_names_xpm ); // Menu View: wxMenu* viewMenu = new wxMenu; @@ -228,35 +220,31 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Zoom in text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr, ID_ZOOM_IN, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, - zoom_in_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, zoom_in_xpm ); // Zoom out text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr, ID_ZOOM_OUT, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, - zoom_out_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, zoom_out_xpm ); // Fit on screen text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, - zoom_fit_in_page_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, zoom_fit_in_page_xpm ); // Separator viewMenu->AppendSeparator(); // Hierarchy - ADD_MENUITEM_WITH_HELP( viewMenu, - ID_HIERARCHY, - _( "H&ierarchy" ), - _( "Navigate schematic hierarchy" ), - hierarchy_nav_xpm ); + AddMenuItem( viewMenu, + ID_HIERARCHY, + _( "H&ierarchy" ), + _( "Navigate schematic hierarchy" ), + hierarchy_nav_xpm ); // Redraw text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, - zoom_redraw_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, zoom_redraw_xpm ); // Menu place: // @todo unify IDs @@ -265,71 +253,70 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Component text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_SCH_PLACE_COMPONENT, text, - HELP_PLACE_COMPONENTS, - add_component_xpm ); + AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, + HELP_PLACE_COMPONENTS, + add_component_xpm ); // Power port text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_POWER, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_PLACE_POWER_BUTT, text, - HELP_PLACE_POWERPORT, - add_power_xpm ); + AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, + HELP_PLACE_POWERPORT, + add_power_xpm ); // Wire text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_WIRE_BUTT, text, - HELP_PLACE_WIRE, - add_line_xpm ); + AddMenuItem( placeMenu, ID_WIRE_BUTT, text, + HELP_PLACE_WIRE, + add_line_xpm ); // Bus text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr, HK_BEGIN_BUS, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_BUS_BUTT, text, - HELP_PLACE_BUS, - add_bus_xpm ); + AddMenuItem( placeMenu, ID_BUS_BUTT, text, + HELP_PLACE_BUS, + add_bus_xpm ); // Wire to Bus entry text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr, HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, - HELP_PLACE_WIRE2BUS_ENTRY, - add_line2bus_xpm ); + AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, + HELP_PLACE_WIRE2BUS_ENTRY, + add_line2bus_xpm ); // Bus to Bus entry text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr, HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, - HELP_PLACE_BUS2BUS_ENTRY, - add_bus2bus_xpm ); + AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, + HELP_PLACE_BUS2BUS_ENTRY, + add_bus2bus_xpm ); // No connect flag text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr, HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, - noconn_xpm ); + AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, noconn_xpm ); // Net name text = AddHotkeyName( _( "Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_LABEL_BUTT, text, - HELP_PLACE_NETLABEL, - add_line_label_xpm ); + AddMenuItem( placeMenu, ID_LABEL_BUTT, text, + HELP_PLACE_NETLABEL, + add_line_label_xpm ); // Global label text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr, HK_ADD_GLABEL, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_GLABEL_BUTT, text, - HELP_PLACE_GLOBALLABEL, - add_glabel_xpm ); + AddMenuItem( placeMenu, ID_GLABEL_BUTT, text, + HELP_PLACE_GLOBALLABEL, + add_glabel_xpm ); // Junction text = AddHotkeyName( _( "Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_JUNCTION_BUTT, text, - HELP_PLACE_JUNCTION, - add_junction_xpm ); + AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text, + HELP_PLACE_JUNCTION, + add_junction_xpm ); // Separator placeMenu->AppendSeparator(); @@ -339,31 +326,31 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_HLABEL, false ); // add comment, not a shortcut text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr, HK_ADD_HLABEL, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_HIERLABEL_BUTT, - text, HELP_PLACE_HIER_LABEL, - add_hierarchical_label_xpm ); + AddMenuItem( placeMenu, ID_HIERLABEL_BUTT, + text, HELP_PLACE_HIER_LABEL, + add_hierarchical_label_xpm ); // Hierarchical sheet text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr, HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_SHEET_SYMBOL_BUTT, text, - HELP_PLACE_SHEET, - add_hierarchical_subsheet_xpm ); + AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, + HELP_PLACE_SHEET, + add_hierarchical_subsheet_xpm ); // Import hierarchical sheet - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_IMPORT_HLABEL_BUTT, - _( "Import Hierarchical Label" ), - HELP_IMPORT_SHEETPIN, - import_hierarchical_label_xpm ); + AddMenuItem( placeMenu, + ID_IMPORT_HLABEL_BUTT, + _( "Import Hierarchical Label" ), + HELP_IMPORT_SHEETPIN, + import_hierarchical_label_xpm ); // Add hierarchical Pin to Sheet - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_SHEET_PIN_BUTT, - _( "Add Hierarchical Pin to Sheet" ), - HELP_PLACE_SHEETPIN, - add_hierar_pin_xpm ); + AddMenuItem( placeMenu, + ID_SHEET_PIN_BUTT, + _( "Add Hierarchical Pin to Sheet" ), + HELP_PLACE_SHEETPIN, + add_hierar_pin_xpm ); // Separator placeMenu->AppendSeparator(); @@ -371,45 +358,45 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Graphic line or polygon text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_LINE_COMMENT_BUTT, text, - HELP_PLACE_GRAPHICLINES, - add_dashed_line_xpm ); + AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, + HELP_PLACE_GRAPHICLINES, + add_dashed_line_xpm ); // Graphic text text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut - ADD_MENUITEM_WITH_HELP( placeMenu, ID_TEXT_COMMENT_BUTT, text, - HELP_PLACE_GRAPHICTEXTS, - add_text_xpm ); + AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, + HELP_PLACE_GRAPHICTEXTS, + add_text_xpm ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Library - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_REQ, - _( "&Library" ), - _( "Library preferences" ), - library_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_REQ, + _( "&Library" ), + _( "Library preferences" ), + library_xpm ); // Colors - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_COLORS_SETUP, - _( "&Colors" ), - _( "Color preferences" ), - palette_xpm ); + AddMenuItem( preferencesMenu, + ID_COLORS_SETUP, + _( "&Colors" ), + _( "Color preferences" ), + palette_xpm ); // Options (Preferences on WXMAC) #ifdef __WXMAC__ preferencesMenu->Append(wxID_PREFERENCES); #else - ADD_MENUITEM_WITH_HELP( preferencesMenu, - wxID_PREFERENCES, - _( "&Options" ), - _( "EESchema preferences" ), - preference_xpm ); + AddMenuItem( preferencesMenu, + wxID_PREFERENCES, + _( "&Options" ), + _( "EESchema preferences" ), + preference_xpm ); #endif // __WXMAC__ @@ -423,83 +410,84 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() preferencesMenu->AppendSeparator(); // Save preferences - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_SAVE, - _( "&Save preferences" ), - _( "Save application preferences" ), - save_setup_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_SAVE, + _( "&Save preferences" ), + _( "Save application preferences" ), + save_setup_xpm ); // Read preferences - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_READ, - _( "&Read preferences" ), - _( "Read application preferences" ), - read_setup_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_READ, + _( "&Read preferences" ), + _( "Read application preferences" ), + read_setup_xpm ); // Menu Tools: wxMenu* toolsMenu = new wxMenu; // Library viewer - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_TO_LIBRARY, - _( "Library &Browser" ), - _( "Library browser" ), - library_browse_xpm ); + AddMenuItem( toolsMenu, + ID_TO_LIBRARY, + _( "Library &Browser" ), + _( "Library browser" ), + library_browse_xpm ); // Library editor - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_TO_LIBRARY, - _( "Library &Editor" ), - _( "Library editor" ), - libedit_xpm ); + AddMenuItem( toolsMenu, + ID_TO_LIBRARY, + _( "Library &Editor" ), + _( "Library editor" ), + libedit_xpm ); // Separator toolsMenu->AppendSeparator(); // Annotate - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_GET_ANNOTATE, - _( "&Annotate" ), - _( "Annotate the components in the schematic" ), - annotate_xpm ); + AddMenuItem( toolsMenu, + ID_GET_ANNOTATE, + _( "&Annotate" ), + _( "Annotate the components in the schematic" ), + annotate_xpm ); // ERC - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_GET_ERC, - _( "ER&C" ), - _( "Perform electrical rule check" ), - erc_xpm ); + AddMenuItem( toolsMenu, + ID_GET_ERC, + _( "ER&C" ), + _( "Perform electrical rule check" ), + erc_xpm ); // Generate netlist - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_GET_NETLIST, - _( "Generate &Netlist" ), - _( "Generate the component netlist" ), + AddMenuItem( toolsMenu, + ID_GET_NETLIST, + _( "Generate &Netlist" ), + _( "Generate the component netlist" ), netlist_xpm ); // Generate bill of materials - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_GET_TOOLS, - _( "Generate Bill of Materials" ), - _( "Generate bill of materials" ), + AddMenuItem( toolsMenu, + ID_GET_TOOLS, + _( "Generate Bill of Materials" ), + _( "Generate bill of materials" ), tools_xpm ); // Separator toolsMenu->AppendSeparator(); //Run CVPcb - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_TO_CVPCB, - _( "A&ssign component footprints" ), - _( "Run CVPcb" ), - cvpcb_xpm ); + AddMenuItem( toolsMenu, + ID_TO_CVPCB, + _( "A&ssign component footprints" ), + _( "Run CVPcb" ), + cvpcb_xpm ); + // Run PCBNew - ADD_MENUITEM_WITH_HELP( toolsMenu, - ID_TO_PCB, - _( "&Layout printed circuit board" ), - _( "Run PCBNew" ), - pcbnew_xpm ); + AddMenuItem( toolsMenu, + ID_TO_PCB, + _( "&Layout printed circuit board" ), + _( "Run PCBNew" ), + pcbnew_xpm ); // Help Menu: @@ -509,24 +497,24 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the Eeschema handbook" ), - online_help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the Eeschema handbook" ), + online_help_xpm ); + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + help_xpm ); // About EESchema helpMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_ABOUT, - _( "&About EESchema" ), - _( "About EESchema schematic designer" ), - info_xpm ); + AddMenuItem( helpMenu, + wxID_ABOUT, + _( "&About EESchema" ), + _( "About EESchema schematic designer" ), + info_xpm ); // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index 7112d5a137..b26661783e 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -3,9 +3,7 @@ * @brief (Re)Create the main menubar for the component editor frame (LibEdit) */ #include "fctsys.h" -#include "common.h" #include "appl_wxstruct.h" -#include "bitmaps.h" #include "general.h" #include "libeditframe.h" @@ -29,6 +27,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); + while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); @@ -38,45 +37,45 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() wxMenu* fileMenu = new wxMenu; // Save current library - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LIBEDIT_SAVE_CURRENT_LIB, - _( "&Save Current Library\tCtrl+S" ), - _( "Save the current active library" ), - save_xpm ); + AddMenuItem( fileMenu, + ID_LIBEDIT_SAVE_CURRENT_LIB, + _( "&Save Current Library\tCtrl+S" ), + _( "Save the current active library" ), + save_xpm ); // Save current library as... - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LIBEDIT_SAVE_CURRENT_LIB_AS, - _( "Save Current Library &as" ), - _( "Save current active library as..." ), - save_as_xpm ); + AddMenuItem( fileMenu, + ID_LIBEDIT_SAVE_CURRENT_LIB_AS, + _( "Save Current Library &as" ), + _( "Save current active library as..." ), + save_as_xpm ); // Separator fileMenu->AppendSeparator(); // Export as png file - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LIBEDIT_GEN_PNG_FILE, - _( "&Create PNG File from Screen" ), - _( "Create a PNG file from the component displayed on screen" ), - plot_xpm ); + AddMenuItem( fileMenu, + ID_LIBEDIT_GEN_PNG_FILE, + _( "&Create PNG File from Screen" ), + _( "Create a PNG file from the component displayed on screen" ), + plot_xpm ); // Export as SVG file - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LIBEDIT_GEN_SVG_FILE, - _( "&Create SVG File" ), - _( "Create a SVG file from the current loaded component" ), - plot_xpm ); + AddMenuItem( fileMenu, + ID_LIBEDIT_GEN_SVG_FILE, + _( "&Create SVG File" ), + _( "Create a SVG file from the current loaded component" ), + plot_xpm ); // Separator fileMenu->AppendSeparator(); // Quit - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_EXIT, - _( "&Quit" ), - _( "Quit Library Editor" ), - exit_xpm ); + AddMenuItem( fileMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit Library Editor" ), + exit_xpm ); // Edit menu wxMenu* editMenu = new wxMenu; @@ -84,29 +83,29 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() // Undo text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO ); - ADD_MENUITEM_WITH_HELP( editMenu, - wxID_UNDO, - text, - _( "Undo last edition" ), - undo_xpm ); + AddMenuItem( editMenu, + wxID_UNDO, + text, + _( "Undo last edition" ), + undo_xpm ); // Redo text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO ); - ADD_MENUITEM_WITH_HELP( editMenu, - wxID_REDO, - text, - _( "Redo the last undo command" ), - redo_xpm ); + AddMenuItem( editMenu, + wxID_REDO, + text, + _( "Redo the last undo command" ), + redo_xpm ); // Separator editMenu->AppendSeparator(); // Delete - ADD_MENUITEM_WITH_HELP( editMenu, - ID_LIBEDIT_DELETE_ITEM_BUTT, - _( "Delete" ), - HELP_DELETE_ITEMS, - delete_body_xpm ); + AddMenuItem( editMenu, + ID_LIBEDIT_DELETE_ITEM_BUTT, + _( "Delete" ), + HELP_DELETE_ITEMS, + delete_body_xpm ); // Menu View: wxMenu* viewMenu = new wxMenu; @@ -126,88 +125,84 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() // Zoom in text = _( "Zoom In" ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, - zoom_in_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, zoom_in_xpm ); // Zoom out text = _( "Zoom Out" ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, - zoom_out_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, zoom_out_xpm ); // Fit on screen text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, - zoom_fit_in_page_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, zoom_fit_in_page_xpm ); // Separator viewMenu->AppendSeparator(); // Redraw text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); - ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, - zoom_redraw_xpm ); + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, zoom_redraw_xpm ); // Menu Place: wxMenu* placeMenu = new wxMenu; // Pin - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_PIN_BUTT, - _( "&Pin" ), - HELP_ADD_PIN, - pin_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_PIN_BUTT, + _( "&Pin" ), + HELP_ADD_PIN, + pin_xpm ); // Graphic text - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_BODY_TEXT_BUTT, - _( "Graphic text" ), - HELP_ADD_BODYTEXT, - add_text_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_BODY_TEXT_BUTT, + _( "Graphic text" ), + HELP_ADD_BODYTEXT, + add_text_xpm ); // Graphic rectangle - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_BODY_RECT_BUTT, - _( "Rectangle" ), - HELP_ADD_BODYRECT, - add_rectangle_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_BODY_RECT_BUTT, + _( "Rectangle" ), + HELP_ADD_BODYRECT, + add_rectangle_xpm ); // Graphic Circle - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_BODY_CIRCLE_BUTT, - _( "Circle" ), - HELP_ADD_BODYCIRCLE, - add_circle_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_BODY_CIRCLE_BUTT, + _( "Circle" ), + HELP_ADD_BODYCIRCLE, + add_circle_xpm ); // Graphic Arc - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_BODY_ARC_BUTT, - _( "Arc" ), - HELP_ADD_BODYARC, - add_arc_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_BODY_ARC_BUTT, + _( "Arc" ), + HELP_ADD_BODYARC, + add_arc_xpm ); // Graphic Line or Polygon - ADD_MENUITEM_WITH_HELP( placeMenu, - ID_LIBEDIT_BODY_LINE_BUTT, - _( "Line or Polygon" ), - HELP_ADD_BODYPOLYGON, - add_polygon_xpm ); + AddMenuItem( placeMenu, + ID_LIBEDIT_BODY_LINE_BUTT, + _( "Line or Polygon" ), + HELP_ADD_BODYPOLYGON, + add_polygon_xpm ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Library - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_REQ, - _( "&Library" ), - _( "Library preferences" ), - library_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_REQ, + _( "&Library" ), + _( "Library preferences" ), + library_xpm ); // Colors - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_COLORS_SETUP, - _( "&Colors" ), - _( "Color preferences" ), - palette_xpm ); + AddMenuItem( preferencesMenu, + ID_COLORS_SETUP, + _( "&Colors" ), + _( "Color preferences" ), + palette_xpm ); // Language submenu wxGetApp().AddMenuLanguageList( preferencesMenu ); @@ -219,18 +214,18 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() preferencesMenu->AppendSeparator(); // Save preferences - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_SAVE, - _( "&Save preferences" ), - _( "Save application preferences" ), - save_setup_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_SAVE, + _( "&Save preferences" ), + _( "Save application preferences" ), + save_setup_xpm ); // Read preferences - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_CONFIG_READ, - _( "&Read preferences" ), - _( "Read application preferences" ), - read_setup_xpm ); + AddMenuItem( preferencesMenu, + ID_CONFIG_READ, + _( "&Read preferences" ), + _( "Read application preferences" ), + read_setup_xpm ); // Menu Help: wxMenu* helpMenu = new wxMenu; @@ -239,24 +234,24 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the eeschema manual" ), - online_help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the eeschema manual" ), + online_help_xpm ); + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + help_xpm ); // About EESchema helpMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_ABOUT, - _( "&About EESchema" ), - _( "About EESchema schematic designer" ), - info_xpm ); + AddMenuItem( helpMenu, + wxID_ABOUT, + _( "&About EESchema" ), + _( "About EESchema schematic designer" ), + info_xpm ); // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index d6d792ec78..d77049d769 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -3,11 +3,9 @@ /********************/ #include "fctsys.h" -#include "common.h" #include "eeschema_id.h" #include "class_drawpanel.h" #include "confirm.h" -#include "bitmaps.h" #include "class_sch_screen.h" #include "wxEeschemaStruct.h" @@ -80,19 +78,20 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { if( item && item->GetFlags() ) { - ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); } else { - ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ), cancel_tool_xpm ); + AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ), cancel_tool_xpm ); } + PopMenu->AppendSeparator(); } else { if( item && item->GetFlags() ) { - ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); PopMenu->AppendSeparator(); } } @@ -100,7 +99,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) if( item == NULL ) { if( GetSheet()->Last() != g_RootSheet ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm ); PopMenu->AppendSeparator(); return true; @@ -113,7 +112,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { case SCH_NO_CONNECT_T: - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ), delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ), delete_xpm ); break; case SCH_JUNCTION_T: @@ -125,14 +124,15 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { wxString msg = AddHotkeyName( _( "Move Bus Entry" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_xpm ); } if( GetBusEntryShape( (SCH_BUS_ENTRY*) item ) == '\\' ) PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH, _( "Set Bus Entry /" ) ); else PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), delete_bus_xpm ); + + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), delete_bus_xpm ); break; case SCH_MARKER_T: @@ -176,8 +176,9 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) default: if( is_new ) - ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), apply_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ), delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), apply_xpm ); + + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ), delete_xpm ); break; } break; @@ -209,13 +210,13 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) { msg = AddHotkeyName( _( "Move Field" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); } msg = AddHotkeyName( _( "Rotate Field" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, msg, rotate_field_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, msg, rotate_field_xpm ); msg = AddHotkeyName( _( "Edit Field" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_FIELD, msg, edit_text_xpm ); } @@ -241,47 +242,48 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) msg = _( "Move Component" ); msg << wxT( " " ) << Component->GetField( REFERENCE )->m_Text; msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_xpm ); msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_xpm ); } wxMenu* orientmenu = new wxMenu; msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, rotate_ccw_xpm ); - ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_cw_xpm ); + AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, rotate_ccw_xpm ); + AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_cw_xpm ); msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); - ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_v_xpm ); + AddMenuItem( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_v_xpm ); msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); - ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, msg, mirror_h_xpm ); + AddMenuItem( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, msg, mirror_h_xpm ); msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT ); - ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, msg, normal_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP, - _( "Orient Component" ), orient_xpm ); + AddMenuItem( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, msg, normal_xpm ); + AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP, + _( "Orient Component" ), orient_xpm ); wxMenu* editmenu = new wxMenu; msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg, edit_component_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CMP, msg, edit_component_xpm ); if( libComponent && libComponent->IsNormal() ) { msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE ); - ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm ); - ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm ); msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_FOOTPRINT ); - ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm ); } if( libComponent && libComponent->HasConversion() ) - ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ), - component_select_alternate_shape_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ), + component_select_alternate_shape_xpm ); if( libComponent && ( libComponent->GetPartCount() >= 2 ) ) { wxMenu* sel_unit_menu = new wxMenu; int ii; + for( ii = 0; ii < libComponent->GetPartCount(); ii++ ) { wxString num_unit; @@ -289,36 +291,37 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) num_unit.Printf( _( "Unit %d %c" ), ii + 1, "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] ); wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, - num_unit, wxEmptyString, - wxITEM_CHECK ); + num_unit, wxEmptyString, + wxITEM_CHECK ); if( unit == ii + 1 ) item->Check(true); } - ADD_MENUITEM_WITH_SUBMENU( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP, - _( "Unit" ), component_select_unit_xpm ); + AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP, + _( "Unit" ), component_select_unit_xpm ); } if( !Component->GetFlags() ) { - ADD_MENUITEM( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, _( "Edit with Library Editor" ), - libedit_xpm ); + AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, + _( "Edit with Library Editor" ), + libedit_xpm ); } - ADD_MENUITEM_WITH_SUBMENU( PopMenu, editmenu, ID_POPUP_SCH_GENERIC_EDIT_CMP, - _( "Edit Component" ), edit_component_xpm ); + AddMenuItem( PopMenu, editmenu, ID_POPUP_SCH_GENERIC_EDIT_CMP, + _( "Edit Component" ), edit_component_xpm ); if( !Component->GetFlags() ) { msg = AddHotkeyName( _( "Copy Component" ), s_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); msg = AddHotkeyName( _( "Delete Component" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, delete_xpm ); } if( libEntry && !libEntry->GetDocFileName().IsEmpty() ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), datasheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), datasheet_xpm ); } @@ -331,31 +334,31 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel ) { msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); } msg = AddHotkeyName( _( "Rotate Global Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm ); msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); msg = AddHotkeyName( _( "Delete Global Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); // add menu change type text (to label, glabel, text): - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, - _( "Change to Hierarchical Label" ), label2glabel_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, - _( "Change to Label" ), glabel2label_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, - _( "Change to Text" ), glabel2text_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, - _( "Change Type" ), gl_change_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, + _( "Change to Hierarchical Label" ), label2glabel_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, + _( "Change to Label" ), glabel2label_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, + _( "Change to Text" ), glabel2text_xpm ); + AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, + _( "Change Type" ), gl_change_xpm ); } @@ -368,30 +371,30 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel ) { msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); - msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr, - HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); + msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); } + msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm ); msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); msg = AddHotkeyName( _( "Delete Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); // add menu change type text (to label, glabel, text): - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, - _( "Change to Label" ), glabel2label_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, - _( "Change to Text" ), glabel2text_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, - _( "Change to Global Label" ), label2glabel_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, - _( "Change Type" ), gl_change_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, + _( "Change to Label" ), glabel2label_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, + _( "Change to Text" ), glabel2text_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, + _( "Change to Global Label" ), label2glabel_xpm ); + AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, + _( "Change Type" ), gl_change_xpm ); } @@ -404,30 +407,30 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label ) { msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); - msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr, - HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); + msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr, HK_DRAG ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm ); msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); } + msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_ccw_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_ccw_xpm ); msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); // add menu change type text (to label, glabel, text): - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, - _( "Change to Hierarchical Label" ), label2glabel_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, - _( "Change to Text" ), label2text_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, - _( "Change to Global Label" ), label2glabel_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, - _( "Change Type" ), gl_change_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, + _( "Change to Hierarchical Label" ), label2glabel_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, + _( "Change to Text" ), label2text_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, + _( "Change to Global Label" ), label2glabel_xpm ); + AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, + _( "Change Type" ), gl_change_xpm ); } @@ -440,32 +443,32 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ) { msg = AddHotkeyName( _( "Move Text" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_text_xpm ); msg = AddHotkeyName( _( "Copy Text" ), s_Schematic_Hokeys_Descr, HK_COPY_COMPONENT_OR_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button_xpm ); } msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_ccw_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_ccw_xpm ); msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm ); msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm ); /* add menu change type text (to label, glabel, text), * but only if this is a single line text */ if( Text->m_Text.Find( wxT( "\n" ) ) == wxNOT_FOUND ) { - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, - _( "Change to Label" ), label2text_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, - _( "Change to Hierarchical Label" ), label2glabel_xpm ); - ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, - _( "Change to Global Label" ), label2glabel_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, - _( "Change Type" ), gl_change_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, + _( "Change to Label" ), label2text_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, + _( "Change to Hierarchical Label" ), label2glabel_xpm ); + AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, + _( "Change to Global Label" ), label2glabel_xpm ); + AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, + _( "Change Type" ), gl_change_xpm ); } } @@ -476,22 +479,22 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct SCH_SCREEN* screen = GetScreen(); msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( aMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm ); + AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm ); if( !aJunction->IsNew() ) { if( m_collectedItems.IsDraggableJunction() ) - ADD_MENUITEM( aMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Junction" ), move_xpm ); + AddMenuItem( aMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Junction" ), move_xpm ); if( screen->GetWire( aJunction->m_Pos, EXCLUDE_END_POINTS_T ) ) - ADD_MENUITEM( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); + AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); } if( screen->GetWireOrBus( aJunction->m_Pos ) ) { - ADD_MENUITEM( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); - ADD_MENUITEM( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), - delete_connection_xpm ); + AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); + AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), + delete_connection_xpm ); } } @@ -505,34 +508,34 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) if( is_new ) { - ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), apply_xpm ); return; } msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg, move_track_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg, move_track_xpm ); PopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), - delete_connection_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), + delete_connection_xpm ); SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() ); if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); PopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); // Add global label command only if the cursor is over one end of the wire. if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); } @@ -544,24 +547,24 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) if( is_new ) { - ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); return; } msg = AddHotkeyName( _( "Delete Bus" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_bus_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_bus_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm ); PopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm ); msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm ); // Add global label command only if the cursor is over one end of the bus. if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm ); } @@ -571,37 +574,38 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) if( !Sheet->GetFlags() ) { - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ), enter_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ), enter_sheet_xpm ); PopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Move Sheet" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, move_sheet_xpm ); msg = AddHotkeyName( _( "Drag Sheet" ), s_Schematic_Hokeys_Descr, HK_DRAG ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_sheet_xpm ); } if( Sheet->GetFlags() ) { - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), apply_xpm ); } else { msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), + AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), resize_sheet_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_IMPORT_GLABEL, _( "Import Sheet Pins" ), - import_hierarchical_label_xpm ); + AddMenuItem( PopMenu, ID_POPUP_IMPORT_GLABEL, _( "Import Sheet Pins" ), + import_hierarchical_label_xpm ); if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ), - options_pinsheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ), + options_pinsheet_xpm ); + PopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Delete Sheet" ), s_Schematic_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_sheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_sheet_xpm ); } } @@ -614,13 +618,13 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet ) { msg = AddHotkeyName( _( "Move Sheet Pin" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_SHEET_PIN, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_SHEET_PIN, msg, move_xpm ); } - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET_PIN, _( "Edit Sheet Pin" ), edit_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET_PIN, _( "Edit Sheet Pin" ), edit_xpm ); if( !PinSheet->GetFlags() ) - ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ), delete_pinsheet_xpm ); + AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ), delete_pinsheet_xpm ); } @@ -628,34 +632,33 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ) { wxString msg; - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), cancel_xpm ); PopMenu->AppendSeparator(); if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) - ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), - zoom_area_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), zoom_area_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); // After a block move (that is also a block selection) one can reselect // a block function. if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) { - ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); + AddMenuItem( PopMenu, wxID_COPY, _( "Save Block" ), copy_button_xpm ); + AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); msg = AddHotkeyName( _( "Drag Block" ), s_Schematic_Hokeys_Descr, HK_MOVEBLOCK_TO_DRAGBLOCK ); - ADD_MENUITEM( PopMenu, ID_POPUP_DRAG_BLOCK, msg, move_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_h_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_v_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_ccw_xpm ); + AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_h_xpm ); + AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_v_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_ccw_xpm ); #if 0 #ifdef __WINDOWS__ - ADD_MENUITEM( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD, - _( "Copy to Clipboard" ), copy_button_xpm ); + AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD, + _( "Copy to Clipboard" ), copy_button_xpm ); #endif #endif } @@ -664,6 +667,6 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ) void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); } diff --git a/eeschema/template_fieldnames.h b/eeschema/template_fieldnames.h index 2297038aa4..d05cb51cfc 100644 --- a/eeschema/template_fieldnames.h +++ b/eeschema/template_fieldnames.h @@ -151,7 +151,7 @@ public: * checks for \a aName in the the template field name list. * * @param aName A wxString object containing the field name to search for. - * @param True if \a aName is found in the list. + * @return True if \a aName is found in the list. */ bool HasFieldName( const wxString& aName ) const; }; diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index 9c56726a45..379f01053f 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -19,6 +19,8 @@ class GERBVIEW_FRAME; //class BOARD; class GERBER_IMAGE; +class Ki_PageDescr; + // Type of photoplotter action: #define GERB_ACTIVE_DRAW 1 // Activate light (lower pen) diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 9929018f86..d8d2c307cd 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -5,10 +5,8 @@ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "gerbview.h" -#include "bitmaps.h" #include "gerbview_id.h" #include "hotkeys.h" @@ -26,6 +24,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); + while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); @@ -35,113 +34,117 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) wxMenu* fileMenu = new wxMenu; // Load - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_FILE, - _( "Load &Gerber File" ), - _( "Load a new Gerber file on the current layer. Previous data will be deleted" ), - gerber_file_xpm ); + AddMenuItem( fileMenu, + wxID_FILE, + _( "Load &Gerber File" ), + _( "Load a new Gerber file on the current layer. Previous data will be deleted" ), + gerber_file_xpm ); // Excellon - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_GERBVIEW_LOAD_DRILL_FILE, - _( "Load &EXCELLON Drill File" ), - _( "Load excellon drill file" ), - gerbview_drill_file_xpm ); + AddMenuItem( fileMenu, + ID_GERBVIEW_LOAD_DRILL_FILE, + _( "Load &EXCELLON Drill File" ), + _( "Load excellon drill file" ), + gerbview_drill_file_xpm ); // Dcodes - ADD_MENUITEM_WITH_HELP( fileMenu, ID_GERBVIEW_LOAD_DCODE_FILE, - _( "Load &DCodes" ), - _( "Load D-Codes definition file" ), - gerber_open_dcode_file_xpm ); + AddMenuItem( fileMenu, ID_GERBVIEW_LOAD_DCODE_FILE, + _( "Load &DCodes" ), + _( "Load D-Codes definition file" ), + gerber_open_dcode_file_xpm ); // Recent gerber files static wxMenu* openRecentGbrMenu; + // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentGbrMenu ) wxGetApp().m_fileHistory.RemoveMenu( openRecentGbrMenu ); + openRecentGbrMenu = new wxMenu(); wxGetApp().m_fileHistory.UseMenu( openRecentGbrMenu ); wxGetApp().m_fileHistory.AddFilesToMenu(); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentGbrMenu, - wxID_ANY, - _( "Open &Recent Gerber File" ), - _( "Open a recent opened Gerber file" ), - gerber_recent_files_xpm ); + AddMenuItem( fileMenu, openRecentGbrMenu, + wxID_ANY, + _( "Open &Recent Gerber File" ), + _( "Open a recent opened Gerber file" ), + gerber_recent_files_xpm ); // Recent drill files static wxMenu* openRecentDrlMenu; + if( openRecentDrlMenu ) m_drillFileHistory.RemoveMenu( openRecentDrlMenu ); + openRecentDrlMenu = new wxMenu(); m_drillFileHistory.UseMenu( openRecentDrlMenu ); m_drillFileHistory.AddFilesToMenu( ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentDrlMenu, - wxID_ANY, - _( "Open Recent &Drill File" ), - _( "Open a recent opened drill file" ), - open_project_xpm ); + AddMenuItem( fileMenu, openRecentDrlMenu, + wxID_ANY, + _( "Open Recent &Drill File" ), + _( "Open a recent opened drill file" ), + open_project_xpm ); // Separator fileMenu->AppendSeparator(); // Clear all - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_GERBVIEW_ERASE_ALL, - _( "&Clear All" ), - _( "Clear all layers. All data will be deleted" ), - gerbview_clear_layers_xpm ); + AddMenuItem( fileMenu, + ID_GERBVIEW_ERASE_ALL, + _( "&Clear All" ), + _( "Clear all layers. All data will be deleted" ), + gerbview_clear_layers_xpm ); // Separator fileMenu->AppendSeparator(); // Export to pcbnew - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_GERBVIEW_EXPORT_TO_PCBNEW, - _( "Export to &Pcbnew" ), - _( "Export data in pcbnew format" ), - export_xpm ); + AddMenuItem( fileMenu, + ID_GERBVIEW_EXPORT_TO_PCBNEW, + _( "Export to &Pcbnew" ), + _( "Export data in pcbnew format" ), + export_xpm ); // Separator fileMenu->AppendSeparator(); // Print - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_PRINT, - _( "P&rint" ), - _( "Print gerber" ), - print_button_xpm ); + AddMenuItem( fileMenu, + wxID_PRINT, + _( "P&rint" ), + _( "Print gerber" ), + print_button_xpm ); // Separator fileMenu->AppendSeparator(); // Exit - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_EXIT, - _( "E&xit" ), - _( "Quit Gerbview" ), - exit_xpm ); + AddMenuItem( fileMenu, + wxID_EXIT, + _( "E&xit" ), + _( "Quit Gerbview" ), + exit_xpm ); // Menu for configuration and preferences wxMenu* configMenu = new wxMenu; // Hide layer manager - ADD_MENUITEM_WITH_HELP( configMenu, - ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, - _( "Hide &Layers Manager" ), - _( "Show/hide the layers manager toolbar" ), - layers_manager_xpm ); + AddMenuItem( configMenu, + ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + _( "Hide &Layers Manager" ), + _( "Show/hide the layers manager toolbar" ), + layers_manager_xpm ); // Options (Preferences on WXMAC) #ifdef __WXMAC__ configMenu->Append(wxID_PREFERENCES); #else - ADD_MENUITEM_WITH_HELP( configMenu, - wxID_PREFERENCES, - _( "&Options" ), - _( "Set options to draw items" ), - preference_xpm ); + AddMenuItem( configMenu, + wxID_PREFERENCES, + _( "&Options" ), + _( "Set options to draw items" ), + preference_xpm ); #endif // __WXMAC__ @@ -155,38 +158,38 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) wxMenu* miscellaneousMenu = new wxMenu; // List dcodes - ADD_MENUITEM_WITH_HELP( miscellaneousMenu, - ID_GERBVIEW_SHOW_LIST_DCODES, - _( "&List DCodes" ), - _( "List and edit D-codes" ), - show_dcodenumber_xpm ); + AddMenuItem( miscellaneousMenu, + ID_GERBVIEW_SHOW_LIST_DCODES, + _( "&List DCodes" ), + _( "List and edit D-codes" ), + show_dcodenumber_xpm ); // Show source - ADD_MENUITEM_WITH_HELP( miscellaneousMenu, - ID_GERBVIEW_SHOW_SOURCE, - _( "&Show Source" ), - _( "Show source file for the current layer" ), - tools_xpm ); + AddMenuItem( miscellaneousMenu, + ID_GERBVIEW_SHOW_SOURCE, + _( "&Show Source" ), + _( "Show source file for the current layer" ), + tools_xpm ); // Separator miscellaneousMenu->AppendSeparator(); // Clear layer - ADD_MENUITEM_WITH_HELP( miscellaneousMenu, - ID_GERBVIEW_GLOBAL_DELETE, - _( "&Clear Layer" ), - _( "Clear current layer" ), - general_deletions_xpm ); + AddMenuItem( miscellaneousMenu, + ID_GERBVIEW_GLOBAL_DELETE, + _( "&Clear Layer" ), + _( "Clear current layer" ), + general_deletions_xpm ); // Separator miscellaneousMenu->AppendSeparator(); // Text editor - ADD_MENUITEM_WITH_HELP( miscellaneousMenu, - ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, - _( "&Text Editor" ), - _( "Select your preferred text editor" ), - editor_xpm ); + AddMenuItem( miscellaneousMenu, + ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, + _( "&Text Editor" ), + _( "Select your preferred text editor" ), + editor_xpm ); // Menu Help wxMenu* helpMenu = new wxMenu; @@ -195,18 +198,18 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the Gerbview handbook" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the Gerbview handbook" ), + help_xpm ); // About gerbview - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_ABOUT, - _( "&About GerbView" ), - _( "About gerbview gerber and drill viewer" ), - online_help_xpm ); + AddMenuItem( helpMenu, + wxID_ABOUT, + _( "&About GerbView" ), + _( "About gerbview gerber and drill viewer" ), + online_help_xpm ); // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index 8bcfb2144e..6dcef8e105 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -3,10 +3,8 @@ /********************/ #include "fctsys.h" -#include "common.h" #include "class_drawpanel.h" #include "confirm.h" -#include "bitmaps.h" #include "gerbview.h" @@ -34,11 +32,11 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) if( GetToolId() != ID_NO_TOOL_SELECTED ) { if( DrawStruct && DrawStruct->m_Flags ) - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel" ), cancel_xpm ); else - ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, - _( "End Tool" ), cancel_tool_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, + _( "End Tool" ), cancel_tool_xpm ); PopMenu->AppendSeparator(); } @@ -48,17 +46,20 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) { if( BlockActive ) { - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel Block" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel Block" ), cancel_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, - _( "Place Block" ), apply_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, - _( "Delete Block (ctrl + drag mouse)" ), delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, + _( "Place Block" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, + _( "Delete Block (ctrl + drag mouse)" ), delete_xpm ); } else - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel" ), cancel_xpm ); + { + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel" ), cancel_xpm ); + } + PopMenu->AppendSeparator(); } } diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index 76bad44418..620e7d233f 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -224,7 +224,7 @@ public: WinEDA_App(); /** * Function GetHelpFile * get the help file path. - * * Return the Kicad help file with path. The base paths defined in * m_searchPaths are tested for a valid file. The path returned can * be relative depending on the paths added to m_searchPaths. See the @@ -233,8 +233,8 @@ public: WinEDA_App(); * version of the help file is made. * wxEmptyString is returned if help file not found. * Help file is searched in directories in this order: - * help/ like help/en_GB - * help/ like help/en + * help/\ like help/en_GB + * help/\ like help/en * help/en *

*/ diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index 49cd3474b2..337c6dc705 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -11,6 +11,9 @@ #define DEFAULT_HOTKEY_FILENAME_EXT wxT( "key" ) +class EDA_DRAW_FRAME; + + /* Class to handle hotkey commnands. hotkeys have a default value * This class allows the real key code changed by user(from a key code list file) */ diff --git a/include/macros.h b/include/macros.h index 6a85d7a01a..0278576eba 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,15 +1,13 @@ -/**************************************/ -/* Useful macros and inline functions */ -/**************************************/ +/** + * @file macros.h + * @brief This file contains miscellaneous helper definitions and functions. + */ #ifndef MACROS_H #define MACROS_H #include -#include "bitmaps.h" - - /** * Macro TO_UTF8 * converts a wxString to a UTF8 encoded C string for all wxWidgets build modes. @@ -26,8 +24,10 @@ static inline wxString FROM_UTF8( const char* cstring ) { wxString line = wxString::FromUTF8( cstring ); + if( line.IsEmpty() ) // happens when cstring is not a valid UTF8 sequence line = wxConvCurrent->cMB2WC( cstring ); // try to use locale conversion + return line; } @@ -78,33 +78,39 @@ static inline const wxChar* GetChars( const wxString& s ) #define RAD2DEG( Rad ) ( (Rad) * 180.0 / M_PI ) // Normalize angle to be in the -360.0 .. 360.0: -#define NORMALIZE_ANGLE_360( Angle ) { while( Angle < -3600 ) \ - Angle += 3600;\ - while( Angle > 3600 ) \ - Angle -= 3600;} +#define NORMALIZE_ANGLE_360( Angle ) { \ + while( Angle < -3600 ) \ + Angle += 3600; \ + while( Angle > 3600 ) \ + Angle -= 3600; } /* Normalize angle to be in the 0.0 .. 360.0 range: */ -#define NORMALIZE_ANGLE_POS( Angle ) { while( Angle < 0 ) \ - Angle += 3600;\ - while( Angle >= 3600 ) \ - Angle -= 3600;} +#define NORMALIZE_ANGLE_POS( Angle ) { \ + while( Angle < 0 ) \ + Angle += 3600; \ + while( Angle >= 3600 ) \ + Angle -= 3600; } -#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \ - { Angle = -Angle; while( Angle < 0 ) \ - Angle += 3600;while( Angle >= 3600 ) \ - Angle -= 3600;} +#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) { \ + Angle = -Angle; \ + while( Angle < 0 ) \ + Angle += 3600; \ + while( Angle >= 3600 ) \ + Angle -= 3600; } /* Normalize angle to be in the -90.0 .. 90.0 range */ -#define NORMALIZE_ANGLE_90( Angle ) { while( Angle < -900 ) \ - Angle += 1800;\ - while( Angle > 900 ) \ - Angle -= 1800;} +#define NORMALIZE_ANGLE_90( Angle ) { \ + while( Angle < -900 ) \ + Angle += 1800; \ + while( Angle > 900 ) \ + Angle -= 1800; } /* Normalize angle to be in the -180.0 .. 180.0 range */ -#define NORMALIZE_ANGLE_180( Angle ) { while( Angle <= -1800 ) \ - Angle += 3600;\ - while( Angle > 1800 ) \ - Angle -= 3600;} +#define NORMALIZE_ANGLE_180( Angle ) { \ + while( Angle <= -1800 ) \ + Angle += 3600; \ + while( Angle > 1800 ) \ + Angle -= 3600; } /*****************************/ /* macro to exchange 2 items */ @@ -140,92 +146,4 @@ BOOST_TYPEOF_REGISTER_TYPE( BOARD_ITEM* ) (b) = __temp__; } -/*****************************************************/ -/* inline functions to insert menuitems with a icon: */ -/*****************************************************/ -static inline void ADD_MENUITEM( wxMenu* menu, - int id, - const wxString& text, - const wxBitmap& icon ) -{ - wxMenuItem* l_item; - - l_item = new wxMenuItem( menu, id, text ); - -#if defined( USE_IMAGES_IN_MENUS ) - l_item->SetBitmap( icon ); -#endif - - menu->Append( l_item ); -} - -static inline void ADD_MENUITEM_WITH_HELP( wxMenu* menu, - int id, - const wxString& text, - const wxString& help, - const wxBitmap& icon ) -{ - wxMenuItem* l_item; - - l_item = new wxMenuItem( menu, id, text, help ); - -#if defined( USE_IMAGES_IN_MENUS ) - l_item->SetBitmap( icon ); -#endif - - menu->Append( l_item ); -} - -static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, - wxMenu* submenu, - int id, - const wxString& text, - const wxBitmap& icon ) -{ - wxMenuItem* l_item; - - l_item = new wxMenuItem( menu, id, text ); - l_item->SetSubMenu( submenu ); - -#if defined( USE_IMAGES_IN_MENUS ) - l_item->SetBitmap( icon ); -#endif - - menu->Append( l_item ); -}; - -static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu, - wxMenu* submenu, - int id, - const wxString& text, - const wxString& help, - const wxBitmap& icon ) -{ - wxMenuItem* l_item; - - l_item = new wxMenuItem( menu, id, text, help ); - l_item->SetSubMenu( submenu ); - -#if defined( USE_IMAGES_IN_MENUS ) - l_item->SetBitmap( icon ); -#endif - - menu->Append( l_item ); -}; - - -// macro to add a bitmap list to check menus (do not use with normal menus) -#if defined( USE_IMAGES_IN_MENUS ) && defined( __WINDOWS__ ) -# define SETBITMAPS( icon ) item->SetBitmaps( KiBitmap( apply_xpm ), KiBitmap( icon ) ) -#else -# define SETBITMAPS( icon ) -#endif - -// macro to add a bitmap menus (do not use with check menus) -#if !defined( USE_IMAGES_IN_MENUS ) || defined( __WXMAC__ ) -# define SET_BITMAP( icon ) -#else -# define SET_BITMAP( icon ) item->SetBitmap( (icon) ) -#endif - #endif /* ifdef MACRO_H */ diff --git a/include/wxstruct.h b/include/wxstruct.h index 1b716f100c..af40e56800 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -1,6 +1,7 @@ -/****************/ -/* wxstruct.h */ -/****************/ +/** + * @file wxstruct.h + * @brief Base window classes and related definitions. + */ #ifndef WXSTRUCT_H #define WXSTRUCT_H @@ -16,10 +17,11 @@ #include #include +#include "bitmaps.h" #include "colors.h" #include "common.h" -//C++ guarantees that operator delete checks its argument for null-ness +// C++ guarantees that operator delete checks its argument for null-ness #ifndef SAFE_DELETE #define SAFE_DELETE( p ) delete (p); (p) = NULL; #endif @@ -28,7 +30,7 @@ #define EESCHEMA_INTERNAL_UNIT 1000 #endif -// Option for dialog boxes +// Option for dialog boxes #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER #define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS @@ -74,16 +76,11 @@ enum id_toolbar { }; -/***********************************************/ -/* Classes for basic main frames used in kicad */ -/***********************************************/ - - -/******************************************************************/ -/* Basic frame for kicad, eeschema, pcbnew and gerbview. */ -/* not directly used: the real frames are derived from this class */ -/******************************************************************/ - +/** + * Class EDA_BASE_FRAME + * is the base frame for deriving all Kicad main window classes. This class is not + * intended to be used directly. + */ class EDA_BASE_FRAME : public wxFrame { public: @@ -95,33 +92,34 @@ public: EDA_TOOLBAR* m_HToolBar; // Standard horizontal Toolbar bool m_FrameIsActive; wxString m_FrameName; // name used for writing and reading setup - // It is "SchematicFrame", "PcbFrame" .... + // It is "SchematicFrame", "PcbFrame" .... wxString m_AboutTitle; // Name of program displayed in About. wxAuiManager m_auimgr; public: - EDA_BASE_FRAME( wxWindow* father, int idtype, - const wxString& title, + EDA_BASE_FRAME( wxWindow* father, int idtype, const wxString& title, const wxPoint& pos, const wxSize& size, long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~EDA_BASE_FRAME(); - void GetKicadHelp( wxCommandEvent& event ); - void GetKicadAbout( wxCommandEvent& event ); + void GetKicadHelp( wxCommandEvent& event ); + void GetKicadAbout( wxCommandEvent& event ); /** - * Copy the version information to the clipboard for bug reporting purposes. + * Function CopyVersionInfoToClipboard + * copies the version information to the clipboard for bug reporting purposes. */ - void CopyVersionInfoToClipboard( wxCommandEvent& event ); - void PrintMsg( const wxString& text ); + void CopyVersionInfoToClipboard( wxCommandEvent& event ); + + void PrintMsg( const wxString& text ); /** * Append the copy version information to clipboard help menu entry to \a aMenu. * * @param aMenu - The menu to append. */ - void AddHelpVersionInfoMenuEntry( wxMenu* aMenu ); + void AddHelpVersionInfoMenuEntry( wxMenu* aMenu ); virtual void LoadSettings(); virtual void SaveSettings(); @@ -139,9 +137,9 @@ public: /** * Function ReadHotkeyConfig * Read configuration data and fill the current hotkey list with hotkeys - * @param aDescList = current hotkey list descr. to initialise. + * @param aDescList = current hotkey list descr. to initialize. */ - int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); /** * Function WriteHotkeyConfig @@ -149,37 +147,37 @@ public: * It is stored using the standard wxConfig mechanism or a file. * * @param aDescList = pointer to the current hotkey list. - * @param aFullFileName = a wxString pointer to a fuill file name. + * @param aFullFileName = a wxString pointer to a full file name. * if NULL, use the standard wxConfig mechanism (default) * the output format is: shortcut "key" "function" * lines starting with # are comments */ - int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, - wxString * aFullFileName = NULL); + int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, + wxString* aFullFileName = NULL); /** * Function ReadHotkeyConfigFile * Read an old configuration file (<file>.key) and fill the current hotkey list * with hotkeys * @param aFilename = file name to read. - * @param aDescList = current hotkey list descr. to initialise. + * @param aDescList = current hotkey list descr. to initialize. */ - int ReadHotkeyConfigFile( const wxString& aFilename, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + int ReadHotkeyConfigFile( const wxString& aFilename, + struct Ki_HotkeyInfoSectionDescriptor* aDescList ); /** * Function ImportHotkeyConfigFromFile * Prompt the user for an old hotkey file to read, and read it. - * @param aDescList = current hotkey list descr. to initialise. + * @param aDescList = current hotkey list descr. to initialize. */ - void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); /** * Function ExportHotkeyConfigToFile * Prompt the user for an old hotkey file to read, and read it. - * @param aDescList = current hotkey list descr. to initialise. + * @param aDescList = current hotkey list descr. to initialize. */ - void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); /** * Function SetLanguage @@ -200,8 +198,8 @@ public: * history is used * @return a wxString containing the selected filename */ - wxString GetFileFromHistory( int cmdId, const wxString& type, - wxFileHistory* aFileHistory = NULL); + wxString GetFileFromHistory( int cmdId, const wxString& type, + wxFileHistory* aFileHistory = NULL ); /** * Function UpdateFileHistory @@ -212,10 +210,9 @@ public: * @param aFileHistory The wxFileHistory in use. * If NULL, the main application file history is used. */ - void UpdateFileHistory( const wxString& FullFileName, - wxFileHistory * aFileHistory = NULL ); + void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL ); - void DisplayActivity( int PerCent, const wxString& Text ); + void DisplayActivity( int PerCent, const wxString& Text ); /** * Function ReCreateMenuBar @@ -240,13 +237,14 @@ public: }; -/*******************************************************/ -/* Basic draw frame for eeschema, pcbnew and gerbview. */ -/*******************************************************/ - +/** + * Class EDA_DRAW_FRAME + * is the base class for create windows for drawing purpose. The eeschema, pcbnew and + * gerbview main windows are just a few examples of classes derived from EDA_DRAW_FRAME. + */ class EDA_DRAW_FRAME : public EDA_BASE_FRAME { - int m_toolId; ///< Id of active button on the vertical toolbar. + int m_toolId; ///< Id of active button on the vertical toolbar. public: EDA_DRAW_PANEL* DrawPanel; // Draw area @@ -273,7 +271,7 @@ public: // for PCBnew and Gerbview bool m_Draw_Axis; // TRUE to show X and Y axis - bool m_Draw_Grid_Axis; /* TRUE to show grid axis. */ + bool m_Draw_Grid_Axis; // TRUE to show grid axis. bool m_Draw_Sheet_Ref; // TRUE to show frame references bool m_Print_Sheet_Ref; // TRUE to print frame references @@ -283,7 +281,7 @@ public: * coordinates for drill, gerber * and component position files */ - wxPoint m_Auxiliary_Axis_Position; /* position of the auxiliary axis */ + wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis protected: Ki_HotkeyInfoSectionDescriptor * m_HotkeysZoomAndGridList; @@ -311,8 +309,7 @@ protected: virtual void unitsChangeRefresh(); public: - EDA_DRAW_FRAME( wxWindow* father, int idtype, - const wxString& title, + EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title, const wxPoint& pos, const wxSize& size, long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); @@ -327,10 +324,10 @@ public: */ virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; } - void OnMenuOpen( wxMenuEvent& event ); - void OnMouseEvent( wxMouseEvent& event ); - virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, - EDA_ITEM* aItem = NULL ); + void OnMenuOpen( wxMenuEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, + EDA_ITEM* aItem = NULL ); /** * Function AddMenuZoomAndGrid (virtual) @@ -338,22 +335,22 @@ public: * uses zoom hotkeys info base to add hotkeys info to menu commands * @param aMasterMenu = the menu to populate. */ - virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu ); + virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu ); - void EraseMsgBox(); - void Process_PageSettings( wxCommandEvent& event ); + void EraseMsgBox(); + void Process_PageSettings( wxCommandEvent& event ); /** * Function SetLanguage * called on a language menu selection * when using a derived function, do not forget to call this one */ - virtual void SetLanguage( wxCommandEvent& event ); + virtual void SetLanguage( wxCommandEvent& event ); - virtual void ReCreateHToolbar() = 0; - virtual void ReCreateVToolbar() = 0; - virtual void ReCreateMenuBar(); - virtual void ReCreateAuxiliaryToolbar(); + virtual void ReCreateHToolbar() = 0; + virtual void ReCreateVToolbar() = 0; + virtual void ReCreateMenuBar(); + virtual void ReCreateAuxiliaryToolbar(); /** * Function SetToolID @@ -379,7 +376,7 @@ public: * Function IsGridVisible() , virtual * @return true if the grid must be shown */ - virtual bool IsGridVisible() + virtual bool IsGridVisible() { return m_DrawGrid; } @@ -389,7 +386,7 @@ public: * It may be overloaded by derived classes * @param aVisible = true if the grid must be shown */ - virtual void SetGridVisibility( bool aVisible ) + virtual void SetGridVisibility( bool aVisible ) { m_DrawGrid = aVisible; } @@ -398,7 +395,7 @@ public: * Function GetGridColor() , virtual * @return the color of the grid */ - virtual int GetGridColor() + virtual int GetGridColor() { return m_GridColor; } @@ -407,7 +404,7 @@ public: * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ - virtual void SetGridColor( int aColor ) + virtual void SetGridColor( int aColor ) { m_GridColor = aColor; } @@ -415,7 +412,7 @@ public: /** * Function GetGridPosition * returns the nearest grid position to \a aPosition if a screen is defined and snap to - * grid is enabled. Otherwise, the origianl positions is returned. + * grid is enabled. Otherwise, the original positions is returned. * @see m_snapToGrid and m_BaseScreen members. * @param aPosition The position to test. * @return The wxPoint of the appropriate cursor position. @@ -432,8 +429,8 @@ public: * @param event - Command event passed by selecting grid size from the * grid size combobox on the toolbar. */ - virtual void OnSelectGrid( wxCommandEvent& event ); - virtual void OnSelectZoom( wxCommandEvent& event ); + virtual void OnSelectGrid( wxCommandEvent& event ); + virtual void OnSelectZoom( wxCommandEvent& event ); // Command event handlers shared by all applications derived from EDA_DRAW_FRAME. void OnToggleGridState( wxCommandEvent& aEvent ); @@ -457,15 +454,15 @@ public: *

* @param aDC A device context. * @param aPosition The current cursor position in logical (drawing) units. - * @param aHotKey A key event used for appication specific control if not zero. + * @param aHotKey A key event used for application specific control if not zero. */ - virtual void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) { } + virtual void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) { } - virtual void OnSize( wxSizeEvent& event ); - void OnEraseBackground( wxEraseEvent& SizeEvent ); + virtual void OnSize( wxSizeEvent& event ); + void OnEraseBackground( wxEraseEvent& SizeEvent ); - virtual void OnZoom( wxCommandEvent& event ); - void OnGrid( int grid_type ); + virtual void OnZoom( wxCommandEvent& event ); + void OnGrid( int grid_type ); /** * Function RedrawScreen @@ -474,21 +471,21 @@ public: * @param aCenterPoint The position in logical units to center the scroll bars. * @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true. */ - void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); + void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); - void Zoom_Automatique( bool aWarpPointer ); + void Zoom_Automatique( bool aWarpPointer ); /* Set the zoom level to show the area Rect */ - void Window_Zoom( EDA_RECT& Rect ); + void Window_Zoom( EDA_RECT& Rect ); /* Return the zoom level which displays the full page on screen */ - virtual double BestZoom() = 0; + virtual double BestZoom() = 0; /* Return the current zoom level */ - double GetZoom( void ); + double GetZoom( void ); - void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); - void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen ); + void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); + void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen ); /** * Function GetXYSheetReferences @@ -498,15 +495,15 @@ public: * @return a wxString containing the message locator like A3 or B6 * (or ?? if out of page limits) */ - wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition ); + wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition ); - void DisplayToolMsg( const wxString& msg ); - virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; - virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; - virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); - virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; - virtual void ToolOnRightClick( wxCommandEvent& event ); - void AdjustScrollBars( const wxPoint& aCenterPosition ); + void DisplayToolMsg( const wxString& msg ); + virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; + virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; + virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; + virtual void ToolOnRightClick( wxCommandEvent& event ); + void AdjustScrollBars( const wxPoint& aCenterPosition ); /** * Function OnActivate (virtual) @@ -514,7 +511,7 @@ public: * In derived classes with a overriding OnActivate function, * do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function. */ - virtual void OnActivate( wxActivateEvent& event ); + virtual void OnActivate( wxActivateEvent& event ); /** * Function UpdateStatusBar @@ -529,13 +526,13 @@ public: * On a MAC, be careful about calling this function when there is an * existing wxDC in existence on a sibling window. */ - virtual void UpdateStatusBar(); + virtual void UpdateStatusBar(); - void DisplayUnitsMsg(); + void DisplayUnitsMsg(); /* Handlers for block commands */ - virtual void InitBlockPasteInfos(); - virtual bool HandleBlockBegin( wxDC* DC, int cmd_type,const wxPoint& startpos ); + virtual void InitBlockPasteInfos(); + virtual bool HandleBlockBegin( wxDC* DC, int cmd_type,const wxPoint& startpos ); /** * Function ReturnBlockCommand @@ -545,7 +542,7 @@ public: * @param aKey = the key modifiers (Alt, Shift ...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...) */ - virtual int ReturnBlockCommand( int aKey ); + virtual int ReturnBlockCommand( int aKey ); /** * Function HandleBlockPlace( ) @@ -568,14 +565,14 @@ public: */ virtual bool HandleBlockEnd( wxDC* DC ); - void CopyToClipboard( wxCommandEvent& event ); + void CopyToClipboard( wxCommandEvent& event ); /* interprocess communication */ - void OnSockRequest( wxSocketEvent& evt ); - void OnSockRequestServer( wxSocketEvent& evt ); + void OnSockRequest( wxSocketEvent& evt ); + void OnSockRequestServer( wxSocketEvent& evt ); - virtual void LoadSettings(); - virtual void SaveSettings(); + virtual void LoadSettings(); + virtual void SaveSettings(); /** * Append a message to the message panel. @@ -597,7 +594,8 @@ public: */ void ClearMsgPanel( void ); - /** Virtual function PrintPage + /** + * Function PrintPage * used to print a page * Print the page pointed by current screen, set by the calling print function * @param aDC = wxDC given by the calling print function @@ -622,17 +620,11 @@ public: }; -/********************************************************* -* class EDA_MSG_PANEL : this is a panel to display various infos -* and messages on items in eeschema an pcbnew -*********************************************************/ - /** - * Struct MsgItem - * is used privately by EDA_MSG_PANEL as the item type of its vector. - * These items are the pairs of text strings shown in the MsgPanel. + * Struct EDA_MSG_ITEM + * is used privately by EDA_MSG_PANEL as the item type for displaying messages. */ -struct MsgItem +struct EDA_MSG_ITEM { int m_X; int m_UpperY; @@ -644,12 +636,12 @@ struct MsgItem /** * Function operator= * overload the assignment operator so that the wxStrings get copied - * properly when copying a MsgItem. + * properly when copying a EDA_MSG_ITEM. * No, actually I'm not sure this needed, C++ compiler may auto-generate it. */ - MsgItem& operator=( const MsgItem& rv ) + EDA_MSG_ITEM& operator=( const EDA_MSG_ITEM& rv ) { - m_X = rv.m_X; + m_X = rv.m_X; m_UpperY = rv.m_UpperY; m_LowerY = rv.m_LowerY; m_UpperText = rv.m_UpperText; // overloaded operator=() @@ -661,15 +653,18 @@ struct MsgItem }; +/** + * class EDA_MSG_PANEL + * is a panel to display various information messages. + */ class EDA_MSG_PANEL : public wxPanel { protected: - std::vector m_Items; - int m_last_x; ///< the last used x coordinate - wxSize m_fontSize; + std::vector m_Items; + int m_last_x; ///< the last used x coordinate + wxSize m_fontSize; - - void showItem( wxDC& dc, const MsgItem& aItem ); + void showItem( wxDC& dc, const EDA_MSG_ITEM& aItem ); void erase( wxDC* DC ); @@ -735,10 +730,10 @@ public: }; -/*********************/ -/* class EDA_TOOLBAR */ -/*********************/ - +/** + * Class EDA_TOOLBAR + * is the base class for deriving Kicad tool bars. + */ class EDA_TOOLBAR : public wxAuiToolBar { public: @@ -770,8 +765,150 @@ public: * Function GetDimension * @return the dimension of this toolbar (Height if horizontal, Width if vertical. */ - int GetDimension( ); + int GetDimension(); }; +/** + * Function AddMenuItem + * is an inline helper function to create and insert a menu item with an image + * into \a aMenu + * + * @param aMenu is the menu to add the new item. + * @param aId is the command ID for the new menu item. + * @param aText is the string for the new menu item. + * @param aImage is the image to add to the new menu item. + */ +static inline void AddMenuItem( wxMenu* aMenu, + int aId, + const wxString& aText, + const wxBitmap& aImage ) +{ + wxMenuItem* item; + + item = new wxMenuItem( aMenu, aId, aText ); + +#if defined( USE_IMAGES_IN_MENUS ) + item->SetBitmap( aImage ); +#endif + + aMenu->Append( item ); +} + + +/** + * Function AddMenuItem + * is an inline helper function to create and insert a menu item with an image + * and a help message string into \a aMenu + * + * @param aMenu is the menu to add the new item. + * @param aId is the command ID for the new menu item. + * @param aText is the string for the new menu item. + * @param aHelpText is the help message string for the new menu item. + * @param aImage is the image to add to the new menu item. + */ +static inline void AddMenuItem( wxMenu* aMenu, + int aId, + const wxString& aText, + const wxString& aHelpText, + const wxBitmap& aImage ) +{ + wxMenuItem* item; + + item = new wxMenuItem( aMenu, aId, aText, aHelpText ); + +#if defined( USE_IMAGES_IN_MENUS ) + item->SetBitmap( aImage ); +#endif + + aMenu->Append( item ); +} + + +/** + * Function AddMenuItem + * is an inline helper function to create and insert a menu item with an image + * into \a aSubMenu in \a aMenu + * + * @param aMenu is the menu to add the new submenu item. + * @param aSubMenu is the submenu to add the new menu. + * @param aId is the command ID for the new menu item. + * @param aText is the string for the new menu item. + * @param aImage is the image to add to the new menu item. + */ +static inline void AddMenuItem( wxMenu* aMenu, + wxMenu* aSubMenu, + int aId, + const wxString& aText, + const wxBitmap& aImage ) +{ + wxMenuItem* item; + + item = new wxMenuItem( aMenu, aId, aText ); + item->SetSubMenu( aSubMenu ); + +#if defined( USE_IMAGES_IN_MENUS ) + item->SetBitmap( aImage ); +#endif + + aMenu->Append( item ); +}; + + +/** + * Function AddMenuItem + * is an inline helper function to create and insert a menu item with an image + * and a help message string into \a aSubMenu in \a aMenu + * + * @param aMenu is the menu to add the new submenu item. + * @param aSubMenu is the submenu to add the new menu. + * @param aId is the command ID for the new menu item. + * @param aText is the string for the new menu item. + * @param aHelpText is the help message string for the new menu item. + * @param aImage is the image to add to the new menu item. + */ +static inline void AddMenuItem( wxMenu* aMenu, + wxMenu* aSubMenu, + int aId, + const wxString& aText, + const wxString& aHelpText, + const wxBitmap& aImage ) +{ + wxMenuItem* item; + + item = new wxMenuItem( aMenu, aId, aText, aHelpText ); + item->SetSubMenu( aSubMenu ); + +#if defined( USE_IMAGES_IN_MENUS ) + item->SetBitmap( aImage ); +#endif + + aMenu->Append( item ); +}; + + +/** + * Definition SETBITMAPS + * is a macro use to add a bitmaps to check menu item. + * @note Do not use with normal menu items or any platform other than Windows. + * @param aImage is the image to add the menu item. + */ +#if defined( USE_IMAGES_IN_MENUS ) && defined( __WINDOWS__ ) +# define SETBITMAPS( aImage ) item->SetBitmaps( KiBitmap( apply_xpm ), KiBitmap( aImage ) ) +#else +# define SETBITMAPS( aImage ) +#endif + +/** + * Definition SETBITMAP + * is a macro use to add a bitmap to a menu items. + * @note Do not use with checked menu items. + * @param aImage is the image to add the menu item. + */ +#if !defined( USE_IMAGES_IN_MENUS ) +# define SET_BITMAP( aImage ) +#else +# define SET_BITMAP( aImage ) item->SetBitmap( aImage ) +#endif + #endif /* WXSTRUCT_H */ diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 65213cae21..3e26963b5c 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -4,10 +4,8 @@ */ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "kicad.h" -#include "macros.h" -#include "bitmaps.h" + /* Menubar and toolbar event table */ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME ) @@ -74,6 +72,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); + while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); @@ -83,91 +82,93 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() wxMenu* fileMenu = new wxMenu; // Open - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_LOAD_PROJECT, - _( "&Open\tCtrl+O" ), - _( "Open an existing project" ), - open_project_xpm ); + AddMenuItem( fileMenu, + ID_LOAD_PROJECT, + _( "&Open\tCtrl+O" ), + _( "Open an existing project" ), + open_project_xpm ); // Open Recent submenu static wxMenu* openRecentMenu; + // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu, - wxID_ANY, - _( "Open &Recent" ), - _( "Open a recent opened schematic project" ), - open_project_xpm ); + AddMenuItem( fileMenu, openRecentMenu, + wxID_ANY, + _( "Open &Recent" ), + _( "Open a recent opened schematic project" ), + open_project_xpm ); // New - ADD_MENUITEM_WITH_HELP( fileMenu, ID_NEW_PROJECT, - _( "&New\tCtrl+N" ), - _( "Start a new project" ), - new_project_xpm ); + AddMenuItem( fileMenu, ID_NEW_PROJECT, + _( "&New\tCtrl+N" ), + _( "Start a new project" ), + new_project_xpm ); // Save - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SAVE_PROJECT, - _( "&Save\tCtrl+S" ), - _( "Save current project" ), - save_project_xpm ); + AddMenuItem( fileMenu, + ID_SAVE_PROJECT, + _( "&Save\tCtrl+S" ), + _( "Save current project" ), + save_project_xpm ); // Archive fileMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_SAVE_AND_ZIP_FILES, - _( "&Archive" ), - _( "Archive project files in zip archive" ), - zip_xpm ); + AddMenuItem( fileMenu, + ID_SAVE_AND_ZIP_FILES, + _( "&Archive" ), + _( "Archive project files in zip archive" ), + zip_xpm ); // Unarchive - ADD_MENUITEM_WITH_HELP( fileMenu, - ID_READ_ZIP_ARCHIVE, - _( "&Unarchive" ), - _( "Unarchive project files from zip file" ), - unzip_xpm ); + AddMenuItem( fileMenu, + ID_READ_ZIP_ARCHIVE, + _( "&Unarchive" ), + _( "Unarchive project files from zip file" ), + unzip_xpm ); // Separator fileMenu->AppendSeparator(); // Quit - ADD_MENUITEM_WITH_HELP( fileMenu, - wxID_EXIT, - _( "&Quit" ), - _( "Quit KiCad" ), - exit_xpm ); + AddMenuItem( fileMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit KiCad" ), + exit_xpm ); // Menu Browse: wxMenu* browseMenu = new wxMenu(); // Text editor - ADD_MENUITEM_WITH_HELP( browseMenu, - ID_TO_EDITOR, - _( "Text E&ditor" ), - _( "Launch preferred text editor" ), - editor_xpm ); + AddMenuItem( browseMenu, + ID_TO_EDITOR, + _( "Text E&ditor" ), + _( "Launch preferred text editor" ), + editor_xpm ); // View file - ADD_MENUITEM_WITH_HELP( browseMenu, - ID_BROWSE_AN_SELECT_FILE, - _( "&View File" ), - _( "View, read or edit file with a text editor" ), - browse_files_xpm ); + AddMenuItem( browseMenu, + ID_BROWSE_AN_SELECT_FILE, + _( "&View File" ), + _( "View, read or edit file with a text editor" ), + browse_files_xpm ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Text editor - ADD_MENUITEM_WITH_HELP( preferencesMenu, - ID_SELECT_PREFERED_EDITOR, - _( "&Text Editor" ), - _( "Select your preferred text editor" ), - editor_xpm ); + AddMenuItem( preferencesMenu, + ID_SELECT_PREFERED_EDITOR, + _( "&Text Editor" ), + _( "Select your preferred text editor" ), + editor_xpm ); // PDF Viewer submenu:System browser or user defined checkbox wxMenu* SubMenuPdfBrowserChoice = new wxMenu; @@ -200,18 +201,18 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() !wxGetApp().m_PdfBrowserIsDefault ); // Append PDF Viewer submenu to preferences - ADD_MENUITEM_WITH_HELP( SubMenuPdfBrowserChoice, - ID_SELECT_PREFERED_PDF_BROWSER_NAME, - _( "PDF Viewer" ), - _( "Select your favourite PDF viewer used to browse datasheets" ), - datasheet_xpm ); + AddMenuItem( SubMenuPdfBrowserChoice, + ID_SELECT_PREFERED_PDF_BROWSER_NAME, + _( "PDF Viewer" ), + _( "Select your favourite PDF viewer used to browse datasheets" ), + datasheet_xpm ); // PDF viewer submenu - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( preferencesMenu, - SubMenuPdfBrowserChoice, -1, - _( "PDF Viewer" ), - _( "PDF viewer preferences" ), - datasheet_xpm ); + AddMenuItem( preferencesMenu, + SubMenuPdfBrowserChoice, -1, + _( "PDF Viewer" ), + _( "PDF viewer preferences" ), + datasheet_xpm ); // Language submenu preferencesMenu->AppendSeparator(); @@ -224,26 +225,26 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the Kicad handbook" ), - online_help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the Kicad handbook" ), + online_help_xpm ); + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + help_xpm ); // Separator helpMenu->AppendSeparator(); // About - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_ABOUT, - _( "&About KiCad" ), - _( "About kicad project manager" ), - info_xpm ); + AddMenuItem( helpMenu, + wxID_ABOUT, + _( "&About KiCad" ), + _( "About kicad project manager" ), + info_xpm ); // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 2f28ed4fd1..f52d563258 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -3,7 +3,6 @@ /****************/ #include "fctsys.h" -#include "common.h" #include "class_drawpanel.h" #include "pcbnew.h" #include "wxPcbStruct.h" @@ -176,16 +175,16 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) wxMenu itemMenu; /* Give a title to the selection menu. This is also a cancel menu item */ - wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) ); + wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) ); #ifdef __WINDOWS__ - wxFont bold_font(*wxNORMAL_FONT); - bold_font.SetWeight(wxFONTWEIGHT_BOLD); - bold_font.SetStyle( wxFONTSTYLE_ITALIC); - item_title->SetFont(bold_font); + wxFont bold_font( *wxNORMAL_FONT ); + bold_font.SetWeight( wxFONTWEIGHT_BOLD ); + bold_font.SetStyle( wxFONTSTYLE_ITALIC ); + item_title->SetFont( bold_font ); #endif - itemMenu.Append(item_title); + itemMenu.Append( item_title ); itemMenu.AppendSeparator(); int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() ); @@ -199,7 +198,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) BITMAP_DEF xpm = item->GetMenuImage(); - ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); + AddMenuItem( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); } /* @todo: rather than assignment to true, these should be increment and decrement diff --git a/pcbnew/gendrill.h b/pcbnew/gendrill.h index ce89170a4c..41d36363f1 100644 --- a/pcbnew/gendrill.h +++ b/pcbnew/gendrill.h @@ -188,12 +188,14 @@ private: * Function BuildHolesList * Create the list of holes and tools for a given board * The list is sorted by increasing drill values - * Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because pad holes are always through holes) + * Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because + * pad holes are always through holes) * @param aPcb : the given board * @param aHoleListBuffer : the std::vector to fill with pcb holes info * @param aToolListBuffer : the std::vector to fill with tools to use * @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored * @param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored + * @param aExcludeThroughHoles Exclude through holes if true. * @param aGenerateNPTH_list : * true to create NPTH only list (with no plated holes) * false to created plated holes list (with no NPTH ) diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 28509bd3ea..b263932d53 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -3,13 +3,11 @@ * @brief (Re)Create the main menubar for the module editor */ #include "fctsys.h" -#include "common.h" #include "pcbnew.h" #include "wxPcbStruct.h" #include "module_editor_frame.h" -#include "bitmaps.h" #include "protos.h" #include "pcbnew_id.h" @@ -71,10 +69,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() openSubmenu->Append( item ); /* Append openSubmenu to fileMenu */ - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1, - _( "&Load Module" ), - _( "Load a footprint module" ), - open_document_xpm ); + AddMenuItem( fileMenu, openSubmenu, -1, + _( "&Load Module" ), + _( "Load a footprint module" ), + open_document_xpm ); // Save module item = new wxMenuItem( fileMenu, @@ -188,11 +186,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() dimensions_Submenu->Append( item ); // Append dimensions_Submenu to editMenu - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu, - dimensions_Submenu, -1, - _( "&Dimensions" ), - _( "Edit dimensions preferences" ), - add_dimension_xpm ); + AddMenuItem( editMenu, + dimensions_Submenu, -1, + _( "&Dimensions" ), + _( "Edit dimensions preferences" ), + add_dimension_xpm ); // View menu wxMenu* viewMenu = new wxMenu; @@ -302,23 +300,23 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the PCBNew handbook" ), - online_help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the PCBNew handbook" ), + online_help_xpm ); + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + help_xpm ); // About PCBNew helpMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, - _( "&About PCBNew" ), - _( "About PCBNew PCB designer" ), - info_xpm ); + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About PCBNew" ), + _( "About PCBNew PCB designer" ), + info_xpm ); // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index ef1ed380b6..bca4ff3d23 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -4,14 +4,11 @@ */ #include "fctsys.h" #include "appl_wxstruct.h" -#include "common.h" #include "pcbnew.h" #include "wxPcbStruct.h" -#include "bitmaps.h" #include "protos.h" #include "hotkeys.h" #include "pcbnew_id.h" -#include "macros.h" #include "help_common_strings.h" @@ -30,6 +27,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); + while( menuBar->GetMenuCount() ) delete menuBar->Remove(0); @@ -54,17 +52,19 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Load Recent submenu static wxMenu* openRecentMenu; + // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu(); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, - -1, _( "Open &Recent" ), - _( "Open a recent opened board" ), - open_project_xpm ); + AddMenuItem( filesMenu, openRecentMenu, + -1, _( "Open &Recent" ), + _( "Open a recent opened board" ), + open_project_xpm ); // PCBNew Board @@ -136,10 +136,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() fabricationOutputsMenu->Append( item ); // Fabrications Outputs submenu append - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, fabricationOutputsMenu, - -1, _( "Fabrication Outputs" ), - _( "Generate files for fabrication" ), - fabrication_xpm ); + AddMenuItem( filesMenu, fabricationOutputsMenu, + -1, _( "Fabrication Outputs" ), + _( "Generate files for fabrication" ), + fabrication_xpm ); @@ -153,9 +153,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( import_xpm ); // @todo need better bitmap submenuImport->Append( item ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport, - ID_GEN_IMPORT_FILE, _( "Import" ), - _( "Import files" ), import_xpm ); + AddMenuItem( filesMenu, submenuImport, + ID_GEN_IMPORT_FILE, _( "Import" ), + _( "Import files" ), import_xpm ); @@ -189,9 +189,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( three_d_xpm ); submenuexport->Append( item ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport, - ID_GEN_EXPORT_FILE, _( "&Export" ), - _( "Export board" ), export_xpm ); + AddMenuItem( filesMenu, submenuexport, + ID_GEN_EXPORT_FILE, _( "&Export" ), + _( "Export board" ), export_xpm ); filesMenu->AppendSeparator(); @@ -240,11 +240,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( library_xpm ); submenuarchive->Append( item ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive, - ID_MENU_ARCHIVE_MODULES, - _( "Archive Footprints" ), - _( "Archive or add footprints in a library file" ), - library_xpm ); + AddMenuItem( filesMenu, submenuarchive, + ID_MENU_ARCHIVE_MODULES, + _( "Archive Footprints" ), + _( "Archive or add footprints in a library file" ), + library_xpm ); /* Quit */ filesMenu->AppendSeparator(); @@ -337,36 +337,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() * for Zoom in and Zoom out sub menus */ // Zoom In - text = AddHotkeyName( _( "Zoom In" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ZOOM_IN, false ); - item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, - HELP_ZOOM_IN, wxITEM_NORMAL ); + text = AddHotkeyName( _( "Zoom In" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_IN, false ); + item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); // Zoom Out - text = AddHotkeyName( _( "Zoom Out" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ZOOM_OUT, false ); - item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, - HELP_ZOOM_OUT, wxITEM_NORMAL ); + text = AddHotkeyName( _( "Zoom Out" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_OUT, false ); + item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); // Fit on Screen - text = AddHotkeyName( _( "Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ZOOM_AUTO ); + text = AddHotkeyName( _( "Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_AUTO ); - item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, - HELP_ZOOM_FIT, wxITEM_NORMAL ); + item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); viewMenu->AppendSeparator(); // Redraw - text = AddHotkeyName( _( "Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ZOOM_REDRAW ); + text = AddHotkeyName( _( "Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW ); item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, @@ -403,8 +396,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() placeMenu->Append( item ); // Track - text = AddHotkeyName( _( "Track" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ADD_NEW_TRACK, false ); + text = AddHotkeyName( _( "Track" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK, false ); item = new wxMenuItem( placeMenu, ID_TRACK_BUTT, text, _( "Add tracks and vias" ), wxITEM_NORMAL ); @@ -449,8 +441,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Dimension item = new wxMenuItem( placeMenu, ID_PCB_DIMENSION_BUTT, - _( "Dimension" ), - _( "Add dimension" ) ); + _( "Dimension" ), + _( "Add dimension" ) ); SET_BITMAP( add_dimension_xpm ); placeMenu->Append( item ); @@ -464,8 +456,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Drill & Place Offset item = new wxMenuItem( placeMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT, - _( "Drill and Place Offset" ), - _( "Place the origin point for drill and place files" )); + _( "Drill and Place Offset" ), + _( "Place the origin point for drill and place files" )); SET_BITMAP( pcb_offset_xpm ); placeMenu->Append( item ); @@ -556,10 +548,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() dimensionsMenu->Append( item ); // Append dimension menu to config menu - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( configmenu, dimensionsMenu, - -1, _( "Di&mensions" ), - _( "Global dimensions preferences" ), - add_dimension_xpm ); + AddMenuItem( configmenu, dimensionsMenu, + -1, _( "Di&mensions" ), + _( "Global dimensions preferences" ), + add_dimension_xpm ); // Language submenu wxGetApp().AddMenuLanguageList( configmenu ); @@ -634,7 +626,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( copper_layers_setup_xpm ); designRulesMenu->Append( item ); - /** * Help menu */ @@ -643,23 +634,23 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_HELP, - _( "&Contents" ), - _( "Open the PCBNew handbook" ), - online_help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - help_xpm ); + AddMenuItem( helpMenu, + wxID_HELP, + _( "&Contents" ), + _( "Open the PCBNew handbook" ), + online_help_xpm ); + AddMenuItem( helpMenu, + wxID_INDEX, + _( "&Getting Started in KiCad" ), + _( "Open the \"Getting Started in KiCad\" guide for beginners" ), + help_xpm ); // About helpMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, - _( "&About PCBNew" ), - _( "About PCBnew printed circuit board designer" ), - info_xpm ); + AddMenuItem( helpMenu, wxID_ABOUT, + _( "&About PCBNew" ), + _( "About PCBnew printed circuit board designer" ), + info_xpm ); /** * Append all menus to the menuBar diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 8a81b80edf..e752e3e603 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -8,7 +8,6 @@ #include "confirm.h" #include "gestfich.h" #include "appl_wxstruct.h" -#include "bitmaps.h" #include "pcbnew_id.h" #include "trigo.h" @@ -100,10 +99,10 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode ) text = item->GetSelectMenuText(); xpm = item->GetMenuImage(); - ADD_MENUITEM( &itemMenu, - ID_POPUP_PCB_ITEM_SELECTION_START + ii, - text, - xpm ); + AddMenuItem( &itemMenu, + ID_POPUP_PCB_ITEM_SELECTION_START + ii, + text, + xpm ); } // this menu's handler is void @@ -735,6 +734,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) edgemod->m_Start0 = edgemod->m_Start; edgemod->m_End0 = edgemod->m_End; } + if( PtStruct->Type() == TYPE_TEXTE_MODULE ) { textmod = (TEXTE_MODULE*) PtStruct; @@ -775,6 +775,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) /* Reverse mirror of footprints. */ PtStruct = module->m_Drawings; + for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index 37950bd7bd..5deaaf7382 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -3,7 +3,6 @@ /************************/ #include "fctsys.h" -#include "common.h" #include "class_drawpanel.h" #include "confirm.h" @@ -13,7 +12,6 @@ #include "module_editor_frame.h" #include "dialog_edit_module_for_Modedit.h" -#include "bitmaps.h" #include "protos.h" #include "pcbnew_id.h" @@ -199,9 +197,9 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen if( GetToolId() != ID_NO_TOOL_SELECTED ) { if( item && item->m_Flags ) - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); else - ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), cancel_tool_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), cancel_tool_xpm ); PopMenu->AppendSeparator(); } @@ -211,31 +209,31 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen { if( blockActive ) // Put block commands in list { - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel Block" ), cancel_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, - _( "Zoom Block (drag middle mouse)" ), - zoom_area_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel Block" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, + _( "Zoom Block (drag middle mouse)" ), + zoom_area_xpm ); PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, - _( "Place Block" ), apply_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, - _( "Copy Block (shift + drag mouse)" ), - copyblock_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, - _( "Mirror Block (alt + drag mouse)" ), - mirror_h_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, - _( "Rotate Block (ctrl + drag mouse)" ), - rotate_ccw_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, - _( "Delete Block (shift+ctrl + drag mouse)" ), - delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, + _( "Place Block" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, + _( "Copy Block (shift + drag mouse)" ), + copyblock_xpm ); + AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, + _( "Mirror Block (alt + drag mouse)" ), + mirror_h_xpm ); + AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, + _( "Rotate Block (ctrl + drag mouse)" ), + rotate_ccw_xpm ); + AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, + _( "Delete Block (shift+ctrl + drag mouse)" ), + delete_xpm ); } else { - ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel" ), cancel_xpm ); + AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel" ), cancel_xpm ); } PopMenu->AppendSeparator(); @@ -252,13 +250,13 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen case TYPE_MODULE: { wxMenu* transform_choice = new wxMenu; - ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ), - rotate_module_pos_xpm ); - ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ), mirror_h_xpm ); + AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ), + rotate_module_pos_xpm ); + AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ), mirror_h_xpm ); msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, edit_module_xpm ); - ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE, - _( "Transform Module" ), edit_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, edit_module_xpm ); + AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE, + _( "Transform Module" ), edit_xpm ); break; } @@ -266,23 +264,23 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen if( !flags ) { msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, move_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, move_pad_xpm ); } msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, - _( "New Pad Settings" ), options_new_pad_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, - _( "Export Pad Settings" ), export_options_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, options_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, + _( "New Pad Settings" ), options_new_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, + _( "Export Pad Settings" ), export_options_pad_xpm ); msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, delete_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, delete_pad_xpm ); if( !flags ) { PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, - _( "Global Pad Settings" ), global_options_pad_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, + _( "Global Pad Settings" ), global_options_pad_xpm ); } break; @@ -292,24 +290,24 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen { msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg, move_field_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg, move_field_xpm ); } msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, rotate_field_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, rotate_field_xpm ); if( !flags ) { msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, edit_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, edit_text_xpm ); if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS ) { msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg, delete_text_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg, delete_text_xpm ); } } break; @@ -317,29 +315,29 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen case TYPE_EDGE_MODULE: { if( (flags & IS_NEW) ) - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ), apply_xpm ); if( !flags ) { msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, move_line_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, move_line_xpm ); } + if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED ) - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ), apply_xpm ); wxMenu* edit_mnu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), - edit_xpm ); - ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE, - _( "Edit Width (Current)" ), width_segment_xpm ); - ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE, - _( "Edit Width (All)" ), width_segment_xpm ); - ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE, - _( "Edit Layer (Current)" ), select_layer_pair_xpm ); - ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE, - _( "Edit Layer (All)" ), select_layer_pair_xpm ); + AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), edit_xpm ); + AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE, + _( "Edit Width (Current)" ), width_segment_xpm ); + AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE, + _( "Edit Width (All)" ), width_segment_xpm ); + AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE, + _( "Edit Layer (Current)" ), select_layer_pair_xpm ); + AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE, + _( "Edit Layer (All)" ), select_layer_pair_xpm ); msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, delete_xpm ); append_set_width = TRUE; } break; @@ -377,7 +375,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen || ( GetToolId() == ID_PCB_CIRCLE_BUTT ) || ( GetToolId() == ID_PCB_ARC_BUTT ) ) ) ) { - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Width" ), width_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Width" ), width_segment_xpm ); PopMenu->AppendSeparator(); } @@ -441,6 +439,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) SetCurItem( NULL ); DrawPanel->Refresh(); } + break; } diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index a5195e6fee..0c7bbeffbf 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -30,7 +30,7 @@ public: /** * Function RedrawActiveWindoow - * daws the footprint editor BOARD, and others elements : axis, grid .. + * daws the footprint editor BOARD, and others elements such as axis and grid. */ void RedrawActiveWindow( wxDC* DC, bool EraseBg ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index c34d316a5a..8afb9d9356 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -4,8 +4,6 @@ #include "fctsys.h" #include "gr_basic.h" -#include "macros.h" -#include "common.h" #include "class_drawpanel.h" #include "confirm.h" @@ -17,8 +15,6 @@ #include "hotkeys.h" #include "collectors.h" -/* Bitmaps */ -#include "bitmaps.h" static wxMenu* Append_Track_Width_List( BOARD* aBoard ); @@ -36,7 +32,6 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu - // If a command or a block is in progress: // Put the Cancel command (if needed) and the End command @@ -53,12 +48,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { if( item && item->m_Flags ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm ); } else { - ADD_MENUITEM( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, - _( "End Tool" ), cancel_tool_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, + _( "End Tool" ), cancel_tool_xpm ); } aPopMenu->AppendSeparator(); @@ -67,8 +62,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { if( item && item->m_Flags ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, - _( "Cancel" ), cancel_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, + _( "Cancel" ), cancel_xpm ); aPopMenu->AppendSeparator(); } } @@ -106,6 +101,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) } item = GetCurItem(); + if( item ) flags = item->m_Flags; else @@ -126,15 +122,15 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { msg = AddHotkeyName( _("Lock Module" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg, - locked_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg, + locked_xpm ); } else { msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, - unlocked_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, + unlocked_xpm ); } if( !flags ) @@ -160,41 +156,45 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) case TYPE_DRAWSEGMENT: // Some graphic items on technical layers if( (flags & IS_NEW) ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, - _( "End Drawing" ), apply_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, + _( "End Drawing" ), apply_xpm ); } if( !flags ) { msg = AddHotkeyName( _( "Move Drawing" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, - msg, move_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), edit_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( - "Delete Drawing" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, + msg, move_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), edit_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, + _( "Delete Drawing" ), delete_xpm ); if( item->GetLayer() > LAST_COPPER_LAYER ) - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER, - _( "Delete All Drawing on Layer" ), delete_body_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER, + _( "Delete All Drawing on Layer" ), delete_body_xpm ); } + break; case TYPE_ZONE: // Item used to fill a zone - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, - _( "Delete Zone Filling" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, + _( "Delete Zone Filling" ), delete_xpm ); break; case TYPE_ZONE_CONTAINER: // Item used to handle a zone area (outlines, holes ...) if( flags & IS_NEW ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, - _( "Close Zone Outline" ), apply_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, - _( "Delete Last Corner" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, + _( "Close Zone Outline" ), apply_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, + _( "Delete Last Corner" ), delete_xpm ); } else + { createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); + } + break; case TYPE_TEXTE: @@ -216,10 +216,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { msg = AddHotkeyName( _( "Edit Dimension" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, edit_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, - _( "Delete Dimension" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, edit_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, + _( "Delete Dimension" ), delete_xpm ); } + break; case TYPE_MIRE: @@ -227,35 +228,35 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { msg = AddHotkeyName( _( "Move Target" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg, move_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg, move_xpm ); msg = AddHotkeyName( _( "Edit Target" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, edit_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, - _( "Delete Target" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, edit_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, + _( "Delete Target" ), delete_xpm ); } + break; case TYPE_EDGE_MODULE: case TYPE_SCREEN: case TYPE_NOT_INIT: case TYPE_PCB: - msg.Printf( - wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ), - item->Type() ); + msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ), + item->Type() ); DisplayError( this, msg ); SetCurItem( NULL ); break; default: - msg.Printf( - wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ), - item->Type() ); + msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ), + item->Type() ); DisplayError( this, msg ); // Attempt to clear error (but should no occurs ) if( item->Type() >= MAX_STRUCT_TYPE_ID ) SetCurItem( NULL ); + break; } @@ -266,8 +267,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { msg = AddHotkeyName( _( "Get and Move Footprint" ), g_Board_Editor_Hokeys_Descr, HK_GET_AND_MOVE_FOOTPRINT ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, - msg, move_module_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, + msg, move_module_xpm ); } /* Display context sensitive comands: */ @@ -277,27 +278,27 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) if( GetBoard()->m_ZoneDescriptorList.size() > 0 ) { aPopMenu->AppendSeparator(); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, - _( "Fill or Refill All Zones" ), fill_zone_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES, - _( "Remove Filled Areas in All Zones" ), fill_zone_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, + _( "Fill or Refill All Zones" ), fill_zone_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES, + _( "Remove Filled Areas in All Zones" ), fill_zone_xpm ); aPopMenu->AppendSeparator(); } - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, - _( "Select Working Layer" ), select_w_layer_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, + _( "Select Working Layer" ), select_w_layer_xpm ); aPopMenu->AppendSeparator(); break; case ID_TRACK_BUTT: if ( ! locate_track ) // This menu is already added when a track is located - ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List( GetBoard() ), - ID_POPUP_PCB_SELECT_WIDTH, - _( "Select Track Width" ), width_track_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, - _( "Select Working Layer" ), select_w_layer_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, - _( "Select Layer Pair for Vias" ), select_layer_pair_xpm ); + AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), + ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), width_track_xpm ); + + AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, + _( "Select Working Layer" ), select_w_layer_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, + _( "Select Layer Pair for Vias" ), select_layer_pair_xpm ); aPopMenu->AppendSeparator(); break; @@ -306,14 +307,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) case ID_PCB_ADD_TEXT_BUTT: case ID_PCB_ADD_LINE_BUTT: case ID_PCB_DIMENSION_BUTT: - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER, + AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER, _( "Select Working Layer" ), select_w_layer_xpm ); aPopMenu->AppendSeparator(); break; case ID_PCB_MODULE_BUTT: - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, - _( "Footprint Documentation" ), book_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, + _( "Footprint Documentation" ), book_xpm ); aPopMenu->AppendSeparator(); break; @@ -321,23 +322,23 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE ) { wxMenu* commands = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, - _( "Glob Move and Place" ), move_xpm ); - ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, - _( "Unlock All Modules" ), unlocked_xpm ); - ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, - _( "Lock All Modules" ), locked_xpm ); + AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, + _( "Glob Move and Place" ), move_xpm ); + AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, + _( "Unlock All Modules" ), unlocked_xpm ); + AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, + _( "Lock All Modules" ), locked_xpm ); commands->AppendSeparator(); - ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES, - _( "Move All Modules" ), move_xpm ); + AddMenuItem( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES, + _( "Move All Modules" ), move_xpm ); commands->Append( ID_POPUP_PCB_AUTOMOVE_NEW_MODULES, _( "Move New Modules" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOPLACE_ALL_MODULES, _( "Autoplace All Modules" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEW_MODULES, _( "Autoplace New Modules" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE, _( "Autoplace Next Module" ) ); commands->AppendSeparator(); - ADD_MENUITEM( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES, - _( "Orient All Modules" ), rotate_module_pos_xpm ); + AddMenuItem( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES, + _( "Orient All Modules" ), rotate_module_pos_xpm ); aPopMenu->AppendSeparator(); } @@ -345,8 +346,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { wxMenu* commands = new wxMenu; aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); - ADD_MENUITEM( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR, - _( "Select Layer Pair" ), select_layer_pair_xpm ); + AddMenuItem( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR, + _( "Select Layer Pair" ), select_layer_pair_xpm ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Autoroute All Modules" ) ); commands->AppendSeparator(); @@ -355,11 +356,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) } if( locate_track ) - ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List( GetBoard() ), - ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), - width_track_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, - _( "Select Working Layer" ), select_w_layer_xpm ); + AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), + ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), + width_track_xpm ); + + AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, + _( "Select Working Layer" ), select_w_layer_xpm ); aPopMenu->AppendSeparator(); break; } @@ -373,14 +375,14 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) */ void PCB_EDIT_FRAME::createPopUpBlockMenu( wxMenu* menu ) { - ADD_MENUITEM( menu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), cancel_xpm ); - ADD_MENUITEM( menu, ID_POPUP_ZOOM_BLOCK, _( "Zoom Block" ), zoom_area_xpm ); + AddMenuItem( menu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), cancel_xpm ); + AddMenuItem( menu, ID_POPUP_ZOOM_BLOCK, _( "Zoom Block" ), zoom_area_xpm ); menu->AppendSeparator(); - ADD_MENUITEM( menu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); - ADD_MENUITEM( menu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); - ADD_MENUITEM( menu, ID_POPUP_FLIP_BLOCK, _( "Flip Block" ), invert_module_xpm ); - ADD_MENUITEM( menu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block" ), rotate_ccw_xpm ); - ADD_MENUITEM( menu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); + AddMenuItem( menu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm ); + AddMenuItem( menu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); + AddMenuItem( menu, ID_POPUP_FLIP_BLOCK, _( "Flip Block" ), invert_module_xpm ); + AddMenuItem( menu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block" ), rotate_ccw_xpm ); + AddMenuItem( menu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); } @@ -402,35 +404,35 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) { if( Track->Type() == TYPE_VIA ) { - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), move_xpm ); } else { if( Track->IsPointOnEnds( cursorPosition, -1 ) != 0 ) { msg = AddHotkeyName( _( "Move Node" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, - msg, move_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, + msg, move_xpm ); } else { msg = AddHotkeyName( _( "Drag Segments, Keep Slope" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_TRACK_KEEP_SLOPE ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE, - msg, drag_segment_withslope_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE, + msg, drag_segment_withslope_xpm ); msg = AddHotkeyName( _( "Drag Segment" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT, - msg, drag_track_segment_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_BREAK_TRACK, - _( "Break Track" ), break_line_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT, + msg, drag_track_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_BREAK_TRACK, + _( "Break Track" ), break_line_xpm ); } } } else if( flags & IS_DRAGGED ) // Drag via or node in progress { - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE, - _( "Place Node" ), apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE, + _( "Place Node" ), apply_xpm ); return; } else // Edition in progress @@ -438,8 +440,9 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) if( flags & IS_NEW ) { msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_END_TRACK ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_END_TRACK, msg, apply_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, apply_xpm ); } + msg = AddHotkeyName( _( "Place Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_VIA ); PopMenu->Append( ID_POPUP_PCB_PLACE_VIA, msg ); @@ -463,55 +466,52 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) { msg = AddHotkeyName( _( "Change Via Size and Drill" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm ); } else { msg = AddHotkeyName( _( "Change Segment Width" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm ); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK, - _( "Change Track Width" ), width_track_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, msg, width_segment_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TRACK, + _( "Change Track Width" ), width_track_xpm ); } } // Allows switching to an other track/via size when routing - ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List( GetBoard() ), - ID_POPUP_PCB_SELECT_WIDTH, - _( "Select Track Width" ), width_track_xpm ); + AddMenuItem( PopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, + _( "Select Track Width" ), width_track_xpm ); // Delete control: PopMenu->AppendSeparator(); wxMenu* track_mnu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, ID_POPUP_PCB_DELETE_TRACK_MNU, - _( "Delete" ), delete_xpm ); + AddMenuItem( PopMenu, track_mnu, ID_POPUP_PCB_DELETE_TRACK_MNU, _( "Delete" ), delete_xpm ); msg = AddHotkeyName( Track->Type()==TYPE_VIA ? _( "Delete Via" ) : _( "Delete Segment" ), g_Board_Editor_Hokeys_Descr, HK_BACK_SPACE ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG, msg, delete_line_xpm ); + AddMenuItem( track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG, msg, delete_line_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Delete Track" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACK, msg, delete_track_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKNET, _( "Delete Net" ), delete_net_xpm ); + AddMenuItem( track_mnu, ID_POPUP_PCB_DELETE_TRACK, msg, delete_track_xpm ); + AddMenuItem( track_mnu, ID_POPUP_PCB_DELETE_TRACKNET, _( "Delete Net" ), delete_net_xpm ); } // Add global edition command if( !flags ) { PopMenu->AppendSeparator(); - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, - _( "Global Tracks and Vias Edition" ), width_track_via_xpm ); + AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, + _( "Global Tracks and Vias Edition" ), width_track_via_xpm ); } // Add lock/unlock flags menu: track_mnu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, - ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), flag_xpm ); + AddMenuItem( PopMenu, track_mnu, ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), flag_xpm ); track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, true ); track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, true ); @@ -539,72 +539,73 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* if( edge_zone->m_Flags == IS_DRAGGED ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT, - _( "Place Edge Outline" ), apply_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT, + _( "Place Edge Outline" ), apply_xpm ); } else if( edge_zone->m_Flags ) { if( (edge_zone->m_Flags & IN_EDIT ) ) - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER, - _( "Place Corner" ), apply_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER, + _( "Place Corner" ), apply_xpm ); else - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_OUTLINES, - _( "Place Zone" ), apply_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_OUTLINES, + _( "Place Zone" ), apply_xpm ); } else { wxMenu* zones_menu = new wxMenu(); - ADD_MENUITEM_WITH_SUBMENU( aPopMenu, zones_menu, - -1, _( "Zones" ), add_zone_xpm ); + AddMenuItem( aPopMenu, zones_menu, -1, _( "Zones" ), add_zone_xpm ); + if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) ) { - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER, - _( "Move Corner" ), move_xpm ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER, - _( "Delete Corner" ), delete_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER, + _( "Move Corner" ), move_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER, + _( "Delete Corner" ), delete_xpm ); } else if( edge_zone->HitTestForEdge( GetScreen()->RefPos( true ) ) ) { - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER, - _( "Create Corner" ), add_corner_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER, + _( "Create Corner" ), add_corner_xpm ); msg = AddHotkeyName( _( "Drag Outline Segment" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT, - msg, drag_outline_segment_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT, + msg, drag_outline_segment_xpm ); } zones_menu->AppendSeparator(); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE, - _( "Add Similar Zone" ), add_zone_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE, + _( "Add Similar Zone" ), add_zone_xpm ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE, - _( "Add Cutout Area" ), add_zone_cutout_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE, + _( "Add Cutout Area" ), add_zone_cutout_xpm ); zones_menu->AppendSeparator(); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), fill_zone_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), fill_zone_xpm ); if( edge_zone->m_FilledPolysList.size() > 0 ) { - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, - _( "Remove Filled Areas in Zone" ), fill_zone_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, + _( "Remove Filled Areas in Zone" ), fill_zone_xpm ); } msg = AddHotkeyName( _( "Move Zone" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES, msg, move_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_ZONE_OUTLINES, msg, move_xpm ); msg = AddHotkeyName( _( "Edit Zone Params" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS, - msg, edit_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS, + msg, edit_xpm ); zones_menu->AppendSeparator(); + if( edge_zone->m_CornerSelection >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) ) - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CUTOUT, - _( "Delete Cutout" ), delete_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CUTOUT, + _( "Delete Cutout" ), delete_xpm ); - ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER, - _( "Delete Zone Outline" ), delete_xpm ); + AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER, + _( "Delete Zone Outline" ), delete_xpm ); } } @@ -620,34 +621,34 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu sub_menu_footprint = new wxMenu; msg = aModule->GetSelectMenuText(); - ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); + AddMenuItem( menu, sub_menu_footprint, -1, msg, module_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Move" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, - msg, move_module_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, + msg, move_module_xpm ); msg = AddHotkeyName( _( "Drag" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, - msg, drag_module_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, + msg, drag_module_xpm ); } msg = AddHotkeyName( _( "Rotate +" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, - msg, rotate_module_pos_xpm ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, - _( "Rotate -" ), rotate_module_neg_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, + msg, rotate_module_pos_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, + _( "Rotate -" ), rotate_module_neg_xpm ); msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_FOOTPRINT ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE, - msg, invert_module_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE, + msg, invert_module_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, edit_module_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, edit_module_xpm ); sub_menu_footprint->AppendSeparator(); - ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, - _( "Delete Module" ), delete_module_xpm ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, + _( "Delete Module" ), delete_module_xpm ); } } @@ -663,32 +664,32 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me sub_menu_Fp_text = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm ); + AddMenuItem( menu, sub_menu_Fp_text, -1, msg, footprint_text_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Move" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, - msg, move_field_xpm ); + AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, + msg, move_field_xpm ); } msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); - ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, - msg, rotate_field_xpm ); + AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_ROTATE_TEXTMODULE, + msg, rotate_field_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE, - msg, edit_text_xpm ); - ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_RESET_TEXT_SIZE, - _( "Reset Size" ), reset_text_xpm ); + AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_EDIT_TEXTMODULE, + msg, edit_text_xpm ); + AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_RESET_TEXT_SIZE, + _( "Reset Size" ), reset_text_xpm ); } // Graphic texts can be deleted only if are not currently edited. if( !flags && FpText->m_Type == TEXT_is_DIVERS ) { - ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, - _( "Delete" ), delete_xpm ); + AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, + _( "Delete" ), delete_xpm ); } if( !flags ) @@ -722,30 +723,30 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) wxString msg = Pad->GetSelectMenuText(); sub_menu_Pad = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); + AddMenuItem( menu, sub_menu_Pad, -1, msg, pad_xpm ); - ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, _( "Move" ), move_pad_xpm ); - ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, _( "Drag" ), drag_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, _( "Move" ), move_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, _( "Drag" ), drag_pad_xpm ); - ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit" ), options_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit" ), options_pad_xpm ); sub_menu_Pad->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, - _( "Copy Current Settings to this Pad" ), - wxEmptyString, - options_new_pad_xpm ); - ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, - _( "Copy this Pad Settings to Current Settings" ), - wxEmptyString, - export_options_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, + _( "Copy Current Settings to this Pad" ), + wxEmptyString, + options_new_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, + _( "Copy this Pad Settings to Current Settings" ), + wxEmptyString, + export_options_pad_xpm ); - ADD_MENUITEM_WITH_HELP( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, - _( "Global Pads Edition" ), - _( "Copy this pad settings to all pads in this footprint (or similar footprints)" ), - global_options_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, + _( "Global Pads Edition" ), + _( "Copy this pad settings to all pads in this footprint (or similar footprints)" ), + global_options_pad_xpm ); sub_menu_Pad->AppendSeparator(); - ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, _( "Delete" ), delete_pad_xpm ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, _( "Delete" ), delete_pad_xpm ); if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) { @@ -773,30 +774,30 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) sub_menu_Text = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Text, -1, msg, add_text_xpm ); + AddMenuItem( menu, sub_menu_Text, -1, msg, add_text_xpm ); if( !flags ) { msg = AddHotkeyName( _( "Move" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); - ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, - msg, move_text_xpm ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, + msg, move_text_xpm ); } msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); - ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, rotate_ccw_xpm ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, rotate_ccw_xpm ); msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, edit_text_xpm ); - ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE, - _( "Reset Size" ), reset_text_xpm ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, edit_text_xpm ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE, + _( "Reset Size" ), reset_text_xpm ); sub_menu_Text->AppendSeparator(); - ADD_MENUITEM( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, _( "Delete" ), delete_text_xpm ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_DELETE_TEXTEPCB, _( "Delete" ), delete_text_xpm ); } void PCB_EDIT_FRAME::createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu ) { - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MARKER, _( "Delete Marker" ), delete_xpm ); - ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MARKER, _( "Delete Marker" ), delete_xpm ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); } @@ -851,11 +852,14 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) PCB_INTERNAL_UNIT, true ); if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 ) + { msg.Printf( _( "Via %s" ), GetChars( value ) ); + } else { msg.Printf( _( "Via %s; (drl %s)" ), GetChars( value ), GetChars( drill ) ); } + if( ii == 0 ) msg << _( " (use NetClass)" ); diff --git a/pcbnew/protos.h b/pcbnew/protos.h index da58e33998..25cd00f64b 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -224,8 +224,9 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int* * interesting segments * @param aTrackLen = a pointer to an integer where to return the lenght of the * track - * @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits - * from the pads connected to this track to the die (if any) + * @param aLengthDie = a pointer to an integer where to return the extra lengths inside + * integrated circuits from the pads connected to this track to the + * die (if any) * @param aReorder = true for reorder the interesting segments (useful for * track edition/deletion) in this case the flag BUSY is * set (the user is responsible of flag clearing). False diff --git a/pcbnew/track.cpp b/pcbnew/track.cpp index eef61bbb38..2e210ee8ff 100644 --- a/pcbnew/track.cpp +++ b/pcbnew/track.cpp @@ -28,30 +28,6 @@ static void Marque_Chaine_segments( BOARD* Pcb, TRACK_PTRS* aList ); -/** - * Function Marque_Une_Piste - * marks a chain of track segments, connected to aTrackList. - * Each segment is marked by setting the BUSY bit into m_Flags. Electrical - * continuity is detected by walking each segment, and finally the segments - * are rearranged into a contiguous chain within the given list. - * @param aPcb = the board to analyze - * @param aStartSegm - The first interesting segment within a list of track - * segment of aPcb - * @param aSegmCount = a pointer to an integer where to return the number of - * interesting segments - * @param aTrackLen = a pointer to an integer where to return the length of the - * track on board - * @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits - * from the pads connected to this track to the die (if any) - * @param aReorder = bool: - * true for reorder the interesting segments (useful for track - *edition/deletion) - * in this case the flag BUSY is set (the user is responsible of flag - *clearing) - * false for no reorder : useful when we want just calculate the track length - * in this case, flags are reset - * @return TRACK* the first in the chain of interesting segments. - */ TRACK* Marque_Une_Piste( BOARD* aPcb, TRACK* aStartSegm, int* aSegmCount,