83 _book = Gtk::make_managed<Gtk::Stack>();
84 _book->set_transition_type(Gtk::StackTransitionType::CROSSFADE);
85 _book->set_transition_duration(130);
86 _book->set_vhomogeneous(
false);
89 _switcher = Gtk::make_managed<Gtk::StackSwitcher>();
94 _switcher->set_halign(Gtk::Align::CENTER);
100 _combo = Gtk::make_managed<IconComboBox>();
101 _combo->set_focusable(
false);
103 _combo->set_tooltip_text(_(
"Choose style of color selection"));
110 _label = Gtk::make_managed<Gtk::Label>();
130 _book->set_hexpand();
131 _book->set_vexpand();
132 attach(*
_book, 0, row, 2, 1);
136 Glib::ustring page_name = prefs->
getString(
"/colorselector/page",
"");
146 GtkWidget *rgbabox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
147 auto const rgbabox_box = GTK_BOX(rgbabox);
151 gtk_widget_set_tooltip_text(
_colormanaged, _(
"Color Managed"));
156 gtk_widget_set_tooltip_text(
_outofgamut, _(
"Out of gamut!"));
161 gtk_widget_set_tooltip_text(
_toomuchink, _(
"Too much ink!"));
167 gtk_button_set_has_frame(GTK_BUTTON(
_btn_picker),
false);
168 gtk_button_set_icon_name(GTK_BUTTON(
_btn_picker),
"color-picker");
169 gtk_widget_set_tooltip_text(
_btn_picker, _(
"Pick colors from image"));
173 auto const pick_under = Gtk::make_managed<Gtk::Button>();
174 pick_under->set_has_frame(
false);
175 pick_under->set_action_name(
"app.chameleon-fill");
176 pick_under->set_icon_name(
"color-picker-chameleon");
177 pick_under->set_tooltip_text(_(
"Chameleon Fill"));
178 gtk_box_append(rgbabox_box, GTK_WIDGET(pick_under->gobj()));
181 _rgbal = gtk_label_new_with_mnemonic(_(
"RGBA"));
182 gtk_widget_set_halign(
_rgbal, GTK_ALIGN_END);
183 gtk_widget_set_hexpand(
_rgbal, TRUE);
184 gtk_box_append(rgbabox_box,
_rgbal);
186 auto const rgba_entry = Gtk::make_managed<ColorEntry>(
_colors);
187 rgba_entry->set_max_width_chars(8);
188 auto const rgba_entry_widget = rgba_entry->Gtk::Widget::gobj();
190 gtk_box_append(rgbabox_box, rgba_entry_widget);
191 gtk_label_set_mnemonic_widget(GTK_LABEL(
_rgbal), rgba_entry_widget);
196 gtk_widget_set_margin_start(rgbabox,
XPAD);
197 gtk_widget_set_margin_end(rgbabox,
XPAD);
198 gtk_widget_set_margin_top(rgbabox,
YPAD);
199 gtk_widget_set_margin_bottom(rgbabox,
YPAD);
200 attach(*Glib::wrap(rgbabox), 0, row, 2, 1);
203 _book->property_visible_child_name().signal_changed().connect([
this]() {
205 Glib::ustring
name =
_book->get_visible_child_name();
206 if (get_visible() && !
name.empty() &&
name !=
"CMS") {
207 Inkscape::Preferences *prefs = Inkscape::Preferences::get();
208 prefs->setString(
"/colorselector/page", name);
213 _p = sp_color_preview_new(0xffffffff);
214 gtk_widget_set_visible(
_p,
true);
215 attach(*Glib::wrap(
_p), 2, 3, row, row + 1, Gtk::FILL, Gtk::FILL,
XPAD,
YPAD);
299 auto selector_widget = Gtk::make_managed<ColorPage>(space,
_colors);
300 auto mode_name = space->getName();
301 _book->add(*selector_widget, mode_name, mode_name);
304 auto const page_num = n_pages - 1;
308 auto obs = prefs->createObserver(space->getPrefsPath() +
"visible", [
this,selector_widget,page_num](
const Preferences::Entry& value) {
309 _combo->set_row_visible(page_num, value.getBool());
310 selector_widget->set_visible(value.getBool());
Data type representing a typeless value of a preference.
bool getBool(bool def=false) const
Interpret the preference as a Boolean value.
Entry widget for typing color value in css form.
Build a set of color sliders for a given color space.
void pack_end(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the end of box.
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.