reoedered to somehow reflect the class hierarchy.

2004-05-23  Michael Natterer  <mitch@gimp.org>

	* app/widgets/widgets-types.h: reoedered to somehow reflect the
	class hierarchy.

	Some dockable context handling cleanup:

	* app/widgets/gimpdocked.[ch]: removed "prev_context" parameter
	from GimpDocked::set_context(). Widgets which need the old context
	to disconnect from should remember it themselves.

	* app/widgets/gimpdockable.c (gimp_dockable_set_context): don't
	pass the old context to gimp_docked_set_context().
	Some cleanup.

	* app/widgets/gimpcontainerbox.c
	* app/widgets/gimpcontainereditor.c: changed accordingly.

	* app/display/gimpnavigationview.[ch]
	* app/widgets/gimpimageeditor.[ch]
	* app/widgets/gimpitemtreeview.[ch]: added a "context" member
	which holds the context set by GimpDocked::set_context().

	* app/widgets/gimpdrawabletreeview.c: use the view's context
	instead of gimp_get_user_context().

	* app/widgets/gimpcoloreditor.[ch]: removed separate API to
	set the context because it implements the GimpDockedInterface.

	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimperrorconsole.c: pass "menu-factory",
	"menu-identifier" and "ui-path" to g_object_new() instead of
	calling gimp_editor_create_menu() later.

	Action cleanup partly related to the context stuff above:

	* app/actions/actions.c (action_data_get_gimp): get the Gimp from
	context->gimp, not gimage->gimp because gimage may be NULL.

	(action_data_get_context): changed to use the new context members
	added above.

	* app/actions/channels-actions.c (channels_actions_update): cleanup.

	* app/actions/edit-actions.c (edit_actions_update): fixed
	sensitivity of "edit-undo-clear".

	* app/actions/vectors-actions.c (vectors_actions_update): make
	"vectors-merge-visible" sensitive only if there is more than one
	GimpVectors in the image.

	* app/actions/colormap-editor-actions.c
	* app/actions/gradient-editor-actions.c
	* app/actions/palette-editor-actions.c: added FG/BG color previews
	to actions which take colors from them. Changed code to be safe
	against "context" being NULL.

	* app/actions/drawable-commands.c:
	s/active_drawable/drawable/g. Makes the code more readable.

	* app/actions/select-commands.[ch]
	* app/actions/vectors-commands.[ch]: removed public stroke utility
	functions and other stuff which is not needed any more because
	dialog buttons invoke the correct actions now. Moved the
	functions' code to the resp. action callbacks.
This commit is contained in:
Michael Natterer
2004-05-23 10:04:41 +00:00
committed by Michael Natterer
parent 92514b0d27
commit 43cdd54dd1
33 changed files with 463 additions and 396 deletions

View File

@ -1,3 +1,69 @@
2004-05-23 Michael Natterer <mitch@gimp.org>
* app/widgets/widgets-types.h: reoedered to somehow reflect the
class hierarchy.
Some dockable context handling cleanup:
* app/widgets/gimpdocked.[ch]: removed "prev_context" parameter
from GimpDocked::set_context(). Widgets which need the old context
to disconnect from should remember it themselves.
* app/widgets/gimpdockable.c (gimp_dockable_set_context): don't
pass the old context to gimp_docked_set_context().
Some cleanup.
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainereditor.c: changed accordingly.
* app/display/gimpnavigationview.[ch]
* app/widgets/gimpimageeditor.[ch]
* app/widgets/gimpitemtreeview.[ch]: added a "context" member
which holds the context set by GimpDocked::set_context().
* app/widgets/gimpdrawabletreeview.c: use the view's context
instead of gimp_get_user_context().
* app/widgets/gimpcoloreditor.[ch]: removed separate API to
set the context because it implements the GimpDockedInterface.
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimperrorconsole.c: pass "menu-factory",
"menu-identifier" and "ui-path" to g_object_new() instead of
calling gimp_editor_create_menu() later.
Action cleanup partly related to the context stuff above:
* app/actions/actions.c (action_data_get_gimp): get the Gimp from
context->gimp, not gimage->gimp because gimage may be NULL.
(action_data_get_context): changed to use the new context members
added above.
* app/actions/channels-actions.c (channels_actions_update): cleanup.
* app/actions/edit-actions.c (edit_actions_update): fixed
sensitivity of "edit-undo-clear".
* app/actions/vectors-actions.c (vectors_actions_update): make
"vectors-merge-visible" sensitive only if there is more than one
GimpVectors in the image.
* app/actions/colormap-editor-actions.c
* app/actions/gradient-editor-actions.c
* app/actions/palette-editor-actions.c: added FG/BG color previews
to actions which take colors from them. Changed code to be safe
against "context" being NULL.
* app/actions/drawable-commands.c:
s/active_drawable/drawable/g. Makes the code more readable.
* app/actions/select-commands.[ch]
* app/actions/vectors-commands.[ch]: removed public stroke utility
functions and other stuff which is not needed any more because
dialog buttons invoke the correct actions now. Moved the
functions' code to the resp. action callbacks.
2004-05-21 Nathan Summers <rock@gimp.org>
Somehow some of the changes from my commit on 2004-05-18 seem to have

View File

