Border colours and line styles for symbol editor.
Fixes https://gitlab.com/kicad/code/kicad/issues/11810
This commit is contained in:
parent
c79dd09464
commit
34e706bcbc
|
@ -28,21 +28,36 @@
|
|||
#include <confirm.h>
|
||||
#include <lib_shape.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <sch_painter.h>
|
||||
|
||||
DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
|
||||
LIB_ITEM* aItem ) :
|
||||
LIB_SHAPE* aShape ) :
|
||||
DIALOG_LIB_SHAPE_PROPERTIES_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_item( aItem ),
|
||||
m_lineWidth( aParent, m_widthLabel, m_widthCtrl, m_widthUnits, true )
|
||||
m_shape( aShape ),
|
||||
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
|
||||
{
|
||||
SetTitle( aItem->GetTypeName() + wxT( " " ) + GetTitle() );
|
||||
SetTitle( m_shape->GetTypeName() + wxT( " " ) + GetTitle() );
|
||||
m_helpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
|
||||
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
SetInitialFocus( m_widthCtrl );
|
||||
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
|
||||
|
||||
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
|
||||
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
|
||||
|
||||
m_borderStyleCombo->Append( DEFAULT_STYLE );
|
||||
|
||||
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
m_fillColorSwatch->SetSwatchBackground( schematicBackground );
|
||||
|
||||
m_helpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
SetInitialFocus( m_borderWidthCtrl );
|
||||
|
||||
// Required under wxGTK if we want to dismiss the dialog with the ESC key
|
||||
SetFocus();
|
||||
|
@ -56,35 +71,55 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
|
|||
m_sdbSizerOK->Enable( false );
|
||||
}
|
||||
|
||||
m_colorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onSwatch, this );
|
||||
m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch, this );
|
||||
m_fillColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch, this );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_LIB_SHAPE_PROPERTIES::~DIALOG_LIB_SHAPE_PROPERTIES()
|
||||
{
|
||||
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch, this );
|
||||
m_fillColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch, this );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
|
||||
{
|
||||
if( !wxDialog::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
LIB_SYMBOL* symbol = m_item->GetParent();
|
||||
EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( m_item );
|
||||
LIB_SYMBOL* symbol = m_shape->GetParent();
|
||||
|
||||
if( shape )
|
||||
m_checkBorder->SetValue( shape->GetWidth() >= 0 );
|
||||
m_checkBorder->SetValue( m_shape->GetWidth() >= 0 );
|
||||
|
||||
if( shape && shape->GetWidth() >= 0 )
|
||||
m_lineWidth.SetValue( shape->GetWidth() );
|
||||
if( m_shape->GetWidth() >= 0 )
|
||||
m_borderWidth.SetValue( m_shape->GetWidth() );
|
||||
|
||||
m_checkBorder->Enable( shape );
|
||||
m_lineWidth.Enable( shape && shape->GetWidth() >= 0 );
|
||||
m_helpLabel->Enable( shape && shape->GetWidth() >= 0 );
|
||||
m_borderWidth.Enable( m_shape->GetWidth() >= 0 );
|
||||
m_helpLabel->Enable( m_shape->GetWidth() >= 0 );
|
||||
m_borderColorLabel->Enable( m_shape->GetWidth() >= 0 );
|
||||
m_borderColorSwatch->Enable( m_shape->GetWidth() >= 0 );
|
||||
m_borderStyleLabel->Enable( m_shape->GetWidth() >= 0 );
|
||||
m_borderStyleCombo->Enable( m_shape->GetWidth() >= 0 );
|
||||
|
||||
m_privateCheckbox->SetValue( m_item->IsPrivate() );
|
||||
m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 );
|
||||
m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
|
||||
|
||||
int style = static_cast<int>( m_shape->GetStroke().GetPlotStyle() );
|
||||
|
||||
if( style == -1 )
|
||||
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
|
||||
else if( style < (int) lineTypeNames.size() )
|
||||
m_borderStyleCombo->SetSelection( style );
|
||||
else
|
||||
wxFAIL_MSG( "Line type not found in the type lookup map" );
|
||||
|
||||
m_privateCheckbox->SetValue( m_shape->IsPrivate() );
|
||||
m_checkApplyToAllUnits->SetValue( m_shape->GetUnit() == 0 );
|
||||
m_checkApplyToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
|
||||
m_checkApplyToAllConversions->SetValue( m_item->GetConvert() == 0 );
|
||||
m_checkApplyToAllConversions->SetValue( m_shape->GetConvert() == 0 );
|
||||
|
||||
bool enblConvOptStyle = symbol && symbol->HasConversion();
|
||||
|
||||
|
@ -97,35 +132,39 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
m_checkApplyToAllConversions->Enable( enblConvOptStyle );
|
||||
|
||||
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 );
|
||||
m_rbFillNone->Enable( m_shape != nullptr );
|
||||
m_rbFillOutline->Enable( m_shape != nullptr );
|
||||
m_rbFillBackground->Enable( m_shape != nullptr );
|
||||
m_rbFillCustom->Enable( m_shape != nullptr );
|
||||
m_fillColorSwatch->Enable( m_shape != nullptr );
|
||||
|
||||
if( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE )
|
||||
if( m_shape->GetFillMode() == FILL_T::FILLED_SHAPE )
|
||||
{
|
||||
m_rbFillOutline->SetValue( true );
|
||||
|
||||
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
m_colorSwatch->SetSwatchColor( color, false );
|
||||
COLOR4D color = m_shape->GetStroke().GetColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
m_fillColorSwatch->SetSwatchColor( color, false );
|
||||
}
|
||||
else if( shape && shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
else if( m_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 );
|
||||
m_fillColorSwatch->SetSwatchColor( color, false );
|
||||
}
|
||||
else if( shape && shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
{
|
||||
m_rbFillCustom->SetValue( true );
|
||||
m_colorSwatch->SetSwatchColor( shape->GetFillColor(), false );
|
||||
m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rbFillNone->SetValue( true );
|
||||
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
|
||||
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -137,31 +176,57 @@ void DIALOG_LIB_SHAPE_PROPERTIES::onFill( wxCommandEvent& event )
|
|||
if( event.GetId() == NO_FILL )
|
||||
{
|
||||
m_rbFillNone->SetValue( true );
|
||||
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
|
||||
m_fillColorSwatch->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 );
|
||||
COLOR4D color = m_shape->GetStroke().GetColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
|
||||
m_fillColorSwatch->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 );
|
||||
m_fillColorSwatch->SetSwatchColor( color, false );
|
||||
}
|
||||
else if( event.GetId() == FILLED_WITH_COLOR )
|
||||
{
|
||||
m_rbFillCustom->SetValue( true );
|
||||
m_colorSwatch->GetNewSwatchColor();
|
||||
m_fillColorSwatch->GetNewSwatchColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_SHAPE_PROPERTIES::onSwatch( wxCommandEvent& aEvent )
|
||||
void DIALOG_LIB_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
|
||||
{
|
||||
bool border = m_checkBorder->GetValue();
|
||||
|
||||
if( border && m_borderWidth.GetValue() < 0 )
|
||||
m_borderWidth.SetValue( Mils2iu( m_frame->libeditconfig()->m_Defaults.line_width ) );
|
||||
|
||||
m_borderWidth.Enable( border );
|
||||
m_borderColorLabel->Enable( border );
|
||||
m_borderColorSwatch->Enable( border );
|
||||
m_borderStyleLabel->Enable( border );
|
||||
m_borderStyleCombo->Enable( border );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_rbFillOutline->GetValue() )
|
||||
m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_rbFillCustom->SetValue( true );
|
||||
}
|
||||
|
@ -172,64 +237,57 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
|
|||
if( !wxDialog::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( m_item );
|
||||
STROKE_PARAMS stroke = m_shape->GetStroke();
|
||||
|
||||
if( shape )
|
||||
if( m_checkBorder->GetValue() )
|
||||
{
|
||||
STROKE_PARAMS stroke = shape->GetStroke();
|
||||
|
||||
if( m_checkBorder->GetValue() )
|
||||
{
|
||||
if( !m_lineWidth.IsIndeterminate() )
|
||||
stroke.SetWidth( m_lineWidth.GetValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
stroke.SetWidth( -1 );
|
||||
}
|
||||
|
||||
shape->SetStroke( stroke );
|
||||
|
||||
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() );
|
||||
if( !m_borderWidth.IsIndeterminate() )
|
||||
stroke.SetWidth( m_borderWidth.GetValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
stroke.SetWidth( -1 );
|
||||
}
|
||||
|
||||
m_item->SetPrivate( m_privateCheckbox->GetValue() );
|
||||
auto it = lineTypeNames.begin();
|
||||
std::advance( it, m_borderStyleCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
|
||||
|
||||
m_shape->SetStroke( stroke );
|
||||
|
||||
if( m_rbFillOutline->GetValue() )
|
||||
m_shape->SetFillMode( FILL_T::FILLED_SHAPE );
|
||||
else if( m_rbFillBackground->GetValue() )
|
||||
m_shape->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
|
||||
else if( m_rbFillCustom->GetValue() )
|
||||
m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
|
||||
else
|
||||
m_shape->SetFillMode( FILL_T::NO_FILL );
|
||||
|
||||
m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
|
||||
|
||||
m_shape->SetPrivate( m_privateCheckbox->GetValue() );
|
||||
|
||||
if( GetApplyToAllConversions() )
|
||||
m_item->SetConvert( 0 );
|
||||
m_shape->SetConvert( 0 );
|
||||
else
|
||||
m_item->SetConvert( m_frame->GetConvert() );
|
||||
m_shape->SetConvert( m_frame->GetConvert() );
|
||||
|
||||
if( GetApplyToAllUnits() )
|
||||
m_item->SetUnit( 0 );
|
||||
m_shape->SetUnit( 0 );
|
||||
else
|
||||
m_item->SetUnit( m_frame->GetUnit() );
|
||||
m_shape->SetUnit( m_frame->GetUnit() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
|
||||
{
|
||||
bool border = m_checkBorder->GetValue();
|
||||
|
||||
if( border && m_lineWidth.GetValue() < 0 )
|
||||
m_lineWidth.SetValue( Mils2iu( m_frame->libeditconfig()->m_Defaults.line_width ) );
|
||||
|
||||
m_lineWidth.Enable( border );
|
||||
m_helpLabel->Enable( border );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllConversions()
|
||||
{
|
||||
return m_checkApplyToAllConversions->IsChecked();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2014-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
|
||||
|
@ -26,7 +26,7 @@
|
|||
#define DIALOG_LIB_SHAPE_PROPERTIES_H
|
||||
|
||||
|
||||
class LIB_ITEM;
|
||||
class LIB_SHAPE;
|
||||
class SYMBOL_EDIT_FRAME;
|
||||
|
||||
|
||||
|
@ -40,7 +40,8 @@ class DIALOG_LIB_SHAPE_PROPERTIES : public DIALOG_LIB_SHAPE_PROPERTIES_BASE
|
|||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_ITEM* aItem );
|
||||
DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_SHAPE* aShape );
|
||||
~DIALOG_LIB_SHAPE_PROPERTIES();
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
@ -49,14 +50,15 @@ public:
|
|||
bool GetApplyToAllUnits();
|
||||
|
||||
private:
|
||||
void onFill(wxCommandEvent &event) override;
|
||||
void onBorderChecked( wxCommandEvent& event ) override;
|
||||
void onSwatch( wxCommandEvent& aEvent );
|
||||
void onBorderChecked( wxCommandEvent& aEvent ) override;
|
||||
void onBorderSwatch( wxCommandEvent& aEvent );
|
||||
void onFill(wxCommandEvent &aEvent) override;
|
||||
void onFillSwatch( wxCommandEvent& aEvent );
|
||||
|
||||
private:
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
LIB_ITEM* m_item;
|
||||
UNIT_BINDER m_lineWidth;
|
||||
LIB_SHAPE* m_shape;
|
||||
UNIT_BINDER m_borderWidth;
|
||||
};
|
||||
|
||||
#endif // DIALOG_LIB_SHAPE_PROPERTIES_H
|
||||
|
|
|
@ -26,35 +26,78 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
|
|||
wxBoxSizer* mainSizer;
|
||||
mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* dlgBorderSizer;
|
||||
dlgBorderSizer = new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer* bTop;
|
||||
bTop = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bLeftCol;
|
||||
bLeftCol = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxGridBagSizer* gbSizer2;
|
||||
gbSizer2 = new wxGridBagSizer( 0, 0 );
|
||||
gbSizer2->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_checkBorder = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_checkBorder, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
|
||||
gbSizer2->Add( m_checkBorder, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerLineWidth;
|
||||
bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL );
|
||||
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthLabel->Wrap( -1 );
|
||||
gbSizer2->Add( m_borderWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
|
||||
m_widthLabel = new wxStaticText( this, wxID_ANY, _("Border width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_widthLabel->Wrap( -1 );
|
||||
bSizerLineWidth->Add( m_widthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
wxBoxSizer* bSizer7;
|
||||
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_widthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerLineWidth->Add( m_widthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
|
||||
bSizer7->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_widthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_widthUnits->Wrap( -1 );
|
||||
bSizerLineWidth->Add( m_widthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 );
|
||||
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthUnits->Wrap( -1 );
|
||||
bSizer7->Add( m_borderWidthUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
|
||||
bSizer7->Add( 5, 0, 0, 0, 5 );
|
||||
|
||||
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer22;
|
||||
bSizer22 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer22->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_panelBorderColor->SetSizer( bSizer22 );
|
||||
m_panelBorderColor->Layout();
|
||||
bSizer22->Fit( m_panelBorderColor );
|
||||
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
gbSizer2->Add( bSizer7, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
|
||||
|
||||
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderStyleLabel->Wrap( -1 );
|
||||
gbSizer2->Add( m_borderStyleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
|
||||
|
||||
gbSizer2->Add( m_borderStyleCombo, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_helpLabel = new wxStaticText( this, wxID_ANY, _("Set border width to 0 to use schematic's default symbol line width."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_helpLabel->Wrap( 320 );
|
||||
dlgBorderSizer->Add( m_helpLabel, 0, wxALL, 3 );
|
||||
gbSizer2->Add( m_helpLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( 0, 3, 0, 0, 5 );
|
||||
bLeftCol->Add( gbSizer2, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bTop->Add( bLeftCol, 1, wxEXPAND|wxRIGHT, 30 );
|
||||
|
||||
wxBoxSizer* bRightCol;
|
||||
bRightCol = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* bSizerFill;
|
||||
bSizerFill = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill Style") ), wxVERTICAL );
|
||||
|
@ -76,32 +119,38 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
|
|||
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 );
|
||||
m_fillColorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_fillColorSwatch, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerFill->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( bSizerFill, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
bRightCol->Add( bSizerFill, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( 0, 3, 0, 0, 5 );
|
||||
bTop->Add( bRightCol, 1, wxEXPAND|wxLEFT, 30 );
|
||||
|
||||
|
||||
mainSizer->Add( bTop, 1, wxALL|wxEXPAND, 10 );
|
||||
|
||||
wxGridSizer* bBottom;
|
||||
bBottom = new wxGridSizer( 0, 2, 0, 60 );
|
||||
|
||||
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_privateCheckbox, 0, wxALL, 3 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( 0, 8, 1, wxEXPAND, 5 );
|
||||
bBottom->Add( m_privateCheckbox, 0, wxALL, 5 );
|
||||
|
||||
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_checkApplyToAllUnits, 0, wxALL, 3 );
|
||||
bBottom->Add( m_checkApplyToAllUnits, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bBottom->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
|
||||
bBottom->Add( m_checkApplyToAllConversions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
mainSizer->Add( dlgBorderSizer, 1, wxALL|wxEXPAND, 10 );
|
||||
mainSizer->Add( bBottom, 0, wxEXPAND|wxALL, 10 );
|
||||
|
||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
mainSizer->Add( m_staticline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,8 +22,10 @@ class COLOR_SWATCH;
|
|||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/button.h>
|
||||
|
@ -54,15 +56,20 @@ class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
};
|
||||
|
||||
wxCheckBox* m_checkBorder;
|
||||
wxStaticText* m_widthLabel;
|
||||
wxTextCtrl* m_widthCtrl;
|
||||
wxStaticText* m_widthUnits;
|
||||
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;
|
||||
wxStaticText* m_helpLabel;
|
||||
wxRadioButton* m_rbFillNone;
|
||||
wxRadioButton* m_rbFillOutline;
|
||||
wxRadioButton* m_rbFillBackground;
|
||||
wxRadioButton* m_rbFillCustom;
|
||||
COLOR_SWATCH* m_colorSwatch;
|
||||
COLOR_SWATCH* m_fillColorSwatch;
|
||||
wxCheckBox* m_privateCheckbox;
|
||||
wxCheckBox* m_checkApplyToAllUnits;
|
||||
wxCheckBox* m_checkApplyToAllConversions;
|
||||
|
|
|
@ -436,7 +436,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
|
||||
case LIB_SHAPE_T:
|
||||
editShapeProperties( item );
|
||||
editShapeProperties( static_cast<LIB_SHAPE*>( item ) );
|
||||
break;
|
||||
|
||||
case LIB_TEXT_T:
|
||||
|
@ -466,14 +466,14 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties( LIB_ITEM* aItem )
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties( LIB_SHAPE* aShape )
|
||||
{
|
||||
DIALOG_LIB_SHAPE_PROPERTIES dlg( m_frame, aItem );
|
||||
DIALOG_LIB_SHAPE_PROPERTIES dlg( m_frame, aShape );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
updateItem( aItem, true );
|
||||
updateItem( aShape, true );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
|
@ -482,7 +482,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties( LIB_ITEM* aItem )
|
|||
drawingTools->SetDrawSpecificUnit( !dlg.GetApplyToAllUnits() );
|
||||
|
||||
std::vector<MSG_PANEL_ITEM> items;
|
||||
aItem->GetMsgPanelInfo( m_frame, items );
|
||||
aShape->GetMsgPanelInfo( m_frame, items );
|
||||
m_frame->SetMsgPanel( items );
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
int DeleteItemCursor( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
void editShapeProperties( LIB_ITEM* aItem );
|
||||
void editShapeProperties( LIB_SHAPE* aShape );
|
||||
void editTextProperties( LIB_ITEM* aItem );
|
||||
void editTextBoxProperties( LIB_ITEM* aItem );
|
||||
void editFieldProperties( LIB_FIELD* aField );
|
||||
|
|
Loading…
Reference in New Issue