From 7d85aa92a89ef4d1412bbbcde4545ae148063853 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 18 Dec 2010 09:59:04 +0100 Subject: [PATCH] Fix minor issues. --- common/basicframe.cpp | 8 ++--- eeschema/libeditframe.cpp | 3 ++ gerbview/class_DCodeSelectionbox.cpp | 8 ++--- gerbview/class_DCodeSelectionbox.h | 4 +-- kicad/menubar.cpp | 51 +++++++++------------------- kicad/preferences.cpp | 8 +---- 6 files changed, 29 insertions(+), 53 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 8d28133836..1652c73424 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -93,11 +93,9 @@ void WinEDA_BasicFrame::SetLanguage( wxCommandEvent& event ) int id = event.GetId(); wxGetApp().SetLanguageIdentifier( id ); - if ( wxGetApp().SetLanguage() ) - { - ReCreateMenuBar(); - Refresh(); - } + wxGetApp().SetLanguage(); + ReCreateMenuBar(); + GetMenuBar()->Refresh(); } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 5e42eb9da0..707a5ed871 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -958,6 +958,9 @@ void LIB_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) { WinEDA_BasicFrame::SetLanguage( event ); SCH_EDIT_FRAME *parent = (SCH_EDIT_FRAME *)GetParent(); + // Call parent->WinEDA_BasicFrame::SetLanguage and NOT + // parent->SetLanguage because parent->SetLanguage call + // LIB_EDIT_FRAME::SetLanguage parent->WinEDA_BasicFrame::SetLanguage( event ); } diff --git a/gerbview/class_DCodeSelectionbox.cpp b/gerbview/class_DCodeSelectionbox.cpp index 048afd8224..ad247cba31 100644 --- a/gerbview/class_DCodeSelectionbox.cpp +++ b/gerbview/class_DCodeSelectionbox.cpp @@ -11,14 +11,14 @@ #include "class_DCodeSelectionbox.h" -/***************************************/ -/* ListBox handling the footprint list */ -/***************************************/ +/*******************************************/ +/* Helper class for displaying DCodes list */ +/*******************************************/ DCODE_SELECTION_BOX::DCODE_SELECTION_BOX( WinEDA_Toolbar* aParent, wxWindowID aId, const wxPoint& aLocation, const wxSize& aSize, const wxArrayString& aChoices ) : - wxChoice( aParent, aId, aLocation, aSize, aChoices ) + wxComboBox( aParent, aId, wxEmptyString, aLocation, aSize, aChoices, wxCB_READONLY ) { m_dcodeList = &aChoices; } diff --git a/gerbview/class_DCodeSelectionbox.h b/gerbview/class_DCodeSelectionbox.h index 163c1184b8..b5cd05a4fa 100644 --- a/gerbview/class_DCodeSelectionbox.h +++ b/gerbview/class_DCodeSelectionbox.h @@ -7,9 +7,9 @@ */ // Define event type for DCODE_SELECTION_BOX -#define EVT_SELECT_DCODE EVT_CHOICE +#define EVT_SELECT_DCODE EVT_COMBOBOX -class DCODE_SELECTION_BOX : public wxChoice +class DCODE_SELECTION_BOX : public wxComboBox { private: const wxArrayString* m_dcodeList; diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index f750aa74fa..620a990cce 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -71,7 +71,7 @@ END_EVENT_TABLE() void WinEDA_MainFrame::ReCreateMenuBar() { wxMenuItem *item; - wxMenuBar *menuBar = GetMenuBar(); + wxMenuBar *menuBar = new wxMenuBar(); if( ! menuBar ) menuBar = new wxMenuBar(); @@ -87,7 +87,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() // Files menu wxMenu* filesMenu = new wxMenu; - /* Open */ + // Open item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), _( "Open an existing project" ) ); @@ -97,7 +97,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() filesMenu->Append( item ); - /* Open Recent submenu */ + // Open Recent submenu wxMenu* openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, @@ -105,7 +105,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() _("Open a recent opened schematic project" ), open_project_xpm ); - /* New */ + // New item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), _( "Start a new project" ) ); @@ -125,10 +125,8 @@ void WinEDA_MainFrame::ReCreateMenuBar() filesMenu->Append( item ); - /* Separator */ + // Archive filesMenu->AppendSeparator(); - - /* Archive */ item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ), _( "Archive project files in zip archive" ) ); @@ -138,7 +136,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() filesMenu->Append( item ); - /* Unarchive */ + // Unarchive item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ), _( "Unarchive project files from zip file" ) ); @@ -161,12 +159,10 @@ void WinEDA_MainFrame::ReCreateMenuBar() - /** - * Browse menu - */ + // Browse menu wxMenu* browseMenu = new wxMenu(); - /* Text editor */ + // Text editor item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ), _( "Open preferred text editor" ) ); #if !defined( __WXMAC__ ) @@ -187,12 +183,10 @@ void WinEDA_MainFrame::ReCreateMenuBar() - /** - * Preferences menu - */ + // Preferences menu wxMenu* PreferencesMenu = new wxMenu; - /* Text editor */ + // Text editor item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, _( "&Text Editor" ), _( "Select your preferred text editor" ) ); @@ -202,13 +196,10 @@ void WinEDA_MainFrame::ReCreateMenuBar() PreferencesMenu->Append( item ); - /** - * PDF Viewer submenu - * System browser or user defined checkbox - */ + // PDF Viewer submenu:System browser or user defined checkbox wxMenu* SubMenuPdfBrowserChoice = new wxMenu; - /* Default */ + // Default item = new wxMenuItem( SubMenuPdfBrowserChoice, ID_SELECT_DEFAULT_PDF_BROWSER, _( "Default" ), @@ -223,7 +214,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER, wxGetApp().m_PdfBrowserIsDefault ); - /* Favourite */ + // Favourite viewer item = new wxMenuItem( SubMenuPdfBrowserChoice, ID_SELECT_PREFERED_PDF_BROWSER, _( "Favourite" ), @@ -258,11 +249,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() PreferencesMenu->AppendSeparator(); wxGetApp().AddMenuLanguageList( PreferencesMenu ); - - - /** - * Help menu - */ + // Help menu wxMenu* helpMenu = new wxMenu; AddHelpVersionInfoMenuEntry( helpMenu ); @@ -277,20 +264,14 @@ void WinEDA_MainFrame::ReCreateMenuBar() helpMenu->Append( item ); - /* About on all platforms except WXMAC */ -#if !defined( __WXMAC__ ) - + // About helpMenu->AppendSeparator(); item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ), _( "About kicad project manager" ) ); item->SetBitmap( info_xpm ); helpMenu->Append( item ); -#endif /* !defined( __WXMAC__ ) */ - - /** - * Create the menubar and append all submenus - */ + // Create the menubar and append all submenus menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( browseMenu, _( "&Browse" ) ); menuBar->Append( PreferencesMenu, _( "&Preferences" ) ); diff --git a/kicad/preferences.cpp b/kicad/preferences.cpp index 43acbdf011..f724657f50 100644 --- a/kicad/preferences.cpp +++ b/kicad/preferences.cpp @@ -98,11 +98,5 @@ void WinEDA_MainFrame::OnSelectPreferredEditor( wxCommandEvent& event ) void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event ) { - wxGetApp().SetLanguageIdentifier( event.GetId() ); - if ( wxGetApp().SetLanguage() ) - { - wxLogDebug( wxT( "Recreating menu bar due to language change." ) ); - ReCreateMenuBar(); - Refresh(); - } + WinEDA_BasicFrame::SetLanguage( event ); }