@ -32,6 +32,7 @@
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpimageeditor.h"
#include "widgets/gimpitemtreeview.h"
@ -225,9 +226,9 @@ action_data_get_gimp (gpointer data)
else if (GIMP_IS_DISPLAY_SHELL (data))
return ((GimpDisplayShell *) data)->gdisp->gimage->gimp;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->gimage->gimp;
return ((GimpItemTreeView *) data)->context->gimp;
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->gimage->gimp;
return ((GimpImageEditor *) data)->context->gimp;
else if (GIMP_IS_GIMP (data))
return data;
else if (GIMP_IS_DOCK (data))
@ -246,10 +247,14 @@ action_data_get_context (gpointer data)
return gimp_get_user_context (((GimpDisplay *) data)->gimage->gimp);
else if (GIMP_IS_DISPLAY_SHELL (data))
return gimp_get_user_context (((GimpDisplayShell *) data)->gdisp->gimage->gimp);
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data))
return gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data))
return gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->context;
else if (GIMP_IS_DOCK (data))
return ((GimpDock *) data)->context;

View File

@ -132,21 +132,18 @@ channels_actions_update (GimpActionGroup *group,
GList *next = NULL;
GList *prev = NULL;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
gimage = GIMP_IMAGE_EDITOR (data)->gimage;
gimage = action_data_get_image (data);
if (gimage)
if (gimage)
{
fs = (gimp_image_floating_sel (gimage) != NULL);
if (GIMP_IS_COMPONENT_EDITOR (data))
{
if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1)
component = TRUE;
}
}
else
{
gimage = action_data_get_image (data);
if (gimage)
else
{
GList *list;
@ -166,9 +163,6 @@ channels_actions_update (GimpActionGroup *group,
}
}
if (gimage)
fs = (gimp_image_floating_sel (gimage) != NULL);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

View File

@ -24,6 +24,7 @@
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpactiongroup.h"
@ -79,11 +80,15 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpImage *gimage;
GimpContext *context;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
@ -91,8 +96,16 @@ colormap_editor_actions_update (GimpActionGroup *group,
num_colors = gimage->num_cols;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
gimage && indexed);
@ -101,5 +114,9 @@ colormap_editor_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
gimage && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}

View File

@ -24,6 +24,7 @@
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpactiongroup.h"
@ -79,11 +80,15 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpImage *gimage;
GimpContext *context;
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
@ -91,8 +96,16 @@ colormap_editor_actions_update (GimpActionGroup *group,
num_colors = gimage->num_cols;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("colormap-editor-edit-color",
gimage && indexed);
@ -101,5 +114,9 @@ colormap_editor_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("colormap-editor-add-color-from-bg",
gimage && indexed && num_colors < 256);
SET_COLOR ("colormap-editor-add-color-from-fg", context ? &fg : NULL);
SET_COLOR ("colormap-editor-add-color-from-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}

View File

@ -48,16 +48,16 @@ drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (! gimp_drawable_is_rgb (active_drawable))
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color layers."));
return;
}
gimp_drawable_desaturate (active_drawable);
gimp_drawable_desaturate (drawable);
gimp_image_flush (gimage);
}
@ -66,16 +66,16 @@ drawable_invert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed layers."));
return;
}
gimp_drawable_invert (active_drawable);
gimp_drawable_invert (drawable);
gimp_image_flush (gimage);
}
@ -84,16 +84,16 @@ drawable_equalize_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
return_if_no_drawable (gimage, active_drawable, data);
GimpDrawable *drawable;
return_if_no_drawable (gimage, drawable, data);
if (gimp_drawable_is_indexed (active_drawable))
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed layers."));
return;
}
gimp_drawable_equalize (active_drawable, TRUE);
gimp_drawable_equalize (drawable, TRUE);
gimp_image_flush (gimage);
}
@ -103,14 +103,15 @@ drawable_flip_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpDrawable *drawable;
GimpItem *item;
GimpContext *context;
gint off_x, off_y;
gdouble axis = 0.0;
return_if_no_drawable (gimage, active_drawable, data);
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
item = GIMP_ITEM (active_drawable);
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &off_x, &off_y);
@ -128,8 +129,6 @@ drawable_flip_cmd_callback (GtkAction *action,
break;
}
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer"));
@ -152,22 +151,21 @@ drawable_rotate_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GimpItem *item;
GimpDrawable *drawable;
GimpContext *context;
GimpItem *item;
gint off_x, off_y;
gdouble center_x, center_y;
return_if_no_drawable (gimage, active_drawable, data);
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
item = GIMP_ITEM (active_drawable);
item = GIMP_ITEM (drawable);
gimp_item_offsets (item, &off_x, &off_y);
center_x = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0);
center_y = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0);
context = gimp_get_user_context (gimage->gimp);
if (gimp_item_get_linked (item))
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Rotate Layer"));

View File

@ -237,7 +237,7 @@ edit_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("edit-undo", undo_enabled && undo_name);
SET_SENSITIVE ("edit-redo", undo_enabled && redo_name);
SET_SENSITIVE ("edit-undo-clear", undo_enabled && (redo_name || redo_name));
SET_SENSITIVE ("edit-undo-clear", undo_enabled && (undo_name || redo_name));
g_free (undo_name);
g_free (redo_name);

View File

