From 1116acd74bd982cf0d2ef85fbe68406d291d7699 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 20 Oct 2018 12:38:36 +0200 Subject: [PATCH] Libedit: Fix broken handling of "common to all bodu style" property of lib draw items. Fix a minor wxWidgets assert. --- common/widgets/unit_binder.cpp | 2 +- .../dialogs/dialog_lib_edit_draw_item.cpp | 6 +- .../dialog_lib_edit_draw_item_base.cpp | 39 +++++---- .../dialog_lib_edit_draw_item_base.fbp | 85 ++++++++++++++++--- .../dialogs/dialog_lib_edit_draw_item_base.h | 12 +-- 5 files changed, 104 insertions(+), 40 deletions(-) diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index 417bdc7c54..b9f75956c2 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -135,7 +135,7 @@ bool UNIT_BINDER::Validate( bool setFocusOnError ) { if( m_showMessage ) { - wxString msg = wxString::Format( _( "%s must be larger than %s." ), + wxString msg = wxString::Format( _( "%s must be larger than %s or equal." ), valueDescriptionFromLabel( m_label ), StringFromValue( m_units, m_min, true ) ); DisplayError( m_value->GetParent(), msg ); diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item.cpp b/eeschema/dialogs/dialog_lib_edit_draw_item.cpp index fcb8db9dd9..3d0f372782 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item.cpp +++ b/eeschema/dialogs/dialog_lib_edit_draw_item.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2006-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2006-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,7 +42,7 @@ DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( LIB_EDIT_FRAME* aParent, L // Required under wxGTK if we want to dismiss the dialog with the ESC key SetFocus(); - m_sdbSizer1OK->SetDefault(); + m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); @@ -56,7 +56,7 @@ bool DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow() m_lineWidth.SetValue( m_item->GetWidth() ); m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 ); m_checkApplyToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 ); - m_checkApplyToAllConversions->SetValue( symbol && symbol->HasConversion() ); + m_checkApplyToAllConversions->SetValue( m_item->GetConvert() == 0 ); bool enblConvOptStyle = symbol && symbol->HasConversion(); // if a symbol contains no graphic items, symbol->HasConversion() returns false. diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item_base.cpp b/eeschema/dialogs/dialog_lib_edit_draw_item_base.cpp index 5b6de43d7d..dcc7d6299e 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item_base.cpp +++ b/eeschema/dialogs/dialog_lib_edit_draw_item_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 11 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -19,22 +19,22 @@ DIALOG_LIB_EDIT_DRAW_ITEM_BASE::DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent wxBoxSizer* dlgBorderSizer; dlgBorderSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer3; - bSizer3 = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bSizerLineWidth; + bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL ); m_widthLabel = new wxStaticText( this, wxID_ANY, _("Line width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_widthLabel->Wrap( -1 ); - bSizer3->Add( m_widthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); + bSizerLineWidth->Add( m_widthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_widthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3->Add( m_widthCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); + bSizerLineWidth->Add( m_widthCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_widthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_widthUnits->Wrap( -1 ); - bSizer3->Add( m_widthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + bSizerLineWidth->Add( m_widthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); - dlgBorderSizer->Add( bSizer3, 0, wxEXPAND, 5 ); + dlgBorderSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 ); wxString m_fillCtrlChoices[] = { _("Do not fill"), _("Fill with body outline color"), _("Fill with body background color") }; int m_fillCtrlNChoices = sizeof( m_fillCtrlChoices ) / sizeof( wxString ); @@ -43,30 +43,29 @@ DIALOG_LIB_EDIT_DRAW_ITEM_BASE::DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent dlgBorderSizer->Add( m_fillCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in component"), wxDefaultPosition, wxDefaultSize, 0 ); - dlgBorderSizer->Add( m_checkApplyToAllUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); + dlgBorderSizer->Add( m_checkApplyToAllUnits, 0, wxALL, 3 ); m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); - dlgBorderSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); + dlgBorderSizer->Add( m_checkApplyToAllConversions, 0, wxALL, 3 ); - mainSizer->Add( dlgBorderSizer, 1, wxEXPAND|wxALL, 10 ); + mainSizer->Add( dlgBorderSizer, 1, wxALL|wxEXPAND, 10 ); - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - mainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 0 ); + mainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); this->SetSizer( mainSizer ); this->Layout(); - mainSizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item_base.fbp b/eeschema/dialogs/dialog_lib_edit_draw_item_base.fbp index 5da4628db9..0d949c062d 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item_base.fbp +++ b/eeschema/dialogs/dialog_lib_edit_draw_item_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_lib_edit_draw_item_base 1000 none + 1 dialog_lib_edit_draw_item @@ -44,7 +45,7 @@ DIALOG_LIB_EDIT_DRAW_ITEM_BASE - + 295,256 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Drawing Properties @@ -54,13 +55,20 @@ - + + + + + + + + @@ -75,17 +83,23 @@ + + + + + + @@ -95,7 +109,7 @@ none 10 - wxEXPAND|wxALL + wxALL|wxEXPAND 1 @@ -108,7 +122,7 @@ 0 - bSizer3 + bSizerLineWidth wxHORIZONTAL none @@ -144,6 +158,7 @@ 0 wxID_ANY Line width: + 0 0 @@ -169,7 +184,14 @@ -1 + + + + + + + @@ -256,7 +278,14 @@ + + + + + + + @@ -318,6 +347,7 @@ 0 wxID_ANY mm + 0 0 @@ -343,7 +373,14 @@ -1 + + + + + + + @@ -434,7 +471,14 @@ + + + + + + + @@ -462,7 +506,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxALL + wxALL 0 1 @@ -522,7 +566,14 @@ + + + + + + + @@ -550,7 +601,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxALL + wxALL 0 1 @@ -610,7 +661,14 @@ + + + + + + + @@ -677,7 +735,7 @@ 0 1 - m_staticline1 + m_staticline 1 @@ -694,7 +752,14 @@ + + + + + + + @@ -720,7 +785,7 @@ - 0 + 5 wxALL|wxEXPAND 0 @@ -733,7 +798,7 @@ 0 0 - m_sdbSizer1 + m_sdbSizer protected diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item_base.h b/eeschema/dialogs/dialog_lib_edit_draw_item_base.h index 5fce46ea7a..f6fdf42671 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item_base.h +++ b/eeschema/dialogs/dialog_lib_edit_draw_item_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 11 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -42,14 +42,14 @@ class DIALOG_LIB_EDIT_DRAW_ITEM_BASE : public DIALOG_SHIM wxRadioBox* m_fillCtrl; wxCheckBox* m_checkApplyToAllUnits; wxCheckBox* m_checkApplyToAllConversions; - wxStaticLine* m_staticline1; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; + wxStaticLine* m_staticline; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; public: - DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_LIB_EDIT_DRAW_ITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 295,256 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_LIB_EDIT_DRAW_ITEM_BASE(); };