From 74e10791ff8a6582eb138dded2fc513cc7e1940f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 1 Jun 2019 14:32:12 +0100 Subject: [PATCH] Fix some Mac-specific issues with the Preferences... menu item. --- common/tool/conditional_menu.cpp | 18 ++++++++++++++++-- eeschema/eeschema_id.h | 7 +------ eeschema/libedit/menubar_libedit.cpp | 2 +- eeschema/menubar.cpp | 2 +- gerbview/hotkeys.h | 1 - gerbview/menubar.cpp | 15 +++++++-------- include/id.h | 1 - kicad/menubar.cpp | 2 +- pagelayout_editor/menubar.cpp | 2 +- pcbnew/hotkeys.h | 1 - pcbnew/menubar_footprint_editor.cpp | 2 +- pcbnew/menubar_pcb_editor.cpp | 2 +- pcbnew/pcbnew_id.h | 10 ---------- 13 files changed, 30 insertions(+), 35 deletions(-) diff --git a/common/tool/conditional_menu.cpp b/common/tool/conditional_menu.cpp index 000bb46fc3..15135b2faf 100644 --- a/common/tool/conditional_menu.cpp +++ b/common/tool/conditional_menu.cpp @@ -69,6 +69,12 @@ void CONDITIONAL_MENU::AddItem( int aId, const wxString& aText, const wxString& AddBitmapToMenuItem( item, KiBitmap( aIcon ) ); addEntry( ENTRY( item, aIcon, aCondition, aOrder, false ) ); + +#ifdef __WXMAC__ + // Make sure the Mac-specific preference-menu handling code can find it + if( aId == wxID_PREFERENCES ) + Append( new wxMenuItem( this, aId, aText, aTooltip, wxITEM_NORMAL ) ); +#endif } @@ -136,8 +142,16 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection ) break; case ENTRY::WXITEM: - menuItem = new wxMenuItem( this, entry.wxItem()->GetId(), entry.wxItem()->GetItemLabel(), - entry.wxItem()->GetHelp(), entry.wxItem()->GetKind() ); +#ifdef __WXMAC__ + // wxWidgets moved the Preferences... item to the Apple menu + if( entry.wxItem()->GetId() == wxID_PREFERENCES ) + continue; +#endif + menuItem = new wxMenuItem( this, + entry.wxItem()->GetId(), + entry.wxItem()->GetItemLabel(), + entry.wxItem()->GetHelp(), + entry.wxItem()->GetKind() ); if( entry.GetIcon() ) AddBitmapToMenuItem( menuItem, KiBitmap( entry.GetIcon() ) ); diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index c426940a11..25d398ba2a 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -108,7 +108,6 @@ enum id_eeschema_frm ID_LIBEDIT_ADD_LIBRARY, ID_LIBEDIT_SAVE, ID_LIBEDIT_SAVE_AS, - ID_LIBEDIT_SAVE_ALL, ID_LIBEDIT_REVERT, ID_LIBEDIT_NEW_PART, ID_LIBEDIT_EDIT_PART, @@ -157,12 +156,10 @@ enum id_eeschema_frm ID_SET_RELATIVE_OFFSET, ID_UPDATE_PCB_FROM_SCH, - ID_UPDATE_SCH_FROM_PCB, ID_SIM_RUN, ID_SIM_TUNE, ID_SIM_PROBE, - ID_SIM_SETTINGS, ID_SIM_ADD_SIGNALS, ID_SIM_SHOW, @@ -181,9 +178,7 @@ enum id_eeschema_frm ID_POPUP_SCH_SELECT_UNIT1, // ... leave room for MAX_UNIT_COUNT_PER_PACKAGE IDs , // to select one unit among MAX_UNIT_COUNT_PER_PACKAGE in popup menu - ID_POPUP_SCH_SELECT_UNIT_CMP_MAX = ID_POPUP_SCH_SELECT_UNIT1 - + MAX_UNIT_COUNT_PER_PACKAGE - + ID_POPUP_SCH_SELECT_UNIT_CMP_MAX = ID_POPUP_SCH_SELECT_UNIT1 + MAX_UNIT_COUNT_PER_PACKAGE }; diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index c22920b30e..d1e8e01177 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -231,7 +231,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() library_table_xpm, EE_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, - AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ), + AddHotkeyName( _( "Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), preference_xpm, EE_CONDITIONS::ShowAlways ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 626a1c6519..1e297d6f24 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() library_table_xpm, EE_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, - AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ), + AddHotkeyName( _( "Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), preference_xpm, EE_CONDITIONS::ShowAlways ); diff --git a/gerbview/hotkeys.h b/gerbview/hotkeys.h index ba8e52582b..7294f0cca5 100644 --- a/gerbview/hotkeys.h +++ b/gerbview/hotkeys.h @@ -43,7 +43,6 @@ enum hotkey_id_command { HK_SWITCH_HIGHCONTRAST_MODE, HK_SWITCH_LAYER_TO_NEXT, HK_SWITCH_LAYER_TO_PREVIOUS, - HK_CANVAS_LEGACY, HK_CANVAS_OPENGL, HK_CANVAS_CAIRO }; diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 9689656ce5..a9788b659d 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -43,7 +43,6 @@ void GERBVIEW_FRAME::ReCreateMenuBar() // we always have to start from scratch with a new wxMenuBar. wxMenuBar* oldMenuBar = GetMenuBar(); wxMenuBar* menuBar = new wxMenuBar(); - wxString text; //-- File menu ----------------------------------------------- // @@ -208,12 +207,12 @@ void GERBVIEW_FRAME::ReCreateMenuBar() viewMenu->AddCheckItem( ID_TB_OPTIONS_DIFF_MODE, _( "Show in Differential Mode" ), _( "Show layers in differential mode" ), - gbr_select_mode2_xpm, diffModeCondition ); + gbr_select_mode2_xpm, diffModeCondition ); - text = AddHotkeyName( _( "Show in High Contrast" ), GerbviewHotkeysDescr, HK_SWITCH_HIGHCONTRAST_MODE ); - viewMenu->AddCheckItem( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, text, + viewMenu->AddCheckItem( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, + AddHotkeyName( _( "Show in High Contrast" ), GerbviewHotkeysDescr, HK_SWITCH_HIGHCONTRAST_MODE ), _( "Show in high contrast mode" ), - contrast_mode_xpm, contrastModeCondition ); + contrast_mode_xpm, contrastModeCondition ); //-- Tools menu ----------------------------------------------- // @@ -247,9 +246,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar() CONDITIONAL_MENU* preferencesMenu = new CONDITIONAL_MENU( false, selTool ); - // Options (Preferences on WXMAC) - text = AddHotkeyName( _( "&Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES ); - preferencesMenu->AddItem( wxID_PREFERENCES, text, _( "Show preferences for all open tools" ), + preferencesMenu->AddItem( wxID_PREFERENCES, + AddHotkeyName( _( "Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES ), + _( "Show preferences for all open tools" ), preference_xpm, SELECTION_CONDITIONS::ShowAlways ); preferencesMenu->AddSeparator(); diff --git a/include/id.h b/include/id.h index 3411675473..e961d0535f 100644 --- a/include/id.h +++ b/include/id.h @@ -99,7 +99,6 @@ enum main_id ID_FILE1, ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE, - ID_MENU_CANVAS_LEGACY, ID_MENU_CANVAS_OPENGL, ID_MENU_CANVAS_CAIRO, diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index a4b91802f4..3913de5106 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -349,7 +349,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() _( "Configure footprint library table" ), KiBitmap( library_table_xpm ) ); - msg = AddHotkeyName( _( "&Preferences..." ), kicad_Manager_Hotkeys_Descr, HK_PREFERENCES ); + msg = AddHotkeyName( _( "Preferences..." ), kicad_Manager_Hotkeys_Descr, HK_PREFERENCES ); AddMenuItem( preferencesMenu, wxID_PREFERENCES, msg, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 81dc6ad43f..15c0e79b6a 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -155,7 +155,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() // wxMenu* preferencesMenu = new wxMenu; - msg = AddHotkeyName( _( "&Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ); + msg = AddHotkeyName( _( "Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ); AddMenuItem( preferencesMenu, wxID_PREFERENCES, msg, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index ab2943d895..611db296a1 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -108,7 +108,6 @@ enum hotkey_id_command { HK_SWITCH_HIGHCONTRAST_MODE, HK_HIGHCONTRAST_INC, HK_HIGHCONTRAST_DEC, - HK_CANVAS_LEGACY, HK_CANVAS_OPENGL, HK_CANVAS_CAIRO, HK_ZONE_FILL_OR_REFILL, diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index ba7db65631..e1f91afe23 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -322,7 +322,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() library_table_xpm, SELECTION_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, - AddHotkeyName( _( "&Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), + AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), preference_xpm, SELECTION_CONDITIONS::ShowAlways ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index f29f5b4304..8457190a22 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -503,7 +503,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() import3d_xpm, SELECTION_CONDITIONS::ShowAlways ); #endif prefsMenu->AddItem( wxID_PREFERENCES, - AddHotkeyName( _( "&Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), + AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), preference_xpm, SELECTION_CONDITIONS::ShowAlways ); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 6f08d955de..8f0eacc40f 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -11,15 +11,12 @@ * from being rebuilt when adding new commands to the Pcbnew. */ -#define MAX_ITEMS_IN_PICKER 15 ///< max no. items in the popup menu for item selection - enum pcbnew_ids { ID_MAIN_MENUBAR = ID_END_LIST, ID_MICROWAVE_V_TOOLBAR, ID_OPEN_MODULE_EDITOR, ID_OPEN_MODULE_VIEWER, - ID_READ_NETLIST, ID_SET_RELATIVE_OFFSET, ID_COPY_BOARD_AS, ID_IMPORT_NON_KICAD_BOARD, @@ -48,9 +45,6 @@ enum pcbnew_ids ID_TUNE_SINGLE_TRACK_LEN_BUTT, ID_TUNE_DIFF_PAIR_LEN_BUTT, ID_TUNE_DIFF_PAIR_SKEW_BUTT, - ID_MENU_REMOVE_MEANDERS, - ID_MENU_MITER_TRACES, - ID_MENU_ADD_TEARDROPS, ID_MENU_DIFF_PAIR_DIMENSIONS, ID_MENU_INTERACTIVE_ROUTER_SETTINGS, @@ -65,7 +59,6 @@ enum pcbnew_ids ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, - ID_POPUP_PCB_SELECT_WIDTH, ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, ID_POPUP_PCB_SELECT_AUTO_WIDTH, ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, @@ -123,10 +116,8 @@ enum pcbnew_ids ID_MENU_READ_BOARD_BACKUP_FILE, ID_MENU_RECOVER_BOARD_AUTOSAVE, - ID_MENU_ARCHIVE_MODULES, ID_MENU_ARCHIVE_MODULES_IN_LIBRARY, ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, - ID_MENU_MICELLANOUS, ID_MENU_LIST_NETS, ID_PCB_EDIT_TRACKS_AND_VIAS, ID_MENU_PCB_CLEAN, @@ -168,7 +159,6 @@ enum pcbnew_ids ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, ID_PCB_MUWAVE_START_CMD, - ID_PCB_MUWAVE_TOOL_DISPLAY_TOOLS, ID_PCB_MUWAVE_TOOL_SELF_CMD, ID_PCB_MUWAVE_TOOL_GAP_CMD, ID_PCB_MUWAVE_TOOL_STUB_CMD,