@ -342,7 +342,7 @@ gradient_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpGradientEditor *editor;
GimpContext *user_context;
GimpContext *context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
@ -354,7 +354,7 @@ gradient_editor_actions_update (GimpActionGroup *group,
editor = GIMP_GRADIENT_EDITOR (data);
user_context =
context =
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
if (editor->control_sel_l->prev)
@ -367,8 +367,11 @@ gradient_editor_actions_update (GimpActionGroup *group,
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_context_get_foreground (user_context, &fg);
gimp_context_get_background (user_context, &bg);
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
{
GimpGradientSegmentType type;
@ -411,8 +414,9 @@ gradient_editor_actions_update (GimpActionGroup *group,
&left_seg->right_color, FALSE);
SET_COLOR ("gradient-editor-load-left-right-endpoint",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("gradient-editor-load-left-fg", &fg, FALSE);
SET_COLOR ("gradient-editor-load-left-bg", &bg, FALSE);
SET_COLOR ("gradient-editor-load-left-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-left-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-left-02", &editor->saved_colors[1], TRUE);
@ -442,8 +446,9 @@ gradient_editor_actions_update (GimpActionGroup *group,
&right_seg->left_color, FALSE);
SET_COLOR ("gradient-editor-load-right-left-endpoint",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("gradient-editor-load-right-fg", &fg, FALSE);
SET_COLOR ("gradient-editor-load-right-bg", &bg, FALSE);
SET_COLOR ("gradient-editor-load-right-fg", context ? &fg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-bg", context ? &bg : NULL, FALSE);
SET_COLOR ("gradient-editor-load-right-01", &editor->saved_colors[0], TRUE);
SET_COLOR ("gradient-editor-load-right-02", &editor->saved_colors[1], TRUE);

View File

@ -24,6 +24,9 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppaletteeditor.h"
@ -87,29 +90,52 @@ palette_editor_actions_setup (GimpActionGroup *group)
void
palette_editor_actions_update (GimpActionGroup *group,
gpointer data)
gpointer user_data)
{
GimpPaletteEditor *editor;
GimpDataEditor *data_editor;
GimpContext *context;
GimpData *data;
gboolean editable = FALSE;
GimpRGB fg;
GimpRGB bg;
editor = GIMP_PALETTE_EDITOR (data);
data_editor = GIMP_DATA_EDITOR (data);
editor = GIMP_PALETTE_EDITOR (user_data);
data_editor = GIMP_DATA_EDITOR (user_data);
if (data_editor->data && data_editor->data_editable)
editable = TRUE;
context = gimp_get_user_context (group->gimp);
data = data_editor->data;
if (data)
{
if (data_editor->data_editable)
editable = TRUE;
}
if (context)
{
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (context, &bg);
}
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, color, FALSE);
SET_SENSITIVE ("palette-editor-edit-color", editable && editor->color);
SET_SENSITIVE ("palette-editor-new-color-fg", editable);
SET_SENSITIVE ("palette-editor-new-color-bg", editable);
SET_SENSITIVE ("palette-editor-delete-color", editable && editor->color);
SET_SENSITIVE ("palette-editor-zoom-out", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-in", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-all", data_editor->data);
SET_SENSITIVE ("palette-editor-zoom-out", data);
SET_SENSITIVE ("palette-editor-zoom-in", data);
SET_SENSITIVE ("palette-editor-zoom-all", data);
SET_COLOR ("palette-editor-new-color-fg", context ? &fg : NULL);
SET_COLOR ("palette-editor-new-color-bg", context ? &bg : NULL);
#undef SET_SENSITIVE
#undef SET_COLOR
}

View File

@ -282,36 +282,22 @@ select_stroke_cmd_callback (GtkAction *action,
GimpImage *gimage;
GimpDrawable *drawable;
GtkWidget *widget;
return_if_no_drawable (gimage, drawable, data);
GtkWidget *dialog;
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
select_stroke (GIMP_ITEM (gimp_image_get_mask (gimage)), widget);
}
drawable = gimp_image_active_drawable (gimage);
void
select_stroke (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (GTK_IS_WIDGET (parent));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_SELECTION_STROKE,
dialog = stroke_dialog_new (GIMP_ITEM (gimp_image_get_mask (gimage)),
GIMP_STOCK_SELECTION_STROKE,
GIMP_HELP_SELECTION_STROKE,
parent);
widget);
gtk_widget_show (dialog);
}

View File

@ -45,8 +45,5 @@ void select_save_cmd_callback (GtkAction *action,
void select_stroke_cmd_callback (GtkAction *action,
gpointer data);
void select_stroke (GimpItem *item,
GtkWidget *parent);
#endif /* __SELECT_COMMANDS_H__ */

View File

@ -181,6 +181,7 @@ vectors_actions_update (GimpActionGroup *group,
{
GimpImage *gimage;
GimpVectors *vectors = NULL;
gint n_vectors = 0;
gboolean mask_empty = TRUE;
gboolean global_buf = FALSE;
GList *next = NULL;
@ -194,6 +195,8 @@ vectors_actions_update (GimpActionGroup *group,
vectors = gimp_image_get_active_vectors (gimage);
n_vectors = gimp_container_num_children (gimage->vectors);
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
global_buf = FALSE;
@ -217,9 +220,10 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-path-tool", vectors);
SET_SENSITIVE ("vectors-edit-attributes", vectors);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-merge-visible", n_vectors > 1);
SET_SENSITIVE ("vectors-raise", vectors && prev);
SET_SENSITIVE ("vectors-raise-to-top", vectors && prev);

View File

@ -197,23 +197,69 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage;
ProcRecord *proc_rec;
Argument *args;
GimpDisplay *gdisp;
return_if_no_image (gimage, data);
vectors_selection_to_vectors (gimage, value);
if (value)
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path_advanced");
else
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path");
if (! proc_rec)
{
g_message ("Selection to path procedure lookup failed.");
return;
}
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
/* plug-in arguments as if called by <Image>/Filters/... */
args = g_new (Argument, 3);
args[0].arg_type = GIMP_PDB_INT32;
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].arg_type = GIMP_PDB_IMAGE;
args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage);
args[2].arg_type = GIMP_PDB_DRAWABLE;
args[2].value.pdb_int = -1; /* unused */
plug_in_run (gimage->gimp, gimp_get_user_context (gimage->gimp),
proc_rec, args, 3, FALSE, TRUE,
gdisp ? gdisp->ID : 0);
g_free (args);
}
void
vectors_stroke_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GtkWidget *widget;
return_if_no_vectors (gimage, active_vectors, data);
GimpImage *gimage;
GimpVectors *vectors;
GimpDrawable *drawable;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_vectors (gimage, vectors, data);
return_if_no_widget (widget, data);
vectors_stroke_vectors (GIMP_ITEM (active_vectors), widget);
drawable = gimp_image_active_drawable (gimage);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (GIMP_ITEM (vectors),
GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
widget);
gtk_widget_show (dialog);
}
void
@ -290,74 +336,6 @@ vectors_edit_attributes_cmd_callback (GtkAction *action,
vectors_edit_vectors_query (active_vectors, widget);
}
void
vectors_stroke_vectors (GimpItem *item,
GtkWidget *parent)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
GtkWidget *dialog;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
dialog = stroke_dialog_new (item, GIMP_STOCK_PATH_STROKE,
GIMP_HELP_PATH_STROKE,
parent);
gtk_widget_show (dialog);
}
void
vectors_selection_to_vectors (GimpImage *gimage,
gboolean advanced)
{
ProcRecord *proc_rec;
Argument *args;
GimpDisplay *gdisp;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
if (advanced)
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path_advanced");
else
proc_rec = procedural_db_lookup (gimage->gimp,
"plug_in_sel2path");
if (! proc_rec)
{
g_message ("Selection to path procedure lookup failed.");
return;
}
gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp));
/* plug-in arguments as if called by <Image>/Filters/... */
args = g_new (Argument, 3);
args[0].arg_type = GIMP_PDB_INT32;
args[0].value.pdb_int = GIMP_RUN_INTERACTIVE;
args[1].arg_type = GIMP_PDB_IMAGE;
args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage);
args[2].arg_type = GIMP_PDB_DRAWABLE;
args[2].value.pdb_int = -1; /* unused */
plug_in_run (gimage->gimp, gimp_get_user_context (gimage->gimp),
proc_rec, args, 3, FALSE, TRUE,
gdisp ? gdisp->ID : 0);
g_free (args);
}
void
vectors_vectors_tool (GimpVectors *vectors)
{

View File

@ -57,10 +57,6 @@ void vectors_vectors_tool_cmd_callback (GtkAction *action,
void vectors_edit_attributes_cmd_callback (GtkAction *action,
gpointer data);
void vectors_stroke_vectors (GimpItem *item,
GtkWidget *parent);
void vectors_selection_to_vectors (GimpImage *gimage,
gboolean advanced);
void vectors_vectors_tool (GimpVectors *vectors);
void vectors_new_vectors_query (GimpImage *gimage,
GimpVectors *template,

View File

@ -57,9 +57,8 @@ static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass);
static void gimp_navigation_view_init (GimpNavigationView *view);
static void gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static void gimp_navigation_view_set_context (GimpDocked *docked,
GimpContext *context);
static void gimp_navigation_view_destroy (GtkObject *object);
@ -192,13 +191,13 @@ gimp_navigation_view_init (GimpNavigationView *view)
static void
gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->set_context = gimp_navigation_view_set_docked_context;
docked_iface->set_context = gimp_navigation_view_set_context;
}
static void
gimp_navigation_view_docked_context_changed (GimpContext *context,
GimpDisplay *gdisp,
GimpNavigationView *view)
gimp_navigation_view_context_changed (GimpContext *context,
GimpDisplay *gdisp,
GimpNavigationView *view)
{
GimpDisplayShell *shell = NULL;
@ -209,23 +208,26 @@ gimp_navigation_view_docked_context_changed (GimpContext *context,
}
static void
gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
gimp_navigation_view_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (docked);
GimpDisplay *gdisp = NULL;
GimpDisplayShell *shell = NULL;
if (prev_context)
g_signal_handlers_disconnect_by_func (prev_context,
gimp_navigation_view_docked_context_changed,
view);
if (view->context)
{
g_signal_handlers_disconnect_by_func (view->context,
gimp_navigation_view_context_changed,
view);
}
view->context = context;
if (context)
{
g_signal_connect (context, "display_changed",
G_CALLBACK (gimp_navigation_view_docked_context_changed),
G_CALLBACK (gimp_navigation_view_context_changed),
view);
gdisp = gimp_context_get_display (context);
@ -240,9 +242,7 @@ gimp_navigation_view_set_docked_context (GimpDocked *docked,
static void
gimp_navigation_view_destroy (GtkObject *object)
{
GimpNavigationView *view;
view = GIMP_NAVIGATION_VIEW (object);
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (object);
if (view->shell)
gimp_navigation_view_set_shell (view, NULL);

View File

@ -43,6 +43,7 @@ struct _GimpNavigationView
{
GimpEditor parent_instance;
GimpContext *context;
GimpDisplayShell *shell;
GtkWidget *preview;

View File

@ -57,9 +57,8 @@ static void gimp_navigation_view_class_init (GimpNavigationViewClass *klass);
static void gimp_navigation_view_init (GimpNavigationView *view);
static void gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static void gimp_navigation_view_set_context (GimpDocked *docked,
GimpContext *context);
static void gimp_navigation_view_destroy (GtkObject *object);
@ -192,13 +191,13 @@ gimp_navigation_view_init (GimpNavigationView *view)
static void
gimp_navigation_view_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->set_context = gimp_navigation_view_set_docked_context;
docked_iface->set_context = gimp_navigation_view_set_context;
}
static void
gimp_navigation_view_docked_context_changed (GimpContext *context,
GimpDisplay *gdisp,
GimpNavigationView *view)
gimp_navigation_view_context_changed (GimpContext *context,
GimpDisplay *gdisp,
GimpNavigationView *view)
{
GimpDisplayShell *shell = NULL;
@ -209,23 +208,26 @@ gimp_navigation_view_docked_context_changed (GimpContext *context,
}
static void
gimp_navigation_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
gimp_navigation_view_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (docked);
GimpDisplay *gdisp = NULL;
GimpDisplayShell *shell = NULL;
if (prev_context)
g_signal_handlers_disconnect_by_func (prev_context,
gimp_navigation_view_docked_context_changed,
view);
if (view->context)
{
g_signal_handlers_disconnect_by_func (view->context,
gimp_navigation_view_context_changed,
view);
}
view->context = context;
if (context)
{
g_signal_connect (context, "display_changed",
G_CALLBACK (gimp_navigation_view_docked_context_changed),
G_CALLBACK (gimp_navigation_view_context_changed),
view);
gdisp = gimp_context_get_display (context);
@ -240,9 +242,7 @@ gimp_navigation_view_set_docked_context (GimpDocked *docked,
static void
gimp_navigation_view_destroy (GtkObject *object)
{
GimpNavigationView *view;
view = GIMP_NAVIGATION_VIEW (object);
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (object);
if (view->shell)
gimp_navigation_view_set_shell (view, NULL);

View File

@ -43,6 +43,7 @@ struct _GimpNavigationView
{
GimpEditor parent_instance;
GimpContext *context;
GimpDisplayShell *shell;
GtkWidget *preview;

View File

@ -48,12 +48,11 @@ static void gimp_color_editor_destroy (GtkObject *object);
static void gimp_color_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_color_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
static void gimp_color_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
static GList *gimp_color_editor_get_aux_info (GimpDocked *docked);
static void gimp_color_editor_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static void gimp_color_editor_set_context (GimpDocked *docked,
GimpContext *context);
static void gimp_color_editor_destroy (GtkObject *object);
@ -304,7 +303,7 @@ gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->set_aux_info = gimp_color_editor_set_aux_info;
docked_iface->get_aux_info = gimp_color_editor_get_aux_info;
docked_iface->set_context = gimp_color_editor_set_docked_context;
docked_iface->set_context = gimp_color_editor_set_context;
}
#define AUX_INFO_CURRENT_PAGE "current-page"
@ -369,61 +368,10 @@ gimp_color_editor_get_aux_info (GimpDocked *docked)
}
static void
gimp_color_editor_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
gimp_color_editor_set_context (GimpDocked *docked,
GimpContext *context)
{
gimp_color_editor_set_context (GIMP_COLOR_EDITOR (docked), context);
}
static void
gimp_color_editor_destroy (GtkObject *object)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
if (editor->context)
gimp_color_editor_set_context (editor, NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* public functions */
GtkWidget *
gimp_color_editor_new (GimpContext *context)
{
GimpColorEditor *editor;
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
editor = g_object_new (GIMP_TYPE_COLOR_EDITOR, NULL);
if (context)
gimp_color_editor_set_context (editor, context);
return GTK_WIDGET (editor);
}
static void
gimp_color_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (widget);
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
if (editor->hbox)
gimp_editor_set_box_style (GIMP_EDITOR (editor), GTK_BOX (editor->hbox));
}
void
gimp_color_editor_set_context (GimpColorEditor *editor,
GimpContext *context)
{
g_return_if_fail (GIMP_IS_COLOR_EDITOR (editor));
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
GimpColorEditor *editor = GIMP_COLOR_EDITOR (docked);
if (context == editor->context)
return;
@ -467,6 +415,48 @@ gimp_color_editor_set_context (GimpColorEditor *editor,
}
}
static void
gimp_color_editor_destroy (GtkObject *object)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
if (editor->context)
gimp_docked_set_context (GIMP_DOCKED (editor), NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
/* public functions */
GtkWidget *
gimp_color_editor_new (GimpContext *context)
{
GimpColorEditor *editor;
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
editor = g_object_new (GIMP_TYPE_COLOR_EDITOR, NULL);
if (context)
gimp_docked_set_context (GIMP_DOCKED (editor), context);
return GTK_WIDGET (editor);
}
static void
gimp_color_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (widget);
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
if (editor->hbox)
gimp_editor_set_box_style (GIMP_EDITOR (editor), GTK_BOX (editor->hbox));
}
/* public functions */

View File

@ -54,11 +54,9 @@ struct _GimpColorEditorClass
};
GType gimp_color_editor_get_type (void) G_GNUC_CONST;
GType gimp_color_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_editor_new (GimpContext *context);
void gimp_color_editor_set_context (GimpColorEditor *editor,
GimpContext *context);
GtkWidget * gimp_color_editor_new (GimpContext *context);
#endif /* __GIMP_COLOR_EDITOR_H__ */

View File

@ -278,14 +278,14 @@ gimp_component_editor_new (gint preview_size,
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
editor = g_object_new (GIMP_TYPE_COMPONENT_EDITOR, NULL);
editor = g_object_new (GIMP_TYPE_COMPONENT_EDITOR,
"menu-factory", menu_factory,
"menu-identifier", "<Channels>",
"ui-path", "/channels-popup",
NULL);
gimp_component_editor_set_preview_size (editor, preview_size);
gimp_editor_create_menu (GIMP_EDITOR (editor),
menu_factory, "<Channels>",
"/channels-popup", editor);
return GTK_WIDGET (editor);
}

View File

@ -50,8 +50,7 @@ static GtkWidget * gimp_container_box_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size);
static void gimp_container_box_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
GimpContext *context);
static GimpEditorClass *parent_class = NULL;
@ -196,8 +195,7 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
static void
gimp_container_box_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
GimpContext *context)
{
gimp_container_view_set_context (GIMP_CONTAINER_VIEW (docked), context);
}

View File

@ -60,15 +60,14 @@ static void gimp_container_editor_context_item (GtkWidget *widge
static void gimp_container_editor_real_context_item(GimpContainerEditor *editor,
GimpViewable *viewable);
static GtkWidget * gimp_container_editor_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size);
static void gimp_container_editor_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static GimpUIManager * gimp_container_editor_get_menu (GimpDocked *docked,
const gchar **ui_path,
gpointer *popup_data);
static GtkWidget * gimp_container_editor_get_preview (GimpDocked *docked,
GimpContext *context,
GtkIconSize size);
static void gimp_container_editor_set_context (GimpDocked *docked,
GimpContext *context);
static GimpUIManager * gimp_container_editor_get_menu(GimpDocked *docked,
const gchar **ui_path,
gpointer *popup_data);
static GtkVBoxClass *parent_class = NULL;
@ -274,13 +273,11 @@ gimp_container_editor_get_preview (GimpDocked *docked,
static void
gimp_container_editor_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
GimpContext *context)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked);
gimp_docked_set_context (GIMP_DOCKED (editor->view),
context, prev_context);
gimp_docked_set_context (GIMP_DOCKED (editor->view), context);
}
static GimpUIManager *

View File

@ -792,13 +792,14 @@ gimp_dockable_set_context (GimpDockable *dockable,
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
if (context != dockable->context && GTK_BIN (dockable)->child)
if (context != dockable->context)
{
gimp_docked_set_context (GIMP_DOCKED (GTK_BIN (dockable)->child),
context, dockable->context);
}
if (GTK_BIN (dockable)->child)
gimp_docked_set_context (GIMP_DOCKED (GTK_BIN (dockable)->child),
context);
dockable->context = context;
dockable->context = context;
}
}
GimpUIManager *
@ -926,16 +927,26 @@ gimp_dockable_menu_end (GimpDockable *dockable)
static gboolean
gimp_dockable_show_menu (GimpDockable *dockable)
{
GimpUIManager *dockbook_ui_manager;
GimpUIManager *dialog_ui_manager;
const gchar *dialog_ui_path;
gpointer dialog_popup_data;
GimpUIManager *dockbook_ui_manager;
GimpUIManager *dialog_ui_manager;
const gchar *dialog_ui_path;
gpointer dialog_popup_data;
GtkWidget *parent_menu_widget;
GtkAction *parent_menu_action;
dockbook_ui_manager = dockable->dockbook->ui_manager;
if (! dockbook_ui_manager)
return FALSE;
parent_menu_widget =
gimp_ui_manager_ui_get (dockbook_ui_manager,
"/dockable-popup/dockable-menu");
parent_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
dialog_ui_manager = gimp_dockable_get_menu (dockable,
&dialog_ui_path,
&dialog_popup_data);
@ -944,8 +955,6 @@ gimp_dockable_show_menu (GimpDockable *dockable)
{
GtkWidget *child_menu_widget;
GtkAction *child_menu_action;
GtkWidget *parent_menu_widget;
GtkAction *parent_menu_action;
const gchar *label;
child_menu_widget =
@ -955,14 +964,6 @@ gimp_dockable_show_menu (GimpDockable *dockable)
gtk_ui_manager_get_action (GTK_UI_MANAGER (dialog_ui_manager),
dialog_ui_path);
parent_menu_widget =
gimp_ui_manager_ui_get (dockbook_ui_manager,
"/dockable-popup/dockable-menu");
parent_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
g_object_get (child_menu_action,
"label", &label,
NULL);
@ -998,12 +999,6 @@ gimp_dockable_show_menu (GimpDockable *dockable)
}
else
{
GtkAction *parent_menu_action;
parent_menu_action =
gtk_ui_manager_get_action (GTK_UI_MANAGER (dockbook_ui_manager),
"/dockable-popup/dockable-menu");
g_object_set (parent_menu_action, "visible", FALSE, NULL);
}

View File

@ -179,17 +179,15 @@ gimp_docked_get_title (GimpDocked *docked)
void
gimp_docked_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
GimpContext *context)
{
GimpDockedInterface *docked_iface;
g_return_if_fail (GIMP_IS_DOCKED (docked));
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
g_return_if_fail (prev_context == NULL || GIMP_IS_CONTEXT (prev_context));
docked_iface = GIMP_DOCKED_GET_INTERFACE (docked);
if (docked_iface->set_context)
docked_iface->set_context (docked, context, prev_context);
docked_iface->set_context (docked, context);
}

View File

@ -52,8 +52,7 @@ struct _GimpDockedInterface
gchar * (* get_title) (GimpDocked *docked);
void (* set_context) (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
GimpContext *context);
};
@ -74,8 +73,7 @@ GimpUIManager * gimp_docked_get_menu (GimpDocked *docked,
gchar * gimp_docked_get_title (GimpDocked *docked);
void gimp_docked_set_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
GimpContext *context);
#endif /* __GIMP_DOCKED_H__ */

View File

@ -227,13 +227,9 @@ gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
"gimp-bucket-fill-tool");
if (tool_info && tool_info->tool_options)
{
context = GIMP_CONTEXT (tool_info->tool_options);
}
context = GIMP_CONTEXT (tool_info->tool_options);
else
{
context = gimp_get_user_context (view->gimage->gimp);
}
context = view->context;
gimp_drawable_bucket_fill_full (drawable,
fill_mode,

View File

@ -228,14 +228,14 @@ gimp_error_console_new (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
console = g_object_new (GIMP_TYPE_ERROR_CONSOLE, NULL);
console = g_object_new (GIMP_TYPE_ERROR_CONSOLE,
"menu-factory", menu_factory,
"menu-dentifier", "<ErrorConsole>",
"ui-path", "/error-console-popup",
NULL);
console->gimp = gimp;
gimp_editor_create_menu (GIMP_EDITOR (console),
menu_factory, "<ErrorConsole>",
"/error-console-popup", console);
console->gimp->message_handler = GIMP_ERROR_CONSOLE;
return GTK_WIDGET (console);

View File

@ -30,20 +30,17 @@
#include "gimpuimanager.h"
static void gimp_image_editor_class_init (GimpImageEditorClass *klass);
static void gimp_image_editor_init (GimpImageEditor *editor);
static void gimp_image_editor_class_init (GimpImageEditorClass *klass);
static void gimp_image_editor_init (GimpImageEditor *editor);
static void gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_image_editor_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static void gimp_image_editor_destroy (GtkObject *object);
static void gimp_image_editor_real_set_image (GimpImageEditor *editor,
GimpImage *gimage);
static void gimp_image_editor_image_flush (GimpImage *gimage,
GimpImageEditor *editor);
static void gimp_image_editor_set_context (GimpDocked *docked,
GimpContext *context);
static void gimp_image_editor_destroy (GtkObject *object);
static void gimp_image_editor_real_set_image (GimpImageEditor *editor,
GimpImage *gimage);
static void gimp_image_editor_image_flush (GimpImage *gimage,
GimpImageEditor *editor);
static GimpEditorClass *parent_class = NULL;
@ -109,34 +106,37 @@ gimp_image_editor_init (GimpImageEditor *editor)
static void
gimp_image_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->set_context = gimp_image_editor_set_docked_context;
docked_iface->set_context = gimp_image_editor_set_context;
}
static void
gimp_image_editor_docked_context_changed (GimpContext *context,
GimpImage *gimage,
GimpImageEditor *editor)
gimp_image_editor_context_changed (GimpContext *context,
GimpImage *gimage,
GimpImageEditor *editor)
{
gimp_image_editor_set_image (editor, gimage);
}
static void
gimp_image_editor_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
gimp_image_editor_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpImageEditor *editor = GIMP_IMAGE_EDITOR (docked);
GimpImage *gimage = NULL;
if (prev_context)
g_signal_handlers_disconnect_by_func (prev_context,
gimp_image_editor_docked_context_changed,
editor);
if (editor->context)
{
g_signal_handlers_disconnect_by_func (editor->context,
gimp_image_editor_context_changed,
editor);
}
editor->context = context;
if (context)
{
g_signal_connect (context, "image_changed",
G_CALLBACK (gimp_image_editor_docked_context_changed),
G_CALLBACK (gimp_image_editor_context_changed),
editor);
gimage = gimp_context_get_image (context);

View File

@ -35,9 +35,10 @@ typedef struct _GimpImageEditorClass GimpImageEditorClass;
struct _GimpImageEditor
{
GimpEditor parent_instance;
GimpEditor parent_instance;
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage;
};
struct _GimpImageEditorClass

View File

@ -77,9 +77,8 @@ static void gimp_item_tree_view_init (GimpItemTreeView *view,
static void gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *view_iface);
static void gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_item_tree_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context);
static void gimp_item_tree_view_set_context (GimpDocked *docked,
GimpContext *context);
static GObject * gimp_item_tree_view_constructor (GType type,
guint n_params,
@ -429,34 +428,37 @@ static void
gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->get_preview = NULL;
docked_iface->set_context = gimp_item_tree_view_set_docked_context;
docked_iface->set_context = gimp_item_tree_view_set_context;
}
static void
gimp_item_tree_view_docked_context_changed (GimpContext *context,
GimpImage *gimage,
GimpItemTreeView *view)
gimp_item_tree_view_context_changed (GimpContext *context,
GimpImage *gimage,
GimpItemTreeView *view)
{
gimp_item_tree_view_set_image (view, gimage);
}
static void
gimp_item_tree_view_set_docked_context (GimpDocked *docked,
GimpContext *context,
GimpContext *prev_context)
gimp_item_tree_view_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (docked);
GimpImage *gimage = NULL;
if (prev_context)
g_signal_handlers_disconnect_by_func (prev_context,
gimp_item_tree_view_docked_context_changed,
view);
if (view->context)
{
g_signal_handlers_disconnect_by_func (view->context,
gimp_item_tree_view_context_changed,
view);
}
view->context = context;
if (context)
{
g_signal_connect (context, "image_changed",
G_CALLBACK (gimp_item_tree_view_docked_context_changed),
G_CALLBACK (gimp_item_tree_view_context_changed),
view);
gimage = gimp_context_get_image (context);

View File

@ -65,6 +65,7 @@ struct _GimpItemTreeView
{
GimpContainerTreeView parent_instance;
GimpContext *context;
GimpImage *gimage;
GType item_type;

View File

@ -66,22 +66,21 @@ typedef struct _GimpEnumComboBox GimpEnumComboBox;
typedef struct _GimpUnitComboBox GimpUnitComboBox;
typedef struct _GimpEditor GimpEditor;
typedef struct _GimpColorEditor GimpColorEditor;
typedef struct _GimpDeviceStatus GimpDeviceStatus;
typedef struct _GimpErrorConsole GimpErrorConsole;
typedef struct _GimpImageEditor GimpImageEditor;
typedef struct _GimpColorBar GimpColorBar;
typedef struct _GimpColorEditor GimpColorEditor;
typedef struct _GimpColormapEditor GimpColormapEditor;
typedef struct _GimpComponentEditor GimpComponentEditor;
typedef struct _GimpToolOptionsEditor GimpToolOptionsEditor;
typedef struct _GimpDataEditor GimpDataEditor;
typedef struct _GimpBrushEditor GimpBrushEditor;
typedef struct _GimpGradientEditor GimpGradientEditor;
typedef struct _GimpGridEditor GimpGridEditor;
typedef struct _GimpPaletteEditor GimpPaletteEditor;
typedef struct _GimpImageEditor GimpImageEditor;
typedef struct _GimpColormapEditor GimpColormapEditor;
typedef struct _GimpComponentEditor GimpComponentEditor;
typedef struct _GimpHistogramEditor GimpHistogramEditor;
typedef struct _GimpSelectionEditor GimpSelectionEditor;
typedef struct _GimpStrokeEditor GimpStrokeEditor;
typedef struct _GimpTemplateEditor GimpTemplateEditor;
typedef struct _GimpToolOptionsEditor GimpToolOptionsEditor;
typedef struct _GimpUndoEditor GimpUndoEditor;
typedef struct _GimpContainerView GimpContainerView; /* dummy typedef */
@ -103,6 +102,7 @@ typedef struct _GimpFontView GimpFontView;
typedef struct _GimpImageView GimpImageView;
typedef struct _GimpTemplateView GimpTemplateView;
typedef struct _GimpToolView GimpToolView;
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpBrushFactoryView GimpBrushFactoryView;
typedef struct _GimpPatternFactoryView GimpPatternFactoryView;
@ -114,20 +114,22 @@ typedef struct _GimpDockable GimpDockable;
typedef struct _GimpDockbook GimpDockbook;
typedef struct _GimpDocked GimpDocked; /* dummy typedef */
typedef struct _GimpFileDialog GimpFileDialog;
typedef struct _GimpTextEditor GimpTextEditor;
typedef struct _GimpViewableDialog GimpViewableDialog;
typedef struct _GimpContainerPopup GimpContainerPopup;
typedef struct _GimpViewableButton GimpViewableButton;
typedef struct _GimpViewableDialog GimpViewableDialog;
typedef struct _GimpFileDialog GimpFileDialog;
typedef struct _GimpHistogramView GimpHistogramView;
typedef struct _GimpHistogramBox GimpHistogramBox;
typedef struct _GimpHistogramEditor GimpHistogramEditor;
typedef struct _GimpDashEditor GimpDashEditor;
typedef struct _GimpThumbBox GimpThumbBox;
typedef struct _GimpTextEditor GimpTextEditor;
typedef struct _GimpColorBar GimpColorBar;
typedef struct _GimpColorDisplayEditor GimpColorDisplayEditor;
typedef struct _GimpDashEditor GimpDashEditor;
typedef struct _GimpGridEditor GimpGridEditor;
typedef struct _GimpHistogramBox GimpHistogramBox;
typedef struct _GimpHistogramView GimpHistogramView;
typedef struct _GimpStrokeEditor GimpStrokeEditor;
typedef struct _GimpTemplateEditor GimpTemplateEditor;
typedef struct _GimpThumbBox GimpThumbBox;
/* structs */