From e414f8da09edf281c14e8712436d39d2882fff31 Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Mon, 8 Aug 2011 18:44:43 +0300 Subject: [PATCH] Store the name of modedit active(/current/working?) library in a static variable. Edit some modedit strings. --- pcbnew/librairi.cpp | 5 +++-- pcbnew/menubar_modedit.cpp | 10 +++++----- pcbnew/module_editor_frame.h | 11 ++++++++++- pcbnew/moduleframe.cpp | 13 ++++++++++++- pcbnew/tool_modedit.cpp | 22 +++++++++++----------- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index f85c34a31e..4a3d4ef57f 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -720,14 +720,15 @@ void WinEDA_ModuleEditFrame::Select_Active_Library() if( g_LibName_List.GetCount() == 0 ) 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 ) return; m_CurrentLib = dlg.GetTextSelection(); - SetTitle( _( "Module Editor (lib: " ) + m_CurrentLib + wxT( ")" ) ); + UpdateTitle(); + return; } diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 05dfcaafe6..2216dd84a0 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -66,7 +66,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() // from current Board item = new wxMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD, - _( "Load from current Board" ), + _( "Load from Current Board" ), _( "Load a footprint module from the current loaded board" ) ); SET_BITMAP( load_module_board_xpm ); openSubmenu->Append( item ); @@ -80,8 +80,8 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() // Save module item = new wxMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, - _( "&Save Module in Current Lib" ), - _( "Save Module in working library" ) ); + _( "&Save Module in Active Library" ), + _( "Save module in active library" ) ); SET_BITMAP( save_library_xpm ); fileMenu->Append( item ); @@ -96,7 +96,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() // Export module item = new wxMenuItem( fileMenu, ID_MODEDIT_EXPORT_PART, - _( "&Export module" ), + _( "&Export Module" ), _( "Save the current loaded module to a file" ) ); SET_BITMAP( export_module_xpm ); fileMenu->Append( item ); @@ -175,7 +175,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() // Pad settings item = new wxMenuItem( dimensions_Submenu, ID_MODEDIT_PAD_SETTINGS, - _( "Pad settings" ), + _( "Pad Settings" ), _( "Edit the settings for new pads" ) ); SET_BITMAP( options_pad_xpm ); dimensions_Submenu->Append( item ); diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 8a079bb016..773bfab9fd 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -12,7 +12,6 @@ class WinEDA_ModuleEditFrame : public PCB_BASE_FRAME { public: MODULE* CurrentModule; - wxString m_CurrentLib; public: WinEDA_ModuleEditFrame( wxWindow* father, @@ -136,9 +135,17 @@ public: const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); private: + static wxString m_CurrentLib; + void GetComponentFromUndoList( wxCommandEvent& event ); void GetComponentFromRedoList( wxCommandEvent& event ); + /** + * Function UpdateTitle + * updates window title according to m_CurrentLib. + */ + void UpdateTitle(); + public: // Footprint edition @@ -219,6 +226,8 @@ public: int Create_Librairie( const wxString& LibName ); void Select_Active_Library(); + wxString GetCurrentLib() const { return m_CurrentLib; }; + DECLARE_EVENT_TABLE() }; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 1bc50d4a4e..b30bec87fd 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -25,6 +25,8 @@ static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the // Design setting for the module editor: static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting; +wxString WinEDA_ModuleEditFrame::m_CurrentLib = wxEmptyString; + /********************************/ /* class WinEDA_ModuleEditFrame */ /********************************/ @@ -128,7 +130,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, // Give an icon SetIcon( wxICON( icon_modedit ) ); - SetTitle( wxT( "Module Editor (lib: " ) + m_CurrentLib + wxT( ")" ) ); + UpdateTitle(); if( g_ModuleEditor_Pcb == NULL ) g_ModuleEditor_Pcb = new BOARD( NULL, this ); @@ -432,3 +434,12 @@ void WinEDA_ModuleEditFrame::OnModify() if( m_Draw3DFrame ) 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( ")" ) ); +} diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index 7daf63a8e5..e9377e8cf6 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -33,10 +33,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() // Set up toolbar m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( open_library_xpm ), - _( "Select working library" ) ); + _( "Select active library" ) ); 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, wxBitmap( new_library_xpm ), @@ -44,14 +44,14 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() m_HToolBar->AddSeparator(); 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->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 ), - _( "Load module from lib" ) ); + _( "Load module from library" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, @@ -68,10 +68,10 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() m_HToolBar->AddSeparator(); 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 ), - _( "export module" ) ); + _( "Export module" ) ); m_HToolBar->AddSeparator(); @@ -83,11 +83,11 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, wxBitmap( module_options_xpm ), - _( "Module Properties" ) ); + _( "Module properties" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ), - _( "Print Module" ) ); + _( "Print module" ) ); m_HToolBar->AddSeparator(); 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->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, wxBitmap( options_pad_xpm ), - _( "Pad Settings" ) ); + _( "Pad settings" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, wxBitmap( module_check_xpm ), - _( "Module Check" ) ); + _( "Check module" ) ); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes