From a6b3ec9cdaf7867d6b02da3122ab4c06bf2246a5 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Fri, 1 Apr 2016 09:35:30 -0400 Subject: Fix regression in swatch color selection and improve it by allowing drag to change the swatch color too. Fixed bugs: - https://launchpad.net/bugs/1564597 (bzr r14757) --- src/widgets/swatch-selector.cpp | 48 +++++------------------------------------ 1 file changed, 5 insertions(+), 43 deletions(-) (limited to 'src/widgets/swatch-selector.cpp') diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index 6f2807255..b9cce1d19 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -37,10 +37,11 @@ SwatchSelector::SwatchSelector() : color_selector->show(); pack_start(*color_selector); - _selected_color.signal_grabbed.connect(sigc::mem_fun(this, &SwatchSelector::_grabbedCb)); - _selected_color.signal_dragged.connect(sigc::mem_fun(this, &SwatchSelector::_draggedCb)); - _selected_color.signal_released.connect(sigc::mem_fun(this, &SwatchSelector::_releasedCb)); - _selected_color.signal_changed.connect(sigc::mem_fun(this, &SwatchSelector::_changedCb)); + //_selected_color.signal_grabbed.connect(sigc::mem_fun(this, &SwatchSelector::_grabbedCb)); + _selected_color.signal_dragged.connect(sigc::mem_fun(this, &SwatchSelector::_changedCb)); + _selected_color.signal_released.connect(sigc::mem_fun(this, &SwatchSelector::_changedCb)); + // signal_changed doesn't get called if updating shape with colour. + //_selected_color.signal_changed.connect(sigc::mem_fun(this, &SwatchSelector::_changedCb)); } SwatchSelector::~SwatchSelector() @@ -53,45 +54,6 @@ SPGradientSelector *SwatchSelector::getGradientSelector() return _gsel; } -void SwatchSelector::_grabbedCb() -{ -} - -void SwatchSelector::_draggedCb() -{ - // if (data) { - //SwatchSelector *swsel = reinterpret_cast(data); - - // TODO might have to block cycles - - // Copied from gradient-vector.cpp, but does not appear to cause visible changes: - /* - if (swsel->_gsel) { - SPGradient *gradient = swsel->_gsel->getVector(); - SPGradient *ngr = sp_gradient_ensure_vector_normalized(gradient); - if (ngr != gradient) { - // Our master gradient has changed - // TODO replace with proper - sp_gradient_vector_widget_load_gradient(GTK_WIDGET(swsel->_gsel), ngr); - } - - sp_gradient_ensure_vector(ngr); - - - SPStop* stop = ngr->getFirstStop(); - if (stop) { - swsel->_csel->base->getColorAlpha(stop->specified_color, &stop->opacity); - stop->currentColor = false; - // TODO push refresh - } - } - */ - // } -} - -void SwatchSelector::_releasedCb() -{ -} - void SwatchSelector::_changedCb() { if (_updating_color) { -- cgit v1.2.3