mirror of https://github.com/GNOME/gimp.git
added a read-only property for the display's image, so it can be retreived
2002-05-10 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplay.c: added a read-only property for the display's image, so it can be retreived by the core, which treats displays as simple GimpObjects. * app/core/gimpcontext.c: made context->display an object property, not just gpointer. Connect to the "remove" signal of gimp->displays to get notified of disappearing displays. Removed the EEKWrapper and get the display's gimage with g_object_get(). * app/widgets/gimpimagedock.[ch]: added image_dock->display_container and require it being passed in the constructor. Do voodoo things in the "image_changed" and "display_changed" callbacks to ensure that the dock doesn't end up with no display even if the active image has one. Added a style property for the image menu's preview size. * app/gui/dialogs-commands.c (dialogs_menu_update): set the "View as List" and "View as Grid" items insensitive if the other view type doesn't exist. Hide them if the view cannot be classified as "list" or "grid" at all. Also hide the "Preview Size" submenu if it's pointless for the view. * app/gui/dialogs-constructors.c: added a special tab for the navigation dialog. Will propbaby add dockable->stock_id to generalize this kind of tab. Pass gimp->displays to gimp_image_dock_new(). * app/gui/menus.c: reordered the "<Dialogs>" factory entries, added more stock icons, cleanup. * etc/gtkrc_user * themes/Default/gtkrc: document usage of GimpImageDock's "menu_preview_height" property.
This commit is contained in:
parent
f4ce6a9ee3
commit
359990db33
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
2002-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplay.c: added a read-only property for the
|
||||
display's image, so it can be retreived by the core, which
|
||||
treats displays as simple GimpObjects.
|
||||
|
||||
* app/core/gimpcontext.c: made context->display an object
|
||||
property, not just gpointer. Connect to the "remove" signal of
|
||||
gimp->displays to get notified of disappearing displays. Removed
|
||||
the EEKWrapper and get the display's gimage with g_object_get().
|
||||
|
||||
* app/widgets/gimpimagedock.[ch]: added image_dock->display_container
|
||||
and require it being passed in the constructor. Do voodoo things
|
||||
in the "image_changed" and "display_changed" callbacks to ensure
|
||||
that the dock doesn't end up with no display even if the active
|
||||
image has one. Added a style property for the image menu's preview
|
||||
size.
|
||||
|
||||
* app/gui/dialogs-commands.c (dialogs_menu_update): set the
|
||||
"View as List" and "View as Grid" items insensitive if the
|
||||
other view type doesn't exist. Hide them if the view cannot
|
||||
be classified as "list" or "grid" at all. Also hide the
|
||||
"Preview Size" submenu if it's pointless for the view.
|
||||
|
||||
* app/gui/dialogs-constructors.c: added a special tab for the
|
||||
navigation dialog. Will propbaby add dockable->stock_id to
|
||||
generalize this kind of tab. Pass gimp->displays to
|
||||
gimp_image_dock_new().
|
||||
|
||||
* app/gui/menus.c: reordered the "<Dialogs>" factory entries,
|
||||
added more stock icons, cleanup.
|
||||
|
||||
* etc/gtkrc_user
|
||||
* themes/Default/gtkrc: document usage of GimpImageDock's
|
||||
"menu_preview_height" property.
|
||||
|
||||
2002-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpnavigationview.c: pack the preview's alignment
|
||||
|
|
|
@ -169,7 +169,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
if (entry)
|
||||
{
|
||||
gchar *identifier;
|
||||
gchar *substring;
|
||||
gchar *substring = NULL;
|
||||
|
||||
identifier = g_strdup (entry->identifier);
|
||||
|
||||
|
@ -184,7 +184,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
memcpy (substring, "grid", 4);
|
||||
}
|
||||
|
||||
if (strcmp (entry->identifier, identifier))
|
||||
if (substring)
|
||||
{
|
||||
GimpContainerView *old_view;
|
||||
GtkWidget *new_dockable;
|
||||
|
@ -417,8 +417,9 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
gint page_num;
|
||||
GimpDialogFactoryEntry *entry;
|
||||
GimpContainerView *view;
|
||||
gboolean is_grid = FALSE;
|
||||
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
|
||||
GimpViewType view_type = -1;
|
||||
gboolean other_view_type = FALSE;
|
||||
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
|
||||
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
||||
|
||||
|
@ -430,66 +431,100 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
|
||||
if (entry)
|
||||
{
|
||||
if (strstr (entry->identifier, "grid"))
|
||||
is_grid = TRUE;
|
||||
gchar *identifier;
|
||||
gchar *substring = NULL;
|
||||
|
||||
identifier = g_strdup (entry->identifier);
|
||||
|
||||
if ((substring = strstr (identifier, "grid")))
|
||||
view_type = GIMP_VIEW_TYPE_GRID;
|
||||
else if ((substring = strstr (identifier, "list")))
|
||||
view_type = GIMP_VIEW_TYPE_LIST;
|
||||
|
||||
if (substring)
|
||||
{
|
||||
if (view_type == GIMP_VIEW_TYPE_GRID)
|
||||
memcpy (substring, "list", 4);
|
||||
else if (view_type == GIMP_VIEW_TYPE_LIST)
|
||||
memcpy (substring, "grid", 4);
|
||||
|
||||
if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory,
|
||||
identifier))
|
||||
other_view_type = TRUE;
|
||||
}
|
||||
|
||||
g_free (identifier);
|
||||
}
|
||||
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view)
|
||||
{
|
||||
preview_size = view->preview_size;
|
||||
}
|
||||
preview_size = view->preview_size;
|
||||
|
||||
#define SET_ACTIVE(path,active) \
|
||||
gimp_item_factory_set_active (factory, (path), (active))
|
||||
#define SET_VISIBLE(path,active) \
|
||||
gimp_item_factory_set_visible (factory, (path), (active))
|
||||
#define SET_SENSITIVE(path,sensitive) \
|
||||
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
|
||||
|
||||
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
SET_VISIBLE ("/view-type-separator",
|
||||
preview_size != GIMP_PREVIEW_SIZE_NONE || view_type != -1);
|
||||
|
||||
SET_VISIBLE ("/Preview Size", preview_size != GIMP_PREVIEW_SIZE_NONE);
|
||||
|
||||
if (preview_size != GIMP_PREVIEW_SIZE_NONE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Huge", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Medium", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
|
||||
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Huge", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Medium", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_TINY)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_grid)
|
||||
SET_VISIBLE ("/View as Grid", view_type != -1);
|
||||
SET_VISIBLE ("/View as List", view_type != -1);
|
||||
|
||||
if (view_type != -1)
|
||||
{
|
||||
SET_ACTIVE ("/View as Grid", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_ACTIVE ("/View as List", TRUE);
|
||||
if (view_type == GIMP_VIEW_TYPE_LIST)
|
||||
SET_ACTIVE ("/View as List", TRUE);
|
||||
else
|
||||
SET_ACTIVE ("/View as Grid", TRUE);
|
||||
|
||||
SET_SENSITIVE ("/View as Grid", other_view_type);
|
||||
SET_SENSITIVE ("/View as List", other_view_type);
|
||||
}
|
||||
|
||||
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
|
||||
|
@ -512,5 +547,6 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
|
||||
#undef SET_ACTIVE
|
||||
#undef SET_VISIBLE
|
||||
#undef SET_SENSITIVE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,9 @@ static void gimp_context_copy_image (GimpContext *src,
|
|||
GimpContext *dest);
|
||||
|
||||
/* display */
|
||||
static void gimp_context_display_removed (GimpContainer *container,
|
||||
gpointer display,
|
||||
GimpContext *context);
|
||||
static void gimp_context_real_set_display (GimpContext *context,
|
||||
gpointer display);
|
||||
static void gimp_context_copy_display (GimpContext *src,
|
||||
|
@ -395,9 +398,9 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpContextClass, display_changed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__POINTER,
|
||||
gimp_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
GIMP_TYPE_OBJECT);
|
||||
|
||||
gimp_context_signals[TOOL_CHANGED] =
|
||||
g_signal_new (gimp_context_signal_names[TOOL_CHANGED],
|
||||
|
@ -556,9 +559,10 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DISPLAY,
|
||||
g_param_spec_pointer (gimp_context_prop_names[DISPLAY_CHANGED],
|
||||
NULL, NULL,
|
||||
G_PARAM_READWRITE));
|
||||
g_param_spec_object (gimp_context_prop_names[DISPLAY_CHANGED],
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_OBJECT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_TOOL,
|
||||
|
@ -799,7 +803,7 @@ gimp_context_set_property (GObject *object,
|
|||
gimp_context_set_image (context, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_DISPLAY:
|
||||
gimp_context_set_display (context, g_value_get_pointer (value));
|
||||
gimp_context_set_display (context, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_TOOL:
|
||||
gimp_context_set_tool (context, g_value_get_object (value));
|
||||
|
@ -859,7 +863,7 @@ gimp_context_get_property (GObject *object,
|
|||
g_value_set_object (value, gimp_context_get_image (context));
|
||||
break;
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_pointer (value, gimp_context_get_display (context));
|
||||
g_value_set_object (value, gimp_context_get_display (context));
|
||||
break;
|
||||
case PROP_TOOL:
|
||||
g_value_set_object (value, gimp_context_get_tool (context));
|
||||
|
@ -947,6 +951,10 @@ gimp_context_new (Gimp *gimp,
|
|||
G_CALLBACK (gimp_context_image_removed),
|
||||
G_OBJECT (context),
|
||||
0);
|
||||
g_signal_connect_object (G_OBJECT (gimp->displays), "remove",
|
||||
G_CALLBACK (gimp_context_display_removed),
|
||||
G_OBJECT (context),
|
||||
0);
|
||||
|
||||
g_signal_connect_object (G_OBJECT (gimp->tool_info_list), "remove",
|
||||
G_CALLBACK (gimp_context_tool_removed),
|
||||
|
@ -1367,61 +1375,34 @@ gimp_context_display_changed (GimpContext *context)
|
|||
context->display);
|
||||
}
|
||||
|
||||
/* handle dissapearing displays */
|
||||
/* handle disappearing displays */
|
||||
static void
|
||||
gimp_context_display_destroy (GObject *disp_shell,
|
||||
GimpContext *context)
|
||||
gimp_context_display_removed (GimpContainer *container,
|
||||
gpointer display,
|
||||
GimpContext *context)
|
||||
{
|
||||
context->display = NULL;
|
||||
|
||||
gimp_context_real_set_image (context, NULL);
|
||||
|
||||
gimp_context_display_changed (context);
|
||||
if (context->display == display)
|
||||
gimp_context_real_set_display (context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_real_set_display (GimpContext *context,
|
||||
gpointer display)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: EEKWrapper
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
GimpObject foo;
|
||||
gint bar;
|
||||
GimpImage *gimage;
|
||||
gint baz;
|
||||
GObject *shell;
|
||||
} EEKWrapper;
|
||||
|
||||
EEKWrapper *eek_wrapper;
|
||||
|
||||
if (context->display == display)
|
||||
return;
|
||||
|
||||
if (context->display)
|
||||
{
|
||||
eek_wrapper = (EEKWrapper *) context->display;
|
||||
|
||||
if (G_IS_OBJECT (eek_wrapper->shell))
|
||||
g_signal_handlers_disconnect_by_func (eek_wrapper->shell,
|
||||
gimp_context_display_destroy,
|
||||
context);
|
||||
}
|
||||
|
||||
context->display = display;
|
||||
|
||||
if (context->display)
|
||||
{
|
||||
eek_wrapper = (EEKWrapper *) context->display;
|
||||
GimpImage *gimage;
|
||||
|
||||
g_signal_connect_object (G_OBJECT (eek_wrapper->shell), "destroy",
|
||||
G_CALLBACK (gimp_context_display_destroy),
|
||||
G_OBJECT (context),
|
||||
0);
|
||||
g_object_get (display, "image", &gimage, NULL);
|
||||
|
||||
gimp_context_real_set_image (context, eek_wrapper->gimage);
|
||||
gimp_context_real_set_image (context, gimage);
|
||||
|
||||
g_object_unref (G_OBJECT (gimage));
|
||||
}
|
||||
|
||||
gimp_context_display_changed (context);
|
||||
|
|
|
@ -47,12 +47,27 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_IMAGE
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_class_init (GimpDisplayClass *klass);
|
||||
static void gimp_display_init (GimpDisplay *gdisp);
|
||||
|
||||
static void gimp_display_finalize (GObject *object);
|
||||
static void gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_display_flush_whenever (GimpDisplay *gdisp,
|
||||
gboolean now);
|
||||
|
@ -106,7 +121,15 @@ gimp_display_class_init (GimpDisplayClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_display_finalize;
|
||||
object_class->finalize = gimp_display_finalize;
|
||||
object_class->set_property = gimp_display_set_property;
|
||||
object_class->get_property = gimp_display_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IMAGE,
|
||||
g_param_spec_object ("image",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_IMAGE,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -135,13 +158,53 @@ gimp_display_finalize (GObject *object)
|
|||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (object));
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_value_set_object (value, gdisp->gimage);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_new (GimpImage *gimage,
|
||||
guint scale)
|
||||
|
|
|
@ -117,6 +117,9 @@ static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
|||
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_navigation_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size);
|
||||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -266,7 +269,9 @@ dialogs_dock_new (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return gimp_image_dock_new (factory, context->gimp->images);
|
||||
return gimp_image_dock_new (factory,
|
||||
context->gimp->images,
|
||||
context->gimp->displays);
|
||||
}
|
||||
|
||||
|
||||
|
@ -929,7 +934,7 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
NULL,
|
||||
dialogs_navigation_tab_func,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
@ -1146,6 +1151,62 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
return hbox;
|
||||
}
|
||||
|
||||
static GtkIconSize
|
||||
gimp_preview_size_to_gtk_icon_size (GimpPreviewSize preview_size)
|
||||
{
|
||||
GtkIconSize gtk_size;
|
||||
gint width, height;
|
||||
GtkIconSize best_match;
|
||||
gint diff;
|
||||
|
||||
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
|
||||
|
||||
best_match = GTK_ICON_SIZE_MENU;
|
||||
diff = abs (preview_size - height);
|
||||
|
||||
for (gtk_size = GTK_ICON_SIZE_MENU + 1;
|
||||
gtk_size <= GTK_ICON_SIZE_DIALOG;
|
||||
gtk_size++)
|
||||
{
|
||||
if (gtk_icon_size_lookup (gtk_size, &width, &height))
|
||||
{
|
||||
if (abs (preview_size - height) < diff)
|
||||
{
|
||||
best_match = gtk_size;
|
||||
diff = abs (preview_size - height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best_match;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_navigation_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_MOVE,
|
||||
gimp_preview_size_to_gtk_icon_size (size));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
label = gtk_label_new (dockable->short_name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
|
|
|
@ -47,12 +47,27 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_IMAGE
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_class_init (GimpDisplayClass *klass);
|
||||
static void gimp_display_init (GimpDisplay *gdisp);
|
||||
|
||||
static void gimp_display_finalize (GObject *object);
|
||||
static void gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_display_flush_whenever (GimpDisplay *gdisp,
|
||||
gboolean now);
|
||||
|
@ -106,7 +121,15 @@ gimp_display_class_init (GimpDisplayClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_display_finalize;
|
||||
object_class->finalize = gimp_display_finalize;
|
||||
object_class->set_property = gimp_display_set_property;
|
||||
object_class->get_property = gimp_display_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IMAGE,
|
||||
g_param_spec_object ("image",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_IMAGE,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -135,13 +158,53 @@ gimp_display_finalize (GObject *object)
|
|||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (object));
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
gdisp = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE:
|
||||
g_value_set_object (value, gdisp->gimage);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_new (GimpImage *gimage,
|
||||
guint scale)
|
||||
|
|
|
@ -169,7 +169,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
if (entry)
|
||||
{
|
||||
gchar *identifier;
|
||||
gchar *substring;
|
||||
gchar *substring = NULL;
|
||||
|
||||
identifier = g_strdup (entry->identifier);
|
||||
|
||||
|
@ -184,7 +184,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
memcpy (substring, "grid", 4);
|
||||
}
|
||||
|
||||
if (strcmp (entry->identifier, identifier))
|
||||
if (substring)
|
||||
{
|
||||
GimpContainerView *old_view;
|
||||
GtkWidget *new_dockable;
|
||||
|
@ -417,8 +417,9 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
gint page_num;
|
||||
GimpDialogFactoryEntry *entry;
|
||||
GimpContainerView *view;
|
||||
gboolean is_grid = FALSE;
|
||||
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
|
||||
GimpViewType view_type = -1;
|
||||
gboolean other_view_type = FALSE;
|
||||
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
|
||||
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
||||
|
||||
|
@ -430,66 +431,100 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
|
||||
if (entry)
|
||||
{
|
||||
if (strstr (entry->identifier, "grid"))
|
||||
is_grid = TRUE;
|
||||
gchar *identifier;
|
||||
gchar *substring = NULL;
|
||||
|
||||
identifier = g_strdup (entry->identifier);
|
||||
|
||||
if ((substring = strstr (identifier, "grid")))
|
||||
view_type = GIMP_VIEW_TYPE_GRID;
|
||||
else if ((substring = strstr (identifier, "list")))
|
||||
view_type = GIMP_VIEW_TYPE_LIST;
|
||||
|
||||
if (substring)
|
||||
{
|
||||
if (view_type == GIMP_VIEW_TYPE_GRID)
|
||||
memcpy (substring, "list", 4);
|
||||
else if (view_type == GIMP_VIEW_TYPE_LIST)
|
||||
memcpy (substring, "grid", 4);
|
||||
|
||||
if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory,
|
||||
identifier))
|
||||
other_view_type = TRUE;
|
||||
}
|
||||
|
||||
g_free (identifier);
|
||||
}
|
||||
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view)
|
||||
{
|
||||
preview_size = view->preview_size;
|
||||
}
|
||||
preview_size = view->preview_size;
|
||||
|
||||
#define SET_ACTIVE(path,active) \
|
||||
gimp_item_factory_set_active (factory, (path), (active))
|
||||
#define SET_VISIBLE(path,active) \
|
||||
gimp_item_factory_set_visible (factory, (path), (active))
|
||||
#define SET_SENSITIVE(path,sensitive) \
|
||||
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
|
||||
|
||||
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
SET_VISIBLE ("/view-type-separator",
|
||||
preview_size != GIMP_PREVIEW_SIZE_NONE || view_type != -1);
|
||||
|
||||
SET_VISIBLE ("/Preview Size", preview_size != GIMP_PREVIEW_SIZE_NONE);
|
||||
|
||||
if (preview_size != GIMP_PREVIEW_SIZE_NONE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Huge", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Medium", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
|
||||
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Huge", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Large", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Medium", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
|
||||
}
|
||||
else if (preview_size >= GIMP_PREVIEW_SIZE_TINY)
|
||||
{
|
||||
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_grid)
|
||||
SET_VISIBLE ("/View as Grid", view_type != -1);
|
||||
SET_VISIBLE ("/View as List", view_type != -1);
|
||||
|
||||
if (view_type != -1)
|
||||
{
|
||||
SET_ACTIVE ("/View as Grid", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_ACTIVE ("/View as List", TRUE);
|
||||
if (view_type == GIMP_VIEW_TYPE_LIST)
|
||||
SET_ACTIVE ("/View as List", TRUE);
|
||||
else
|
||||
SET_ACTIVE ("/View as Grid", TRUE);
|
||||
|
||||
SET_SENSITIVE ("/View as Grid", other_view_type);
|
||||
SET_SENSITIVE ("/View as List", other_view_type);
|
||||
}
|
||||
|
||||
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
|
||||
|
@ -512,5 +547,6 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
|
||||
#undef SET_ACTIVE
|
||||
#undef SET_VISIBLE
|
||||
#undef SET_SENSITIVE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,9 @@ static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
|||
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_navigation_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size);
|
||||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -266,7 +269,9 @@ dialogs_dock_new (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return gimp_image_dock_new (factory, context->gimp->images);
|
||||
return gimp_image_dock_new (factory,
|
||||
context->gimp->images,
|
||||
context->gimp->displays);
|
||||
}
|
||||
|
||||
|
||||
|
@ -929,7 +934,7 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
NULL,
|
||||
dialogs_navigation_tab_func,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
@ -1146,6 +1151,62 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
return hbox;
|
||||
}
|
||||
|
||||
static GtkIconSize
|
||||
gimp_preview_size_to_gtk_icon_size (GimpPreviewSize preview_size)
|
||||
{
|
||||
GtkIconSize gtk_size;
|
||||
gint width, height;
|
||||
GtkIconSize best_match;
|
||||
gint diff;
|
||||
|
||||
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
|
||||
|
||||
best_match = GTK_ICON_SIZE_MENU;
|
||||
diff = abs (preview_size - height);
|
||||
|
||||
for (gtk_size = GTK_ICON_SIZE_MENU + 1;
|
||||
gtk_size <= GTK_ICON_SIZE_DIALOG;
|
||||
gtk_size++)
|
||||
{
|
||||
if (gtk_icon_size_lookup (gtk_size, &width, &height))
|
||||
{
|
||||
if (abs (preview_size - height) < diff)
|
||||
{
|
||||
best_match = gtk_size;
|
||||
diff = abs (preview_size - height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best_match;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_navigation_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_MOVE,
|
||||
gimp_preview_size_to_gtk_icon_size (size));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
label = gtk_label_new (dockable->short_name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
|
|
|
@ -167,15 +167,18 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
SEPARATOR ("/File/Dialogs/---"),
|
||||
|
||||
{ { N_("/File/Dialogs/Brushes..."), "<control><shift>B",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
|
||||
"gimp-brush-grid",
|
||||
"file/dialogs/brush_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Patterns..."), "<control><shift>P",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
|
||||
"gimp-pattern-grid",
|
||||
"file/dialogs/pattern_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Gradients..."), "<control>G",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
|
||||
"gimp-gradient-list",
|
||||
"file/dialogs/gradient_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Palettes..."), "<control>P",
|
||||
|
@ -188,8 +191,9 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"gimp-indexed-palette",
|
||||
"file/dialogs/indexed_palette.html", NULL },
|
||||
{ { N_("/File/Dialogs/Buffers..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
{ { N_("/File/Dialogs/Buffers..."), "foo",
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_PASTE },
|
||||
"gimp-buffer-list",
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Dialogs/Images..."), NULL,
|
||||
|
@ -833,7 +837,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
tools_swap_colors_cmd_callback, 0 },
|
||||
NULL,
|
||||
"toolbox/toolbox.html#swap_colors", NULL },
|
||||
{ { N_("/Tools/Swap Contexts"), "<shift>X",
|
||||
{ { N_("/Tools/Swap Contexts"), "<alt>X",
|
||||
tools_swap_contexts_cmd_callback, 0 },
|
||||
NULL,
|
||||
"toolbox/toolbox.html#swap_colors", NULL },
|
||||
|
@ -866,15 +870,18 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
SEPARATOR ("/Dialogs/---"),
|
||||
|
||||
{ { N_("/Dialogs/Brushes..."), "<control><shift>B",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
|
||||
"gimp-brush-grid",
|
||||
"dialogs/brush_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Patterns..."), "<control><shift>P",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
|
||||
"gimp-pattern-grid",
|
||||
"dialogs/pattern_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Gradients..."), "<control>G",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
|
||||
"gimp-gradient-list",
|
||||
"dialogs/gradient_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Palettes..."), "<control>P",
|
||||
|
@ -887,8 +894,9 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"gimp-indexed-palette",
|
||||
"dialogs/indexed_palette.html", NULL },
|
||||
{ { N_("/Dialogs/Buffers..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
{ { N_("/Dialogs/Buffers..."), "foo",
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_PASTE },
|
||||
"gimp-buffer-list",
|
||||
NULL, NULL },
|
||||
{ { N_("/Dialogs/Images..."), NULL,
|
||||
|
@ -1334,7 +1342,7 @@ static GimpItemFactoryEntry paths_entries[] =
|
|||
/***** <Dialogs> *****/
|
||||
|
||||
#define ADD_TAB(path,id,type,stock_id) \
|
||||
{ { (path), NULL, dialogs_add_tab_cmd_callback, 0, (type), (stock_id) }, \
|
||||
{ { (path), "foo", dialogs_add_tab_cmd_callback, 0, (type), (stock_id) }, \
|
||||
(id), NULL, NULL }
|
||||
#define PREVIEW_SIZE(path,size) \
|
||||
{ { (path), NULL, dialogs_preview_size_cmd_callback, \
|
||||
|
@ -1343,46 +1351,52 @@ static GimpItemFactoryEntry paths_entries[] =
|
|||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { N_("/Select Tab"), NULL, NULL, 0 },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
|
||||
NULL, NULL, NULL },
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Layers..."), "gimp-layer-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Channels..."), "gimp-channel-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Paths..."), "gimp-vectors-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Old Paths..."), "gimp-path-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Document History..."), "gimp-document-history", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Error Console..."), "gimp-error-console", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Gradients..."), "gimp-gradient-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Navigation..."), "gimp-navigation-view",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_MOVE),
|
||||
ADD_TAB (N_("/Add Tab/Images..."), "gimp-image-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Document History..."), "gimp-document-history", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH),
|
||||
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL),
|
||||
ADD_TAB (N_("/Add Tab/Gradients..."), "gimp-gradient-list",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND),
|
||||
ADD_TAB (N_("/Add Tab/Palettes..."), "gimp-palette-list",
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR),
|
||||
ADD_TAB (N_("/Add Tab/Indexed Palette..."), "gimp-indexed-palette",
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR),
|
||||
ADD_TAB (N_("/Add Tab/Buffers..."), "gimp-buffer-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Images..."), "gimp-image-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Navigation..."), "gimp-navigation-view", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Buffers..."), "gimp-buffer-list",
|
||||
"<StockItem>", GTK_STOCK_PASTE),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Tools..."), "gimp-tool-list", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/---"),
|
||||
ADD_TAB (N_("/Add Tab/Tools..."), "gimp-tool-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Error Console..."), "gimp-error-console", NULL, NULL),
|
||||
|
||||
{ { N_("/Remove Tab"), NULL,
|
||||
dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
SEPARATOR ("/view-type-separator"),
|
||||
|
||||
BRANCH ("/Preview Size"),
|
||||
|
||||
{ { N_("/Preview Size/Tiny"), NULL,
|
||||
dialogs_preview_size_cmd_callback,
|
||||
GIMP_PREVIEW_SIZE_TINY, "<RadioItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
PREVIEW_SIZE (N_("/Preview Size/Extra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL),
|
||||
PREVIEW_SIZE (N_("/Preview Size/Small"), GIMP_PREVIEW_SIZE_SMALL),
|
||||
|
@ -1395,24 +1409,19 @@ static GimpItemFactoryEntry dialogs_entries[] =
|
|||
|
||||
{ { N_("/View as List"), NULL,
|
||||
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "<RadioItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
{ { N_("/View as Grid"), NULL,
|
||||
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
SEPARATOR ("/image-menu-separator"),
|
||||
|
||||
{ { N_("/Show Image Menu"), NULL,
|
||||
dialogs_toggle_image_menu_cmd_callback, 0, "<ToggleItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
{ { N_("/Auto Follow Active Image"), NULL,
|
||||
dialogs_toggle_auto_cmd_callback, 0, "<ToggleItem>" },
|
||||
NULL,
|
||||
NULL, NULL }
|
||||
|
||||
NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#undef ADD_TAB
|
||||
|
|
|
@ -167,15 +167,18 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
SEPARATOR ("/File/Dialogs/---"),
|
||||
|
||||
{ { N_("/File/Dialogs/Brushes..."), "<control><shift>B",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
|
||||
"gimp-brush-grid",
|
||||
"file/dialogs/brush_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Patterns..."), "<control><shift>P",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
|
||||
"gimp-pattern-grid",
|
||||
"file/dialogs/pattern_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Gradients..."), "<control>G",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
|
||||
"gimp-gradient-list",
|
||||
"file/dialogs/gradient_selection.html", NULL },
|
||||
{ { N_("/File/Dialogs/Palettes..."), "<control>P",
|
||||
|
@ -188,8 +191,9 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"gimp-indexed-palette",
|
||||
"file/dialogs/indexed_palette.html", NULL },
|
||||
{ { N_("/File/Dialogs/Buffers..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
{ { N_("/File/Dialogs/Buffers..."), "foo",
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_PASTE },
|
||||
"gimp-buffer-list",
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Dialogs/Images..."), NULL,
|
||||
|
@ -833,7 +837,7 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
tools_swap_colors_cmd_callback, 0 },
|
||||
NULL,
|
||||
"toolbox/toolbox.html#swap_colors", NULL },
|
||||
{ { N_("/Tools/Swap Contexts"), "<shift>X",
|
||||
{ { N_("/Tools/Swap Contexts"), "<alt>X",
|
||||
tools_swap_contexts_cmd_callback, 0 },
|
||||
NULL,
|
||||
"toolbox/toolbox.html#swap_colors", NULL },
|
||||
|
@ -866,15 +870,18 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
SEPARATOR ("/Dialogs/---"),
|
||||
|
||||
{ { N_("/Dialogs/Brushes..."), "<control><shift>B",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
|
||||
"gimp-brush-grid",
|
||||
"dialogs/brush_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Patterns..."), "<control><shift>P",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
|
||||
"gimp-pattern-grid",
|
||||
"dialogs/pattern_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Gradients..."), "<control>G",
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
|
||||
"gimp-gradient-list",
|
||||
"dialogs/gradient_selection.html", NULL },
|
||||
{ { N_("/Dialogs/Palettes..."), "<control>P",
|
||||
|
@ -887,8 +894,9 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"gimp-indexed-palette",
|
||||
"dialogs/indexed_palette.html", NULL },
|
||||
{ { N_("/Dialogs/Buffers..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
{ { N_("/Dialogs/Buffers..."), "foo",
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_PASTE },
|
||||
"gimp-buffer-list",
|
||||
NULL, NULL },
|
||||
{ { N_("/Dialogs/Images..."), NULL,
|
||||
|
@ -1334,7 +1342,7 @@ static GimpItemFactoryEntry paths_entries[] =
|
|||
/***** <Dialogs> *****/
|
||||
|
||||
#define ADD_TAB(path,id,type,stock_id) \
|
||||
{ { (path), NULL, dialogs_add_tab_cmd_callback, 0, (type), (stock_id) }, \
|
||||
{ { (path), "foo", dialogs_add_tab_cmd_callback, 0, (type), (stock_id) }, \
|
||||
(id), NULL, NULL }
|
||||
#define PREVIEW_SIZE(path,size) \
|
||||
{ { (path), NULL, dialogs_preview_size_cmd_callback, \
|
||||
|
@ -1343,46 +1351,52 @@ static GimpItemFactoryEntry paths_entries[] =
|
|||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { N_("/Select Tab"), NULL, NULL, 0 },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
|
||||
NULL, NULL, NULL },
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Layers..."), "gimp-layer-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Channels..."), "gimp-channel-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Paths..."), "gimp-vectors-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Old Paths..."), "gimp-path-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Document History..."), "gimp-document-history", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Error Console..."), "gimp-error-console", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Gradients..."), "gimp-gradient-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Navigation..."), "gimp-navigation-view",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_MOVE),
|
||||
ADD_TAB (N_("/Add Tab/Images..."), "gimp-image-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Document History..."), "gimp-document-history", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH),
|
||||
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL),
|
||||
ADD_TAB (N_("/Add Tab/Gradients..."), "gimp-gradient-list",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_BLEND),
|
||||
ADD_TAB (N_("/Add Tab/Palettes..."), "gimp-palette-list",
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR),
|
||||
ADD_TAB (N_("/Add Tab/Indexed Palette..."), "gimp-indexed-palette",
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR),
|
||||
ADD_TAB (N_("/Add Tab/Buffers..."), "gimp-buffer-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Images..."), "gimp-image-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Navigation..."), "gimp-navigation-view", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Buffers..."), "gimp-buffer-list",
|
||||
"<StockItem>", GTK_STOCK_PASTE),
|
||||
|
||||
SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Tools..."), "gimp-tool-list", NULL, NULL),
|
||||
|
||||
SEPARATOR ("/---"),
|
||||
ADD_TAB (N_("/Add Tab/Tools..."), "gimp-tool-list", NULL, NULL),
|
||||
ADD_TAB (N_("/Add Tab/Error Console..."), "gimp-error-console", NULL, NULL),
|
||||
|
||||
{ { N_("/Remove Tab"), NULL,
|
||||
dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
SEPARATOR ("/view-type-separator"),
|
||||
|
||||
BRANCH ("/Preview Size"),
|
||||
|
||||
{ { N_("/Preview Size/Tiny"), NULL,
|
||||
dialogs_preview_size_cmd_callback,
|
||||
GIMP_PREVIEW_SIZE_TINY, "<RadioItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
PREVIEW_SIZE (N_("/Preview Size/Extra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL),
|
||||
PREVIEW_SIZE (N_("/Preview Size/Small"), GIMP_PREVIEW_SIZE_SMALL),
|
||||
|
@ -1395,24 +1409,19 @@ static GimpItemFactoryEntry dialogs_entries[] =
|
|||
|
||||
{ { N_("/View as List"), NULL,
|
||||
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "<RadioItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
{ { N_("/View as Grid"), NULL,
|
||||
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
SEPARATOR ("/image-menu-separator"),
|
||||
|
||||
{ { N_("/Show Image Menu"), NULL,
|
||||
dialogs_toggle_image_menu_cmd_callback, 0, "<ToggleItem>" },
|
||||
NULL,
|
||||
NULL, NULL },
|
||||
NULL, NULL, NULL },
|
||||
{ { N_("/Auto Follow Active Image"), NULL,
|
||||
dialogs_toggle_auto_cmd_callback, 0, "<ToggleItem>" },
|
||||
NULL,
|
||||
NULL, NULL }
|
||||
|
||||
NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#undef ADD_TAB
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#warning FIXME #include "display/display-types.h"
|
||||
#include "display/display-types.h"
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "gimpimagedock.h"
|
||||
|
@ -43,7 +47,8 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define DEFAULT_MINIMAL_WIDTH 250
|
||||
#define DEFAULT_MINIMAL_WIDTH 250
|
||||
#define DEFAULT_MENU_PREVIEW_HEIGHT 24
|
||||
|
||||
|
||||
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
|
||||
|
@ -120,6 +125,13 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
|
|||
G_MAXINT,
|
||||
DEFAULT_MINIMAL_WIDTH,
|
||||
G_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("menu_preview_height",
|
||||
NULL, NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_MENU_PREVIEW_HEIGHT,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -128,6 +140,7 @@ gimp_image_dock_init (GimpImageDock *dock)
|
|||
GtkWidget *hbox;
|
||||
|
||||
dock->image_container = NULL;
|
||||
dock->display_container = NULL;
|
||||
dock->show_image_menu = FALSE;
|
||||
dock->auto_follow_active = TRUE;
|
||||
|
||||
|
@ -184,21 +197,47 @@ static void
|
|||
gimp_image_dock_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
gint minimal_width;
|
||||
GimpImageDock *image_dock;
|
||||
gint minimal_width;
|
||||
gint menu_preview_height;
|
||||
gint focus_line_width;
|
||||
gint focus_padding;
|
||||
gint ythickness;
|
||||
|
||||
image_dock = GIMP_IMAGE_DOCK (widget);
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"minimal_width", &minimal_width,
|
||||
"minimal_width", &minimal_width,
|
||||
"menu_preview_height", &menu_preview_height,
|
||||
NULL);
|
||||
|
||||
gtk_widget_style_get (image_dock->auto_button,
|
||||
"focus_line_width", &focus_line_width,
|
||||
"focus_padding", &focus_padding,
|
||||
NULL);
|
||||
|
||||
ythickness = image_dock->auto_button->style->ythickness;
|
||||
|
||||
gtk_widget_set_size_request (widget, minimal_width, -1);
|
||||
|
||||
gimp_container_menu_set_preview_size (GIMP_CONTAINER_MENU (image_dock->menu),
|
||||
menu_preview_height);
|
||||
|
||||
gtk_widget_set_size_request (image_dock->auto_button, -1,
|
||||
menu_preview_height +
|
||||
2 * (1 /* CHILD_SPACING */ +
|
||||
ythickness +
|
||||
focus_padding +
|
||||
focus_line_width));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
||||
GimpContainer *image_container)
|
||||
GimpContainer *image_container,
|
||||
GimpContainer *display_container)
|
||||
{
|
||||
GimpImageDock *image_dock;
|
||||
GimpContext *context;
|
||||
|
@ -208,6 +247,7 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
|
||||
|
||||
image_dock = g_object_new (GIMP_TYPE_IMAGE_DOCK, NULL);
|
||||
|
||||
|
@ -215,7 +255,8 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
gtk_window_set_title (GTK_WINDOW (image_dock), title);
|
||||
g_free (title);
|
||||
|
||||
image_dock->image_container = image_container;
|
||||
image_dock->image_container = image_container;
|
||||
image_dock->display_container = display_container;
|
||||
|
||||
context = gimp_context_new (dialog_factory->context->gimp,
|
||||
"Dock Context", NULL);
|
||||
|
@ -253,7 +294,8 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
G_OBJECT (image_dock),
|
||||
0);
|
||||
|
||||
image_dock->menu = gimp_container_menu_new (image_container, context, 24);
|
||||
image_dock->menu = gimp_container_menu_new (image_container, context,
|
||||
DEFAULT_MENU_PREVIEW_HEIGHT);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (image_dock->option_menu),
|
||||
image_dock->menu);
|
||||
gtk_widget_show (image_dock->menu);
|
||||
|
@ -337,7 +379,7 @@ gimp_image_dock_image_changed (GimpContext *context,
|
|||
/* this invokes this function recursively but we don't enter
|
||||
* the if() branch the second time
|
||||
*/
|
||||
gimp_context_set_image (dock->context, gimage);
|
||||
gimp_context_set_image (context, gimage);
|
||||
|
||||
/* stop the emission of the original signal (the emission of
|
||||
* the recursive signal is finished)
|
||||
|
@ -345,6 +387,54 @@ gimp_image_dock_image_changed (GimpContext *context,
|
|||
g_signal_stop_emission_by_name (G_OBJECT (context), "image_changed");
|
||||
}
|
||||
}
|
||||
else if (image_dock->display_container->num_children > 0)
|
||||
{
|
||||
GimpObject *gdisp;
|
||||
gboolean find_display = TRUE;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
GimpImage *gdisp_gimage;
|
||||
|
||||
g_object_get (gdisp, "image", &gdisp_gimage, NULL);
|
||||
g_object_unref (G_OBJECT (gdisp_gimage));
|
||||
|
||||
if (gdisp_gimage == gimage)
|
||||
find_display = FALSE;
|
||||
}
|
||||
|
||||
if (find_display)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = GIMP_LIST (image_dock->display_container)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpImage *gdisp_gimage;
|
||||
|
||||
gdisp = GIMP_OBJECT (list->data);
|
||||
|
||||
g_object_get (gdisp, "image", &gdisp_gimage, NULL);
|
||||
g_object_unref (G_OBJECT (gdisp_gimage));
|
||||
|
||||
if (gdisp_gimage == gimage)
|
||||
{
|
||||
/* this invokes this function recursively but we don't enter
|
||||
* the if(find_display) branch the second time
|
||||
*/
|
||||
gimp_context_set_display (context, gdisp);
|
||||
|
||||
/* don't stop signal emission here because the context's
|
||||
* image was not changed by the recursive call
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -41,6 +41,7 @@ struct _GimpImageDock
|
|||
GimpDock parent_instance;
|
||||
|
||||
GimpContainer *image_container;
|
||||
GimpContainer *display_container;
|
||||
|
||||
gboolean show_image_menu;
|
||||
gboolean auto_follow_active;
|
||||
|
@ -59,7 +60,8 @@ struct _GimpImageDockClass
|
|||
GType gimp_image_dock_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
||||
GimpContainer *image_container);
|
||||
GimpContainer *image_container,
|
||||
GimpContainer *display_container);
|
||||
|
||||
void gimp_image_dock_set_auto_follow_active (GimpImageDock *image_dock,
|
||||
gboolean show);
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#warning FIXME #include "display/display-types.h"
|
||||
#include "display/display-types.h"
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "gimpimagedock.h"
|
||||
|
@ -43,7 +47,8 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define DEFAULT_MINIMAL_WIDTH 250
|
||||
#define DEFAULT_MINIMAL_WIDTH 250
|
||||
#define DEFAULT_MENU_PREVIEW_HEIGHT 24
|
||||
|
||||
|
||||
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
|
||||
|
@ -120,6 +125,13 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
|
|||
G_MAXINT,
|
||||
DEFAULT_MINIMAL_WIDTH,
|
||||
G_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("menu_preview_height",
|
||||
NULL, NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_MENU_PREVIEW_HEIGHT,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -128,6 +140,7 @@ gimp_image_dock_init (GimpImageDock *dock)
|
|||
GtkWidget *hbox;
|
||||
|
||||
dock->image_container = NULL;
|
||||
dock->display_container = NULL;
|
||||
dock->show_image_menu = FALSE;
|
||||
dock->auto_follow_active = TRUE;
|
||||
|
||||
|
@ -184,21 +197,47 @@ static void
|
|||
gimp_image_dock_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
gint minimal_width;
|
||||
GimpImageDock *image_dock;
|
||||
gint minimal_width;
|
||||
gint menu_preview_height;
|
||||
gint focus_line_width;
|
||||
gint focus_padding;
|
||||
gint ythickness;
|
||||
|
||||
image_dock = GIMP_IMAGE_DOCK (widget);
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"minimal_width", &minimal_width,
|
||||
"minimal_width", &minimal_width,
|
||||
"menu_preview_height", &menu_preview_height,
|
||||
NULL);
|
||||
|
||||
gtk_widget_style_get (image_dock->auto_button,
|
||||
"focus_line_width", &focus_line_width,
|
||||
"focus_padding", &focus_padding,
|
||||
NULL);
|
||||
|
||||
ythickness = image_dock->auto_button->style->ythickness;
|
||||
|
||||
gtk_widget_set_size_request (widget, minimal_width, -1);
|
||||
|
||||
gimp_container_menu_set_preview_size (GIMP_CONTAINER_MENU (image_dock->menu),
|
||||
menu_preview_height);
|
||||
|
||||
gtk_widget_set_size_request (image_dock->auto_button, -1,
|
||||
menu_preview_height +
|
||||
2 * (1 /* CHILD_SPACING */ +
|
||||
ythickness +
|
||||
focus_padding +
|
||||
focus_line_width));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
||||
GimpContainer *image_container)
|
||||
GimpContainer *image_container,
|
||||
GimpContainer *display_container)
|
||||
{
|
||||
GimpImageDock *image_dock;
|
||||
GimpContext *context;
|
||||
|
@ -208,6 +247,7 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
|
||||
|
||||
image_dock = g_object_new (GIMP_TYPE_IMAGE_DOCK, NULL);
|
||||
|
||||
|
@ -215,7 +255,8 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
gtk_window_set_title (GTK_WINDOW (image_dock), title);
|
||||
g_free (title);
|
||||
|
||||
image_dock->image_container = image_container;
|
||||
image_dock->image_container = image_container;
|
||||
image_dock->display_container = display_container;
|
||||
|
||||
context = gimp_context_new (dialog_factory->context->gimp,
|
||||
"Dock Context", NULL);
|
||||
|
@ -253,7 +294,8 @@ gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
|||
G_OBJECT (image_dock),
|
||||
0);
|
||||
|
||||
image_dock->menu = gimp_container_menu_new (image_container, context, 24);
|
||||
image_dock->menu = gimp_container_menu_new (image_container, context,
|
||||
DEFAULT_MENU_PREVIEW_HEIGHT);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (image_dock->option_menu),
|
||||
image_dock->menu);
|
||||
gtk_widget_show (image_dock->menu);
|
||||
|
@ -337,7 +379,7 @@ gimp_image_dock_image_changed (GimpContext *context,
|
|||
/* this invokes this function recursively but we don't enter
|
||||
* the if() branch the second time
|
||||
*/
|
||||
gimp_context_set_image (dock->context, gimage);
|
||||
gimp_context_set_image (context, gimage);
|
||||
|
||||
/* stop the emission of the original signal (the emission of
|
||||
* the recursive signal is finished)
|
||||
|
@ -345,6 +387,54 @@ gimp_image_dock_image_changed (GimpContext *context,
|
|||
g_signal_stop_emission_by_name (G_OBJECT (context), "image_changed");
|
||||
}
|
||||
}
|
||||
else if (image_dock->display_container->num_children > 0)
|
||||
{
|
||||
GimpObject *gdisp;
|
||||
gboolean find_display = TRUE;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
GimpImage *gdisp_gimage;
|
||||
|
||||
g_object_get (gdisp, "image", &gdisp_gimage, NULL);
|
||||
g_object_unref (G_OBJECT (gdisp_gimage));
|
||||
|
||||
if (gdisp_gimage == gimage)
|
||||
find_display = FALSE;
|
||||
}
|
||||
|
||||
if (find_display)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = GIMP_LIST (image_dock->display_container)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpImage *gdisp_gimage;
|
||||
|
||||
gdisp = GIMP_OBJECT (list->data);
|
||||
|
||||
g_object_get (gdisp, "image", &gdisp_gimage, NULL);
|
||||
g_object_unref (G_OBJECT (gdisp_gimage));
|
||||
|
||||
if (gdisp_gimage == gimage)
|
||||
{
|
||||
/* this invokes this function recursively but we don't enter
|
||||
* the if(find_display) branch the second time
|
||||
*/
|
||||
gimp_context_set_display (context, gdisp);
|
||||
|
||||
/* don't stop signal emission here because the context's
|
||||
* image was not changed by the recursive call
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -41,6 +41,7 @@ struct _GimpImageDock
|
|||
GimpDock parent_instance;
|
||||
|
||||
GimpContainer *image_container;
|
||||
GimpContainer *display_container;
|
||||
|
||||
gboolean show_image_menu;
|
||||
gboolean auto_follow_active;
|
||||
|
@ -59,7 +60,8 @@ struct _GimpImageDockClass
|
|||
GType gimp_image_dock_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_image_dock_new (GimpDialogFactory *dialog_factory,
|
||||
GimpContainer *image_container);
|
||||
GimpContainer *image_container,
|
||||
GimpContainer *display_container);
|
||||
|
||||
void gimp_image_dock_set_auto_follow_active (GimpImageDock *image_dock,
|
||||
gboolean show);
|
||||
|
|
|
@ -21,17 +21,18 @@ style "gimp-small-style"
|
|||
GtkOptionMenu::indicator_size = { 4, 7 }
|
||||
GtkOptionMenu::indicator_spacing = { 4, 3, 1, 1 }
|
||||
|
||||
GtkPaned::handle_size = 5
|
||||
GimpDock::separator_height = 5
|
||||
GimpImageDock::minimal_width = 200
|
||||
GimpToolbox::tool_icon_size = menu
|
||||
GimpDockbook::tab_border = 0
|
||||
GimpDockbook::tab_height = 16
|
||||
GimpDockable::content_border = 1
|
||||
GimpDockable::content_spacing = 1
|
||||
GimpEditor::content_spacing = 1
|
||||
GimpEditor::button_spacing = 1
|
||||
GimpEditor::button_icon_size = menu
|
||||
GtkPaned::handle_size = 5
|
||||
GimpDock::separator_height = 5
|
||||
GimpImageDock::minimal_width = 200
|
||||
GimpImageDock::menu_preview_height = 18
|
||||
GimpToolbox::tool_icon_size = menu
|
||||
GimpDockbook::tab_border = 0
|
||||
GimpDockbook::tab_height = 16
|
||||
GimpDockable::content_border = 1
|
||||
GimpDockable::content_spacing = 1
|
||||
GimpEditor::content_spacing = 1
|
||||
GimpEditor::button_spacing = 1
|
||||
GimpEditor::button_icon_size = menu
|
||||
}
|
||||
|
||||
# class "GtkWidget" style "gimp-small-style"
|
||||
|
|
|
@ -70,17 +70,18 @@ style "gimp-default-style"
|
|||
{ "images/gimp-dialog-warning.png", *, *, "gtk-dialog" }
|
||||
}
|
||||
|
||||
GtkPaned::handle_size = 6
|
||||
GimpDock::separator_height = 6
|
||||
GimpImageDock::minimal_width = 250
|
||||
GimpToolbox::tool_icon_size = button
|
||||
GimpDockbook::tab_border = 0
|
||||
GimpDockbook::tab_height = 24
|
||||
GimpDockable::content_border = 2
|
||||
GimpDockable::content_spacing = 2
|
||||
GimpEditor::content_spacing = 2
|
||||
GimpEditor::button_spacing = 2
|
||||
GimpEditor::button_icon_size = button
|
||||
GtkPaned::handle_size = 6
|
||||
GimpDock::separator_height = 6
|
||||
GimpImageDock::minimal_width = 250
|
||||
GimpImageDock::menu_preview_height = 24
|
||||
GimpToolbox::tool_icon_size = button
|
||||
GimpDockbook::tab_border = 0
|
||||
GimpDockbook::tab_height = 24
|
||||
GimpDockable::content_border = 2
|
||||
GimpDockable::content_spacing = 2
|
||||
GimpEditor::content_spacing = 2
|
||||
GimpEditor::button_spacing = 2
|
||||
GimpEditor::button_icon_size = button
|
||||
}
|
||||
|
||||
class "GtkWidget" style "gimp-default-style"
|
||||
|
|
Loading…
Reference in New Issue