Fix some Mac-specific issues with the Preferences... menu item.

This commit is contained in:
Jeff Young 2019-06-01 14:32:12 +01:00
parent f67df4bf11
commit 74e10791ff
13 changed files with 30 additions and 35 deletions

View File

@ -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() ) );

View File

@ -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
};

View File

@ -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 );

View File

@ -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 );

View File

@ -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
};

View File

@ -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 -----------------------------------------------
//
@ -210,8 +209,8 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
_( "Show layers in differential mode" ),
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 );
@ -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();

View File

@ -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,

View File

@ -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 ) );

View File

@ -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 ) );

View File

@ -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,

View File

@ -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 );

View File

@ -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 );

View File

@ -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,