diff --git a/share/ui/paint-strip.ui b/share/ui/paint-strip.ui index bd700e9d955af214b36c49c17d172f6a60cc03b8..4f1de81ee85dbe17e3770c8fc0e37c3c17c9d310 100644 --- a/share/ui/paint-strip.ui +++ b/share/ui/paint-strip.ui @@ -1,6 +1,6 @@ - + 0 @@ -25,25 +25,20 @@ 0 - - true - true + - - - - + + 4 + 0 + 16 + start + 16 - - - - 0 - 16 - 16 - - + + true + true diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp index ecf80c025570c9c3df534c3fe191ef08698ce53a..b1062bafa4b2d26173919182f016a100ade74438 100644 --- a/src/ui/widget/color-preview.cpp +++ b/src/ui/widget/color-preview.cpp @@ -42,8 +42,6 @@ void ColorPreview::construct() { } void ColorPreview::setRgba32(std::uint32_t const rgba) { - if (_rgba == rgba && !_pattern) return; - _rgba = rgba; _pattern = {}; _gradient.clear(); @@ -143,9 +141,6 @@ void ColorPreview::draw_func(Cairo::RefPtr const &cr, // if preview is disabled, render colors with reduced saturation and intensity if (disabled) { color = make_disabled_color(color, dark_theme); -// ======= -// auto color = Colors::Color(_rgba); -// rgba = rgb.toRGBA(); } width = rect.width() / 2; diff --git a/src/ui/widget/paint-attribute.cpp b/src/ui/widget/paint-attribute.cpp index 4a5687037882e1ea0ce801aca2457020ef9b3605..a6b1c6fafba82f98a3309f9075273f28404dc903 100644 --- a/src/ui/widget/paint-attribute.cpp +++ b/src/ui/widget/paint-attribute.cpp @@ -251,7 +251,6 @@ PaintAttribute::PaintStrip::PaintStrip(Glib::RefPtr builder, const _popover(get_widget(builder, "popup")), _color_preview(get_derived_widget(builder, "paint-color-preview")), _paint_icon(get_widget(builder, "paint-icon-preview")), - _stack(get_widget(builder, "paint-preview-stack")), _label(get_widget(builder, "paint-label")), _alpha(get_widget(builder, "paint-alpha")), _define(get_widget(builder, "paint-add")), @@ -496,6 +495,9 @@ void PaintAttribute::PaintStrip::set_preview(const SPIPaint& paint, double paint if (mode == PaintMode::Solid || mode == PaintMode::Swatch || mode == PaintMode::Gradient || mode == PaintMode::Pattern) { _alpha.set_value(paint_opacity); + _paint_icon.set_visible(false); + _color_preview.set_visible(); + if (mode == PaintMode::Solid) { auto color = paint.getColor(); color.setOpacity(paint_opacity); @@ -540,16 +542,18 @@ void PaintAttribute::PaintStrip::set_preview(const SPIPaint& paint, double paint gradient.push_back({stop.offset, SP_RGBA32_R_F(c), SP_RGBA32_G_F(c), SP_RGBA32_B_F(c), SP_RGBA32_A_F(c)}); } } + _paint_icon.set_from_icon_name(is(server) ? "paint-gradient-radial" : "paint-gradient-linear"); + _paint_icon.set_visible(); _color_preview.set_gradient(gradient); - _color_preview.setIndicator(is(server) ? ColorPreview::RadialGradient : ColorPreview::LinearGradient); + _color_preview.setIndicator(ColorPreview::None); } - _stack.set_visible_child(_color_preview); show(); } else { auto icon = get_paint_mode_icon(mode); _paint_icon.set_from_icon_name(icon); - _stack.set_visible_child(_paint_icon); + _paint_icon.set_visible(); + _color_preview.set_visible(false); show(); } } diff --git a/src/ui/widget/paint-attribute.h b/src/ui/widget/paint-attribute.h index 053f0e7a2ce952444f1416dbe8a07eb3f941713c..6f17b263f65811f5377b8cdb0cf2b20cc3393e4a 100644 --- a/src/ui/widget/paint-attribute.h +++ b/src/ui/widget/paint-attribute.h @@ -89,7 +89,6 @@ private: std::unique_ptr _switch; ColorPreview& _color_preview; Gtk::Image& _paint_icon; - Gtk::Stack& _stack; Gtk::Label& _label; InkSpinButton& _alpha; Gtk::Box& _box;