Commit 0d2d45c3 authored by Ell's avatar Ell

app: add config option to enable/disable layer-group previews

Preview generation for layer groups is more expensive than for
other types of drawables, mostly since we can't currently generate
layer-group previews asynchronously.  Add a preferences option for
enabling layer-group previews separately from the rest of the
layer/channel previews; both of these options are enabled by
default.  This can be desirable regardless of performance
considerations, since it makes layer groups easily distinguishable
from ordinary layers.

(cherry picked from commit 30cc85fd)
parent a3883e5d
......@@ -100,6 +100,7 @@ enum
PROP_FILTER_HISTORY_SIZE,
PROP_PLUGINRC_PATH,
PROP_LAYER_PREVIEWS,
PROP_GROUP_LAYER_PREVIEWS,
PROP_LAYER_PREVIEW_SIZE,
PROP_THUMBNAIL_SIZE,
PROP_THUMBNAIL_FILESIZE_LIMIT,
......@@ -567,6 +568,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_GROUP_LAYER_PREVIEWS,
"group-layer-previews",
"Layer group previews",
GROUP_LAYER_PREVIEWS_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_PREVIEW_SIZE,
"layer-preview-size",
"Layer preview size",
......@@ -942,6 +950,9 @@ gimp_core_config_set_property (GObject *object,
case PROP_LAYER_PREVIEWS:
core_config->layer_previews = g_value_get_boolean (value);
break;
case PROP_GROUP_LAYER_PREVIEWS:
core_config->group_layer_previews = g_value_get_boolean (value);
break;
case PROP_LAYER_PREVIEW_SIZE:
core_config->layer_preview_size = g_value_get_enum (value);
break;
......@@ -1147,6 +1158,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_LAYER_PREVIEWS:
g_value_set_boolean (value, core_config->layer_previews);
break;
case PROP_GROUP_LAYER_PREVIEWS:
g_value_set_boolean (value, core_config->group_layer_previews);
break;
case PROP_LAYER_PREVIEW_SIZE:
g_value_set_enum (value, core_config->layer_preview_size);
break;
......
......@@ -85,6 +85,7 @@ struct _GimpCoreConfig
gint filter_history_size;
gchar *plug_in_rc_path;
gboolean layer_previews;
gboolean group_layer_previews;
GimpViewSize layer_preview_size;
GimpThumbnailSize thumbnail_size;
guint64 thumbnail_filesize_limit;
......
......@@ -309,6 +309,10 @@ _("Sets whether GIMP should create previews of layers and channels. " \
"Previews in the layers and channels dialog are nice to have but they " \
"can slow things down when working with large images.")
#define GROUP_LAYER_PREVIEWS_BLURB \
_("Sets whether GIMP should create previews of layer groups. " \
"Layer group previews are more expensive than ordinary layer previews.")
#define LAYER_PREVIEW_SIZE_BLURB \
_("Sets the preview size used for layers and channel previews in newly " \
"created dialogs.")
......
......@@ -856,6 +856,9 @@ gimp_image_constructed (GObject *object)
g_signal_connect_object (config, "notify::layer-previews",
G_CALLBACK (gimp_viewable_size_changed),
image, G_CONNECT_SWAPPED);
g_signal_connect_object (config, "notify::group-layer-previews",
G_CALLBACK (gimp_viewable_size_changed),
image, G_CONNECT_SWAPPED);
gimp_container_add (image->gimp->images, GIMP_OBJECT (image));
}
......
......@@ -1745,9 +1745,17 @@ prefs_dialog_new (Gimp *gimp,
/* Previews */
vbox2 = prefs_frame_new (_("Previews"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (object, "layer-previews",
_("_Enable layer & channel previews"),
GTK_BOX (vbox2));
button = prefs_check_button_add (object, "layer-previews",
_("_Enable layer & channel previews"),
GTK_BOX (vbox2));
vbox3 = prefs_frame_new (NULL, GTK_CONTAINER (vbox2), FALSE);
g_object_bind_property (button, "active",
vbox3, "sensitive",
G_BINDING_SYNC_CREATE);
button = prefs_check_button_add (object, "group-layer-previews",
_("Enable layer group previews"),
GTK_BOX (vbox3));
table = prefs_table_new (3, GTK_CONTAINER (vbox2));
......
......@@ -27,7 +27,11 @@
#include "widgets-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "text/gimptextlayer.h"
......@@ -75,8 +79,16 @@ gimp_view_renderer_layer_render (GimpViewRenderer *renderer,
{
GimpContainer *children = gimp_viewable_get_children (renderer->viewable);
if (children && gimp_container_get_n_children (children) == 0)
icon_name = "folder";
if (children)
{
GimpItem *item = GIMP_ITEM (renderer->viewable);
GimpImage *image = gimp_item_get_image (item);
if (gimp_container_get_n_children (children) == 0)
icon_name = "folder";
else if (image && ! image->gimp->config->group_layer_previews)
icon_name = gimp_viewable_get_icon_name (renderer->viewable);
}
}
if (icon_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment