Improve GUI of lib item colors.

This commit is contained in:
Jeff Young 2021-12-16 18:04:59 +00:00
parent 24472ff9e3
commit 03a2723b67
7 changed files with 451 additions and 131 deletions

View File

@ -222,7 +222,7 @@ void COLOR_SWATCH::rePostEvent( wxEvent& aEvent )
static void sendSwatchChangeEvent( COLOR_SWATCH& aSender )
{
wxCommandEvent changeEvt( COLOR_SWATCH_CHANGED );
wxCommandEvent changeEvt( COLOR_SWATCH_CHANGED, aSender.GetId() );
// use this class as the object (alternative might be to
// set a custom event class but that's more work)

View File

@ -26,6 +26,8 @@
#include <symbol_edit_frame.h>
#include <confirm.h>
#include <lib_shape.h>
#include <widgets/color_swatch.h>
#include <sch_painter.h>
DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_ITEM* aItem ) :
@ -37,6 +39,8 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
SetTitle( aItem->GetTypeName() + wxT( " " ) + GetTitle() );
m_helpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
SetInitialFocus( m_widthCtrl );
// Required under wxGTK if we want to dismiss the dialog with the ESC key
@ -51,11 +55,7 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
m_sdbSizerOK->Enable( false );
}
m_fillCtrl->Bind( wxEVT_RADIOBOX,
[this]( wxEvent& )
{
m_fillColorSizer->Show( m_fillCtrl->GetSelection() == 3 );
} );
m_colorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onSwatch, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -88,19 +88,76 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
m_checkApplyToAllConversions->Enable( enblConvOptStyle );
if( shape )
m_rbFillNone->Enable( shape != nullptr );
m_rbFillOutline->Enable( shape != nullptr );
m_rbFillBackground->Enable( shape != nullptr );
m_rbFillCustom->Enable( shape != nullptr );
m_colorSwatch->Enable( shape != nullptr );
if( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE )
{
m_fillCtrl->SetSelection( static_cast<int>( shape->GetFillMode() ) - 1 );
m_fillColorPicker->SetColour( shape->GetFillColor().ToColour() );
m_fillColorSizer->Show( shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR );
m_rbFillOutline->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_colorSwatch->SetSwatchColor( color, false );
}
else if( shape && shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_colorSwatch->SetSwatchColor( color, false );
}
else if( shape && shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_colorSwatch->SetSwatchColor( shape->GetFillColor(), false );
}
else
{
m_rbFillNone->SetValue( true );
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
m_fillCtrl->Enable( shape != nullptr );
return true;
}
void DIALOG_LIB_SHAPE_PROPERTIES::onFill( wxCommandEvent& event )
{
if( event.GetId() == NO_FILL )
{
m_rbFillNone->SetValue( true );
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
else if( event.GetId() == FILLED_SHAPE )
{
m_rbFillOutline->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_colorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_colorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_colorSwatch->GetNewSwatchColor();
}
}
void DIALOG_LIB_SHAPE_PROPERTIES::onSwatch( wxCommandEvent& aEvent )
{
m_rbFillCustom->SetValue( true );
}
bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
@ -110,9 +167,16 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
if( shape )
{
FILL_T fill = static_cast<FILL_T>( std::max( m_fillCtrl->GetSelection() + 1, 1 ) );
shape->SetFillMode( fill );
shape->SetFillColor( static_cast<COLOR4D>(m_fillColorPicker->GetColour() ) );
if( m_rbFillOutline->GetValue() )
shape->SetFillMode( FILL_T::FILLED_SHAPE );
else if( m_rbFillBackground->GetValue() )
shape->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
else if( m_rbFillCustom->GetValue() )
shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
else
shape->SetFillMode( FILL_T::NO_FILL );
shape->SetFillColor( m_colorSwatch->GetSwatchColor() );
STROKE_PARAMS stroke = shape->GetStroke();
stroke.SetWidth( m_lineWidth.GetValue() );

View File

@ -48,6 +48,10 @@ public:
bool GetApplyToAllConversions();
bool GetApplyToAllUnits();
private:
void onFill(wxCommandEvent &event) override;
void onSwatch( wxCommandEvent& aEvent );
private:
SYMBOL_EDIT_FRAME* m_frame;
LIB_ITEM* m_item;

View File

@ -1,14 +1,23 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "dialog_lib_shape_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LIB_SHAPE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_RADIOBUTTON( NO_FILL, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_SHAPE, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_BG_BODYCOLOR, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_COLOR, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
END_EVENT_TABLE()
DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_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 );
@ -40,25 +49,34 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
m_helpLabel->Wrap( 333 );
dlgBorderSizer->Add( m_helpLabel, 0, wxALL, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* bSizerFill;
bSizerFill = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill Style") ), wxVERTICAL );
wxString m_fillCtrlChoices[] = { _("Do not fill"), _("Fill with body outline color"), _("Fill with body background color"), _("Fill with custom color") };
int m_fillCtrlNChoices = sizeof( m_fillCtrlChoices ) / sizeof( wxString );
m_fillCtrl = new wxRadioBox( this, wxID_ANY, _("Fill Style"), wxDefaultPosition, wxDefaultSize, m_fillCtrlNChoices, m_fillCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_fillCtrl->SetSelection( 0 );
bSizer4->Add( m_fillCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_fillColorSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill Color") ), wxVERTICAL );
m_rbFillNone = new wxRadioButton( bSizerFill->GetStaticBox(), NO_FILL, _("Do not fill"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
gbSizer1->Add( m_rbFillNone, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_fillColorPicker = new wxColourPickerCtrl( m_fillColorSizer->GetStaticBox(), wxID_ANY, *wxBLACK, wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
m_fillColorSizer->Add( m_fillColorPicker, 0, wxALL|wxEXPAND, 5 );
m_rbFillOutline = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_SHAPE, _("Fill with body outline color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillOutline, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillBackground = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_BG_BODYCOLOR, _("Fill with body background color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillBackground, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillCustom = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, _("Fill with:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillCustom, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_colorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_colorSwatch, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSizer4->Add( m_fillColorSizer, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 10 );
bSizerFill->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
dlgBorderSizer->Add( bSizer4, 1, wxEXPAND, 5 );
dlgBorderSizer->Add( bSizerFill, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
dlgBorderSizer->Add( m_checkApplyToAllUnits, 0, wxALL, 3 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,7 +14,6 @@
<property name="file">dialog_lib_shape_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_lib_shape_properties</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -52,20 +50,19 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Drawing Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">dlgBorderSizer</property>
<property name="orient">wxVERTICAL</property>
@ -330,96 +327,39 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Fill Style</property>
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxHORIZONTAL</property>
<property name="name">bSizerFill</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Do not fill&quot; &quot;Fill with body outline color&quot; &quot;Fill with body background color&quot; &quot;Fill with custom color&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Fill Style</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_fillCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Fill Color</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_fillColorSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="name">gbSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="vgap">3</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxColourPickerCtrl" expanded="1">
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -434,7 +374,6 @@
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="colour"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -447,7 +386,8 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="id">NO_FILL</property>
<property name="label">Do not fill</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -455,7 +395,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_fillColorPicker</property>
<property name="name">m_rbFillNone</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -465,7 +405,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxCLRP_DEFAULT_STYLE</property>
<property name="style">wxRB_GROUP</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@ -473,6 +413,277 @@
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onFill</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">FILLED_SHAPE</property>
<property name="label">Fill with body outline color</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rbFillOutline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onFill</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">FILLED_WITH_BG_BODYCOLOR</property>
<property name="label">Fill with body background color</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rbFillBackground</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onFill</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">FILLED_WITH_COLOR</property>
<property name="label">Fill with:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rbFillCustom</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">onFill</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="CustomControl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="class">COLOR_SWATCH</property>
<property name="close_button">1</property>
<property name="construction"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="declaration"></property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">FILLED_WITH_COLOR</property>
<property name="include"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_colorSwatch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="settings"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">COLOR_SWATCH; widgets/color_swatch.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -10,6 +10,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class COLOR_SWATCH;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -19,8 +21,8 @@
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/clrpicker.h>
#include <wx/radiobut.h>
#include <wx/gbsizer.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
@ -34,16 +36,31 @@
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_onFill( wxCommandEvent& event ){ onFill( event ); }
protected:
enum
{
NO_FILL = 1000,
FILLED_SHAPE,
FILLED_WITH_BG_BODYCOLOR,
FILLED_WITH_COLOR
};
wxStaticText* m_widthLabel;
wxTextCtrl* m_widthCtrl;
wxStaticText* m_widthUnits;
wxStaticText* m_helpLabel;
wxRadioBox* m_fillCtrl;
wxStaticBoxSizer* m_fillColorSizer;
wxColourPickerCtrl* m_fillColorPicker;
wxRadioButton* m_rbFillNone;
wxRadioButton* m_rbFillOutline;
wxRadioButton* m_rbFillBackground;
wxRadioButton* m_rbFillCustom;
COLOR_SWATCH* m_colorSwatch;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllConversions;
wxStaticLine* m_staticline;
@ -51,10 +68,13 @@ class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void onFill( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drawing Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_SHAPE_PROPERTIES_BASE();
};

View File

@ -528,7 +528,10 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
if( shape )
{
COLOR4D fillColor;
if( shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
if( shape->GetFillMode() == FILL_T::FILLED_SHAPE )
fillColor = getRenderColor( aItem, LAYER_DEVICE, false );
else if( shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
fillColor = getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false );
else if( shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
fillColor = shape->GetFillColor();