diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index cdea97bfea..8cbdc15b34 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -116,6 +116,8 @@ EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT, WinEDA_LibeditFrame::Process_Special_Functions ) /* menubar commands */ +EVT_MENU( wxID_EXIT, + WinEDA_LibeditFrame::CloseWindow ) EVT_MENU( ID_LIBEDIT_SAVE_CURRENT_LIB_AS, WinEDA_LibeditFrame::SaveActiveLibrary ) EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, @@ -339,7 +341,8 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) GetScreen()->ClrModify(); } - BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) { + BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) + { if( lib.IsModified() ) { wxString msg; @@ -965,11 +968,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) } -/** Called on activate the frame. - * Test if the current library exists - * the library list can be changed by the schematic editor after reloading a new schematic - * and the current m_library can point a non existent lib. - */ void WinEDA_LibeditFrame::OnActivate( wxActivateEvent& event ) { WinEDA_DrawFrame::OnActivate( event ); @@ -992,9 +990,6 @@ void WinEDA_LibeditFrame::EnsureActiveLibExists() m_library = NULL; } -/** function SetLanguage - * called on a language menu selection - */ void WinEDA_LibeditFrame::SetLanguage( wxCommandEvent& event ) { WinEDA_BasicFrame::SetLanguage( event ); diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index 24bc395c53..86cfa5375d 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -36,14 +36,16 @@ public: void ReCreateMenuBar(); - /** Function EnsureActiveLibExists - * Must be called after the libraries are reloaded + /** + * Function EnsureActiveLibExists + * must be called after the libraries are reloaded * (for instance after loading a schematic project) */ static void EnsureActiveLibExists(); - /** function SetLanguage - * called on a language menu selection + /** + * Function SetLanguage + * is called on a language menu selection */ void SetLanguage( wxCommandEvent& event ); @@ -101,6 +103,19 @@ public: void LoadSettings(); void SaveSettings(); + /** + * Function CloseWindow() + * triggers the wxCloseEvent, which is handled by the function given + * to EVT_CLOSE() macro: + *

+ * EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow ) + */ + void CloseWindow( wxCommandEvent& WXUNUSED(event) ) + { + // Generate a wxCloseEvent + Close( false ); + } + /** Function OnModify() * Must be called after a schematic change * in order to set the "modify" flag of the current screen @@ -154,7 +169,11 @@ public: private: - /** OnActivate event funtion( virtual ) + /** + * Function OnActivate + * is called when the frame is activated. Tests if the current library exists. + * The library list can be changed by the schematic editor after reloading a new schematic + * and the current m_library can point a non existent lib. */ virtual void OnActivate( wxActivateEvent& event ); diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index ff272f7ff8..e451a23020 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -68,6 +68,17 @@ void WinEDA_LibeditFrame::ReCreateMenuBar() item->SetBitmap( plot_xpm ); filesMenu->Append( item ); + /* Quit on all platforms except WXMAC, because else this "breaks" the mac + UI compliance. The Quit item is in a different menu on a mac than + windows or unix machine. + */ +#if !defined(__WXMAC__) + filesMenu->AppendSeparator(); + item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), + _( "Quit Library Editor" ) ); + filesMenu->Append( item ); +#endif + /** * Edit menu */ diff --git a/include/wxstruct.h b/include/wxstruct.h index 5e6b6b31ec..cb59a50e65 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -341,12 +341,14 @@ public: virtual void ToolOnRightClick( wxCommandEvent& event ); void AdjustScrollBars(); - /** OnActivate event function (virtual) - * called when activating the frame. - * in derived classes with a virtual OnActivate function, - * do not forget to call the WinEDA_DrawFrame::OnActivate( event ) basic function + /** + * Function OnActivate (virtual) + * is called when activating the frame. + * In derived classes with a overriding OnActivate function, + * do not forget to call this WinEDA_DrawFrame::OnActivate( event ) basic function. */ virtual void OnActivate( wxActivateEvent& event ); + /** * Function UpdateStatusBar * updates the status bar information.