From bb6fffa5a98bbcc3eccda33a1d4e64ccb4ed442c Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 29 Apr 2013 12:50:10 -0400 Subject: [PATCH] * Set "Ctrl+Shift+S" as shortcut for "Save as..." in CvPcb and PCBnew. This seems to me like the defacto standard for this menu command. * Added a default filename for save as. Currently it's set to "Unnamed file" using _() so its translatable. * Changed the save dialog in PCBnew to use the path of the "original" file as a base for the new file. --- cvpcb/menubar.cpp | 2 +- cvpcb/readwrite_dlgs.cpp | 4 ++-- pcbnew/files.cpp | 9 +++++++-- pcbnew/menubar_pcbframe.cpp | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 19fab61ade..f7c188d4aa 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -95,7 +95,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Save as the .cmp file AddMenuItem( filesMenu, wxID_SAVEAS, - _( "Save &As..." ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) ); + _( "Save &As...\tCtrl+Shift+S" ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) ); // Separator filesMenu->AppendSeparator(); diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 63a2ba06ea..162d1d00a2 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -166,8 +166,8 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) } else { - wxFileDialog dlg( this, _( "Save Component Footprint Link File" ), wxGetCwd(), - wxEmptyString, ComponentFileWildcard, wxFD_SAVE ); + wxFileDialog dlg( this, _( "Save Component Footprint Link File" ), wxEmptyString, + _( "Unnamed file" ), ComponentFileWildcard, wxFD_SAVE ); if( dlg.ShowModal() == wxID_CANCEL ) return -1; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 2b36023dd8..9be8af1641 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -445,12 +445,17 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF pcbFileName = GetBoard()->GetFileName(); + if( pcbFileName.GetName() == wxEmptyString ) + { + pcbFileName.SetName( _( "Unnamed file" ) ); + } + // Match the default wildcard filter choice, with the inital file extension shown. // That'll be the extension unless user changes filter dropdown listbox. pcbFileName.SetExt( KiCadPcbFileExtension ); - wxFileDialog dlg( this, _( "Save Board File As" ), wxEmptyString, - pcbFileName.GetFullPath(), + wxFileDialog dlg( this, _( "Save Board File As" ), pcbFileName.GetPath(), + pcbFileName.GetFullName(), wildcard, wxFD_SAVE /* wxFileDialog is not equipped to handle multiple wildcards and wxFD_OVERWRITE_PROMPT both together. diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 722bece58d..b3d732d934 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -106,8 +106,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Save As AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, - _( "Sa&ve As..." ), - _( "Save the current board as.." ), + _( "Sa&ve As...\tCtrl+Shift+S" ), + _( "Save the current board as..." ), KiBitmap( save_as_xpm ) ); filesMenu->AppendSeparator();