From 569c2be354515c7c487dd78a15999adbf8c174a8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 28 Apr 2015 17:07:36 +0200 Subject: [PATCH] Minor fixes: dialog rescue: make strings translatable. Remove a few coverity warnings (not initialized members). Very minor other changes. --- common/dialog_about/AboutDialog_main.cpp | 2 +- common/dialog_about/dialog_about_base.cpp | 19 ++- common/dialog_about/dialog_about_base.fbp | 112 ++++-------------- common/dialog_about/dialog_about_base.h | 12 +- eeschema/dialogs/dialog_rescue_each.cpp | 18 +-- eeschema/dialogs/dialog_rescue_each_base.cpp | 8 +- eeschema/dialogs/dialog_rescue_each_base.fbp | 8 +- pcbnew/dialogs/dialog_gendrill.cpp | 14 +-- pcbnew/exporters/gendrill_Excellon_writer.cpp | 6 +- pcbnew/exporters/gendrill_Excellon_writer.h | 16 +-- pcbnew/router/pns_diff_pair.h | 17 ++- pcbnew/router/pns_meander.h | 14 +++ pcbnew/router/router_tool.cpp | 1 + 13 files changed, 102 insertions(+), 145 deletions(-) diff --git a/common/dialog_about/AboutDialog_main.cpp b/common/dialog_about/AboutDialog_main.cpp index f22ad748da..07b491b9e2 100644 --- a/common/dialog_about/AboutDialog_main.cpp +++ b/common/dialog_about/AboutDialog_main.cpp @@ -201,7 +201,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) << HtmlNewline( 4 ) << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 ) << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ), - _( "GNU General Public License (GPL) version 2" ) ) + _( "GNU General Public License (GPL) version 2 or any later version" ) ) << wxT( "" ); info.SetLicense( license ); diff --git a/common/dialog_about/dialog_about_base.cpp b/common/dialog_about/dialog_about_base.cpp index 66cb2f05a2..19b9db7a43 100644 --- a/common/dialog_about/dialog_about_base.cpp +++ b/common/dialog_about/dialog_about_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -65,23 +65,18 @@ dialog_about_base::dialog_about_base( wxWindow* parent, wxWindowID id, const wxS bSizer1->Add( m_auiNotebook, 2, wxEXPAND | wxALL, 5 ); - m_buttonOK = new wxButton( this, wxID_CANCEL, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonOK->SetDefault(); - bSizer1->Add( m_buttonOK, 0, wxALIGN_CENTER|wxALL, 5 ); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizer->Realize(); + + bSizer1->Add( m_sdbSizer, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); this->SetSizer( bSizer1 ); this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( dialog_about_base::OnClose ) ); - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( dialog_about_base::OnOkClick ), NULL, this ); } dialog_about_base::~dialog_about_base() { - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( dialog_about_base::OnClose ) ); - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( dialog_about_base::OnOkClick ), NULL, this ); - } diff --git a/common/dialog_about/dialog_about_base.fbp b/common/dialog_about/dialog_about_base.fbp index ce0bf7d57d..e776d48c0d 100644 --- a/common/dialog_about/dialog_about_base.fbp +++ b/common/dialog_about/dialog_about_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -44,7 +44,7 @@ -1,-1 dialog_about_base - 750,450 + 750,437 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP About... @@ -61,7 +61,7 @@ - OnClose + @@ -88,7 +88,7 @@ - + bSizer1 wxVERTICAL @@ -720,92 +720,30 @@ - + 5 - wxALIGN_CENTER|wxALL + wxALL|wxALIGN_CENTER_HORIZONTAL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - OK - - 0 - - - 0 + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 - 1 - m_buttonOK - 1 - - - private - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - + m_sdbSizer + protected + + + + + + + + diff --git a/common/dialog_about/dialog_about_base.h b/common/dialog_about/dialog_about_base.h index d0485f3575..909898445a 100644 --- a/common/dialog_about/dialog_about_base.h +++ b/common/dialog_about/dialog_about_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -35,7 +35,6 @@ class dialog_about_base : public wxDialog { private: - wxButton* m_buttonOK; protected: wxStaticBitmap* m_bitmapApp; @@ -44,15 +43,12 @@ class dialog_about_base : public wxDialog wxStaticText* m_staticTextBuildVersion; wxStaticText* m_staticTextLibVersion; wxAuiNotebook* m_auiNotebook; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } - + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; public: - dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP ); + dialog_about_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 750,437 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSTAY_ON_TOP ); ~dialog_about_base(); }; diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index d69d89149a..3a20775d6c 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -99,10 +99,10 @@ bool DIALOG_RESCUE_EACH::TransferDataToWindow() if( !wxDialog::TransferDataToWindow() ) return false; - m_ListOfConflicts->AppendToggleColumn( wxT("Rescue") ); - m_ListOfConflicts->AppendTextColumn( wxT("Symbol Name") ); - m_ListOfInstances->AppendTextColumn( wxT("Reference") ); - m_ListOfInstances->AppendTextColumn( wxT("Value") ); + m_ListOfConflicts->AppendToggleColumn( _("Rescue symbol") ); + m_ListOfConflicts->AppendTextColumn( _("Symbol name") ); + m_ListOfInstances->AppendTextColumn( _("Reference") ); + m_ListOfInstances->AppendTextColumn( _("Value") ); PopulateConflictList(); PopulateInstanceList(); @@ -273,10 +273,12 @@ bool DIALOG_RESCUE_EACH::TransferDataFromWindow() void DIALOG_RESCUE_EACH::OnNeverShowClick( wxCommandEvent& aEvent ) { - wxMessageDialog dlg( m_Parent, wxT( "Stop showing this tool? No changes will be made.\n\n" - "This setting can be changed from the Component Libraries settings, and the " - "tool can be activated manually from the Tools menu." ), - wxT( "Rescue Components" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION ); + wxMessageDialog dlg( m_Parent, + _( "Stop showing this tool?\n" + "No changes will be made.\n\n" + "This setting can be changed from the \"Component Libraries\" dialog,\n" + "and the tool can be activated manually from the \"Tools\" menu." ), + _( "Rescue Components" ), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION ); int resp = dlg.ShowModal (); if( resp == wxID_YES ) diff --git a/eeschema/dialogs/dialog_rescue_each_base.cpp b/eeschema/dialogs/dialog_rescue_each_base.cpp index c96ac22aff..bad4ea9ba9 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.cpp +++ b/eeschema/dialogs/dialog_rescue_each_base.cpp @@ -27,7 +27,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i bSizerMain->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListOfConflicts = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerMain->Add( m_ListOfConflicts, 2, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( m_ListOfConflicts, 2, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_staticText4 = new wxStaticText( this, wxID_ANY, _("Instances of this symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4->Wrap( -1 ); @@ -36,7 +36,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i bSizerMain->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListOfInstances = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerMain->Add( m_ListOfInstances, 1, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( m_ListOfInstances, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizerView; bSizerView = new wxBoxSizer( wxHORIZONTAL ); @@ -53,7 +53,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_componentViewOld = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); m_componentViewOld->SetMinSize( wxSize( 150,150 ) ); - bSizer6->Add( m_componentViewOld, 1, wxEXPAND | wxALL, 5 ); + bSizer6->Add( m_componentViewOld, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerView->Add( bSizer6, 1, wxEXPAND, 5 ); @@ -70,7 +70,7 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i m_componentViewNew = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); m_componentViewNew->SetMinSize( wxSize( 150,150 ) ); - bSizer7->Add( m_componentViewNew, 1, wxEXPAND | wxALL, 5 ); + bSizer7->Add( m_componentViewNew, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerView->Add( bSizer7, 1, wxEXPAND, 5 ); diff --git a/eeschema/dialogs/dialog_rescue_each_base.fbp b/eeschema/dialogs/dialog_rescue_each_base.fbp index dc96440e2d..3df33bb114 100644 --- a/eeschema/dialogs/dialog_rescue_each_base.fbp +++ b/eeschema/dialogs/dialog_rescue_each_base.fbp @@ -261,7 +261,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 2 @@ -412,7 +412,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 @@ -581,7 +581,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 1 @@ -755,7 +755,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 1 diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 570d2acf17..c3291d4423 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -360,10 +360,6 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) * layer pair by layer pair for * buried vias */ - int layer1 = F_Cu; - int layer2 = B_Cu; - bool gen_through_holes = true; - bool gen_NPTH_holes = false; UpdateConfig(); // set params and Save drill options @@ -372,14 +368,17 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) if( m_microViasCount || m_blindOrBuriedViasCount ) hasBuriedVias = true; - EXCELLON_WRITER excellonWriter( m_parent->GetBoard(), - m_FileDrillOffset ); + EXCELLON_WRITER excellonWriter( m_parent->GetBoard() ); excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat, m_Precision.m_lhs, m_Precision.m_rhs ); excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH ); wxFileName fn; + int layer1 = F_Cu; + int layer2 = B_Cu; + bool gen_through_holes = true; + bool gen_NPTH_holes = false; for( ; ; ) { @@ -509,8 +508,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) return; - EXCELLON_WRITER excellonWriter( m_parent->GetBoard(), - m_FileDrillOffset ); + EXCELLON_WRITER excellonWriter( m_parent->GetBoard() ); excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat, m_Precision.m_lhs, m_Precision.m_rhs ); diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index 5a950ad4e9..6b302d85df 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -431,7 +431,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles, bool aGenerateNPTH_list, - bool aMergePTHNPTH ) + bool aMerge_PTH_NPTH ) { HOLE_INFO new_hole; int hole_value; @@ -445,7 +445,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, EXCHG( aFirstLayer, aLastLayer ); } - if ( aGenerateNPTH_list && aMergePTHNPTH ) + if ( aGenerateNPTH_list && aMerge_PTH_NPTH ) { return; } @@ -497,7 +497,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, { if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED && - ! aMergePTHNPTH ) + ! aMerge_PTH_NPTH ) continue; if( aGenerateNPTH_list && pad->GetAttribute() != PAD_HOLE_NOT_PLATED ) diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h index 705154b2c3..676057c9d9 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.h +++ b/pcbnew/exporters/gendrill_Excellon_writer.h @@ -143,12 +143,12 @@ private: // (i.e inches or mm) bool m_mirror; wxPoint m_offset; // Drill offset coordinates - bool m_mergePTHNPTH; + bool m_merge_PTH_NPTH; std::vector m_holeListBuffer; // Buffer containing holes std::vector m_toolListBuffer; // Buffer containing tools public: - EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset ) + EXCELLON_WRITER( BOARD* aPcb ) { m_file = NULL; m_pcb = aPcb; @@ -156,7 +156,7 @@ public: m_conversionUnits = 0.0001; m_unitsDecimal = false; m_mirror = false; - m_mergePTHNPTH = false; + m_merge_PTH_NPTH = false; m_minimalHeader = false; m_ShortHeader = false; } @@ -188,14 +188,14 @@ public: * @param aMirror = true to create mirrored coordinates (Y coordinates negated) * @param aMinimalHeader = true to use a minimal header (no comments, no info) * @param aOffset = drill coordinates offset - * @param aMergePTHNPTH : true to create only one list which contains both PTH and NPTH + * @param aMerge_PTH_NPTH : true to create only one list which contains both PTH and NPTH */ - void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMergePTHNPTH ) + void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH ) { m_mirror = aMirror; m_offset = aOffset; m_minimalHeader = aMinimalHeader; - m_mergePTHNPTH = aMergePTHNPTH; + m_merge_PTH_NPTH = aMerge_PTH_NPTH; } /** @@ -210,12 +210,12 @@ public: * @param aGenerateNPTH_list : * true to create NPTH only list (with no plated holes) * false to created plated holes list (with no NPTH ) - * @param aMergePTHNPTH : true to create only one list which contains both PTH and NPTH + * @param aMerge_PTH_NPTH : true to create only one list which contains both PTH and NPTH */ void BuildHolesList( int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles, bool aGenerateNPTH_list, - bool aMergePTHNPTH ); + bool aMerge_PTH_NPTH ); int GetHolesCount() const { return m_holeListBuffer.size(); } diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h index 1784a474e1..234ef89851 100644 --- a/pcbnew/router/pns_diff_pair.h +++ b/pcbnew/router/pns_diff_pair.h @@ -176,9 +176,15 @@ class PNS_DP_GATEWAYS public: PNS_DP_GATEWAYS ( int aGap ): - m_gap(aGap), m_viaGap( aGap ) {}; + m_gap(aGap), m_viaGap( aGap ) + { + // Do not leave unitialized members, and keep static analyser quiet: + m_viaDiameter = 0; + m_fitVias = true; + } - void SetGap ( int aGap ) { + void SetGap ( int aGap ) + { m_gap = aGap; m_viaGap = aGap; } @@ -320,6 +326,13 @@ public: m_net_n = aLineN.Net(); m_p = aLineP.CLine(); m_n = aLineN.CLine(); + + // Do not leave unitialized members, and keep static analyser quiet: + m_width = 0; + m_gap = 0; + m_viaGap = 0; + m_maxUncoupledLength = 0; + m_chamferLimit = 0; } static inline bool ClassOf( const PNS_ITEM* aItem ) diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h index de08329ed7..03e1ba7071 100644 --- a/pcbnew/router/pns_meander.h +++ b/pcbnew/router/pns_meander.h @@ -115,6 +115,12 @@ public: m_width( aWidth ), m_baselineOffset( 0 ) { + // Do not leave unitialized members, and keep static analyser quiet: + m_type = MT_SINGLE; + m_amplitude = 0; + m_side = false; + m_baseIndex = 0; + m_currentTarget = NULL; } /** @@ -385,6 +391,11 @@ class PNS_MEANDERED_LINE public: PNS_MEANDERED_LINE() { + // Do not leave unitialized members, and keep static analyser quiet: + m_placer = NULL; + m_dual = false; + m_width = 0; + m_baselineOffset = 0; } /** @@ -397,6 +408,9 @@ public: m_placer( aPlacer ), m_dual( aIsDual ) { + // Do not leave unitialized members, and keep static analyser quiet: + m_width = 0; + m_baselineOffset = 0; } /** diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index fadfd400f5..1710df9eac 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -94,6 +94,7 @@ class CONTEXT_TRACK_WIDTH_MENU: public CONTEXT_MENU public: CONTEXT_TRACK_WIDTH_MENU() { + m_board = NULL; SetIcon( width_track_via_xpm ); setCustomEventHandler( boost::bind( &CONTEXT_TRACK_WIDTH_MENU::handleCustomEvent, this, _1 ) );