1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 05:22:40 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Alx Sa
5655e63a4f menu: Add option to change transparency type in View menu
This allows quicker access rather than repeatedly going to the Preferences dialogue.
2024-08-11 19:52:16 +00:00
5 changed files with 90 additions and 0 deletions

View File

@@ -588,6 +588,51 @@ static const GimpToggleActionEntry view_padding_color_toggle_actions[] =
GIMP_HELP_VIEW_PADDING_COLOR }
};
static const GimpEnumActionEntry view_check_style_actions[] =
{
{ "view-check-style-light-checks", NULL,
NC_("view-check-style", "_Light checks"), NULL, { NULL },
NC_("view-check-style", "Use light check style for transparency"),
GIMP_CHECK_TYPE_LIGHT_CHECKS, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-midtone-checks", NULL,
NC_("view-check-style", "_Mid-tone checks"), NULL, { NULL },
NC_("view-check-style", "Use mid-tone check style for transparency"),
GIMP_CHECK_TYPE_GRAY_CHECKS, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-dark-checks", NULL,
NC_("view-check-style", "_Dark checks"), NULL, { NULL },
NC_("view-check-style", "Use dark check style for transparency"),
GIMP_CHECK_TYPE_DARK_CHECKS, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-white-checks", NULL,
NC_("view-check-style", "_White only"), NULL, { NULL },
NC_("view-check-style", "Use solid white for transparency"),
GIMP_CHECK_TYPE_WHITE_ONLY, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-gray-checks", NULL,
NC_("view-check-style", "_Gray only"), NULL, { NULL },
NC_("view-check-style", "Use solid gray for transparency"),
GIMP_CHECK_TYPE_GRAY_ONLY, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-black-checks", NULL,
NC_("view-check-style", "_Black only"), NULL, { NULL },
NC_("view-check-style", "Use solid black for transparency"),
GIMP_CHECK_TYPE_BLACK_ONLY, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE },
{ "view-check-style-custom-checks", NULL,
NC_("view-check-style", "_Custom checks"), NULL, { NULL },
NC_("view-check-style", "Use custom check colors for transparency"),
GIMP_CHECK_TYPE_CUSTOM_CHECKS, FALSE,
GIMP_HELP_VIEW_CHECK_STYLE }
};
static const GimpEnumActionEntry view_scroll_horizontal_actions[] =
{
{ "view-scroll-horizontal", NULL,
@@ -716,6 +761,11 @@ view_actions_setup (GimpActionGroup *group)
view_padding_color_toggle_actions,
G_N_ELEMENTS (view_padding_color_toggle_actions));
gimp_action_group_add_enum_actions (group, "view-check-style",
view_check_style_actions,
G_N_ELEMENTS (view_check_style_actions),
view_check_style_cmd_callback);
gimp_action_group_add_enum_actions (group, "view-action",
view_scroll_horizontal_actions,
G_N_ELEMENTS (view_scroll_horizontal_actions),
@@ -954,6 +1004,14 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-padding-color-in-show-all", image);
SET_ACTIVE ("view-padding-color-in-show-all", display && options->padding_in_show_all);
SET_SENSITIVE ("view-check-style-light-checks", image);
SET_SENSITIVE ("view-check-style-midtone-checks", image);
SET_SENSITIVE ("view-check-style-dark-checks", image);
SET_SENSITIVE ("view-check-style-white-checks", image);
SET_SENSITIVE ("view-check-style-gray-checks", image);
SET_SENSITIVE ("view-check-style-black-checks", image);
SET_SENSITIVE ("view-check-style-custom-checks", image);
SET_SENSITIVE ("view-show-menubar", image);
SET_ACTIVE ("view-show-menubar", display && options->show_menubar);
SET_SENSITIVE ("view-show-rulers", image);

View File

@@ -1120,6 +1120,22 @@ view_padding_color_cmd_callback (GimpAction *action,
}
}
void
view_check_style_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data)
{
GimpCheckType check_style;
GimpDisplay *display;
return_if_no_display (display, data);
check_style = (GimpCheckType) g_variant_get_int32 (value);
g_object_set (display->config,
"transparency-type", check_style,
NULL);
}
void
view_padding_color_in_show_all_cmd_callback (GimpAction *action,
GVariant *value,

View File

@@ -166,6 +166,9 @@ void view_snap_to_equidistance_cmd_callback (GimpAction *action,
void view_padding_color_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data);
void view_check_style_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data);
void view_padding_color_in_show_all_cmd_callback (GimpAction *action,
GVariant *value,
gpointer data);

View File

@@ -121,6 +121,7 @@
#define GIMP_HELP_VIEW_SHOW_SCROLLBARS "gimp-view-show-scrollbars"
#define GIMP_HELP_VIEW_SHOW_STATUSBAR "gimp-view-show-statusbar"
#define GIMP_HELP_VIEW_PADDING_COLOR "gimp-view-padding-color"
#define GIMP_HELP_VIEW_CHECK_STYLE "gimp-view-check-style"
#define GIMP_HELP_VIEW_SHRINK_WRAP "gimp-view-shrink-wrap"
#define GIMP_HELP_VIEW_FULLSCREEN "gimp-view-fullscreen"
#define GIMP_HELP_VIEW_CHANGE_SCREEN "gimp-view-change-screen"

View File

@@ -295,6 +295,18 @@
<item><attribute name="action">app.view-padding-color-prefs</attribute></item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes" context="view-action">Check St_yle</attribute>
<section>
<item><attribute name="action">app.view-check-style-light-checks</attribute></item>
<item><attribute name="action">app.view-check-style-midtone-checks</attribute></item>
<item><attribute name="action">app.view-check-style-dark-checks</attribute></item>
<item><attribute name="action">app.view-check-style-white-checks</attribute></item>
<item><attribute name="action">app.view-check-style-gray-checks</attribute></item>
<item><attribute name="action">app.view-check-style-black-checks</attribute></item>
<item><attribute name="action">app.view-check-style-custom-checks</attribute></item>
</section>
</submenu>
<item><attribute name="action">app.view-show-menubar</attribute></item>
<item><attribute name="action">app.view-show-rulers</attribute></item>
<item><attribute name="action">app.view-show-scrollbars</attribute></item>