diff options
| author | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-04-03 07:12:40 +0000 |
|---|---|---|
| committer | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-04-25 01:44:10 +0000 |
| commit | d16a4890d0492626c04bdcefb9a5ce6ed5562755 (patch) | |
| tree | d2d296f62693145924dcb0ab3664025e7718963b /src | |
| parent | fix #175 crash with mask in <style> (diff) | |
| download | inkscape-d16a4890d0492626c04bdcefb9a5ce6ed5562755.tar.gz inkscape-d16a4890d0492626c04bdcefb9a5ce6ed5562755.zip | |
Change Alpha slider max from 255 to 100
Also stops normalising alpha values 0..1 to 0..100.
No longer necessary (useful when max value was 255).
Fixes https://gitlab.com/inkscape/inkscape/issues/165
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/widget/color-icc-selector.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/color-scales.cpp | 1 | ||||
| -rw-r--r-- | src/ui/widget/color-wheel-selector.cpp | 10 |
3 files changed, 3 insertions, 16 deletions
diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index 0970c779c..a8e1d255f 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -486,7 +486,7 @@ void ColorICCSelector::init() attachToGridOrTable(t, _impl->_label, 0, row, 1, 1); // Adjustment - _impl->_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 255.0, 1.0, 10.0, 10.0)); + _impl->_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 10.0, 10.0)); // Slider _impl->_slider = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(Glib::wrap(_impl->_adj, true))); @@ -941,12 +941,6 @@ void ColorICCSelectorImpl::_updateSliders(gint ignore) void ColorICCSelectorImpl::_adjustmentChanged(GtkAdjustment *adjustment, ColorICCSelectorImpl *cs) { -// // TODO check this. It looks questionable: -// // if a value is entered between 0 and 1 exclusive, normalize it to (int) 0..255 or 0..100 -// if (adjustment->value > 0.0 && adjustment->value < 1.0) { -// gtk_adjustment_set_value( adjustment, floor ((adjustment->value) * adjustment->upper + 0.5) ); -// } - #ifdef DEBUG_LCMS g_message("/^^^^^^^^^ %p::_adjustmentChanged()", cs); #endif // DEBUG_LCMS diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 588e9a84d..d68d19aec 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -376,6 +376,7 @@ void ColorScales::setMode(SPColorScalesMode mode) switch (mode) { case SP_COLOR_SCALES_MODE_RGB: _setRangeLimit(255.0); + gtk_adjustment_set_upper(_a[3], 100.0); gtk_label_set_markup_with_mnemonic(GTK_LABEL(_l[0]), _("_R:")); _s[0]->set_tooltip_text(_("Red")); gtk_widget_set_tooltip_text(_b[0], _("Red")); diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index 1c2660876..969530302 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -78,7 +78,7 @@ void ColorWheelSelector::_initUI() attach(*label, 0, row, 1, 1); /* Adjustment */ - _alpha_adjustment = Gtk::Adjustment::create(0.0, 0.0, 255.0, 1.0, 10.0, 10.0); + _alpha_adjustment = Gtk::Adjustment::create(0.0, 0.0, 100.0, 1.0, 10.0, 10.0); /* Slider */ _slider = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(_alpha_adjustment)); @@ -137,14 +137,6 @@ void ColorWheelSelector::_adjustmentChanged() return; } - // TODO check this. It looks questionable: - // if a value is entered between 0 and 1 exclusive, normalize it to (int) 0..255 or 0..100 - gdouble value = _alpha_adjustment->get_value(); - gdouble upper = _alpha_adjustment->get_upper(); - if (value > 0.0 && value < 1.0) { - _alpha_adjustment->set_value(floor(value * upper + 0.5)); - } - _color.preserveICC(); _color.setAlpha(ColorScales::getScaled(_alpha_adjustment->gobj())); } |
