Allow sheet colors to remain unspecified if not manually set
This way, when the user changes their color theme, any sheets that did not have a specific color set will change with the theme. Also add a button to clear color overrides from a sheet, because any schematics that have been saved before this change will have the colors set to something other than UNSPECIFIED.
This commit is contained in:
parent
64766d9754
commit
b0c6a0f9ef
|
@ -172,7 +172,8 @@ void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool sendEvent )
|
|||
{
|
||||
m_color = aColor;
|
||||
|
||||
wxBitmap bm = MakeBitmap( m_color, m_background, m_size );
|
||||
wxBitmap bm = MakeBitmap( m_color == COLOR4D::UNSPECIFIED ? m_default : m_color,
|
||||
m_background, m_size );
|
||||
m_swatch->SetBitmap( bm );
|
||||
|
||||
if( sendEvent )
|
||||
|
@ -180,6 +181,12 @@ void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool sendEvent )
|
|||
}
|
||||
|
||||
|
||||
void COLOR_SWATCH::SetDefaultColor( COLOR4D aColor )
|
||||
{
|
||||
m_default = aColor;
|
||||
}
|
||||
|
||||
|
||||
void COLOR_SWATCH::SetSwatchBackground( COLOR4D aBackground )
|
||||
{
|
||||
m_background = aBackground;
|
||||
|
|
|
@ -789,3 +789,15 @@ void DIALOG_SCH_SHEET_PROPS::OnInitDlg( wxInitDialogEvent& event )
|
|||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SCH_SHEET_PROPS::OnRemoveColors( wxCommandEvent& event )
|
||||
{
|
||||
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
|
||||
|
||||
m_borderSwatch->SetDefaultColor( colorSettings->GetColor( LAYER_SHEET ) );
|
||||
m_backgroundSwatch->SetDefaultColor( colorSettings->GetColor( LAYER_SHEET_BACKGROUND ) );
|
||||
|
||||
m_borderSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
|
||||
m_backgroundSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ private:
|
|||
void OnGridCellChanging( wxGridEvent& event );
|
||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||
void OnInitDlg( wxInitDialogEvent& event ) override;
|
||||
void OnRemoveColors( wxCommandEvent& event ) override;
|
||||
|
||||
void AdjustGridColumns( int aWidth );
|
||||
};
|
||||
|
|
|
@ -78,19 +78,16 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
|
|||
|
||||
m_bpAdd = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpAdd->SetToolTip( _("Add field") );
|
||||
m_bpAdd->SetMinSize( wxSize( 30,30 ) );
|
||||
|
||||
bButtonSize->Add( m_bpAdd, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_bpMoveUp = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpMoveUp->SetToolTip( _("Move up") );
|
||||
m_bpMoveUp->SetMinSize( wxSize( 30,30 ) );
|
||||
|
||||
bButtonSize->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_bpMoveDown = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpMoveDown->SetToolTip( _("Move down") );
|
||||
m_bpMoveDown->SetMinSize( wxSize( 30,30 ) );
|
||||
|
||||
bButtonSize->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
@ -99,7 +96,6 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
|
|||
|
||||
m_bpDelete = new wxBitmapButton( sbFields->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpDelete->SetToolTip( _("Delete field") );
|
||||
m_bpDelete->SetMinSize( wxSize( 30,30 ) );
|
||||
|
||||
bButtonSize->Add( m_bpDelete, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
@ -155,6 +151,14 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
|
|||
sbSizer2->Add( m_backgroundSwatch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_btnResetColors = new wxButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Remove Colors"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnResetColors->SetToolTip( _("Remove the specified colors for this sheet (the current color theme will be used instead)") );
|
||||
|
||||
sbSizer2->Add( m_btnResetColors, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bSizer5->Add( sbSizer2, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
|
@ -222,6 +226,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
|
|||
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
|
||||
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
|
||||
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
|
||||
m_btnResetColors->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnRemoveColors ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
|
||||
|
@ -234,5 +239,6 @@ DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
|
|||
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
|
||||
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
|
||||
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
|
||||
m_btnResetColors->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnRemoveColors ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<property name="file">dialog_sch_sheet_props_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_sch_sheet_props_base</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">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -194,7 +192,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -268,7 +265,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -342,7 +338,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -426,7 +421,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -974,6 +968,89 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" 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="bitmap"></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="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></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="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Remove Colors</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</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_btnResetColors</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="position"></property>
|
||||
<property name="pressed"></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">Remove the specified colors for this sheet (the current color theme will be used instead)</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>
|
||||
<event name="OnButtonClick">OnRemoveColors</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -56,6 +56,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
|
|||
COLOR_SWATCH* m_borderSwatch;
|
||||
wxStaticText* m_backgroundColorLabel;
|
||||
COLOR_SWATCH* m_backgroundSwatch;
|
||||
wxButton* m_btnResetColors;
|
||||
wxStaticText* m_hiearchicalPathLabel;
|
||||
wxTextCtrl* m_heirarchyPath;
|
||||
wxStaticText* m_timestampLabel;
|
||||
|
@ -73,6 +74,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
|
|||
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRemoveColors( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -279,19 +279,15 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) aItem;
|
||||
|
||||
// Lazy fixup of legacy sheets with no color specifications
|
||||
if( sheet->GetBorderColor() == COLOR4D::UNSPECIFIED )
|
||||
sheet->SetBorderColor( m_schSettings.GetLayerColor( LAYER_SHEET ) );
|
||||
|
||||
if( sheet->GetBackgroundColor() == COLOR4D::UNSPECIFIED )
|
||||
sheet->SetBackgroundColor( m_schSettings.GetLayerColor( LAYER_SHEET_BACKGROUND ) );
|
||||
|
||||
if( m_schSettings.m_OverrideItemColors )
|
||||
color = m_schSettings.GetLayerColor( aLayer );
|
||||
else if( aLayer == LAYER_SHEET )
|
||||
color = sheet->GetBorderColor();
|
||||
else if( aLayer == LAYER_SHEET_BACKGROUND )
|
||||
color = sheet->GetBackgroundColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = m_schSettings.GetLayerColor( aLayer );
|
||||
}
|
||||
|
||||
if( aItem->IsBrightened() && !aDrawingShadows ) // Selection disambiguation, etc.
|
||||
|
|
|
@ -60,6 +60,11 @@ public:
|
|||
*/
|
||||
void SetSwatchColor( KIGFX::COLOR4D aColor, bool sendEvent );
|
||||
|
||||
/**
|
||||
* Sets the color that will be chosen with the "Reset to Default" button in the chooser
|
||||
*/
|
||||
void SetDefaultColor( KIGFX::COLOR4D aColor );
|
||||
|
||||
/**
|
||||
* Set the swatch background color.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue