pleditor: Fix menubar actions and display
* Move the preview settings to view and make the menu item work * Fix bug with preferences menu not displaying on GTK * Implement quit command and make it similar to the other programs Fixes: lp:1832139 * https://bugs.launchpad.net/kicad/+bug/1832139
This commit is contained in:
parent
05429bc39c
commit
c258ad7e3c
|
@ -75,12 +75,21 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
fileMenu->AddItem( ACTIONS::saveAs, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( ACTIONS::saveAs, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AddSeparator();
|
||||||
fileMenu->AddItem( ACTIONS::pageSettings, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AddSeparator();
|
||||||
|
|
||||||
|
if( Kiface().IsSingle() )
|
||||||
|
{
|
||||||
// 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 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileMenu->AddItem( wxID_CLOSE, _( "Close" ), "", exit_xpm,
|
||||||
|
SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
}
|
||||||
|
|
||||||
fileMenu->Resolve();
|
fileMenu->Resolve();
|
||||||
|
|
||||||
|
@ -135,6 +144,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->AddSeparator();
|
||||||
|
viewMenu->AddItem( PL_ACTIONS::previewSettings, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->Resolve();
|
viewMenu->Resolve();
|
||||||
|
|
||||||
//-- Inspector menu -------------------------------------------------------
|
//-- Inspector menu -------------------------------------------------------
|
||||||
|
@ -169,6 +181,8 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
|
||||||
// Language submenu
|
// Language submenu
|
||||||
AddMenuLanguageList( preferencesMenu, selTool );
|
AddMenuLanguageList( preferencesMenu, selTool );
|
||||||
|
|
||||||
|
preferencesMenu->Resolve();
|
||||||
|
|
||||||
//-- Menubar -----------------------------------------------------------
|
//-- Menubar -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
|
|
|
@ -57,6 +57,9 @@
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
|
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
|
||||||
|
EVT_MENU( wxID_CLOSE, PL_EDITOR_FRAME::OnExit )
|
||||||
|
EVT_MENU( wxID_EXIT, PL_EDITOR_FRAME::OnExit )
|
||||||
|
|
||||||
EVT_MENU( wxID_FILE, PL_EDITOR_FRAME::Files_io )
|
EVT_MENU( wxID_FILE, PL_EDITOR_FRAME::Files_io )
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory )
|
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory )
|
||||||
|
@ -177,6 +180,9 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
// Add the exit key handler
|
||||||
|
InitExitKey();
|
||||||
|
|
||||||
wxPoint originCoord = ReturnCoordOriginCorner();
|
wxPoint originCoord = ReturnCoordOriginCorner();
|
||||||
SetGridOrigin( originCoord );
|
SetGridOrigin( originCoord );
|
||||||
|
|
||||||
|
@ -237,7 +243,17 @@ bool PL_EDITOR_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
void PL_EDITOR_FRAME::OnExit( wxCommandEvent& aEvent )
|
||||||
|
{
|
||||||
|
if( aEvent.GetId() == wxID_EXIT )
|
||||||
|
Kiway().OnKiCadExit();
|
||||||
|
|
||||||
|
if( aEvent.GetId() == wxID_CLOSE || Kiface().IsSingle() )
|
||||||
|
Close( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( GetScreen()->IsModify() )
|
if( GetScreen()->IsModify() )
|
||||||
{
|
{
|
||||||
|
@ -247,7 +263,7 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
if( !HandleUnsavedChanges( this, wxString::Format( msg, filename.GetFullName() ),
|
if( !HandleUnsavedChanges( this, wxString::Format( msg, filename.GetFullName() ),
|
||||||
[&]()->bool { return saveCurrentPageLayout(); } ) )
|
[&]()->bool { return saveCurrentPageLayout(); } ) )
|
||||||
{
|
{
|
||||||
Event.Veto();
|
aEvent.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,18 @@ public:
|
||||||
*/
|
*/
|
||||||
bool InsertPageLayoutDescrFile( const wxString& aFullFileName );
|
bool InsertPageLayoutDescrFile( const wxString& aFullFileName );
|
||||||
|
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
|
||||||
|
/*
|
||||||
|
* Function OnExit
|
||||||
|
* Event handler for the wxID_EXIT and wxID_CLOSE events
|
||||||
|
*/
|
||||||
|
void OnExit( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function OnCloseWindow
|
||||||
|
* Event handler for the close event
|
||||||
|
*/
|
||||||
|
void OnCloseWindow( wxCloseEvent& aEvent );
|
||||||
|
|
||||||
// The Tool Framework initalization
|
// The Tool Framework initalization
|
||||||
void setupTools();
|
void setupTools();
|
||||||
|
|
|
@ -117,13 +117,6 @@ int PL_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PL_EDITOR_CONTROL::Quit( const TOOL_EVENT& aEvent )
|
|
||||||
{
|
|
||||||
m_frame->Close( false );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int PL_EDITOR_CONTROL::ToggleBackgroundColor( const TOOL_EVENT& aEvent )
|
int PL_EDITOR_CONTROL::ToggleBackgroundColor( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->SetDrawBgColor( m_frame->GetDrawBgColor() == WHITE ? BLACK : WHITE );
|
m_frame->SetDrawBgColor( m_frame->GetDrawBgColor() == WHITE ? BLACK : WHITE );
|
||||||
|
@ -185,7 +178,6 @@ void PL_EDITOR_CONTROL::setTransitions()
|
||||||
Go( &PL_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
|
Go( &PL_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
|
||||||
Go( &PL_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
|
Go( &PL_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
|
||||||
Go( &PL_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
|
Go( &PL_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
|
||||||
Go( &PL_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
|
|
||||||
|
|
||||||
Go( &PL_EDITOR_CONTROL::PageSetup, PL_ACTIONS::previewSettings.MakeEvent() );
|
Go( &PL_EDITOR_CONTROL::PageSetup, PL_ACTIONS::previewSettings.MakeEvent() );
|
||||||
Go( &PL_EDITOR_CONTROL::ToggleBackgroundColor, PL_ACTIONS::toggleBackground.MakeEvent() );
|
Go( &PL_EDITOR_CONTROL::ToggleBackgroundColor, PL_ACTIONS::toggleBackground.MakeEvent() );
|
||||||
|
|
|
@ -58,7 +58,6 @@ public:
|
||||||
int PageSetup( const TOOL_EVENT& aEvent );
|
int PageSetup( const TOOL_EVENT& aEvent );
|
||||||
int Print( const TOOL_EVENT& aEvent );
|
int Print( const TOOL_EVENT& aEvent );
|
||||||
int Plot( const TOOL_EVENT& aEvent );
|
int Plot( const TOOL_EVENT& aEvent );
|
||||||
int Quit( const TOOL_EVENT& aEvent );
|
|
||||||
|
|
||||||
int ToggleBackgroundColor( const TOOL_EVENT& aEvent );
|
int ToggleBackgroundColor( const TOOL_EVENT& aEvent );
|
||||||
int ShowInspector( const TOOL_EVENT& aEvent );
|
int ShowInspector( const TOOL_EVENT& aEvent );
|
||||||
|
|
Loading…
Reference in New Issue