Show/hide sheet colors when flipping override flag.
This commit is contained in:
parent
e143ecbf40
commit
b067e441c7
|
@ -141,6 +141,20 @@ const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs )
|
|||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs )
|
||||
{
|
||||
if( lhs.r < rhs.r )
|
||||
return true;
|
||||
else if( lhs.g < rhs.g )
|
||||
return true;
|
||||
else if( lhs.b < rhs.b )
|
||||
return true;
|
||||
else if( lhs.a < rhs.a )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
|
||||
{
|
||||
return aStream << aColor.ToWxString( wxC2S_CSS_SYNTAX );
|
||||
|
|
|
@ -186,14 +186,7 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme( bool aValidate )
|
|||
|
||||
for( SCH_LAYER_ID layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; ++layer )
|
||||
{
|
||||
COLOR4D color;
|
||||
|
||||
if( layer == LAYER_SHEET )
|
||||
color = m_frame->GetDefaultSheetBorderColor();
|
||||
else if( layer == LAYER_SHEET_BACKGROUND )
|
||||
color = m_frame->GetDefaultSheetBackgroundColor();
|
||||
else
|
||||
color = m_currentSettings->GetColor( layer );
|
||||
COLOR4D color = m_currentSettings->GetColor( layer );
|
||||
|
||||
// Do not allow non-background layers to be completely white.
|
||||
// This ensures the BW printing recognizes that the colors should be printed black.
|
||||
|
@ -230,10 +223,6 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createButtons()
|
|||
|
||||
for( SCH_LAYER_ID layer : layers )
|
||||
{
|
||||
// Sheet borders and backgrounds are now sheet-specific
|
||||
if( layer == LAYER_SHEET || layer == LAYER_SHEET_BACKGROUND )
|
||||
continue;
|
||||
|
||||
wxString name = LayerName( layer );
|
||||
wxStaticText* label = new wxStaticText( m_colorsListWindow, wxID_ANY, name );
|
||||
COLOR4D color = m_currentSettings->GetColor( layer );
|
||||
|
@ -256,9 +245,18 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createButtons()
|
|||
m_buttonSizePx + border + wxSize( 1, 1 ) );
|
||||
button->SetToolTip( _( "Edit color (right click for options)" ) );
|
||||
|
||||
// If the theme is not overriding individual item colors then don't show them so that
|
||||
// the user doesn't get seduced into thinking they'll have some effect.
|
||||
if( layer == LAYER_SHEET || layer == LAYER_SHEET_BACKGROUND )
|
||||
{
|
||||
label->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
button->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
}
|
||||
|
||||
m_colorsGridSizer->Add( label, 0, flags, 5 );
|
||||
m_colorsGridSizer->Add( button, 0, flags, 5 );
|
||||
|
||||
m_labels[layer] = label;
|
||||
m_buttons[layer] = button;
|
||||
|
||||
button->Bind( wxEVT_RIGHT_DOWN,
|
||||
|
@ -561,7 +559,12 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
|||
updatePreview();
|
||||
|
||||
for( auto pair : m_buttons )
|
||||
{
|
||||
drawButton( pair.second, m_currentSettings->GetColor( pair.first ) );
|
||||
|
||||
if( pair.first == LAYER_SHEET || pair.first == LAYER_SHEET_BACKGROUND )
|
||||
pair.second->Show( selected->GetOverrideSchItemColors() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +572,18 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
|||
|
||||
void PANEL_EESCHEMA_COLOR_SETTINGS::OnOverrideItemColorsClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
// JEY TODO: hide/show extra color buttons
|
||||
m_currentSettings->SetOverrideSchItemColors( m_optOverrideColors->GetValue() );
|
||||
|
||||
// If the theme is not overriding individual item colors then don't show them so that
|
||||
// the user doesn't get seduced into thinking they'll have some effect.
|
||||
m_labels[ LAYER_SHEET ]->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
m_buttons[ LAYER_SHEET ]->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
|
||||
m_labels[ LAYER_SHEET_BACKGROUND ]->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
m_buttons[ LAYER_SHEET_BACKGROUND ]->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
|
||||
m_colorsGridSizer->Layout();
|
||||
m_colorsListWindow->Layout();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
|
||||
std::vector<EDA_ITEM*> m_previewItems;
|
||||
|
||||
std::map<SCH_LAYER_ID, wxStaticText*> m_labels;
|
||||
std::map<SCH_LAYER_ID, wxBitmapButton*> m_buttons;
|
||||
|
||||
KIGFX::COLOR4D m_copied;
|
||||
|
|
|
@ -475,6 +475,9 @@ void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
m_selectPinSelectSymbol = cfg->m_Selection.select_pin_selects_symbol;
|
||||
m_repeatDeltaLabel = cfg->m_Drawing.repeat_label_increment;
|
||||
|
||||
SetDefaultSheetBorderColor( cfg->m_Drawing.default_sheet_border_color );
|
||||
SetDefaultSheetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
||||
|
||||
wxString templateFieldNames = cfg->m_Drawing.field_names;
|
||||
|
||||
if( !templateFieldNames.IsEmpty() )
|
||||
|
@ -535,6 +538,8 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
cfg->m_Drawing.hv_lines_only = GetForceHVLines();
|
||||
cfg->m_Drawing.repeat_label_increment = m_repeatDeltaLabel;
|
||||
cfg->m_Drawing.text_markup_flags = GetTextMarkupFlags();
|
||||
cfg->m_Drawing.default_sheet_border_color = GetDefaultSheetBorderColor();
|
||||
cfg->m_Drawing.default_sheet_background_color = GetDefaultSheetBackgroundColor();
|
||||
|
||||
cfg->m_Input.drag_is_move = m_dragActionIsMove;
|
||||
|
||||
|
|
|
@ -104,6 +104,12 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
|
|||
m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
|
||||
&m_Drawing.repeat_label_increment, 1, -10, 10 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
|
||||
&m_Drawing.default_sheet_border_color, COLOR4D( MAGENTA ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
|
||||
&m_Drawing.default_sheet_background_color, COLOR4D( WHITE ).WithAlpha( 0.0 ) ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "drawing.text_markup_flags", &m_Drawing.text_markup_flags, 0 ) );
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include <settings/app_settings.h>
|
||||
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
|
||||
class EESCHEMA_SETTINGS : public APP_SETTINGS_BASE
|
||||
{
|
||||
public:
|
||||
|
@ -60,6 +63,8 @@ public:
|
|||
int default_repeat_offset_x;
|
||||
int default_repeat_offset_y;
|
||||
int default_wire_thickness;
|
||||
COLOR4D default_sheet_border_color;
|
||||
COLOR4D default_sheet_background_color;
|
||||
wxString field_names;
|
||||
bool hv_lines_only;
|
||||
int repeat_label_increment;
|
||||
|
|
|
@ -318,6 +318,8 @@ const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
|
|||
/// @brief Not equality operator, are two colors not equal
|
||||
const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
|
||||
|
||||
const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs );
|
||||
|
||||
/// Syntactic sugar for outputting colors to strings
|
||||
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor );
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
if( m_use_minmax )
|
||||
{
|
||||
if( val > m_max || val < m_min )
|
||||
if( m_max < val || val < m_min )
|
||||
val = m_default;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue