From 06df90636b0d71638e7f8fe6d0b5839ec4e8b02c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 5 Apr 2022 23:32:48 +0100 Subject: [PATCH] Rationalize negative line-width handling. Make "don't stroke" an explicit property in the GUI. Silently enforce line width to >= 0 when stroking. Make layouts between dialogs more consistent. Interpret unspecified fill colour as layer colour. Fixes https://gitlab.com/kicad/code/kicad/issues/11279 --- .../dialogs/dialog_lib_textbox_properties.cpp | 32 +- eeschema/dialogs/dialog_line_properties.cpp | 2 +- .../dialogs/dialog_line_properties_base.cpp | 30 +- .../dialogs/dialog_line_properties_base.fbp | 261 ++-- eeschema/dialogs/dialog_shape_properties.cpp | 69 +- eeschema/dialogs/dialog_shape_properties.h | 6 +- .../dialogs/dialog_shape_properties_base.cpp | 141 +- .../dialogs/dialog_shape_properties_base.fbp | 1273 +++++++++-------- .../dialogs/dialog_shape_properties_base.h | 34 +- eeschema/dialogs/dialog_text_properties.cpp | 7 +- .../dialogs/dialog_wire_bus_properties.cpp | 2 +- .../dialog_wire_bus_properties_base.cpp | 37 +- .../dialog_wire_bus_properties_base.fbp | 291 ++-- eeschema/sch_painter.cpp | 5 +- eeschema/sch_shape.cpp | 10 +- 15 files changed, 1199 insertions(+), 1001 deletions(-) diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index b507dbb72c..8b2fbb95a5 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -128,10 +128,21 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() m_bold->Check( m_currentText->IsBold() ); m_italic->Check( m_currentText->IsItalic() ); - m_borderCheckbox->SetValue( m_currentText->GetWidth() >= 0 ); - if( m_currentText->GetWidth() >= 0 ) + { + m_borderCheckbox->SetValue( true ); m_borderWidth.SetValue( m_currentText->GetWidth() ); + } + else + { + m_borderCheckbox->SetValue( false ); + + m_borderWidth.Enable( false ); + m_borderColorLabel->Enable( false ); + m_borderColorSwatch->Enable( false ); + m_borderStyleLabel->Enable( false ); + m_borderStyleCombo->Enable( false ); + } m_borderColorSwatch->SetSwatchColor( m_currentText->GetStroke().GetColor(), false ); @@ -144,12 +155,6 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow() else wxFAIL_MSG( "Line type not found in the type lookup map" ); - m_borderWidth.Enable( m_currentText->GetWidth() >= 0 ); - m_borderColorLabel->Enable( m_currentText->GetWidth() >= 0 ); - m_borderColorSwatch->Enable( m_currentText->GetWidth() >= 0 ); - m_borderStyleLabel->Enable( m_currentText->GetWidth() >= 0 ); - m_borderStyleCombo->Enable( m_currentText->GetWidth() >= 0 ); - m_filledCtrl->SetValue( m_currentText->IsFilled() ); m_fillColorSwatch->SetSwatchColor( m_currentText->GetFillColor(), false ); @@ -198,10 +203,6 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow() if( !wxDialog::TransferDataFromWindow() ) return false; - // Don't allow text to disappear; it can be difficult to correct if you can't select it - if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) ) - return false; - wxString text = m_textCtrl->GetValue(); #ifdef __WXMAC__ @@ -274,14 +275,9 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow() STROKE_PARAMS stroke = m_currentText->GetStroke(); if( m_borderCheckbox->GetValue() ) - { - if( !m_borderWidth.IsIndeterminate() ) - stroke.SetWidth( m_borderWidth.GetValue() ); - } + stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) ); else - { stroke.SetWidth( -1 ); - } auto it = lineTypeNames.begin(); std::advance( it, m_borderStyleCombo->GetSelection() ); diff --git a/eeschema/dialogs/dialog_line_properties.cpp b/eeschema/dialogs/dialog_line_properties.cpp index 97a9242712..f4b936386d 100644 --- a/eeschema/dialogs/dialog_line_properties.cpp +++ b/eeschema/dialogs/dialog_line_properties.cpp @@ -135,7 +135,7 @@ bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow() for( SCH_LINE* line : m_lines ) { if( !m_width.IsIndeterminate() ) - line->SetLineWidth( m_width.GetValue() ); + line->SetLineWidth( std::max( (long long int) 0, m_width.GetValue() ) ); auto it = lineTypeNames.begin(); std::advance( it, m_typeCombo->GetSelection() ); diff --git a/eeschema/dialogs/dialog_line_properties_base.cpp b/eeschema/dialogs/dialog_line_properties_base.cpp index e3a11762ac..0035844a5e 100644 --- a/eeschema/dialogs/dialog_line_properties_base.cpp +++ b/eeschema/dialogs/dialog_line_properties_base.cpp @@ -23,27 +23,27 @@ DIALOG_LINE_PROPERTIES_BASE::DIALOG_LINE_PROPERTIES_BASE( wxWindow* parent, wxWi mainSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizerGeneral; - fgSizerGeneral = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizerGeneral = new wxFlexGridSizer( 0, 3, 3, 0 ); fgSizerGeneral->AddGrowableCol( 1 ); fgSizerGeneral->SetFlexibleDirection( wxBOTH ); fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextWidth->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); m_lineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticWidthUnits->Wrap( -1 ); m_staticWidthUnits->SetMinSize( wxSize( 40,-1 ) ); - fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); m_staticTextColor = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextColor->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + fgSizerGeneral->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); wxBoxSizer* bSizer2; @@ -56,30 +56,36 @@ DIALOG_LINE_PROPERTIES_BASE::DIALOG_LINE_PROPERTIES_BASE( wxWindow* parent, wxWi m_panel1->SetSizer( bSizer2 ); m_panel1->Layout(); bSizer2->Fit( m_panel1 ); - fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 2 ); + fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 ); fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + fgSizerGeneral->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_typeCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_typeCombo->SetMinSize( wxSize( 240,-1 ) ); - fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 ); - m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Schematic default line width."), wxDefaultPosition, wxDefaultSize, 0 ); - m_helpLabel1->Wrap( 333 ); - mainSizer->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 ); + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use schematic default line width."), wxDefaultPosition, wxDefaultSize, 0 ); + m_helpLabel1->Wrap( -1 ); + bSizer3->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 ); m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set color to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 ); m_helpLabel2->Wrap( -1 ); - mainSizer->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bSizer3->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + + + mainSizer->Add( bSizer3, 0, wxEXPAND|wxTOP, 5 ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_line_properties_base.fbp b/eeschema/dialogs/dialog_line_properties_base.fbp index 500c1329c6..b83daa1b18 100644 --- a/eeschema/dialogs/dialog_line_properties_base.fbp +++ b/eeschema/dialogs/dialog_line_properties_base.fbp @@ -73,10 +73,10 @@ wxFLEX_GROWMODE_SPECIFIED none 0 - 0 + 3 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -137,7 +137,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -201,7 +201,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -262,7 +262,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -323,7 +323,7 @@ 2 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -458,7 +458,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -519,7 +519,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -585,125 +585,136 @@ - 10 - wxRIGHT|wxLEFT + 5 + wxEXPAND|wxTOP 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set width to 0 to use Schematic default line width. - 0 - - 0 - - - 0 + - 1 - m_helpLabel1 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - 333 - - - - 10 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set color to transparent to use Schematic Editor colors. - 0 - - 0 - - - 0 - - 1 - m_helpLabel2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + bSizer3 + wxVERTICAL + none + + 10 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Set width to 0 to use schematic default line width. + 0 + + 0 + + + 0 + + 1 + m_helpLabel1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 10 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Set color to transparent to use Schematic Editor colors. + 0 + + 0 + + + 0 + + 1 + m_helpLabel2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + diff --git a/eeschema/dialogs/dialog_shape_properties.cpp b/eeschema/dialogs/dialog_shape_properties.cpp index 02d5c078b3..bed50174f1 100644 --- a/eeschema/dialogs/dialog_shape_properties.cpp +++ b/eeschema/dialogs/dialog_shape_properties.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2021-2022 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 @@ -32,21 +32,21 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S DIALOG_SHAPE_PROPERTIES_BASE( aParent ), m_frame( aParent ), m_shape( aShape ), - m_lineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ) + m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true ) { SetTitle( wxString::Format( GetTitle(), aShape->ShowShape() ) ); m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() ); m_helpLabel2->SetFont( KIUI::GetInfoFont( this ).Italic() ); - SetInitialFocus( m_lineWidthCtrl ); + SetInitialFocus( m_borderWidthCtrl ); - m_lineColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); + m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); for( const std::pair& typeEntry : lineTypeNames ) - m_lineStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); + m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); - m_lineStyleCombo->Append( DEFAULT_STYLE ); + m_borderStyleCombo->Append( DEFAULT_STYLE ); m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); @@ -68,15 +68,30 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow() if( !wxDialog::TransferDataToWindow() ) return false; - m_lineWidth.SetValue( m_shape->GetWidth() ); - m_lineColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false ); + if( m_shape->GetWidth() >= 0 ) + { + m_borderCheckbox->SetValue( true ); + m_borderWidth.SetValue( m_shape->GetWidth() ); + } + else + { + m_borderCheckbox->SetValue( false ); + + m_borderWidth.Enable( false ); + m_borderColorLabel->Enable( false ); + m_borderColorSwatch->Enable( false ); + m_borderStyleLabel->Enable( false ); + m_borderStyleCombo->Enable( false ); + } + + m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false ); int style = static_cast( m_shape->GetStroke().GetPlotStyle() ); if( style == -1 ) - m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE ); + m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE ); else if( style < (int) lineTypeNames.size() ) - m_lineStyleCombo->SetSelection( style ); + m_borderStyleCombo->SetSelection( style ); else wxFAIL_MSG( "Line type not found in the type lookup map" ); @@ -87,6 +102,30 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow() } +void DIALOG_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event ) +{ + bool border = m_borderCheckbox->GetValue(); + + if( border && m_borderWidth.GetValue() < 0 ) + m_borderWidth.SetValue( Mils2iu( m_frame->eeconfig()->m_Drawing.default_line_thickness ) ); + + m_borderWidth.Enable( border ); + m_borderColorLabel->Enable( border ); + m_borderColorSwatch->Enable( border ); + m_borderStyleLabel->Enable( border ); + m_borderStyleCombo->Enable( border ); +} + + +void DIALOG_SHAPE_PROPERTIES::onFillChecked( wxCommandEvent& aEvent ) +{ + bool fill = m_filledCtrl->GetValue(); + + m_fillColorLabel->Enable( fill ); + m_fillColorSwatch->Enable( fill ); +} + + bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow() { if( !wxDialog::TransferDataFromWindow() ) @@ -100,18 +139,20 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow() STROKE_PARAMS stroke = m_shape->GetStroke(); - if( !m_lineWidth.IsIndeterminate() ) - stroke.SetWidth( m_lineWidth.GetValue() ); + if( m_borderCheckbox->GetValue() ) + stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) ); + else + stroke.SetWidth( -1 ); auto it = lineTypeNames.begin(); - std::advance( it, m_lineStyleCombo->GetSelection() ); + std::advance( it, m_borderStyleCombo->GetSelection() ); if( it == lineTypeNames.end() ) stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT ); else stroke.SetPlotStyle( it->first ); - stroke.SetColor( m_lineColorSwatch->GetSwatchColor() ); + stroke.SetColor( m_borderColorSwatch->GetSwatchColor() ); m_shape->SetStroke( stroke ); diff --git a/eeschema/dialogs/dialog_shape_properties.h b/eeschema/dialogs/dialog_shape_properties.h index 9fbb443bcc..13761fa7fd 100644 --- a/eeschema/dialogs/dialog_shape_properties.h +++ b/eeschema/dialogs/dialog_shape_properties.h @@ -41,10 +41,14 @@ public: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; +private: + void onBorderChecked( wxCommandEvent& aEvent) override; + void onFillChecked( wxCommandEvent& aEvent ) override; + private: SCH_EDIT_FRAME* m_frame; SCH_SHAPE* m_shape; - UNIT_BINDER m_lineWidth; + UNIT_BINDER m_borderWidth; }; #endif // DIALOG_SHAPE_PROPERTIES_H diff --git a/eeschema/dialogs/dialog_shape_properties_base.cpp b/eeschema/dialogs/dialog_shape_properties_base.cpp index 6db5733a64..4c2115e1ef 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.cpp +++ b/eeschema/dialogs/dialog_shape_properties_base.cpp @@ -12,6 +12,11 @@ /////////////////////////////////////////////////////////////////////////// +BEGIN_EVENT_TABLE( DIALOG_SHAPE_PROPERTIES_BASE, DIALOG_SHIM ) + EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onBorderChecked ) + EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillChecked ) +END_EVENT_TABLE() + DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_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 ); @@ -26,105 +31,107 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx mainSizer->Add( m_infoBar, 0, wxBOTTOM|wxEXPAND, 5 ); - wxFlexGridSizer* fgSizerGeneral; - fgSizerGeneral = new wxFlexGridSizer( 0, 3, 7, 0 ); - fgSizerGeneral->AddGrowableCol( 1 ); - fgSizerGeneral->SetFlexibleDirection( wxBOTH ); - fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + m_textEntrySizer = new wxGridBagSizer( 3, 3 ); + m_textEntrySizer->SetFlexibleDirection( wxBOTH ); + m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + m_textEntrySizer->SetEmptyCellSize( wxSize( 36,-1 ) ); - m_lineWidthLabel = new wxStaticText( this, wxID_ANY, _("Line width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineWidthLabel->Wrap( -1 ); - fgSizerGeneral->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 ); + m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 ); - m_lineWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - fgSizerGeneral->Add( m_lineWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); + m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_borderWidthLabel->Wrap( -1 ); + m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - m_lineWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineWidthUnits->Wrap( -1 ); - m_lineWidthUnits->SetMinSize( wxSize( 40,-1 ) ); + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxHORIZONTAL ); - fgSizerGeneral->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer7->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_lineColorLabel = new wxStaticText( this, wxID_ANY, _("Line color:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineColorLabel->Wrap( -1 ); - fgSizerGeneral->Add( m_lineColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); + m_borderWidthUnits->Wrap( -1 ); + bSizer7->Add( m_borderWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer2; - bSizer2 = new wxBoxSizer( wxVERTICAL ); - - m_lineColorSwatch = new COLOR_SWATCH( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer2->Add( m_lineColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_borderColorLabel->Wrap( -1 ); + bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 ); - m_panel1->SetSizer( bSizer2 ); - m_panel1->Layout(); - bSizer2->Fit( m_panel1 ); - fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL, 2 ); + bSizer7->Add( 5, 0, 0, 0, 5 ); + + m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer23; + bSizer23 = new wxBoxSizer( wxVERTICAL ); + + m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer23->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_lineStyleLabel = new wxStaticText( this, wxID_ANY, _("Line style:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lineStyleLabel->Wrap( -1 ); - fgSizerGeneral->Add( m_lineStyleLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_lineStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); - m_lineStyleCombo->SetMinSize( wxSize( 240,-1 ) ); - - fgSizerGeneral->Add( m_lineStyleCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); + m_panelBorderColor->SetSizer( bSizer23 ); + m_panelBorderColor->Layout(); + bSizer23->Fit( m_panelBorderColor ); + bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 ); - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); + m_textEntrySizer->Add( bSizer7, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 ); + m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_borderStyleLabel->Wrap( -1 ); + m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) ); - - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); - - - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); + m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Filled shape"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerGeneral->Add( m_filledCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 0, 5 ), wxGBSpan( 1, 2 ), wxRIGHT, 80 ); - - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); - - - fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); + wxBoxSizer* bSizer8; + bSizer8 = new wxBoxSizer( wxHORIZONTAL ); m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 ); m_fillColorLabel->Wrap( -1 ); - fgSizerGeneral->Add( m_fillColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + bSizer8->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - m_panel11 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer21; - bSizer21 = new wxBoxSizer( wxVERTICAL ); + m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer211; + bSizer211 = new wxBoxSizer( wxVERTICAL ); - m_fillColorSwatch = new COLOR_SWATCH( m_panel11, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer21->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer211->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - m_panel11->SetSizer( bSizer21 ); - m_panel11->Layout(); - bSizer21->Fit( m_panel11 ); - fgSizerGeneral->Add( m_panel11, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_panelFillColor->SetSizer( bSizer211 ); + m_panelFillColor->Layout(); + bSizer211->Fit( m_panelFillColor ); + bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 ); - mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 ); + m_textEntrySizer->Add( bSizer8, wxGBPosition( 1, 5 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 ); - m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set line width to 0 to use Schematic Editor line widths."), wxDefaultPosition, wxDefaultSize, 0 ); - m_helpLabel1->Wrap( 333 ); - mainSizer->Add( m_helpLabel1, 0, wxTOP|wxRIGHT|wxLEFT, 10 ); - m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set line color to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 ); + m_textEntrySizer->AddGrowableCol( 3 ); + + mainSizer->Add( m_textEntrySizer, 0, wxEXPAND|wxALL, 15 ); + + wxBoxSizer* bSizer12; + bSizer12 = new wxBoxSizer( wxVERTICAL ); + + m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set border width to 0 to use Schematic Editor default line width."), wxDefaultPosition, wxDefaultSize, 0 ); + m_helpLabel1->Wrap( -1 ); + bSizer12->Add( m_helpLabel1, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 10 ); + + m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set colors to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 ); m_helpLabel2->Wrap( -1 ); - mainSizer->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bSizer12->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + + + mainSizer->Add( bSizer12, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + mainSizer->Add( m_staticline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); diff --git a/eeschema/dialogs/dialog_shape_properties_base.fbp b/eeschema/dialogs/dialog_shape_properties_base.fbp index cbaef6594d..01d5342da6 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.fbp +++ b/eeschema/dialogs/dialog_shape_properties_base.fbp @@ -119,26 +119,28 @@ - 10 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT - 1 - - 3 + 15 + wxEXPAND|wxALL + 0 + + 36,-1 wxBOTH - 1 + 3 - 0 + 3 - fgSizerGeneral + m_textEntrySizer wxFLEX_GROWMODE_SPECIFIED - none - 0 - 7 - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - + protected + 3 + + 2 + 2 + 0 + wxBOTTOM + 0 + 1 + 1 1 1 @@ -152,6 +154,7 @@ 1 0 + 0 1 1 @@ -166,8 +169,7 @@ 0 0 wxID_ANY - Line width: - 0 + Border 0 @@ -175,7 +177,7 @@ 0 1 - m_lineWidthLabel + m_borderCheckbox 1 @@ -186,340 +188,26 @@ 1 - - 0 - - - - - -1 - - - - 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - -1,-1 - 0 - -1,-1 - 1 - m_lineWidthCtrl - 1 - - - protected - 1 - - Resizable - 1 - -1,-1 - - + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - + onBorderChecked - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - 40,-1 - 1 - m_lineWidthUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - + 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Line color: - 0 - - 0 - - - 0 - - 1 - m_lineColorLabel - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; Not forward_declare - 0 - - - - - -1 - - - - 2 + 1 + 0 wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_panel1 - 1 - - - protected - 1 - - Resizable - 1 - - ; ; forward_declare - 0 - - - - wxBORDER_SIMPLE|wxTAB_TRAVERSAL - - - bSizer2 - wxVERTICAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - COLOR_SWATCH - 1 - - - 1 - - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_lineColorSwatch - 1 - - - protected - 1 - - Resizable - - 1 - - COLOR_SWATCH; widgets/color_swatch.h; forward_declare - 0 - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 + 1 + 1 1 1 @@ -548,7 +236,7 @@ 0 0 wxID_ANY - Line style: + Width: 0 0 @@ -557,7 +245,7 @@ 0 1 - m_lineStyleLabel + m_borderWidthLabel 1 @@ -577,10 +265,412 @@ -1 - - 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT - 0 + + 5 + 2 + 1 + wxEXPAND + 1 + 1 + + + bSizer7 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + -1,-1 + 0 + -1,-1 + 1 + m_borderWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + -1,-1 + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mm + 0 + + 0 + + + 0 + -1,-1 + 1 + m_borderWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 15 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Color: + 0 + + 0 + + + 0 + + 1 + m_borderColorLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; Not forward_declare + 0 + + + + + -1 + + + + 5 + + 0 + + 0 + protected + 5 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelBorderColor + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxBORDER_SIMPLE|wxTAB_TRAVERSAL + + + bSizer23 + wxVERTICAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + COLOR_SWATCH + 1 + + + 1 + + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_borderColorSwatch + 1 + + + protected + 1 + + Resizable + + 1 + + COLOR_SWATCH; widgets/color_swatch.h; forward_declare + 0 + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Style: + 0 + + 0 + + + 0 + + 1 + m_borderStyleLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 2 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 2 + 1 1 1 @@ -617,7 +707,7 @@ 0 240,-1 1 - m_lineStyleCombo + m_borderStyleCombo 1 @@ -642,50 +732,13 @@ - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 + + 80 + 2 + 5 + wxRIGHT + 0 + 1 1 1 @@ -744,31 +797,223 @@ + onFillChecked - + 5 + 2 + 5 wxEXPAND - 1 - - 0 - protected - 0 + 1 + 1 + + + bSizer8 + wxHORIZONTAL + none + + 5 + wxRIGHT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Fill color: + 0 + + 0 + + + 0 + + 1 + m_fillColorLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelFillColor + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxBORDER_SIMPLE|wxTAB_TRAVERSAL + + + bSizer211 + wxVERTICAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + COLOR_SWATCH + 1 + + + 1 + + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_fillColorSwatch + 1 + + + protected + 1 + + Resizable + + 1 + + COLOR_SWATCH; widgets/color_swatch.h; forward_declare + 0 + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizer12 + wxVERTICAL + none - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT + 10 + wxTOP|wxRIGHT|wxLEFT|wxEXPAND 0 1 @@ -798,7 +1043,7 @@ 0 0 wxID_ANY - Fill color: + Set border width to 0 to use Schematic Editor default line width. 0 0 @@ -807,7 +1052,7 @@ 0 1 - m_fillColorLabel + m_helpLabel1 1 @@ -828,10 +1073,10 @@ - 5 - wxALIGN_CENTER_VERTICAL + 10 + wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -859,6 +1104,8 @@ 0 0 wxID_ANY + Set colors to transparent to use Schematic Editor colors. + 0 0 @@ -866,7 +1113,7 @@ 0 1 - m_panel11 + m_helpLabel2 1 @@ -876,209 +1123,21 @@ Resizable 1 + ; ; forward_declare 0 - wxBORDER_SIMPLE|wxTAB_TRAVERSAL - - - bSizer21 - wxVERTICAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - COLOR_SWATCH - 1 - - - 1 - - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_fillColorSwatch - 1 - - - protected - 1 - - Resizable - - 1 - - COLOR_SWATCH; widgets/color_swatch.h; forward_declare - 0 - - - - - - - + + -1 - - 10 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set line width to 0 to use Schematic Editor line widths. - 0 - - 0 - - - 0 - - 1 - m_helpLabel1 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - 333 - - - - 10 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set line color to transparent to use Schematic Editor colors. - 0 - - 0 - - - 0 - - 1 - m_helpLabel2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 1 diff --git a/eeschema/dialogs/dialog_shape_properties_base.h b/eeschema/dialogs/dialog_shape_properties_base.h index e4a02e7445..88b739baac 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.h +++ b/eeschema/dialogs/dialog_shape_properties_base.h @@ -20,12 +20,13 @@ class WX_INFOBAR; #include #include #include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -37,21 +38,29 @@ class WX_INFOBAR; /////////////////////////////////////////////////////////////////////////////// class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM { + DECLARE_EVENT_TABLE() private: + // Private event handlers + void _wxFB_onBorderChecked( wxCommandEvent& event ){ onBorderChecked( event ); } + void _wxFB_onFillChecked( wxCommandEvent& event ){ onFillChecked( event ); } + + protected: WX_INFOBAR* m_infoBar; - wxStaticText* m_lineWidthLabel; - wxTextCtrl* m_lineWidthCtrl; - wxStaticText* m_lineWidthUnits; - wxStaticText* m_lineColorLabel; - wxPanel* m_panel1; - COLOR_SWATCH* m_lineColorSwatch; - wxStaticText* m_lineStyleLabel; - wxBitmapComboBox* m_lineStyleCombo; + wxGridBagSizer* m_textEntrySizer; + wxCheckBox* m_borderCheckbox; + wxStaticText* m_borderWidthLabel; + wxTextCtrl* m_borderWidthCtrl; + wxStaticText* m_borderWidthUnits; + wxStaticText* m_borderColorLabel; + wxPanel* m_panelBorderColor; + COLOR_SWATCH* m_borderColorSwatch; + wxStaticText* m_borderStyleLabel; + wxBitmapComboBox* m_borderStyleCombo; wxCheckBox* m_filledCtrl; wxStaticText* m_fillColorLabel; - wxPanel* m_panel11; + wxPanel* m_panelFillColor; COLOR_SWATCH* m_fillColorSwatch; wxStaticText* m_helpLabel1; wxStaticText* m_helpLabel2; @@ -60,6 +69,11 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; + // Virtual event handlers, overide them in your derived class + virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); } + virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); } + + public: DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 15e18c31c5..16332ba792 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/eeschema/dialogs/dialog_text_properties.cpp @@ -458,14 +458,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() STROKE_PARAMS stroke = textBox->GetStroke(); if( m_borderCheckbox->GetValue() ) - { - if( !m_borderWidth.IsIndeterminate() ) - stroke.SetWidth( m_borderWidth.GetValue() ); - } + stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) ); else - { stroke.SetWidth( -1 ); - } auto it = lineTypeNames.begin(); std::advance( it, m_borderStyleCombo->GetSelection() ); diff --git a/eeschema/dialogs/dialog_wire_bus_properties.cpp b/eeschema/dialogs/dialog_wire_bus_properties.cpp index 3f4462ff90..a2d6f12bbc 100644 --- a/eeschema/dialogs/dialog_wire_bus_properties.cpp +++ b/eeschema/dialogs/dialog_wire_bus_properties.cpp @@ -184,7 +184,7 @@ bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow() { if( !m_wireWidth.IsIndeterminate() ) { - int width = m_wireWidth.GetValue(); + int width = std::max( (long long int) 0, m_wireWidth.GetValue() ); if( item->Type() == SCH_LINE_T ) static_cast( item )->SetLineWidth( width ); diff --git a/eeschema/dialogs/dialog_wire_bus_properties_base.cpp b/eeschema/dialogs/dialog_wire_bus_properties_base.cpp index f538556577..a122da885b 100644 --- a/eeschema/dialogs/dialog_wire_bus_properties_base.cpp +++ b/eeschema/dialogs/dialog_wire_bus_properties_base.cpp @@ -23,27 +23,27 @@ DIALOG_WIRE_BUS_PROPERTIES_BASE::DIALOG_WIRE_BUS_PROPERTIES_BASE( wxWindow* pare mainSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizerGeneral; - fgSizerGeneral = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizerGeneral = new wxFlexGridSizer( 0, 3, 3, 0 ); fgSizerGeneral->AddGrowableCol( 1 ); fgSizerGeneral->SetFlexibleDirection( wxBOTH ); fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Wire/bus width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextWidth->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); m_lineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticWidthUnits->Wrap( -1 ); m_staticWidthUnits->SetMinSize( wxSize( 40,-1 ) ); - fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); m_staticTextColor = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextColor->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + fgSizerGeneral->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL ); wxBoxSizer* bSizer2; @@ -56,19 +56,28 @@ DIALOG_WIRE_BUS_PROPERTIES_BASE::DIALOG_WIRE_BUS_PROPERTIES_BASE( wxWindow* pare m_panel1->SetSizer( bSizer2 ); m_panel1->Layout(); bSizer2->Fit( m_panel1 ); - fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 2 ); + fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 ); fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle->Wrap( -1 ); - fgSizerGeneral->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + fgSizerGeneral->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); m_typeCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_typeCombo->SetMinSize( wxSize( 240,-1 ) ); - fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 ); + + + fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); + + + fgSizerGeneral->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + + fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -87,13 +96,19 @@ DIALOG_WIRE_BUS_PROPERTIES_BASE::DIALOG_WIRE_BUS_PROPERTIES_BASE( wxWindow* pare mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 ); + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Netclass wire/bus widths."), wxDefaultPosition, wxDefaultSize, 0 ); - m_helpLabel1->Wrap( 333 ); - mainSizer->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 ); + m_helpLabel1->Wrap( -1 ); + bSizer3->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 ); m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set color to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 ); m_helpLabel2->Wrap( -1 ); - mainSizer->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bSizer3->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + + + mainSizer->Add( bSizer3, 0, wxEXPAND|wxTOP, 5 ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_wire_bus_properties_base.fbp b/eeschema/dialogs/dialog_wire_bus_properties_base.fbp index 7817308db8..2a644a1392 100644 --- a/eeschema/dialogs/dialog_wire_bus_properties_base.fbp +++ b/eeschema/dialogs/dialog_wire_bus_properties_base.fbp @@ -73,10 +73,10 @@ wxFLEX_GROWMODE_SPECIFIED none 0 - 0 + 3 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -137,7 +137,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -201,7 +201,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -262,7 +262,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -323,7 +323,7 @@ 2 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -458,7 +458,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -519,7 +519,7 @@ 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT 0 1 @@ -592,6 +592,36 @@ 0 + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + 5 wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL @@ -781,125 +811,136 @@ - 10 - wxRIGHT|wxLEFT + 5 + wxEXPAND|wxTOP 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set width to 0 to use Netclass wire/bus widths. - 0 - - 0 - - - 0 + - 1 - m_helpLabel1 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - 333 - - - - 10 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Set color to transparent to use Schematic Editor colors. - 0 - - 0 - - - 0 - - 1 - m_helpLabel2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + bSizer3 + wxVERTICAL + none + + 10 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Set width to 0 to use Netclass wire/bus widths. + 0 + + 0 + + + 0 + + 1 + m_helpLabel1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 10 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Set color to transparent to use Schematic Editor colors. + 0 + + 0 + + + 0 + + 1 + m_helpLabel2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 014319f612..ac0ca9510f 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -341,6 +341,9 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr color = shape->GetStroke().GetColor(); else if( aLayer == LAYER_NOTES_BACKGROUND ) color = shape->GetFillColor(); + + if( color == COLOR4D::UNSPECIFIED ) + color = m_schSettings.GetLayerColor( LAYER_NOTES ); } else if( aItem->Type() == LIB_SHAPE_T ) { @@ -1760,7 +1763,7 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer ) { m_gal->SetIsFill( true ); m_gal->SetIsStroke( false ); - m_gal->SetFillColor( aShape->GetFillColor() ); + m_gal->SetFillColor( color ); drawShape( aShape ); } diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index 3cf994aa9e..ec40c2e784 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -108,7 +108,10 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED ) { - aPlotter->SetColor( GetFillColor() ); + if( GetFillColor() != COLOR4D::UNSPECIFIED ) + aPlotter->SetColor( GetFillColor() ); + else + aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) ); switch( GetShape() ) { @@ -244,7 +247,10 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset if( GetFillMode() == FILL_T::FILLED_WITH_COLOR ) { - color = GetFillColor(); + if( GetFillColor() == COLOR4D::UNSPECIFIED ) + color = aSettings->GetLayerColor( LAYER_NOTES ); + else + color = GetFillColor(); switch( GetShape() ) {