[gimp] app, libgimpbase: improve preferences and checkboard defaults.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimpbase: improve preferences and checkboard defaults.
- Date: Sat, 14 May 2022 14:36:59 +0000 (UTC)
commit 916c5f9d111cb3970a8a0d9aab3f6477053ce4d9
Author: Jehan <jehan girinstud io>
Date: Sat May 14 00:57:23 2022 +0200
app, libgimpbase: improve preferences and checkboard defaults.
- Slightly nicer layout for the checkboard color widgets.
- Also set the 2 color widgets insensitive when the check type is not
GIMP_CHECK_TYPE_CUSTOM_CHECKS.
- Default the custom colors to the same colors as the basic default
grayscale. I mean, red and blue defaults are fun and all, but that's
like radioactive colors burning the eyes! Ahahah!
- Unlike the gimp-2-10 commit (cf. !274), on the main dev branch, use
the new GimpLabelColor widget.
Fixed Conflicts from !274:
app/dialogs/preferences-dialog.c
app/dialogs/preferences-dialog.c | 58 +++++++++++++++++++++++++++-------------
libgimpbase/gimpchecks.h | 29 ++++++++++----------
2 files changed, 54 insertions(+), 33 deletions(-)
---
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 4965ba4914..d70f9687e1 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -139,6 +139,9 @@ static void prefs_help_language_change_callback (GtkComboBox *combo,
Gimp *gimp);
static void prefs_help_language_change_callback2 (GtkComboBox *combo,
GtkContainer *box);
+static void prefs_check_style_callback (GObject *config,
+ GParamSpec *pspec,
+ GtkWidget *widget);
/* private variables */
@@ -916,6 +919,17 @@ prefs_help_language_change_callback2 (GtkComboBox *combo,
g_list_free (children);
}
+static void
+prefs_check_style_callback (GObject *config,
+ GParamSpec *pspec,
+ GtkWidget *widget)
+{
+ GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (config);
+
+ gtk_widget_set_sensitive (widget,
+ display_config->transparency_type == GIMP_CHECK_TYPE_CUSTOM_CHECKS);
+}
+
static void
prefs_format_string_select_callback (GtkListBox *listbox,
GtkListBoxRow *row,
@@ -2727,29 +2741,35 @@ prefs_dialog_new (Gimp *gimp,
_("_Check style:"),
GTK_GRID (grid), 0, size_group);
- button = gimp_prop_color_button_new (object,
- "transparency-custom-color1",
- _("Transparency Custom Color 1"),
- PREFS_COLOR_BUTTON_WIDTH,
- PREFS_COLOR_BUTTON_HEIGHT,
- GIMP_COLOR_AREA_FLAT);
+ button = gimp_prop_label_color_new (object,
+ "transparency-custom-color1",
+ TRUE);
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
- _("_Custom color 1:"), 0.0, 0.5,
+ NULL, 0.0, 0.5,
button, 1);
- gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
- gimp_get_user_context (gimp));
-
- button = gimp_prop_color_button_new (object,
- "transparency-custom-color2",
- _("Transparency Custom Color 2"),
- PREFS_COLOR_BUTTON_WIDTH,
- PREFS_COLOR_BUTTON_HEIGHT,
- GIMP_COLOR_AREA_FLAT);
+ gtk_widget_set_hexpand (button, FALSE);
+ gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (gimp_label_color_get_color_widget (GIMP_LABEL_COLOR
(button))),
+ gimp->config->color_management);
+ gtk_widget_set_sensitive (button,
+ display_config->transparency_type == GIMP_CHECK_TYPE_CUSTOM_CHECKS);
+ g_signal_connect (object, "notify::transparency-type",
+ G_CALLBACK (prefs_check_style_callback),
+ button);
+
+ button = gimp_prop_label_color_new (object,
+ "transparency-custom-color2",
+ TRUE);
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 2,
- _("_Custom color 2:"), 0.0, 0.5,
+ NULL, 0.0, 0.5,
button, 1);
- gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
- gimp_get_user_context (gimp));
+ gtk_widget_set_hexpand (button, FALSE);
+ gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (gimp_label_color_get_color_widget (GIMP_LABEL_COLOR
(button))),
+ gimp->config->color_management);
+ gtk_widget_set_sensitive (button,
+ display_config->transparency_type == GIMP_CHECK_TYPE_CUSTOM_CHECKS);
+ g_signal_connect (object, "notify::transparency-type",
+ G_CALLBACK (prefs_check_style_callback),
+ button);
prefs_enum_combo_box_add (object, "transparency-size", 0, 0,
_("Check _size:"),
diff --git a/libgimpbase/gimpchecks.h b/libgimpbase/gimpchecks.h
index f188aa2119..adea3e0953 100644
--- a/libgimpbase/gimpchecks.h
+++ b/libgimpbase/gimpchecks.h
@@ -57,20 +57,6 @@ G_BEGIN_DECLS
**/
#define GIMP_CHECK_LIGHT 0.6
-/**
- * GIMP_CHECKS_CUSTOM_COLOR1:
- *
- * The default color 1 for the custom checkerboard type.
- **/
-#define GIMP_CHECKS_CUSTOM_COLOR1 ((GimpRGB) { 1.0, 0.0, 0.0, 1.0 })
-
-/**
- * GIMP_CHECKS_CUSTOM_COLOR2:
- *
- * The default color 2 for the custom checkerboard type.
- **/
-#define GIMP_CHECKS_CUSTOM_COLOR2 ((GimpRGB) { 0.0, 1.0, 0.0, 1.0 })
-
/**
* GIMP_CHECKS_LIGHT_COLOR_DARK:
*
@@ -134,6 +120,21 @@ G_BEGIN_DECLS
**/
#define GIMP_CHECKS_BLACK_COLOR ((GimpRGB) { 0.0, 0.0, 0.0, 1.0 })
+/**
+ * GIMP_CHECKS_CUSTOM_COLOR1:
+ *
+ * The default color 1 for the custom checkerboard type.
+ **/
+#define GIMP_CHECKS_CUSTOM_COLOR1 GIMP_CHECKS_GRAY_COLOR_LIGHT
+
+/**
+ * GIMP_CHECKS_CUSTOM_COLOR2:
+ *
+ * The default color 2 for the custom checkerboard type.
+ **/
+#define GIMP_CHECKS_CUSTOM_COLOR2 GIMP_CHECKS_GRAY_COLOR_DARK
+
+
GIMP_DEPRECATED_FOR(gimp_checks_get_colors)
void gimp_checks_get_shades (GimpCheckType type,
guchar *light,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]