Moved PANEL_COLOR_SETTINGS from buttons to swatches.
This allows us to correctly display non-100%-opacity colors (ie: over the correct background color).
This commit is contained in:
parent
d0217e38cd
commit
001a50bf14
|
@ -29,12 +29,9 @@
|
|||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <validators.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
|
||||
|
||||
// Width and height of every (color-displaying / bitmap) button in dialog units
|
||||
const wxSize BUTTON_SIZE( 24, 12 );
|
||||
const wxSize BUTTON_BORDER( 4, 4 );
|
||||
|
||||
// Button ID starting point
|
||||
constexpr int FIRST_BUTTON_ID = 1800;
|
||||
|
||||
|
@ -42,7 +39,7 @@ constexpr int FIRST_BUTTON_ID = 1800;
|
|||
PANEL_COLOR_SETTINGS::PANEL_COLOR_SETTINGS( wxWindow* aParent ) :
|
||||
PANEL_COLOR_SETTINGS_BASE( aParent ),
|
||||
m_currentSettings( nullptr ),
|
||||
m_buttons(),
|
||||
m_swatches(),
|
||||
m_copied( COLOR4D::UNSPECIFIED ),
|
||||
m_validLayers(),
|
||||
m_colorNamespace()
|
||||
|
@ -53,8 +50,6 @@ PANEL_COLOR_SETTINGS::PANEL_COLOR_SETTINGS( wxWindow* aParent ) :
|
|||
// Simple border is too dark on OSX
|
||||
m_colorsListWindow->SetWindowStyle( wxBORDER_SUNKEN|wxVSCROLL );
|
||||
#endif
|
||||
|
||||
m_buttonSizePx = ConvertDialogToPixels( BUTTON_SIZE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,15 +65,15 @@ void PANEL_COLOR_SETTINGS::OnBtnResetClicked( wxCommandEvent& event )
|
|||
if( !m_currentSettings )
|
||||
return;
|
||||
|
||||
for( const auto& pair : m_buttons )
|
||||
for( const std::pair<int, COLOR_SWATCH*>& pair : m_swatches )
|
||||
{
|
||||
int layer = pair.first;
|
||||
wxBitmapButton* button = pair.second;
|
||||
COLOR_SWATCH* button = pair.second;
|
||||
|
||||
COLOR4D defaultColor = m_currentSettings->GetDefaultColor( layer );
|
||||
|
||||
m_currentSettings->SetColor( layer, defaultColor );
|
||||
drawButton( button, defaultColor );
|
||||
button->SetSwatchColor( defaultColor, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,9 +144,12 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
|||
*m_currentSettings = *selected;
|
||||
onNewThemeSelected();
|
||||
|
||||
for( auto pair : m_buttons )
|
||||
COLOR4D background = m_currentSettings->GetColor( m_backgroundLayer );
|
||||
|
||||
for( std::pair<int, COLOR_SWATCH*> pair : m_swatches )
|
||||
{
|
||||
drawButton( pair.second, m_currentSettings->GetColor( pair.first ) );
|
||||
pair.second->SetSwatchBackground( background );
|
||||
pair.second->SetSwatchColor( m_currentSettings->GetColor( pair.first ), false );
|
||||
|
||||
if( pair.first == LAYER_SHEET || pair.first == LAYER_SHEET_BACKGROUND )
|
||||
pair.second->Show( selected->GetOverrideSchItemColors() );
|
||||
|
@ -189,44 +187,33 @@ void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent )
|
|||
}
|
||||
|
||||
|
||||
void PANEL_COLOR_SETTINGS::createButton( int aLayer, const KIGFX::COLOR4D& aColor,
|
||||
const wxString& aName )
|
||||
void PANEL_COLOR_SETTINGS::createSwatch( int aLayer, const wxString& aName )
|
||||
{
|
||||
const wxSize border = ConvertDialogToPixels( BUTTON_BORDER );
|
||||
|
||||
wxStaticText* label = new wxStaticText( m_colorsListWindow, wxID_ANY, aName );
|
||||
|
||||
wxMemoryDC iconDC;
|
||||
wxBitmap bitmap( m_buttonSizePx );
|
||||
|
||||
iconDC.SelectObject( bitmap );
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
|
||||
wxBrush brush;
|
||||
brush.SetColour( aColor.ToColour() );
|
||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||
iconDC.SetBrush( brush );
|
||||
iconDC.DrawRectangle( 0, 0, m_buttonSizePx.x, m_buttonSizePx.y );
|
||||
|
||||
void* clientData = m_cbTheme->GetClientData( m_cbTheme->GetSelection() );
|
||||
COLOR_SETTINGS* selected = static_cast<COLOR_SETTINGS*>( clientData );
|
||||
int id = FIRST_BUTTON_ID + aLayer;
|
||||
COLOR4D defaultColor = selected->GetDefaultColor( aLayer );
|
||||
COLOR4D color = m_currentSettings->GetColor( aLayer );
|
||||
COLOR4D backgroundColor = m_currentSettings->GetColor( m_backgroundLayer );
|
||||
|
||||
auto button = new wxBitmapButton( m_colorsListWindow, id, bitmap, wxDefaultPosition,
|
||||
m_buttonSizePx + border + wxSize( 1, 1 ) );
|
||||
button->SetToolTip( _( "Edit color (right click for options)" ) );
|
||||
COLOR_SWATCH* swatch = new COLOR_SWATCH( m_colorsListWindow, color, id, backgroundColor,
|
||||
defaultColor, true );
|
||||
swatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
|
||||
|
||||
m_colorsGridSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxLEFT, 5 );
|
||||
m_colorsGridSizer->Add( button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 );
|
||||
m_colorsGridSizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3 );
|
||||
|
||||
m_labels[aLayer] = label;
|
||||
m_buttons[aLayer] = button;
|
||||
m_swatches[aLayer] = swatch;
|
||||
|
||||
button->Bind( wxEVT_RIGHT_DOWN,
|
||||
swatch->Bind( wxEVT_RIGHT_DOWN,
|
||||
[&, aLayer]( wxMouseEvent& aEvent )
|
||||
{
|
||||
ShowColorContextMenu( aEvent, aLayer );
|
||||
} );
|
||||
|
||||
button->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &PANEL_COLOR_SETTINGS::SetColor, this );
|
||||
swatch->Bind( COLOR_SWATCH_CHANGED, &PANEL_COLOR_SETTINGS::OnColorChanged, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -249,7 +236,8 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
|
|||
AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ), KiBitmap( undo_xpm ) );
|
||||
|
||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||
[&]( wxCommandEvent& aCmd ) {
|
||||
[&]( wxCommandEvent& aCmd )
|
||||
{
|
||||
switch( aCmd.GetId() )
|
||||
{
|
||||
case ID_COPY:
|
||||
|
@ -273,50 +261,30 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
|
|||
}
|
||||
|
||||
|
||||
void PANEL_COLOR_SETTINGS::SetColor( wxCommandEvent& event )
|
||||
void PANEL_COLOR_SETTINGS::OnColorChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
auto button = static_cast<wxBitmapButton*>( event.GetEventObject() );
|
||||
auto layer = static_cast<SCH_LAYER_ID>( button->GetId() - FIRST_BUTTON_ID );
|
||||
|
||||
COLOR4D oldColor = m_currentSettings->GetColor( layer );
|
||||
COLOR4D newColor = COLOR4D::UNSPECIFIED;
|
||||
DIALOG_COLOR_PICKER dialog( this, oldColor, false );
|
||||
|
||||
if( dialog.ShowModal() == wxID_OK )
|
||||
newColor = dialog.GetColor();
|
||||
|
||||
if( newColor == COLOR4D::UNSPECIFIED || oldColor == newColor )
|
||||
return;
|
||||
COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
|
||||
COLOR4D newColor = swatch->GetSwatchColor();
|
||||
LAYER_NUM layer = static_cast<SCH_LAYER_ID>( swatch->GetId() - FIRST_BUTTON_ID );
|
||||
|
||||
updateColor( layer, newColor );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_COLOR_SETTINGS::drawButton( wxBitmapButton* aButton, const COLOR4D& aColor ) const
|
||||
{
|
||||
wxMemoryDC iconDC;
|
||||
|
||||
wxBitmap bitmap = aButton->GetBitmapLabel();
|
||||
iconDC.SelectObject( bitmap );
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
|
||||
wxBrush brush;
|
||||
brush.SetColour( aColor.ToColour() );
|
||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||
|
||||
iconDC.SetBrush( brush );
|
||||
iconDC.DrawRectangle( 0, 0, m_buttonSizePx.x, m_buttonSizePx.y );
|
||||
aButton->SetBitmapLabel( bitmap );
|
||||
aButton->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_COLOR_SETTINGS::updateColor( int aLayer, const KIGFX::COLOR4D& aColor )
|
||||
{
|
||||
if( m_currentSettings )
|
||||
m_currentSettings->SetColor( aLayer, aColor );
|
||||
|
||||
drawButton( m_buttons[aLayer], aColor );
|
||||
m_swatches[aLayer]->SetSwatchColor( aColor, false );
|
||||
|
||||
if( aLayer == m_backgroundLayer )
|
||||
{
|
||||
COLOR4D background = m_currentSettings->GetColor( m_backgroundLayer );
|
||||
|
||||
for( std::pair<int, COLOR_SWATCH*> pair : m_swatches )
|
||||
pair.second->SetSwatchBackground( background );
|
||||
}
|
||||
|
||||
onColorChanged();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
class COLOR_SWATCH;
|
||||
|
||||
|
||||
class PANEL_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS_BASE
|
||||
|
@ -51,16 +52,14 @@ protected:
|
|||
|
||||
void ShowColorContextMenu( wxMouseEvent& aEvent, int aLayer );
|
||||
|
||||
void SetColor( wxCommandEvent& aEvent );
|
||||
void OnColorChanged( wxCommandEvent& aEvent );
|
||||
|
||||
void createThemeList( const wxString& aCurrent );
|
||||
|
||||
void createButton( int aLayer, const KIGFX::COLOR4D& aColor, const wxString& aName );
|
||||
void createSwatch( int aLayer, const wxString& aName );
|
||||
|
||||
void updateColor( int aLayer, const KIGFX::COLOR4D& aColor );
|
||||
|
||||
void drawButton( wxBitmapButton* aButton, const KIGFX::COLOR4D& aColor ) const;
|
||||
|
||||
virtual bool saveCurrentTheme( bool aValidate );
|
||||
|
||||
/**
|
||||
|
@ -85,11 +84,8 @@ protected:
|
|||
|
||||
COLOR_SETTINGS* m_currentSettings;
|
||||
|
||||
wxSize m_buttonSizePx;
|
||||
|
||||
std::map<int, wxStaticText*> m_labels;
|
||||
|
||||
std::map<int, wxBitmapButton*> m_buttons;
|
||||
std::map<int, COLOR_SWATCH*> m_swatches;
|
||||
|
||||
KIGFX::COLOR4D m_copied;
|
||||
|
||||
|
@ -102,6 +98,7 @@ protected:
|
|||
* This list must be filled in the application-specific color settings panel constructors.
|
||||
*/
|
||||
std::vector<int> m_validLayers;
|
||||
int m_backgroundLayer;
|
||||
|
||||
/**
|
||||
* A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings
|
||||
|
|
|
@ -299,13 +299,18 @@ COLOR4D COLOR_SETTINGS::GetDefaultColor( int aLayer )
|
|||
{
|
||||
COLOR_MAP_PARAM* p = nullptr;
|
||||
|
||||
for( auto param : m_params )
|
||||
if( auto cmp = dynamic_cast<COLOR_MAP_PARAM*>( param ) )
|
||||
if( cmp->GetKey() == aLayer )
|
||||
p = cmp;
|
||||
for( PARAM_BASE* param : m_params )
|
||||
{
|
||||
COLOR_MAP_PARAM* cmp = dynamic_cast<COLOR_MAP_PARAM*>( param );
|
||||
|
||||
wxASSERT( p );
|
||||
if( cmp && cmp->GetKey() == aLayer )
|
||||
p = cmp;
|
||||
}
|
||||
|
||||
if( p )
|
||||
m_defaultColors[aLayer] = p->GetDefault();
|
||||
else
|
||||
m_defaultColors[aLayer] = COLOR4D::UNSPECIFIED;
|
||||
}
|
||||
|
||||
return m_defaultColors.at( aLayer );;
|
||||
|
|
|
@ -65,12 +65,15 @@ wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize a
|
|||
|
||||
|
||||
COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID, COLOR4D aBackground,
|
||||
const COLOR4D aDefault ) :
|
||||
const COLOR4D aDefault, bool aForDialog ) :
|
||||
wxPanel( aParent, aID ),
|
||||
m_color( aColor ),
|
||||
m_background( aBackground ),
|
||||
m_default( aDefault )
|
||||
{
|
||||
if( aForDialog )
|
||||
m_size = ConvertDialogToPixels( DIALOG_SWATCH_SIZE_DU );
|
||||
else
|
||||
m_size = ConvertDialogToPixels( PALETTE_SWATCH_SIZE_DU );
|
||||
|
||||
auto sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -128,7 +131,6 @@ void COLOR_SWATCH::setupEvents()
|
|||
{
|
||||
// forward click to any other listeners, since we don't want them
|
||||
m_swatch->Bind( wxEVT_LEFT_DOWN, &COLOR_SWATCH::rePostEvent, this );
|
||||
m_swatch->Bind( wxEVT_RIGHT_DOWN, &COLOR_SWATCH::rePostEvent, this );
|
||||
|
||||
// bind the events that trigger the dialog
|
||||
m_swatch->Bind( wxEVT_LEFT_DCLICK,
|
||||
|
@ -143,6 +145,8 @@ void COLOR_SWATCH::setupEvents()
|
|||
{
|
||||
GetNewSwatchColor();
|
||||
} );
|
||||
|
||||
m_swatch->Bind( wxEVT_RIGHT_DOWN, &COLOR_SWATCH::rePostEvent, this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,13 +21,11 @@
|
|||
#include <regex>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/dialog_color_picker.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <gal/gal_display_options.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <class_libentry.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <page_info.h>
|
||||
#include <panel_eeschema_color_settings.h>
|
||||
#include <pgm_base.h>
|
||||
|
@ -45,7 +43,7 @@
|
|||
#include <view/view.h>
|
||||
#include <ws_proxy_view_item.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <validators.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
|
||||
// Width and height of every (color-displaying / bitmap) button in dialog units
|
||||
const wxSize BUTTON_SIZE( 24, 12 );
|
||||
|
@ -84,7 +82,9 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aF
|
|||
for( int id = SCH_LAYER_ID_START; id < SCH_LAYER_ID_END; id++ )
|
||||
m_validLayers.push_back( id );
|
||||
|
||||
createButtons();
|
||||
m_backgroundLayer = LAYER_SCHEMATIC_BACKGROUND;
|
||||
|
||||
createSwatches();
|
||||
|
||||
KIGFX::GAL_DISPLAY_OPTIONS options;
|
||||
options.ReadConfig( *common_settings, app_settings->m_Window, this );
|
||||
|
@ -187,7 +187,7 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme( bool aValidate)
|
|||
}
|
||||
|
||||
|
||||
void PANEL_EESCHEMA_COLOR_SETTINGS::createButtons()
|
||||
void PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches()
|
||||
{
|
||||
std::vector<SCH_LAYER_ID> layers;
|
||||
|
||||
|
@ -201,7 +201,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createButtons()
|
|||
} );
|
||||
|
||||
for( int layer : layers )
|
||||
createButton( layer, m_currentSettings->GetColor( layer ), LayerName( layer ) );
|
||||
createSwatch( layer, LayerName( layer ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -389,10 +389,10 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::OnOverrideItemColorsClicked( wxCommandEvent&
|
|||
// 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_swatches[ 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_swatches[ LAYER_SHEET_BACKGROUND ]->Show( m_currentSettings->GetOverrideSchItemColors() );
|
||||
|
||||
m_colorsGridSizer->Layout();
|
||||
m_colorsListWindow->Layout();
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
void createPreviewItems();
|
||||
|
||||
void createButtons();
|
||||
void createSwatches();
|
||||
|
||||
|
||||
void updatePreview();
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
* @param aID id to use when sending swatch events
|
||||
*/
|
||||
COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground,
|
||||
const KIGFX::COLOR4D aDefault = KIGFX::COLOR4D::UNSPECIFIED );
|
||||
const KIGFX::COLOR4D aDefault, bool aForDialog );
|
||||
|
||||
/**
|
||||
* constructor for wxFormBuilder
|
||||
|
|
|
@ -73,9 +73,11 @@ PANEL_MODEDIT_COLOR_SETTINGS::PANEL_MODEDIT_COLOR_SETTINGS( FOOTPRINT_EDIT_FRAME
|
|||
m_validLayers.push_back( id );
|
||||
}
|
||||
|
||||
m_backgroundLayer = LAYER_PCB_BACKGROUND;
|
||||
|
||||
m_colorsMainSizer->Insert( 0, 10, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
createButtons();
|
||||
createSwatches();
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,7 +113,7 @@ bool PANEL_MODEDIT_COLOR_SETTINGS::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
void PANEL_MODEDIT_COLOR_SETTINGS::createButtons()
|
||||
void PANEL_MODEDIT_COLOR_SETTINGS::createSwatches()
|
||||
{
|
||||
std::vector<int> layers;
|
||||
|
||||
|
@ -140,6 +142,6 @@ void PANEL_MODEDIT_COLOR_SETTINGS::createButtons()
|
|||
if( board && layer >= PCBNEW_LAYER_ID_START && layer < PCB_LAYER_ID_COUNT )
|
||||
name = board->GetLayerName( static_cast<PCB_LAYER_ID>( layer ) );
|
||||
|
||||
createButton( layer, m_currentSettings->GetColor( layer ), name );
|
||||
createSwatch( layer, name );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ private:
|
|||
|
||||
KIGFX::WS_PROXY_VIEW_ITEM* m_ws;
|
||||
|
||||
void createButtons();
|
||||
void createSwatches();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -73,9 +73,11 @@ PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( PCB_EDIT_FRAME* aFrame
|
|||
m_validLayers.push_back( id );
|
||||
}
|
||||
|
||||
m_backgroundLayer = LAYER_PCB_BACKGROUND;
|
||||
|
||||
m_colorsMainSizer->Insert( 0, 10, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
createButtons();
|
||||
createSwatches();
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +114,7 @@ bool PANEL_PCBNEW_COLOR_SETTINGS::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
void PANEL_PCBNEW_COLOR_SETTINGS::createButtons()
|
||||
void PANEL_PCBNEW_COLOR_SETTINGS::createSwatches()
|
||||
{
|
||||
std::vector<int> layers;
|
||||
|
||||
|
@ -141,6 +143,6 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createButtons()
|
|||
if( board && layer >= PCBNEW_LAYER_ID_START && layer < PCB_LAYER_ID_COUNT )
|
||||
name = board->GetLayerName( static_cast<PCB_LAYER_ID>( layer ) );
|
||||
|
||||
createButton( layer, m_currentSettings->GetColor( layer ), name );
|
||||
createSwatch( layer, name );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ private:
|
|||
|
||||
KIGFX::WS_PROXY_VIEW_ITEM* m_ws;
|
||||
|
||||
void createButtons();
|
||||
void createSwatches();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -148,10 +148,8 @@ void LAYER_WIDGET::OnRightDownLayer( wxMouseEvent& aEvent, COLOR_SWATCH* aColorS
|
|||
|
||||
void LAYER_WIDGET::OnLayerSwatchChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
|
||||
|
||||
COLOR_SWATCH* eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
|
||||
COLOR4D newColor = eventSource->GetSwatchColor();
|
||||
|
||||
LAYER_NUM layer = getDecodedId( eventSource->GetId() );
|
||||
|
||||
// tell the client code.
|
||||
|
@ -333,7 +331,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
|
|||
col = COLUMN_COLORBM;
|
||||
|
||||
auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
|
||||
getBackgroundLayerColor(), aSpec.defaultColor );
|
||||
getBackgroundLayerColor(), aSpec.defaultColor, false );
|
||||
bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
|
||||
bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this );
|
||||
bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) );
|
||||
|
@ -433,7 +431,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
|
|||
if( aSpec.color != COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
|
||||
getBackgroundLayerColor(), aSpec.defaultColor );
|
||||
getBackgroundLayerColor(), aSpec.defaultColor, false );
|
||||
bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnRenderSwatchChanged, this );
|
||||
bmb->SetToolTip( _( "Left double click or middle click for color change" ) );
|
||||
m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
|
||||
|
|
Loading…
Reference in New Issue