diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index dbd08b174c..a9d8409f56 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -240,6 +240,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); + text = AddHotkeyName( _( "&Redraw" ), g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); + + AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + viewMenu->AppendSeparator(); AddMenuItem( viewMenu, @@ -248,8 +252,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() _( "Navigate hierarchical sheets" ), KiBitmap( hierarchy_nav_xpm ) ); - text = AddHotkeyName( _( "&Redraw" ), g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); - AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + AddMenuItem( viewMenu, + ID_POPUP_SCH_LEAVE_SHEET, + _( "&Leave Sheet" ), + _( "Leave Sheet" ), + KiBitmap( leave_sheet_xpm ) ); // Menu place: wxMenu* placeMenu = new wxMenu; diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index b4bbf694a6..0afeae965d 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -308,6 +308,9 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool ) EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END, SCH_EDIT_FRAME::OnUpdateSelectTool ) + EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave ) + EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet ) + EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet ) /* Search dialog events. */ EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose ) @@ -773,6 +776,29 @@ void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent ) } +void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent ) +{ + SCH_SHEET_LIST sheetList; + + aEvent.Enable( sheetList.IsModified() ); + +} + + +void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent ) +{ + aEvent.Enable( GetScreen()->IsModify() ); + +} + + +void SCH_EDIT_FRAME::OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent ) +{ + aEvent.Enable( m_CurrentSheet->Last() != g_RootSheet ); + +} + + void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event ) { InvokeDialogAnnotate( this ); diff --git a/eeschema/schframe.h b/eeschema/schframe.h index 614858307d..3ca5f04728 100644 --- a/eeschema/schframe.h +++ b/eeschema/schframe.h @@ -844,6 +844,9 @@ private: void OnUpdateHiddenPins( wxUpdateUIEvent& event ); void OnUpdateBusOrientation( wxUpdateUIEvent& event ); void OnUpdateSelectTool( wxUpdateUIEvent& aEvent ); + void OnUpdateSave( wxUpdateUIEvent& aEvent ); + void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent ); + void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent ); /** * Function UpdateTitle diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index f03faa8ff1..91ce5e3870 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -128,6 +128,9 @@ void SCH_EDIT_FRAME::ReCreateHToolbar() _( "Navigate schematic hierarchy" ) ); + m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString, KiBitmap( leave_sheet_xpm ), + _( "Leave sheet" ) ); + m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_RUN_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ),