diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp
index 7eb28077f5..33f8d29973 100644
--- a/common/dialogs/dialog_color_picker.cpp
+++ b/common/dialogs/dialog_color_picker.cpp
@@ -530,7 +530,7 @@ void DIALOG_COLOR_PICKER::SetEditVals( CHANGED_COLOR aChanged, bool aCheckTransp
if( aCheckTransparency )
{
// If they've changed the color, they probably don't want it to remain 100% transparent,
- // and it looks like a bug when it changing the color has no effect.
+ // and it looks like a bug when changing the color has no effect.
if( m_newColor4D.a == 0.0 )
m_newColor4D.a = 1.0;
}
@@ -556,9 +556,10 @@ void DIALOG_COLOR_PICKER::SetEditVals( CHANGED_COLOR aChanged, bool aCheckTransp
m_spinCtrlSaturation->SetValue( m_sat * 255 );
if( aChanged != VAL_CHANGED )
- {
m_sliderBrightness->SetValue(normalizeToInt( m_val ) );
- }
+
+ if( aChanged != HEX_CHANGED )
+ m_colorValue->SetValue( m_newColor4D.ToWxString( wxC2S_CSS_SYNTAX ) );
}
@@ -714,6 +715,16 @@ void DIALOG_COLOR_PICKER::onHSVMouseDrag( wxMouseEvent& event )
}
+void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
+{
+ m_newColor4D.SetFromWxString( m_colorValue->GetValue() );
+ m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
+
+ SetEditVals( HEX_CHANGED, true );
+ drawAll();
+}
+
+
bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( wxPoint aMouseCursor )
{
wxPoint mousePos = aMouseCursor;
diff --git a/common/dialogs/dialog_color_picker.h b/common/dialogs/dialog_color_picker.h
index 551dbfbbe5..fb8188f470 100644
--- a/common/dialogs/dialog_color_picker.h
+++ b/common/dialogs/dialog_color_picker.h
@@ -62,6 +62,7 @@ enum CHANGED_COLOR
HUE_CHANGED,
SAT_CHANGED,
VAL_CHANGED,
+ HEX_CHANGED
};
class DIALOG_COLOR_PICKER : public DIALOG_COLOR_PICKER_BASE
@@ -148,6 +149,8 @@ private:
void onHSVMouseClick( wxMouseEvent& event ) override;
void onHSVMouseDrag( wxMouseEvent& event ) override;
+ void OnColorValueText( wxCommandEvent& event ) override;
+
///< Event handler for the reset button press
void OnResetButton( wxCommandEvent& aEvent ) override;
diff --git a/common/dialogs/dialog_color_picker_base.cpp b/common/dialogs/dialog_color_picker_base.cpp
index 01741be4db..e06b2cd8bf 100644
--- a/common/dialogs/dialog_color_picker_base.cpp
+++ b/common/dialogs/dialog_color_picker_base.cpp
@@ -182,7 +182,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
- m_staticTextOldColor = new wxStaticText( this, wxID_ANY, _("Preview (old / new):"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticTextOldColor = new wxStaticText( this, wxID_ANY, _("Preview (old/new):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOldColor->Wrap( -1 );
bButtonsSizer->Add( m_staticTextOldColor, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@@ -196,8 +196,19 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
bButtonsSizer->Add( m_NewColorRect, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bButtonsSizer->Add( 10, 0, 0, wxEXPAND, 5 );
+
+ m_colorValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_colorValue->SetMinSize( wxSize( 176,-1 ) );
+
+ bButtonsSizer->Add( m_colorValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
+
+
+ bButtonsSizer->Add( 20, 0, 0, wxEXPAND, 5 );
+
m_resetToDefault = new wxButton( this, wxID_ANY, _("Reset to Default"), wxDefaultPosition, wxDefaultSize, 0 );
- bButtonsSizer->Add( m_resetToDefault, 0, wxALL, 5 );
+ bButtonsSizer->Add( m_resetToDefault, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
@@ -246,6 +257,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
m_sliderTransparency->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
m_sliderTransparency->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
m_sliderTransparency->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
+ m_colorValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COLOR_PICKER_BASE::OnColorValueText ), NULL, this );
m_resetToDefault->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_PICKER_BASE::OnResetButton ), NULL, this );
}
@@ -279,6 +291,7 @@ DIALOG_COLOR_PICKER_BASE::~DIALOG_COLOR_PICKER_BASE()
m_sliderTransparency->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
m_sliderTransparency->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
m_sliderTransparency->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_COLOR_PICKER_BASE::OnChangeAlpha ), NULL, this );
+ m_colorValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COLOR_PICKER_BASE::OnColorValueText ), NULL, this );
m_resetToDefault->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_PICKER_BASE::OnResetButton ), NULL, this );
}
diff --git a/common/dialogs/dialog_color_picker_base.fbp b/common/dialogs/dialog_color_picker_base.fbp
index 47907131ab..f2b61d6280 100644
--- a/common/dialogs/dialog_color_picker_base.fbp
+++ b/common/dialogs/dialog_color_picker_base.fbp
@@ -1493,7 +1493,7 @@
0
0
wxID_ANY
- Preview (old / new):
+ Preview (old/new):
0
0
@@ -1640,7 +1640,92 @@
+
+ 5
+ wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+
+ 0
+ 176,-1
+ 1
+ m_colorValue
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+ OnColorValueText
+
+
+
+ 5
+ wxEXPAND
+ 0
+
+ 0
+ protected
+ 20
+
+
+
+ 5
+ wxALL|wxALIGN_CENTER_VERTICAL
0
1
diff --git a/common/dialogs/dialog_color_picker_base.h b/common/dialogs/dialog_color_picker_base.h
index 8d5c1f4b7e..b69a805b47 100644
--- a/common/dialogs/dialog_color_picker_base.h
+++ b/common/dialogs/dialog_color_picker_base.h
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
@@ -68,6 +69,7 @@ class DIALOG_COLOR_PICKER_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextOldColor;
wxStaticBitmap* m_OldColorRect;
wxStaticBitmap* m_NewColorRect;
+ wxTextCtrl* m_colorValue;
wxButton* m_resetToDefault;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
@@ -85,6 +87,7 @@ class DIALOG_COLOR_PICKER_BASE : public DIALOG_SHIM
virtual void OnChangeEditSat( wxSpinEvent& event ) { event.Skip(); }
virtual void OnChangeBrightness( wxScrollEvent& event ) { event.Skip(); }
virtual void OnChangeAlpha( wxScrollEvent& event ) { event.Skip(); }
+ virtual void OnColorValueText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetButton( wxCommandEvent& event ) { event.Skip(); }