From eed2bed0bdf1d72c0de544d5b78a3028c5be9f01 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sun, 21 Apr 2013 20:31:09 -0400 Subject: [PATCH 1/5] changed implementation of MacOpenFile to make it open files when they are double clicked in Finder. --- kicad/kicad.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index f78126d13a..adc08bfab9 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -56,21 +56,17 @@ void EDA_APP::MacOpenFile( const wxString &fileName ) frame->m_ProjectFileName = fn; - if( m_fileHistory.GetCount() ) + if( !frame->m_ProjectFileName.FileExists() ) { - frame->m_ProjectFileName = m_fileHistory.GetHistoryFile( 0 ); - - if( !frame->m_ProjectFileName.FileExists() ) - { - m_fileHistory.RemoveFileFromHistory( 0 ); - } - else - { - wxCommandEvent cmd( 0, wxID_FILE1 ); - frame->OnFileHistory( cmd ); - } + m_fileHistory.RemoveFileFromHistory( 0 ); + return; } + wxCommandEvent loadEvent; + loadEvent.SetId(wxID_ANY); + + frame->OnLoadProject(loadEvent); + wxString title = GetTitle() + wxT( " " ) + GetBuildVersion() + wxT( " " ) + frame->m_ProjectFileName.GetFullPath(); From ec83adde3fb01bdb6681f29aaecc47f7d2c3f7a2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 22 Apr 2013 12:20:34 -0400 Subject: [PATCH 2/5] Updated the pcbnew Info.plist to associate .kicad_pcb files with pcbnew. --- pcbnew/Info.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/pcbnew/Info.plist b/pcbnew/Info.plist index 33d718d2cd..8fef4f79de 100644 --- a/pcbnew/Info.plist +++ b/pcbnew/Info.plist @@ -11,6 +11,7 @@ pcbnew_doc.icns CFBundleTypeExtensions + kicad_pcb brd CFBundleTypeName From 7700779e2cda739de65b22955657012a27535c8d Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 25 Apr 2013 13:27:43 -0400 Subject: [PATCH 3/5] made changes compliant to style guide. --- kicad/kicad.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index adc08bfab9..d1cee62d5e 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -63,9 +63,9 @@ void EDA_APP::MacOpenFile( const wxString &fileName ) } wxCommandEvent loadEvent; - loadEvent.SetId(wxID_ANY); + loadEvent.SetId( wxID_ANY ); - frame->OnLoadProject(loadEvent); + frame->OnLoadProject( loadEvent ); wxString title = GetTitle() + wxT( " " ) + GetBuildVersion() + wxT( " " ) + frame->m_ProjectFileName.GetFullPath(); From 8d32141b8f4f90ee4da03fa11edc9b3e91138db9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 25 Apr 2013 18:31:14 -0400 Subject: [PATCH 4/5] resaved some files as UTF-8 to silence clangs warnings about illegal character encodings. --- pcb_calculator/transline/c_microstrip.cpp | 2 +- pcb_calculator/transline/coplanar.cpp | 2 +- pcb_calculator/transline/microstrip.cpp | 2 +- pcb_calculator/transline/stripline.cpp | 2 +- pcb_calculator/transline/twistedpair.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pcb_calculator/transline/c_microstrip.cpp b/pcb_calculator/transline/c_microstrip.cpp index 813a7d8449..154f8edc03 100644 --- a/pcb_calculator/transline/c_microstrip.cpp +++ b/pcb_calculator/transline/c_microstrip.cpp @@ -869,7 +869,7 @@ void C_MICROSTRIP::show_results() setResult( 4, atten_dielectric_e, "dB" ); setResult( 5, atten_dielectric_o, "dB" ); - setResult( 6, skindepth / UNIT_MICRON, "µm" ); + setResult( 6, skindepth / UNIT_MICRON, "µm" ); } diff --git a/pcb_calculator/transline/coplanar.cpp b/pcb_calculator/transline/coplanar.cpp index 80f2952711..3bfd16eba9 100644 --- a/pcb_calculator/transline/coplanar.cpp +++ b/pcb_calculator/transline/coplanar.cpp @@ -184,7 +184,7 @@ void COPLANAR::show_results() setResult( 1, atten_cond, "dB" ); setResult( 2, atten_dielectric, "dB" ); - setResult( 3, skindepth / UNIT_MICRON, "µm" ); + setResult( 3, skindepth / UNIT_MICRON, "µm" ); } diff --git a/pcb_calculator/transline/microstrip.cpp b/pcb_calculator/transline/microstrip.cpp index 1bb1982bd0..cc06d584a1 100644 --- a/pcb_calculator/transline/microstrip.cpp +++ b/pcb_calculator/transline/microstrip.cpp @@ -511,7 +511,7 @@ void MICROSTRIP::show_results() setResult( 1, atten_cond, "dB" ); setResult( 2, atten_dielectric, "dB" ); - setResult( 3, skindepth/UNIT_MICRON, "µm" ); + setResult( 3, skindepth/UNIT_MICRON, "µm" ); } diff --git a/pcb_calculator/transline/stripline.cpp b/pcb_calculator/transline/stripline.cpp index 332314e64d..f44e311ca8 100644 --- a/pcb_calculator/transline/stripline.cpp +++ b/pcb_calculator/transline/stripline.cpp @@ -123,7 +123,7 @@ void STRIPLINE::show_results() setResult( 1, atten_cond, "dB" ); setResult( 2, atten_dielectric, "dB" ); - setResult( 3, skindepth / UNIT_MICRON, "µm" ); + setResult( 3, skindepth / UNIT_MICRON, "µm" ); } diff --git a/pcb_calculator/transline/twistedpair.cpp b/pcb_calculator/transline/twistedpair.cpp index d2c22ea672..c75130d034 100644 --- a/pcb_calculator/transline/twistedpair.cpp +++ b/pcb_calculator/transline/twistedpair.cpp @@ -84,7 +84,7 @@ void TWISTEDPAIR::show_results() setResult( 1, atten_cond, "dB" ); setResult( 2, atten_dielectric, "dB" ); - setResult( 3, skindepth / UNIT_MICRON, "µm" ); + setResult( 3, skindepth / UNIT_MICRON, "µm" ); } From 46644277846613226350b1794c3d65c9c231c5af Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 29 Apr 2013 12:50:10 -0400 Subject: [PATCH 5/5] * 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();