Store the name of modedit active(/current/working?) library in a static variable. Edit some modedit strings.

This commit is contained in:
Marco Mattila 2011-08-08 18:44:43 +03:00
parent d80da9f132
commit e414f8da09
5 changed files with 41 additions and 20 deletions

View File

@ -720,14 +720,15 @@ void WinEDA_ModuleEditFrame::Select_Active_Library()
if( g_LibName_List.GetCount() == 0 ) if( g_LibName_List.GetCount() == 0 )
return; return;
WinEDAListBox dlg( this, _( "Active Lib:" ), g_LibName_List, m_CurrentLib ); WinEDAListBox dlg( this, _( "Select Active Library:" ), g_LibName_List, m_CurrentLib );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
m_CurrentLib = dlg.GetTextSelection(); m_CurrentLib = dlg.GetTextSelection();
SetTitle( _( "Module Editor (lib: " ) + m_CurrentLib + wxT( ")" ) ); UpdateTitle();
return; return;
} }

View File

@ -66,7 +66,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// from current Board // from current Board
item = new wxMenuItem( openSubmenu, item = new wxMenuItem( openSubmenu,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
_( "Load from current Board" ), _( "Load from Current Board" ),
_( "Load a footprint module from the current loaded board" ) ); _( "Load a footprint module from the current loaded board" ) );
SET_BITMAP( load_module_board_xpm ); SET_BITMAP( load_module_board_xpm );
openSubmenu->Append( item ); openSubmenu->Append( item );
@ -80,8 +80,8 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// Save module // Save module
item = new wxMenuItem( fileMenu, item = new wxMenuItem( fileMenu,
ID_MODEDIT_SAVE_LIBMODULE, ID_MODEDIT_SAVE_LIBMODULE,
_( "&Save Module in Current Lib" ), _( "&Save Module in Active Library" ),
_( "Save Module in working library" ) ); _( "Save module in active library" ) );
SET_BITMAP( save_library_xpm ); SET_BITMAP( save_library_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
@ -96,7 +96,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// Export module // Export module
item = new wxMenuItem( fileMenu, item = new wxMenuItem( fileMenu,
ID_MODEDIT_EXPORT_PART, ID_MODEDIT_EXPORT_PART,
_( "&Export module" ), _( "&Export Module" ),
_( "Save the current loaded module to a file" ) ); _( "Save the current loaded module to a file" ) );
SET_BITMAP( export_module_xpm ); SET_BITMAP( export_module_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
@ -175,7 +175,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// Pad settings // Pad settings
item = new wxMenuItem( dimensions_Submenu, item = new wxMenuItem( dimensions_Submenu,
ID_MODEDIT_PAD_SETTINGS, ID_MODEDIT_PAD_SETTINGS,
_( "Pad settings" ), _( "Pad Settings" ),
_( "Edit the settings for new pads" ) ); _( "Edit the settings for new pads" ) );
SET_BITMAP( options_pad_xpm ); SET_BITMAP( options_pad_xpm );
dimensions_Submenu->Append( item ); dimensions_Submenu->Append( item );

View File

@ -12,7 +12,6 @@ class WinEDA_ModuleEditFrame : public PCB_BASE_FRAME
{ {
public: public:
MODULE* CurrentModule; MODULE* CurrentModule;
wxString m_CurrentLib;
public: public:
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_ModuleEditFrame( wxWindow* father,
@ -136,9 +135,17 @@ public:
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
private: private:
static wxString m_CurrentLib;
void GetComponentFromUndoList( wxCommandEvent& event ); void GetComponentFromUndoList( wxCommandEvent& event );
void GetComponentFromRedoList( wxCommandEvent& event ); void GetComponentFromRedoList( wxCommandEvent& event );
/**
* Function UpdateTitle
* updates window title according to m_CurrentLib.
*/
void UpdateTitle();
public: public:
// Footprint edition // Footprint edition
@ -219,6 +226,8 @@ public:
int Create_Librairie( const wxString& LibName ); int Create_Librairie( const wxString& LibName );
void Select_Active_Library(); void Select_Active_Library();
wxString GetCurrentLib() const { return m_CurrentLib; };
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -25,6 +25,8 @@ static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the
// Design setting for the module editor: // Design setting for the module editor:
static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting; static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
wxString WinEDA_ModuleEditFrame::m_CurrentLib = wxEmptyString;
/********************************/ /********************************/
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
@ -128,7 +130,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
// Give an icon // Give an icon
SetIcon( wxICON( icon_modedit ) ); SetIcon( wxICON( icon_modedit ) );
SetTitle( wxT( "Module Editor (lib: " ) + m_CurrentLib + wxT( ")" ) ); UpdateTitle();
if( g_ModuleEditor_Pcb == NULL ) if( g_ModuleEditor_Pcb == NULL )
g_ModuleEditor_Pcb = new BOARD( NULL, this ); g_ModuleEditor_Pcb = new BOARD( NULL, this );
@ -432,3 +434,12 @@ void WinEDA_ModuleEditFrame::OnModify()
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest(); m_Draw3DFrame->ReloadRequest();
} }
void WinEDA_ModuleEditFrame::UpdateTitle()
{
if( m_CurrentLib.IsEmpty() )
SetTitle( _( "Module Editor (no active library)" ) );
else
SetTitle( _( "Module Editor (active library: " ) + m_CurrentLib + wxT( ")" ) );
}

View File

@ -33,10 +33,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
wxBitmap( open_library_xpm ), wxBitmap( open_library_xpm ),
_( "Select working library" ) ); _( "Select active library" ) );
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, wxBitmap( save_library_xpm ), m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, wxBitmap( save_library_xpm ),
_( "Save Module in working library" ) ); _( "Save module in active library" ) );
m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
wxBitmap( new_library_xpm ), wxBitmap( new_library_xpm ),
@ -44,14 +44,14 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ), m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
_( "Delete part in current library" ) ); _( "Delete part from active library" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, wxBitmap( new_footprint_xpm ), m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, wxBitmap( new_footprint_xpm ),
_( "New Module" ) ); _( "New module" ) );
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, wxBitmap( module_xpm ), m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, wxBitmap( module_xpm ),
_( "Load module from lib" ) ); _( "Load module from library" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString,
@ -68,10 +68,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, wxBitmap( import_module_xpm ), m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, wxBitmap( import_module_xpm ),
_( "import module" ) ); _( "Import module" ) );
m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, wxBitmap( export_module_xpm ), m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, wxBitmap( export_module_xpm ),
_( "export module" ) ); _( "Export module" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
@ -83,11 +83,11 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString,
wxBitmap( module_options_xpm ), wxBitmap( module_options_xpm ),
_( "Module Properties" ) ); _( "Module properties" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print Module" ) ); _( "Print module" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, false ); msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, false );
@ -104,12 +104,12 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, wxBitmap( options_pad_xpm ), m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, wxBitmap( options_pad_xpm ),
_( "Pad Settings" ) ); _( "Pad settings" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString,
wxBitmap( module_check_xpm ), wxBitmap( module_check_xpm ),
_( "Module Check" ) ); _( "Check module" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes // the changes