Instantate a default menu from no selection when menu is first built.
This might resolve some of the GTK menu anomalies.
This commit is contained in:
parent
b7f4113f96
commit
45a9544726
|
@ -69,12 +69,6 @@ void CONDITIONAL_MENU::AddItem( int aId, const wxString& aText, const wxString&
|
||||||
AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
|
AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
|
||||||
|
|
||||||
addEntry( ENTRY( item, aIcon, aCondition, aOrder, false ) );
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +98,14 @@ void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SELECTION g_resolveDummySelection;
|
||||||
|
|
||||||
|
void CONDITIONAL_MENU::Resolve()
|
||||||
|
{
|
||||||
|
Evaluate( g_resolveDummySelection );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
|
void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -143,9 +145,13 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
|
||||||
|
|
||||||
case ENTRY::WXITEM:
|
case ENTRY::WXITEM:
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// wxWidgets moved the Preferences... item to the Apple menu
|
// Instantiate the Preferences item only on the first Resolve(); after that
|
||||||
|
// wxWidgets will have moved it to the Application menu
|
||||||
if( entry.wxItem()->GetId() == wxID_PREFERENCES )
|
if( entry.wxItem()->GetId() == wxID_PREFERENCES )
|
||||||
continue;
|
{
|
||||||
|
if( &aSelection != &g_resolveDummySelection )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
menuItem = new wxMenuItem( this,
|
menuItem = new wxMenuItem( this,
|
||||||
entry.wxItem()->GetId(),
|
entry.wxItem()->GetId(),
|
||||||
|
|
|
@ -108,6 +108,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
fileMenu->Resolve();
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------
|
//-- Edit menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -135,6 +137,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
editMenu->AddItem( EE_ACTIONS::symbolProperties, havePartCondition );
|
editMenu->AddItem( EE_ACTIONS::symbolProperties, havePartCondition );
|
||||||
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
||||||
|
|
||||||
|
editMenu->Resolve();
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------
|
//-- View menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -181,6 +185,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
||||||
|
|
||||||
|
viewMenu->Resolve();
|
||||||
|
|
||||||
//-- Place menu -----------------------------------------------
|
//-- Place menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -192,6 +198,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, EE_CONDITIONS::ShowAlways );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->Resolve();
|
||||||
|
|
||||||
//-- Inspect menu -----------------------------------------------
|
//-- Inspect menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -208,6 +216,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Check for duplicate and off-grid pins" ),
|
_( "Check for duplicate and off-grid pins" ),
|
||||||
KiBitmap( erc_xpm ) );
|
KiBitmap( erc_xpm ) );
|
||||||
|
|
||||||
|
inspectMenu->Resolve();
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -239,8 +249,9 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
//
|
prefsMenu->Resolve();
|
||||||
// Create the menubar and append all submenus
|
|
||||||
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
|
|
|
@ -131,6 +131,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
fileMenu->Resolve();
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------------------
|
//-- Edit menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -165,6 +167,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Sets symbol fields to original library values" ),
|
_( "Sets symbol fields to original library values" ),
|
||||||
update_fields_xpm, EE_CONDITIONS::ShowAlways );
|
update_fields_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
editMenu->Resolve();
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------------------
|
//-- View menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -217,9 +221,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::toggleHiddenPins, hiddenPinsCondition );
|
viewMenu->AddCheckItem( EE_ACTIONS::toggleHiddenPins, hiddenPinsCondition );
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AddSeparator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
viewMenu->Resolve();
|
||||||
|
|
||||||
//-- Place menu -----------------------------------------------------------
|
//-- Place menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -246,6 +252,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->Resolve();
|
||||||
|
|
||||||
//-- Inspect menu -----------------------------------------------
|
//-- Inspect menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -255,6 +263,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
inspectMenu->AddItem( EE_ACTIONS::runSimulation, EE_CONDITIONS::ShowAlways );
|
inspectMenu->AddItem( EE_ACTIONS::runSimulation, EE_CONDITIONS::ShowAlways );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inspectMenu->Resolve();
|
||||||
|
|
||||||
//-- Tools menu -----------------------------------------------
|
//-- Tools menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -291,6 +301,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
toolsMenu->AddItem( EE_ACTIONS::assignFootprints, EE_CONDITIONS::ShowAlways );
|
toolsMenu->AddItem( EE_ACTIONS::assignFootprints, EE_CONDITIONS::ShowAlways );
|
||||||
toolsMenu->AddItem( EE_ACTIONS::generateBOM, EE_CONDITIONS::ShowAlways );
|
toolsMenu->AddItem( EE_ACTIONS::generateBOM, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
toolsMenu->Resolve();
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -322,7 +334,9 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
//-- Menubar -----------------------------------------------
|
prefsMenu->Resolve();
|
||||||
|
|
||||||
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
|
|
|
@ -96,19 +96,16 @@ void LIB_VIEW_FRAME::ReCreateVToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Virtual function
|
|
||||||
void LIB_VIEW_FRAME::ReCreateMenuBar()
|
void LIB_VIEW_FRAME::ReCreateMenuBar()
|
||||||
{
|
{
|
||||||
LIB_CONTROL* libControl = m_toolManager->GetTool<LIB_CONTROL>();
|
LIB_CONTROL* libControl = m_toolManager->GetTool<LIB_CONTROL>();
|
||||||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
// wxWidgets handles the OSX Application menu behind the scenes, but that means
|
||||||
// we always have to start from scratch with a new wxMenuBar.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
// Recreate all menus:
|
//-- File menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
// Menu File:
|
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
|
|
||||||
AddMenuItem( fileMenu, wxID_EXIT,
|
AddMenuItem( fileMenu, wxID_EXIT,
|
||||||
|
@ -116,13 +113,13 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
||||||
_( "Close schematic symbol viewer" ),
|
_( "Close schematic symbol viewer" ),
|
||||||
KiBitmap( exit_xpm ) );
|
KiBitmap( exit_xpm ) );
|
||||||
|
|
||||||
// View menu
|
//-- View menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, libControl );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, libControl );
|
||||||
|
|
||||||
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
return IsGridVisible();
|
return IsGridVisible();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto electricalTypesShownCondition = [ this ] ( const SELECTION& aSel ) {
|
auto electricalTypesShownCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
return GetShowElectricalType();
|
return GetShowElectricalType();
|
||||||
};
|
};
|
||||||
|
@ -139,9 +136,11 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::showElectricalTypes, electricalTypesShownCondition );
|
viewMenu->AddCheckItem( EE_ACTIONS::showElectricalTypes, electricalTypesShownCondition );
|
||||||
|
|
||||||
// Append menus to the menubar
|
viewMenu->Resolve();
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
|
||||||
|
|
||||||
|
//-- Menubar -------------------------------------------------------------
|
||||||
|
//
|
||||||
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
|
|
||||||
//-- File menu -----------------------------------------------
|
//-- File menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
static ACTION_MENU* openRecentGbrMenu;
|
static ACTION_MENU* openRecentGbrMenu;
|
||||||
|
@ -142,7 +142,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------
|
fileMenu->Resolve();
|
||||||
|
|
||||||
|
//-- View menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -226,7 +228,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
_( "Show in high contrast mode" ),
|
_( "Show in high contrast mode" ),
|
||||||
contrast_mode_xpm, contrastModeCondition );
|
contrast_mode_xpm, contrastModeCondition );
|
||||||
|
|
||||||
//-- Tools menu -----------------------------------------------
|
viewMenu->Resolve();
|
||||||
|
|
||||||
|
//-- Tools menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -270,9 +274,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
preferencesMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
preferencesMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
preferencesMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
preferencesMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
preferencesMenu->AppendSeparator();
|
preferencesMenu->Resolve();
|
||||||
|
|
||||||
//-- Menubar -----------------------------------------------
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
|
|
|
@ -110,6 +110,15 @@ public:
|
||||||
*/
|
*/
|
||||||
void Evaluate( SELECTION& aSelection );
|
void Evaluate( SELECTION& aSelection );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Resolve()
|
||||||
|
*
|
||||||
|
* Updates the initial contents so that wxWidgets doesn't get its knickers tied in a knot
|
||||||
|
* over the menu being empty (mainly an issue on GTK, but also on OSX with the preferences
|
||||||
|
* and quit menu items).
|
||||||
|
*/
|
||||||
|
void Resolve();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///> Helper class to organize menu entries.
|
///> Helper class to organize menu entries.
|
||||||
class ENTRY
|
class ENTRY
|
||||||
|
|
|
@ -57,8 +57,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
if( openRecentMenu )
|
if( openRecentMenu )
|
||||||
Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
|
Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||||
|
|
||||||
//
|
//-- File menu -------------------------------------------------------
|
||||||
// File Menu:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -86,8 +85,9 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
fileMenu->Resolve();
|
||||||
// Edit Menu:
|
|
||||||
|
//-- Edit menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -110,8 +110,9 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
editMenu->AddItem( ACTIONS::paste, idleCondition );
|
editMenu->AddItem( ACTIONS::paste, idleCondition );
|
||||||
editMenu->AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::MoreThan( 0 ) );
|
editMenu->AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::MoreThan( 0 ) );
|
||||||
|
|
||||||
//
|
editMenu->Resolve();
|
||||||
// View Menu:
|
|
||||||
|
//-- View menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -137,8 +138,9 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
|
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
|
||||||
|
|
||||||
//
|
viewMenu->Resolve();
|
||||||
// Place Menu:
|
|
||||||
|
//-- Place menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -150,8 +152,9 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
placeMenu->AddSeparator();
|
placeMenu->AddSeparator();
|
||||||
placeMenu->AddItem( PL_ACTIONS::appendImportedWorksheet, SELECTION_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( PL_ACTIONS::appendImportedWorksheet, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
placeMenu->Resolve();
|
||||||
// Menu for preferences
|
|
||||||
|
//-- Preferences menu --------------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* preferencesMenu = new wxMenu;
|
wxMenu* preferencesMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -163,7 +166,8 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
// Language submenu
|
// Language submenu
|
||||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||||
|
|
||||||
// Append menus to the menubar
|
//-- Menubar -----------------------------------------------------------
|
||||||
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
|
|
|
@ -59,7 +59,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
return( !libName.IsEmpty() || !partName.IsEmpty() );
|
return( !libName.IsEmpty() || !partName.IsEmpty() );
|
||||||
};
|
};
|
||||||
|
|
||||||
//-- File menu -----------------------------------------------
|
//-- File menu ----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -131,7 +131,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------
|
fileMenu->Resolve();
|
||||||
|
|
||||||
|
//-- Edit menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -171,7 +173,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Delete the current footprint" ),
|
_( "Delete the current footprint" ),
|
||||||
KiBitmap( delete_xpm ) );
|
KiBitmap( delete_xpm ) );
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------
|
editMenu->Resolve();
|
||||||
|
|
||||||
|
//-- View menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -260,7 +264,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
|
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
|
||||||
search_tree_xpm, searchTreeShownCondition );
|
search_tree_xpm, searchTreeShownCondition );
|
||||||
|
|
||||||
//-- Place menu -----------------------------------------------
|
viewMenu->Resolve();
|
||||||
|
|
||||||
|
//-- Place menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -277,8 +283,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
placeMenu->AddItem( PCB_ACTIONS::setAnchor, SELECTION_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( PCB_ACTIONS::setAnchor, SELECTION_CONDITIONS::ShowAlways );
|
||||||
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->Resolve();
|
||||||
|
|
||||||
//-- Inspect menu -----------------------------------------------
|
//-- Inspect menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* inspectMenu = new wxMenu;
|
wxMenu* inspectMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -287,7 +294,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Measure distance" ),
|
_( "Measure distance" ),
|
||||||
KiBitmap( measurement_xpm ) );
|
KiBitmap( measurement_xpm ) );
|
||||||
|
|
||||||
//-- Tools menu -----------------------------------------------
|
//-- Tools menu -------------------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
|
|
||||||
|
@ -302,7 +309,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
KiBitmap( insert_module_board_xpm ) );
|
KiBitmap( insert_module_board_xpm ) );
|
||||||
|
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -333,6 +340,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
|
prefsMenu->Resolve();
|
||||||
|
|
||||||
//--MenuBar -----------------------------------------------------------
|
//--MenuBar -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
|
|
|
@ -201,7 +201,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
||||||
fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
|
||||||
// Archive submenu
|
// Archive submenu
|
||||||
ACTION_MENU* submenuArchive = new ACTION_MENU();
|
ACTION_MENU* submenuArchive = new ACTION_MENU();
|
||||||
submenuArchive->SetTool( selTool );
|
submenuArchive->SetTool( selTool );
|
||||||
|
@ -225,6 +224,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
fileMenu->Resolve();
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------------------
|
//-- Edit menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -280,7 +281,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
|
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
|
||||||
delete_xpm, SELECTION_CONDITIONS::ShowAlways );
|
delete_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
editMenu->Resolve();
|
||||||
|
|
||||||
//----- View menu -----------------------------------------------------------
|
//----- View menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
auto layersPaletteShownCondition = [ this ] ( const SELECTION& aSel ) {
|
auto layersPaletteShownCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
|
@ -412,6 +416,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
viewMenu->Resolve();
|
||||||
|
|
||||||
//-- Place Menu ----------------------------------------------------------
|
//-- Place Menu ----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
@ -448,6 +454,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
placeMenu->AddMenu( autoplaceSubmenu );
|
placeMenu->AddMenu( autoplaceSubmenu );
|
||||||
|
|
||||||
|
placeMenu->Resolve();
|
||||||
|
|
||||||
//-- Route Menu ----------------------------------------------------------
|
//-- Route Menu ----------------------------------------------------------
|
||||||
//
|
//
|
||||||
wxMenu* routeMenu = new wxMenu;
|
wxMenu* routeMenu = new wxMenu;
|
||||||
|
@ -514,6 +522,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
|
prefsMenu->Resolve();
|
||||||
|
|
||||||
//--MenuBar -----------------------------------------------------------
|
//--MenuBar -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
|
|
|
@ -115,7 +115,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Virtual function
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
||||||
{
|
{
|
||||||
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
|
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
|
||||||
|
@ -123,11 +122,9 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
||||||
// we always have to start from scratch with a new wxMenuBar.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
// Recreate all menus:
|
//----- File menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
// Menu File:
|
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
|
|
||||||
// Close viewer
|
// Close viewer
|
||||||
|
@ -136,7 +133,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
||||||
_( "Close footprint viewer" ),
|
_( "Close footprint viewer" ),
|
||||||
KiBitmap( exit_xpm ) );
|
KiBitmap( exit_xpm ) );
|
||||||
|
|
||||||
// View menu
|
//----- View menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
|
@ -145,14 +143,16 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AddSeparator();
|
||||||
|
viewMenu->AddItem( ID_MODVIEW_SHOW_3D_VIEW,
|
||||||
|
AddHotkeyName( _( "3D Viewer" ), g_Module_Viewer_Hotkeys_Descr, HK_3D_VIEWER ),
|
||||||
|
_( "Show footprint in 3D viewer" ),
|
||||||
|
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
// 3D view
|
viewMenu->Resolve();
|
||||||
text = AddHotkeyName( _( "3&D Viewer" ), g_Module_Viewer_Hotkeys_Descr, HK_3D_VIEWER );
|
|
||||||
AddMenuItem( viewMenu, ID_MODVIEW_SHOW_3D_VIEW, text, _( "Show footprint in 3D viewer" ),
|
|
||||||
KiBitmap( three_d_xpm ) );
|
|
||||||
|
|
||||||
// Append menus to the menubar
|
//----- Menubar -------------------------------------------------------------
|
||||||
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
Loading…
Reference in New Issue