Commit 5ae97bb3 authored by Dick Hollenbeck's avatar Dick Hollenbeck

[Kicad-developers] Add close shortcut to Library Editor -- from Yuri

parent 0191ee9a
......@@ -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 );
......
......@@ -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:
* <p>
* 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 );
......
......@@ -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
*/
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment