From 292c1f0912534ea8a07802e6151777bfb8bc2820 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 18 Oct 2012 21:31:40 +0200 Subject: [PATCH] Kicad: bug fix in menubar when changing the selected locale. fctsys.h: remove useless define. Fix minor issues and add minor enhancements. --- common/build_version.cpp | 4 +- .../dialogs/dialog_display_info_HTML_base.fbp | 2 +- common/dialogs/dialog_get_component_base.cpp | 7 +- common/dialogs/dialog_get_component_base.fbp | 306 ++++++++++- common/dialogs/dialog_get_component_base.h | 16 +- common/dialogs/dialog_hotkeys_editor_base.fbp | 492 +++++++++--------- common/displlst.cpp | 21 +- common/gestfich.cpp | 8 +- common/projet_config.cpp | 6 +- eeschema/selpart.cpp | 23 +- include/dialog_helpers.h | 3 +- include/fctsys.h | 14 +- kicad/menubar.cpp | 23 +- pcbnew/files.cpp | 9 +- 14 files changed, 608 insertions(+), 326 deletions(-) diff --git a/common/build_version.cpp b/common/build_version.cpp index d3ae27a24d..10259e63ca 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -7,9 +7,9 @@ #ifndef KICAD_BUILD_VERSION #if defined KICAD_GOST -# define KICAD_BUILD_VERSION "(2011-nov-30 GOST)" +# define KICAD_BUILD_VERSION "(2012-oct-18 GOST)" #else -# define KICAD_BUILD_VERSION "(2011-nov-30)" +# define KICAD_BUILD_VERSION "(2012-oct-18)" #endif #endif diff --git a/common/dialogs/dialog_display_info_HTML_base.fbp b/common/dialogs/dialog_display_info_HTML_base.fbp index 5ced1e7215..01ae4b615d 100644 --- a/common/dialogs/dialog_display_info_HTML_base.fbp +++ b/common/dialogs/dialog_display_info_HTML_base.fbp @@ -1,6 +1,6 @@ - + C++ diff --git a/common/dialogs/dialog_get_component_base.cpp b/common/dialogs/dialog_get_component_base.cpp index f72ec8ad30..ebdf97acc8 100644 --- a/common/dialogs/dialog_get_component_base.cpp +++ b/common/dialogs/dialog_get_component_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Apr 10 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -35,6 +35,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow bSizerLeft->Add( m_historyList, 1, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 ); wxBoxSizer* bSizerRight; @@ -56,8 +57,10 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow m_buttonBrowse = new wxButton( this, ID_EXTRA_TOOL, _("Select by Browser"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_buttonBrowse, 0, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( bSizerRight, 0, wxALIGN_CENTER_VERTICAL, 5 ); + this->SetSizer( bSizerMain ); this->Layout(); diff --git a/common/dialogs/dialog_get_component_base.fbp b/common/dialogs/dialog_get_component_base.fbp index 815c7470b2..9e44ad279d 100644 --- a/common/dialogs/dialog_get_component_base.fbp +++ b/common/dialogs/dialog_get_component_base.fbp @@ -1,12 +1,14 @@ - + C++ 1 source_name + 0 0 + res UTF-8 connect dialog_get_component_base @@ -18,10 +20,13 @@ . 1 + 1 1 0 0 + 0 + wxAUI_MGR_DEFAULT wxBOTH @@ -39,18 +44,20 @@ 375,210 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + DIALOG_SHIM; dialog_shim.h - - wxFILTER_NONE - wxDefaultValidator - + + + + + + @@ -98,28 +105,55 @@ wxTOP|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Name: + + 0 + + 0 + 1 m_staticTextName + 1 + + protected + 1 + Resizable + 1 + 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -154,23 +188,54 @@ wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY + + 0 0 + + 0 + 1 m_textCmpNameCtrl + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -214,28 +279,55 @@ wxTOP|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY History list: + + 0 + + 0 + 1 m_staticTextHistory + 1 + + protected + 1 + Resizable + 1 + 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -270,23 +362,54 @@ wxALL|wxEXPAND 1 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 ID_SEL_BY_LISTBOX + + 0 + + 0 200,100 + 1 m_historyList + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -338,24 +461,55 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_OK OK + + 0 + + 0 + 1 m_buttonOK + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -395,24 +549,55 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 0 + 0 + Dock + 0 + Left 1 + 1 + 0 0 ID_ACCEPT_KEYWORD Search by Keyword + + 0 + + 0 + 1 m_buttonKW + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -452,24 +637,55 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 0 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_CANCEL Cancel + + 0 + + 0 + 1 m_buttonCancel + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -509,24 +725,55 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 0 + 0 + Dock + 0 + Left 1 + 1 + 0 0 ID_LIST_ALL List All + + 0 + + 0 + 1 m_buttonList + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -566,24 +813,55 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 0 + 0 + Dock + 0 + Left 1 + 1 + 0 0 ID_EXTRA_TOOL Select by Browser + + 0 + + 0 + 1 m_buttonBrowse + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE diff --git a/common/dialogs/dialog_get_component_base.h b/common/dialogs/dialog_get_component_base.h index 32835c6a2f..ab47e72923 100644 --- a/common/dialogs/dialog_get_component_base.h +++ b/common/dialogs/dialog_get_component_base.h @@ -1,15 +1,17 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Apr 10 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __dialog_get_component_base__ -#define __dialog_get_component_base__ +#ifndef __DIALOG_GET_COMPONENT_BASE_H__ +#define __DIALOG_GET_COMPONENT_BASE_H__ +#include +#include #include - +#include "dialog_shim.h" #include #include #include @@ -32,7 +34,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_GET_COMPONENT_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_GET_COMPONENT_BASE : public wxDialog +class DIALOG_GET_COMPONENT_BASE : public DIALOG_SHIM { private: @@ -55,9 +57,9 @@ class DIALOG_GET_COMPONENT_BASE : public wxDialog public: - DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,210 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,210 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_GET_COMPONENT_BASE(); }; -#endif //__dialog_get_component_base__ +#endif //__DIALOG_GET_COMPONENT_BASE_H__ diff --git a/common/dialogs/dialog_hotkeys_editor_base.fbp b/common/dialogs/dialog_hotkeys_editor_base.fbp index 6e3d2ce260..62c128bae9 100644 --- a/common/dialogs/dialog_hotkeys_editor_base.fbp +++ b/common/dialogs/dialog_hotkeys_editor_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 source_name @@ -14,73 +14,73 @@ none 1 dialog_hotkeys_editor_base - + . - + 1 1 0 0 - - - + + + 1 1 impl_virtual - - - + + + 0 wxID_ANY - - + + HOTKEYS_EDITOR_DIALOG_BASE - + 304,235 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + Hotkeys Editor - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxHORIZONTAL none @@ -91,19 +91,19 @@ 1 0 - - - + + + wxALIGN_LEFT - + wxALIGN_TOP wxALIGN_CENTRE 30 - + wxALIGN_CENTRE 2 - - + + 1 0 1 @@ -111,93 +111,93 @@ 1 0 1 - - - + + + 1 0 wxID_ANY - - - + + + 0 0 - - + + m_hotkeyGrid protected - + wxALIGN_CENTRE 0 - + wxALIGN_CENTRE - + 1 - - - - + + + + wxFILTER_NONE wxDefaultValidator - - - + + + wxDOUBLE_BORDER|wxTAB_TRAVERSAL|wxWANTS_CHARS OnKeyPressed - - - - - + + + + + OnRightClickOnCell - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + OnClickOnCell - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -205,7 +205,7 @@ wxALIGN_CENTER_VERTICAL 0 - + b_buttonsSizer wxVERTICAL none @@ -214,56 +214,56 @@ wxALL|wxEXPAND 0 - - + + 1 0 1 - - + + 0 wxID_OK OK - - + + m_OKButton protected - - - - - - + + + + + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnOKClicked - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -271,56 +271,56 @@ wxALL|wxEXPAND 0 - - + + 1 0 1 - - + + 0 wxID_CANCEL Close - - + + m_cancelButton protected - - - - - - + + + + + + wxFILTER_NONE wxDefaultValidator - - - - + + + + CancelClicked - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -328,56 +328,56 @@ wxALL|wxEXPAND 0 - - + + 1 0 1 - - + + 0 wxID_CANCEL Undo - - + + m_undoButton protected - - - - - - + + + + + + wxFILTER_NONE wxDefaultValidator - - - - + + + + UndoClicked - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/displlst.cpp b/common/displlst.cpp index 45058ee168..aad9222810 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -4,9 +4,6 @@ #include #include -#include -#include -#include #include #include @@ -30,7 +27,7 @@ END_EVENT_TABLE() EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, const wxArrayString& aItemList, const wxString& aRefText, void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) : - wxDialog( aParent, wxID_ANY, aTitle, aPos, wxDefaultSize, + DIALOG_SHIM( aParent, wxID_ANY, aTitle, aPos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ) { m_callBackFct = aCallBackFunction; @@ -41,18 +38,30 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl SetSizer( GeneralBoxSizer ); m_listBox = new wxListBox( this, ID_LISTBOX_LIST, wxDefaultPosition, - wxSize( 300, 200 ), 0, NULL, + wxDefaultSize, 0, NULL, wxLB_NEEDED_SB | wxLB_SINGLE | wxLB_HSCROLL ); + m_listBox->SetMinSize( wxSize( 200, 200 ) ); GeneralBoxSizer->Add( m_listBox, 2, wxGROW | wxALL, 5 ); InsertItems( aItemList, 0 ); + if( !aRefText.IsEmpty() ) // try to select the item matching aRefText + { + for( unsigned ii = 0; ii < aItemList.GetCount(); ii++ ) + if( aItemList[ii] == aRefText ) + { + m_listBox->SetSelection( ii ); + break; + } + } + if( m_callBackFct ) { m_messages = new wxTextCtrl( this, -1, wxEmptyString, - wxDefaultPosition, wxSize( -1, 60 ), + wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE ); + m_messages->SetMinSize( wxSize( -1, 60 ) ); GeneralBoxSizer->Add( m_messages, 1, wxGROW | wxALL, 5 ); } diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 3aad48437e..3b0ceb13cc 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -256,8 +256,10 @@ wxString EDA_FileSelector( const wxString& Title, wxString defaultpath = Path; wxString dotted_Ext = wxT(".") + Ext; - defaultname.Replace( wxT( "/" ), STRING_DIR_SEP ); - defaultpath.Replace( wxT( "/" ), STRING_DIR_SEP ); +#ifdef __WINDOWS__ + defaultname.Replace( wxT( "/" ), wxT( "\\" ) ); + defaultpath.Replace( wxT( "/" ), wxT( "\\" ) ); +#endif if( defaultpath.IsEmpty() ) defaultpath = wxGetCwd(); @@ -421,7 +423,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para FullFileName = FindKicadFile( ExecFile ); #ifdef __WXMAC__ - if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) ) + if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) ) { ProcessExecute( wxGetApp().GetExecutablePath() + wxT("/") + ExecFile + wxT(" ") + param ); } else { diff --git a/common/projet_config.cpp b/common/projet_config.cpp index fce2668a30..dba92bb4e5 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -298,7 +298,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, else { if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() ) - m_CurrentOptionFile = wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename; + m_CurrentOptionFile = wxGetCwd() + wxFileName::GetPathSeparator() + + g_Prj_Config_LocalFilename; else m_CurrentOptionFile = g_Prj_Config_LocalFilename; } @@ -352,7 +353,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, else { if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() ) - m_CurrentOptionFile = wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename; + m_CurrentOptionFile = wxGetCwd() + wxFileName::GetPathSeparator() + + g_Prj_Config_LocalFilename; else m_CurrentOptionFile = g_Prj_Config_LocalFilename; } diff --git a/eeschema/selpart.cpp b/eeschema/selpart.cpp index fce25ce44e..b8f1ba4514 100644 --- a/eeschema/selpart.cpp +++ b/eeschema/selpart.cpp @@ -16,11 +16,10 @@ CMP_LIBRARY* SelectLibraryFromList( EDA_DRAW_FRAME* frame ) { static wxString OldLibName; - wxString msg; wxArrayString libNamesList; - int count = CMP_LIBRARY::GetLibraryCount(); CMP_LIBRARY* Lib = NULL; + int count = CMP_LIBRARY::GetLibraryCount(); if( count == 0 ) { DisplayError( frame, _( "No component libraries are loaded." ) ); @@ -29,22 +28,20 @@ CMP_LIBRARY* SelectLibraryFromList( EDA_DRAW_FRAME* frame ) libNamesList = CMP_LIBRARY::GetLibraryNames(); - msg.Printf( _( " Select 1 of %d libraries." ), count ); + EDA_LIST_DIALOG dlg( frame, _( "Select Library" ), libNamesList, OldLibName ); - wxSingleChoiceDialog dlg( frame, msg, _( "Select Library" ), libNamesList ); - - int index = libNamesList.Index( OldLibName ); - - if( index != wxNOT_FOUND ) - dlg.SetSelection( index ); - - if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() ) + if( dlg.ShowModal() != wxID_OK ) return NULL; - Lib = CMP_LIBRARY::FindLibrary( dlg.GetStringSelection() ); + wxString libname = dlg.GetTextSelection(); + + if( libname.IsEmpty() ) + return NULL; + + Lib = CMP_LIBRARY::FindLibrary( libname ); if( Lib != NULL ) - OldLibName = dlg.GetStringSelection(); + OldLibName = libname; return Lib; } diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index c8aab8e084..e7b74e007d 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -9,6 +9,7 @@ #include // EDA_UNITS_T +#include class EDA_DRAW_FRAME; @@ -21,7 +22,7 @@ class EDA_DRAW_FRAME; * Used to display a list of elements for selection, and an help of info line * about the selected item. */ -class EDA_LIST_DIALOG : public wxDialog +class EDA_LIST_DIALOG : public DIALOG_SHIM { private: wxListBox* m_listBox; diff --git a/include/fctsys.h b/include/fctsys.h index 42e8742e08..764ab50825 100644 --- a/include/fctsys.h +++ b/include/fctsys.h @@ -26,19 +26,7 @@ #endif /** - * @note Shouldn't we be using wxFileName::GetPathSeparator() instead of the following code - * for improved portability? - */ -#ifdef __WINDOWS__ -#define DIR_SEP '\\' -#define STRING_DIR_SEP wxT( "\\" ) -#else -#define DIR_SEP '/' -#define STRING_DIR_SEP wxT( "/" ) -#endif - -/** - * @note Do we really need these defined again? + * @note Do we really need these defined? */ #define UNIX_STRING_DIR_SEP wxT( "/" ) #define WIN_STRING_DIR_SEP wxT( "\\" ) diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 3b734bfcaa..3202d365e2 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -32,7 +32,6 @@ #include #include - /* Menubar and toolbar event table */ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME ) /* Window events */ @@ -91,6 +90,9 @@ END_EVENT_TABLE() */ void KICAD_MANAGER_FRAME::ReCreateMenuBar() { + static wxMenu* openRecentMenu; // Open Recent submenu, + // static to remember this menu + // Create and try to get the current menubar wxMenuItem* item; wxMenuBar* menuBar = GetMenuBar(); @@ -102,6 +104,12 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // This allows language changes of the menu text on the fly. menuBar->Freeze(); + // Before deleting, remove the menus managed by m_fileHistory + // (the file history will be updated when adding/removing files in history) + if( openRecentMenu ) + wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); + + // Delete all existing menus while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); @@ -117,14 +125,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() _( "Open an existing project" ), KiBitmap( open_project_xpm ) ); - // Open Recent submenu - static wxMenu* openRecentMenu; - - // Add this menu to list menu managed by m_fileHistory - // (the file history will be updated when adding/removing files in history - if( openRecentMenu ) - wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); - + // File history openRecentMenu = new wxMenu(); wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().AddFilesToMenu( ); @@ -135,7 +136,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() KiBitmap( open_project_xpm ) ); // New - static wxMenu* newMenu = new wxMenu(); + wxMenu* newMenu = new wxMenu(); AddMenuItem( newMenu, ID_NEW_PROJECT, _( "&Blank\tCtrl+N" ), _( "Start a blank project" ), @@ -147,7 +148,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() KiBitmap( new_project_with_template_xpm ) ); AddMenuItem( fileMenu, newMenu, - wxID_ANY, + wxID_ANY, _( "New" ), _( "Start a new project" ), KiBitmap( new_project_xpm ) ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index d992e9e20c..ce754602c5 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -133,11 +133,10 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) case ID_NEW_BOARD: { Clear_Pcb( true ); - wxString newFilename; - newFilename.Printf( wxT( "%s%cnoname%s" ), - GetChars( wxGetCwd() ), DIR_SEP, - GetChars( PcbFileExtension ) ); - GetBoard()->SetFileName( newFilename ); + wxFileName fn( wxT( "noname" ) ); + fn.AssignCwd(); + fn.SetExt( PcbFileExtension ); + GetBoard()->SetFileName( fn.GetFullPath() ); UpdateTitle(); ReCreateLayerBox( NULL ); }