More GimpContainerView chopping:
2004-05-10 Michael Natterer <mitch@gimp.org> More GimpContainerView chopping: * app/widgets/gimpcontainerview.[ch]: added GimpContainerViewPrivate struct (which is currently puclic :-) and removed all members from the GimpContainerView struct. Added accessors for "context", "container" and "preview_size / preview_border_width". Added macro to get the private struct (*not* via G_TYPE_INSTANCE_GET_PRIVATE because that's unavailable for interfaces). * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcontainerbox.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpcontainertreeview-dnd.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdocumentview.c * app/widgets/gimpfontview.c * app/widgets/gimpimageview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpsessioninfo.c * app/widgets/gimptemplateview.c * app/widgets/gimptoolview.c * app/actions/brushes-actions.c * app/actions/buffers-actions.c * app/actions/dockable-actions.c * app/actions/dockable-commands.c * app/actions/documents-actions.c * app/actions/fonts-actions.c * app/actions/gradients-actions.c * app/actions/gradients-commands.c * app/actions/images-actions.c * app/actions/palettes-actions.c * app/actions/palettes-commands.c * app/actions/patterns-actions.c * app/actions/templates-actions.c * app/actions/tools-actions.c * app/actions/tools-commands.c: changed accordingly.
This commit is contained in:

committed by
Michael Natterer

parent
c1dc358dd8
commit
3adc0816e6
46
ChangeLog
46
ChangeLog
@ -1,3 +1,49 @@
|
||||
2004-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
More GimpContainerView chopping:
|
||||
|
||||
* app/widgets/gimpcontainerview.[ch]: added
|
||||
GimpContainerViewPrivate struct (which is currently puclic :-) and
|
||||
removed all members from the GimpContainerView struct. Added
|
||||
accessors for "context", "container" and "preview_size /
|
||||
preview_border_width". Added macro to get the private struct
|
||||
(*not* via G_TYPE_INSTANCE_GET_PRIVATE because that's unavailable
|
||||
for interfaces).
|
||||
|
||||
* app/widgets/gimpbrushfactoryview.c
|
||||
* app/widgets/gimpbufferview.c
|
||||
* app/widgets/gimpchanneltreeview.c
|
||||
* app/widgets/gimpcontainerbox.c
|
||||
* app/widgets/gimpcontainereditor.c
|
||||
* app/widgets/gimpcontainergridview.c
|
||||
* app/widgets/gimpcontainerpopup.c
|
||||
* app/widgets/gimpcontainertreeview-dnd.c
|
||||
* app/widgets/gimpcontainertreeview.c
|
||||
* app/widgets/gimpdatafactoryview.c
|
||||
* app/widgets/gimpdocumentview.c
|
||||
* app/widgets/gimpfontview.c
|
||||
* app/widgets/gimpimageview.c
|
||||
* app/widgets/gimpitemtreeview.c
|
||||
* app/widgets/gimplayertreeview.c
|
||||
* app/widgets/gimpsessioninfo.c
|
||||
* app/widgets/gimptemplateview.c
|
||||
* app/widgets/gimptoolview.c
|
||||
* app/actions/brushes-actions.c
|
||||
* app/actions/buffers-actions.c
|
||||
* app/actions/dockable-actions.c
|
||||
* app/actions/dockable-commands.c
|
||||
* app/actions/documents-actions.c
|
||||
* app/actions/fonts-actions.c
|
||||
* app/actions/gradients-actions.c
|
||||
* app/actions/gradients-commands.c
|
||||
* app/actions/images-actions.c
|
||||
* app/actions/palettes-actions.c
|
||||
* app/actions/palettes-commands.c
|
||||
* app/actions/patterns-actions.c
|
||||
* app/actions/templates-actions.c
|
||||
* app/actions/tools-actions.c
|
||||
* app/actions/tools-commands.c: changed accordingly.
|
||||
|
||||
2004-05-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimpmagnifyoptions.[ch]
|
||||
|
@ -84,12 +84,14 @@ brushes_actions_update (GimpActionGroup *group,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpBrush *brush;
|
||||
GimpData *data = NULL;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
brush = gimp_context_get_brush (editor->view->context);
|
||||
brush = gimp_context_get_brush (context);
|
||||
|
||||
if (brush)
|
||||
data = GIMP_DATA (brush);
|
||||
|
@ -77,11 +77,13 @@ buffers_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
buffer = gimp_context_get_buffer (context);
|
||||
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
@ -239,7 +239,7 @@ dockable_actions_update (GimpActionGroup *group,
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view)
|
||||
preview_size = view->preview_size;
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
tab_style = dockable->tab_style;
|
||||
|
||||
|
@ -168,7 +168,8 @@ dockable_toggle_view_cmd_callback (GtkAction *action,
|
||||
old_view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (old_view)
|
||||
preview_size = old_view->preview_size;
|
||||
preview_size = gimp_container_view_get_preview_size (old_view,
|
||||
NULL);
|
||||
|
||||
new_dockable =
|
||||
gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory,
|
||||
@ -216,13 +217,20 @@ dockable_preview_size_cmd_callback (GtkAction *action,
|
||||
|
||||
if (dockable)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GimpContainerView *view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
if (view)
|
||||
{
|
||||
gint old_size;
|
||||
gint border_width;
|
||||
|
||||
if (view && view->preview_size != preview_size)
|
||||
gimp_container_view_set_preview_size (view, preview_size,
|
||||
view->preview_border_width);
|
||||
old_size = gimp_container_view_get_preview_size (view,
|
||||
&border_width);
|
||||
|
||||
if (old_size != preview_size)
|
||||
gimp_container_view_set_preview_size (view, preview_size,
|
||||
border_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,11 +92,13 @@ documents_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
imagefile = gimp_context_get_imagefile (context);
|
||||
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
@ -64,11 +64,13 @@ fonts_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpFont *font;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
font = gimp_context_get_font (editor->view->context);
|
||||
font = gimp_context_get_font (context);
|
||||
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
@ -91,12 +91,14 @@ gradients_actions_update (GimpActionGroup *group,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpGradient *gradient;
|
||||
GimpData *data = NULL;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
gradient = gimp_context_get_gradient (editor->view->context);
|
||||
gradient = gimp_context_get_gradient (context);
|
||||
|
||||
if (gradient)
|
||||
data = GIMP_DATA (gradient);
|
||||
|
@ -61,11 +61,14 @@ gradients_save_as_pov_ray_cmd_callback (GtkAction *action,
|
||||
static void
|
||||
gradients_save_as_pov_query (GimpContainerEditor *editor)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpGradient *gradient;
|
||||
GtkFileChooser *chooser;
|
||||
gchar *title;
|
||||
|
||||
gradient = gimp_context_get_gradient (editor->view->context);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
gradient = gimp_context_get_gradient (context);
|
||||
|
||||
if (! gradient)
|
||||
return;
|
||||
|
@ -73,11 +73,13 @@ images_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpImage *image;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
image = gimp_context_get_image (editor->view->context);
|
||||
image = gimp_context_get_image (context);
|
||||
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
@ -95,12 +95,14 @@ palettes_actions_update (GimpActionGroup *group,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpPalette *palette;
|
||||
GimpData *data = NULL;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
palette = gimp_context_get_palette (editor->view->context);
|
||||
palette = gimp_context_get_palette (context);
|
||||
|
||||
if (palette)
|
||||
data = GIMP_DATA (palette);
|
||||
|
@ -55,8 +55,11 @@ palettes_import_palette_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
|
||||
GimpContext *context;
|
||||
|
||||
palette_import_dialog_show (editor->view->context->gimp);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
palette_import_dialog_show (context->gimp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -84,12 +84,14 @@ patterns_actions_update (GimpActionGroup *group,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpPattern *pattern;
|
||||
GimpData *data = NULL;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
editor = GIMP_CONTAINER_EDITOR (user_data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
pattern = gimp_context_get_pattern (editor->view->context);
|
||||
pattern = gimp_context_get_pattern (context);
|
||||
|
||||
if (pattern)
|
||||
data = GIMP_DATA (pattern);
|
||||
|
@ -83,11 +83,13 @@ templates_actions_update (GimpActionGroup *group,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
editor = GIMP_CONTAINER_EDITOR (data);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
@ -165,8 +165,14 @@ tools_actions_update (GimpActionGroup *group,
|
||||
GimpToolInfo *tool_info = NULL;
|
||||
|
||||
if (GIMP_IS_CONTAINER_EDITOR (data))
|
||||
tool_info =
|
||||
gimp_context_get_tool (GIMP_CONTAINER_EDITOR (data)->view->context);
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
|
||||
GimpContext *context;
|
||||
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
}
|
||||
|
||||
#define SET_ACTIVE(action,condition) \
|
||||
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
||||
|
@ -105,11 +105,14 @@ tools_toggle_visibility_cmd_callback (GtkAction *action,
|
||||
{
|
||||
if (GIMP_IS_CONTAINER_EDITOR (data))
|
||||
{
|
||||
GimpToolInfo *tool_info;
|
||||
gboolean active;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
gboolean active;
|
||||
|
||||
tool_info =
|
||||
gimp_context_get_tool (GIMP_CONTAINER_EDITOR (data)->view->context);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
||||
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
|
||||
|
@ -129,13 +129,16 @@ gimp_brush_factory_view_init (GimpBrushFactoryView *view)
|
||||
static void
|
||||
gimp_brush_factory_view_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBrushFactoryView *view;
|
||||
|
||||
view = GIMP_BRUSH_FACTORY_VIEW (object);
|
||||
GimpBrushFactoryView *view = GIMP_BRUSH_FACTORY_VIEW (object);
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (object);
|
||||
|
||||
if (view->spacing_changed_handler_id)
|
||||
{
|
||||
gimp_container_remove_handler (GIMP_CONTAINER_EDITOR (view)->view->container,
|
||||
GimpContainer *container;
|
||||
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
gimp_container_remove_handler (container,
|
||||
view->spacing_changed_handler_id);
|
||||
|
||||
view->spacing_changed_handler_id = 0;
|
||||
@ -189,7 +192,7 @@ gimp_brush_factory_view_new (GimpViewType view_type,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
factory_view->spacing_changed_handler_id =
|
||||
gimp_container_add_handler (editor->view->container, "spacing_changed",
|
||||
gimp_container_add_handler (factory->container, "spacing_changed",
|
||||
G_CALLBACK (gimp_brush_factory_view_spacing_changed),
|
||||
factory_view);
|
||||
|
||||
@ -200,17 +203,16 @@ static void
|
||||
gimp_brush_factory_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpBrushFactoryView *view;
|
||||
GimpBrushFactoryView *view = GIMP_BRUSH_FACTORY_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
gboolean spacing_sensitive = FALSE;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
view = GIMP_BRUSH_FACTORY_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable &&
|
||||
gimp_container_have (GIMP_CONTAINER_EDITOR (view)->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
GimpBrush *brush = GIMP_BRUSH (viewable);
|
||||
|
||||
@ -235,7 +237,12 @@ static void
|
||||
gimp_brush_factory_view_spacing_changed (GimpBrush *brush,
|
||||
GimpBrushFactoryView *view)
|
||||
{
|
||||
if (brush == GIMP_CONTAINER_EDITOR (view)->view->context->brush)
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (brush == gimp_context_get_brush (context))
|
||||
{
|
||||
g_signal_handlers_block_by_func (view->spacing_adjustment,
|
||||
gimp_brush_factory_view_spacing_update,
|
||||
@ -254,7 +261,13 @@ static void
|
||||
gimp_brush_factory_view_spacing_update (GtkAdjustment *adjustment,
|
||||
GimpBrushFactoryView *view)
|
||||
{
|
||||
GimpBrush *brush = GIMP_CONTAINER_EDITOR (view)->view->context->brush;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
GimpBrush *brush;
|
||||
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
brush = gimp_context_get_brush (context);
|
||||
|
||||
if (brush && view->change_brush_spacing)
|
||||
{
|
||||
|
@ -206,14 +206,18 @@ gimp_buffer_view_paste (GimpBufferView *view,
|
||||
gboolean paste_into)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
buffer = gimp_context_get_buffer (context);
|
||||
|
||||
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
|
||||
{
|
||||
GimpDisplay *gdisp = gimp_context_get_display (editor->view->context);
|
||||
GimpDisplay *gdisp = gimp_context_get_display (context);
|
||||
GimpImage *gimage = NULL;
|
||||
gint x = -1;
|
||||
gint y = -1;
|
||||
@ -231,7 +235,7 @@ gimp_buffer_view_paste (GimpBufferView *view,
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gimp_context_get_image (editor->view->context);
|
||||
gimage = gimp_context_get_image (context);
|
||||
}
|
||||
|
||||
if (gimage)
|
||||
@ -263,14 +267,18 @@ gimp_buffer_view_paste_as_new_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
buffer = gimp_context_get_buffer (context);
|
||||
|
||||
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
|
||||
{
|
||||
GimpImage *gimage = gimp_context_get_image (editor->view->context);
|
||||
GimpImage *gimage = gimp_context_get_image (context);
|
||||
|
||||
if (gimage)
|
||||
gimp_edit_paste_as_new (gimage->gimp, gimage, buffer);
|
||||
@ -282,14 +290,18 @@ gimp_buffer_view_delete_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
buffer = gimp_context_get_buffer (context);
|
||||
|
||||
if (buffer && gimp_container_have (container, GIMP_OBJECT (buffer)))
|
||||
{
|
||||
gimp_container_remove (editor->view->container, GIMP_OBJECT (buffer));
|
||||
gimp_container_remove (container, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,6 +310,7 @@ gimp_buffer_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpBufferView *view = GIMP_BUFFER_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
gboolean paste_sensitive = FALSE;
|
||||
gboolean paste_into_sensitive = FALSE;
|
||||
gboolean paste_as_new_sensitive = FALSE;
|
||||
@ -306,8 +319,9 @@ gimp_buffer_view_select_item (GimpContainerEditor *editor,
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
paste_sensitive = TRUE;
|
||||
paste_into_sensitive = TRUE;
|
||||
@ -326,12 +340,14 @@ gimp_buffer_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpBufferView *view = GIMP_BUFFER_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_buffer_view_paste_clicked (NULL, view);
|
||||
}
|
||||
|
@ -178,14 +178,17 @@ static void
|
||||
gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
GimpChannelTreeView *channel_view;
|
||||
|
||||
channel_view = GIMP_CHANNEL_TREE_VIEW (item_view);
|
||||
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (item_view);
|
||||
|
||||
if (! channel_view->component_editor)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (item_view);
|
||||
gint preview_size;
|
||||
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
channel_view->component_editor =
|
||||
gimp_component_editor_new (GIMP_CONTAINER_VIEW (item_view)->preview_size,
|
||||
gimp_component_editor_new (preview_size,
|
||||
GIMP_EDITOR (item_view)->menu_factory);
|
||||
gtk_box_pack_start (GTK_BOX (item_view), channel_view->component_editor,
|
||||
FALSE, FALSE, 0);
|
||||
@ -241,15 +244,16 @@ gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
static void
|
||||
gimp_channel_tree_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpChannelTreeView *channel_view;
|
||||
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
gint preview_size;
|
||||
|
||||
channel_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size (view);
|
||||
|
||||
if (channel_view->component_editor)
|
||||
gimp_component_editor_set_preview_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
||||
view->preview_size);
|
||||
preview_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -102,7 +102,10 @@ gimp_container_box_class_init (GimpContainerBoxClass *klass)
|
||||
static void
|
||||
gimp_container_box_init (GimpContainerBox *box)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (box);
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (box);
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
box->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box), box->scrolled_win, TRUE, TRUE, 0);
|
||||
@ -111,7 +114,7 @@ gimp_container_box_init (GimpContainerBox *box)
|
||||
GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (box->scrolled_win)->vscrollbar,
|
||||
GTK_CAN_FOCUS);
|
||||
|
||||
view->dnd_widget = box->scrolled_win;
|
||||
private->dnd_widget = box->scrolled_win;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -129,6 +132,7 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
|
||||
GimpContainerView *view;
|
||||
GtkScrolledWindowClass *sw_class;
|
||||
GtkRequisition req;
|
||||
gint preview_size;
|
||||
gint scrollbar_width;
|
||||
gint border_x;
|
||||
gint border_y;
|
||||
@ -137,8 +141,10 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (box);
|
||||
|
||||
g_return_if_fail (width <= 0 || width >= view->preview_size);
|
||||
g_return_if_fail (height <= 0 || height >= view->preview_size);
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
g_return_if_fail (width <= 0 || width >= preview_size);
|
||||
g_return_if_fail (height <= 0 || height >= preview_size);
|
||||
|
||||
sw_class = GTK_SCROLLED_WINDOW_GET_CLASS (box->scrolled_win);
|
||||
|
||||
@ -176,6 +182,7 @@ gimp_container_box_get_preview (GimpDocked *docked,
|
||||
{
|
||||
GimpContainerBox *box = GIMP_CONTAINER_BOX (docked);
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (docked);
|
||||
GimpContainer *container;
|
||||
GtkWidget *preview;
|
||||
GdkScreen *screen;
|
||||
gint width;
|
||||
@ -183,13 +190,15 @@ gimp_container_box_get_preview (GimpDocked *docked,
|
||||
gint border_width = 1;
|
||||
const gchar *prop_name;
|
||||
|
||||
g_return_val_if_fail (view->container != NULL, NULL);
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
g_return_val_if_fail (container != NULL, NULL);
|
||||
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (box));
|
||||
gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
|
||||
size, &width, &height);
|
||||
|
||||
prop_name = gimp_context_type_to_prop_name (view->container->children_type);
|
||||
prop_name = gimp_context_type_to_prop_name (container->children_type);
|
||||
|
||||
if (! strcmp (prop_name, "tool") ||
|
||||
! strcmp (prop_name, "template"))
|
||||
|
@ -259,8 +259,9 @@ static void
|
||||
gimp_container_editor_real_context_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
GimpContainer *container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
GimpEditor *gimp_editor = GIMP_EDITOR (editor->view);
|
||||
|
||||
|
@ -249,31 +249,32 @@ gimp_container_grid_view_new (GimpContainer *container,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_container_grid_view_move_by (GimpContainerGridView *view,
|
||||
gimp_container_grid_view_move_by (GimpContainerGridView *grid_view,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpViewable *item;
|
||||
gint index;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
GimpContainer *container;
|
||||
GimpViewable *item;
|
||||
gint index;
|
||||
|
||||
if (! view->selected_item)
|
||||
if (! grid_view->selected_item)
|
||||
return FALSE;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
item = view->selected_item->viewable;
|
||||
item = grid_view->selected_item->viewable;
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
index += x;
|
||||
index = CLAMP (index, 0, container->num_children - 1);
|
||||
|
||||
index += y * view->columns;
|
||||
index += y * grid_view->columns;
|
||||
while (index < 0)
|
||||
index += view->columns;
|
||||
index += grid_view->columns;
|
||||
while (index >= container->num_children)
|
||||
index -= view->columns;
|
||||
index -= grid_view->columns;
|
||||
|
||||
item = (GimpViewable *) gimp_container_get_child_by_index (container, index);
|
||||
if (item)
|
||||
@ -283,30 +284,32 @@ gimp_container_grid_view_move_by (GimpContainerGridView *view,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_container_grid_view_move_cursor (GimpContainerGridView *view,
|
||||
gimp_container_grid_view_move_cursor (GimpContainerGridView *grid_view,
|
||||
GtkMovementStep step,
|
||||
gint count)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpViewable *item;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
GimpContainer *container;
|
||||
GimpViewable *item;
|
||||
|
||||
if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (view)) || count == 0)
|
||||
if (! GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (grid_view)) || count == 0)
|
||||
return FALSE;
|
||||
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
switch (step)
|
||||
{
|
||||
case GTK_MOVEMENT_PAGES:
|
||||
return gimp_container_grid_view_move_by (view,
|
||||
0, count * view->visible_rows);
|
||||
return gimp_container_grid_view_move_by (grid_view, 0,
|
||||
count * grid_view->visible_rows);
|
||||
|
||||
case GTK_MOVEMENT_BUFFER_ENDS:
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
count = count < 0 ? 0 : container->num_children - 1;
|
||||
|
||||
item = (GimpViewable *) gimp_container_get_child_by_index (container,
|
||||
count);
|
||||
if (item)
|
||||
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (view), item);
|
||||
gimp_container_view_item_selected (view, item);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -400,10 +403,13 @@ gimp_container_grid_view_insert_item (GimpContainerView *view,
|
||||
{
|
||||
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (view);
|
||||
GtkWidget *preview;
|
||||
gint preview_size;
|
||||
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
preview = gimp_preview_new_full (viewable,
|
||||
view->preview_size,
|
||||
view->preview_size,
|
||||
preview_size,
|
||||
preview_size,
|
||||
1,
|
||||
FALSE, TRUE, TRUE);
|
||||
gimp_preview_renderer_set_border_type (GIMP_PREVIEW (preview)->renderer,
|
||||
@ -506,6 +512,9 @@ gimp_container_grid_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (view);
|
||||
GtkWrapBoxChild *child;
|
||||
gint preview_size;
|
||||
|
||||
preview_size = gimp_container_view_get_preview_size (view, NULL);
|
||||
|
||||
for (child = GTK_WRAP_BOX (grid_view->wrap_box)->children;
|
||||
child;
|
||||
@ -514,7 +523,7 @@ gimp_container_grid_view_set_preview_size (GimpContainerView *view)
|
||||
GimpPreview *preview = GIMP_PREVIEW (child->widget);
|
||||
|
||||
gimp_preview_renderer_set_size (preview->renderer,
|
||||
view->preview_size,
|
||||
preview_size,
|
||||
preview->renderer->border_width);
|
||||
}
|
||||
|
||||
@ -565,8 +574,11 @@ gimp_container_grid_view_highlight_item (GimpContainerView *view,
|
||||
{
|
||||
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (view);
|
||||
GimpContainerBox *box = GIMP_CONTAINER_BOX (view);
|
||||
GimpContainer *container;
|
||||
GimpPreview *preview = NULL;
|
||||
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
if (insert_data)
|
||||
preview = GIMP_PREVIEW (insert_data);
|
||||
|
||||
@ -593,7 +605,7 @@ gimp_container_grid_view_highlight_item (GimpContainerView *view,
|
||||
|
||||
item_height = preview_requisition.height;
|
||||
|
||||
index = gimp_container_get_child_index (view->container,
|
||||
index = gimp_container_get_child_index (container,
|
||||
GIMP_OBJECT (viewable));
|
||||
|
||||
row = index / grid_view->columns;
|
||||
@ -630,7 +642,7 @@ gimp_container_grid_view_viewport_resized (GtkWidget *widget,
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
|
||||
if (view->container)
|
||||
if (gimp_container_view_get_container (view))
|
||||
{
|
||||
GList *children;
|
||||
gint n_children;
|
||||
|
@ -531,10 +531,12 @@ static void
|
||||
gimp_container_popup_smaller_clicked (GtkWidget *button,
|
||||
GimpContainerPopup *popup)
|
||||
{
|
||||
gint preview_size;
|
||||
GimpContainerViewPrivate *private;
|
||||
gint preview_size;
|
||||
|
||||
preview_size = MAX (GIMP_PREVIEW_SIZE_TINY,
|
||||
popup->editor->view->preview_size * 0.8);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (popup->editor->view);
|
||||
|
||||
preview_size = MAX (GIMP_PREVIEW_SIZE_TINY, private->preview_size * 0.8);
|
||||
|
||||
if (preview_size != popup->preview_size)
|
||||
{
|
||||
@ -550,10 +552,12 @@ static void
|
||||
gimp_container_popup_larger_clicked (GtkWidget *button,
|
||||
GimpContainerPopup *popup)
|
||||
{
|
||||
gint preview_size;
|
||||
GimpContainerViewPrivate *private;
|
||||
gint preview_size;
|
||||
|
||||
preview_size = MIN (GIMP_PREVIEW_SIZE_HUGE,
|
||||
popup->editor->view->preview_size * 1.2);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (popup->editor->view);
|
||||
|
||||
preview_size = MIN (GIMP_PREVIEW_SIZE_HUGE, private->preview_size * 1.2);
|
||||
|
||||
if (preview_size != popup->preview_size)
|
||||
{
|
||||
|
@ -45,11 +45,14 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView *tree_view,
|
||||
GimpViewable **return_dest,
|
||||
GtkTreeViewDropPosition *return_pos)
|
||||
{
|
||||
GtkWidget *src_widget;
|
||||
GimpViewable *src_viewable;
|
||||
GtkTreePath *path;
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkWidget *src_widget;
|
||||
GimpViewable *src_viewable;
|
||||
GtkTreePath *path;
|
||||
|
||||
if (! GIMP_CONTAINER_VIEW (tree_view)->reorderable)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (tree_view);
|
||||
|
||||
if (! private->reorderable)
|
||||
return FALSE;
|
||||
|
||||
src_widget = gtk_drag_get_source_widget (context);
|
||||
@ -278,24 +281,21 @@ gimp_container_tree_view_real_drop_possible (GimpContainerTreeView *tree_view,
|
||||
GtkTreeViewDropPosition drop_pos,
|
||||
GdkDragAction *drag_action)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
GimpContainer *container = gimp_container_view_get_container (view);
|
||||
GimpObject *src_object;
|
||||
GimpObject *dest_object;
|
||||
gint src_index;
|
||||
gint dest_index;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
|
||||
if (src_viewable == dest_viewable)
|
||||
return FALSE;
|
||||
|
||||
src_object = GIMP_OBJECT (src_viewable);
|
||||
dest_object = GIMP_OBJECT (dest_viewable);
|
||||
|
||||
src_index = gimp_container_get_child_index (container_view->container,
|
||||
src_object);
|
||||
dest_index = gimp_container_get_child_index (container_view->container,
|
||||
dest_object);
|
||||
src_index = gimp_container_get_child_index (container, src_object);
|
||||
dest_index = gimp_container_get_child_index (container, dest_object);
|
||||
|
||||
if (src_index == -1 || dest_index == -1)
|
||||
return FALSE;
|
||||
@ -323,21 +323,18 @@ gimp_container_tree_view_real_drop (GimpContainerTreeView *tree_view,
|
||||
GimpViewable *dest_viewable,
|
||||
GtkTreeViewDropPosition drop_pos)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
GimpContainer *container = gimp_container_view_get_container (view);
|
||||
GimpObject *src_object;
|
||||
GimpObject *dest_object;
|
||||
gint src_index;
|
||||
gint dest_index;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
|
||||
src_object = GIMP_OBJECT (src_viewable);
|
||||
dest_object = GIMP_OBJECT (dest_viewable);
|
||||
|
||||
src_index = gimp_container_get_child_index (container_view->container,
|
||||
src_object);
|
||||
dest_index = gimp_container_get_child_index (container_view->container,
|
||||
dest_object);
|
||||
src_index = gimp_container_get_child_index (container, src_object);
|
||||
dest_index = gimp_container_get_child_index (container, dest_object);
|
||||
|
||||
if (drop_pos == GTK_TREE_VIEW_DROP_AFTER && src_index > dest_index)
|
||||
{
|
||||
@ -348,5 +345,5 @@ gimp_container_tree_view_real_drop (GimpContainerTreeView *tree_view,
|
||||
dest_index--;
|
||||
}
|
||||
|
||||
gimp_container_reorder (container_view->container, src_object, dest_index);
|
||||
gimp_container_reorder (container, src_object, dest_index);
|
||||
}
|
||||
|
@ -183,17 +183,19 @@ gimp_container_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerView *view;
|
||||
GimpContainerBox *box;
|
||||
GtkListStore *list;
|
||||
GObject *object;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerView *view;
|
||||
GimpContainerBox *box;
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkListStore *list;
|
||||
GObject *object;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (object);
|
||||
view = GIMP_CONTAINER_VIEW (object);
|
||||
box = GIMP_CONTAINER_BOX (object);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
list = gtk_list_store_newv (tree_view->n_model_columns,
|
||||
tree_view->model_columns);
|
||||
@ -208,7 +210,7 @@ gimp_container_tree_view_constructor (GType type,
|
||||
GTK_WIDGET (tree_view->view));
|
||||
gtk_widget_show (GTK_WIDGET (tree_view->view));
|
||||
|
||||
GIMP_CONTAINER_VIEW (tree_view)->dnd_widget = GTK_WIDGET (tree_view->view);
|
||||
private->dnd_widget = GTK_WIDGET (tree_view->view);
|
||||
|
||||
tree_view->main_column = gtk_tree_view_column_new ();
|
||||
gtk_tree_view_insert_column (tree_view->view, tree_view->main_column, 0);
|
||||
@ -402,17 +404,18 @@ gimp_container_tree_view_set (GimpContainerTreeView *tree_view,
|
||||
GtkTreeIter *iter,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
GimpPreviewRenderer *renderer;
|
||||
gchar *name;
|
||||
gint preview_size;
|
||||
gint border_width;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
||||
|
||||
name = gimp_viewable_get_description (viewable, NULL);
|
||||
|
||||
renderer = gimp_preview_renderer_new (G_TYPE_FROM_INSTANCE (viewable),
|
||||
view->preview_size,
|
||||
view->preview_border_width,
|
||||
preview_size, border_width,
|
||||
FALSE);
|
||||
gimp_preview_renderer_set_viewable (renderer, viewable);
|
||||
gimp_preview_renderer_remove_idle (renderer);
|
||||
@ -437,13 +440,16 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
GimpContainer *old_container;
|
||||
|
||||
if (view->container)
|
||||
old_container = gimp_container_view_get_container (view);
|
||||
|
||||
if (old_container)
|
||||
{
|
||||
if (! container)
|
||||
{
|
||||
if (gimp_dnd_viewable_source_remove (GTK_WIDGET (tree_view->view),
|
||||
view->container->children_type))
|
||||
old_container->children_type))
|
||||
{
|
||||
gtk_drag_source_unset (GTK_WIDGET (tree_view->view));
|
||||
}
|
||||
@ -518,9 +524,10 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
GtkTreeIter *iter;
|
||||
GimpContainer *container;
|
||||
GtkTreeIter *iter = (GtkTreeIter *) insert_data;
|
||||
|
||||
iter = (GtkTreeIter *) insert_data;
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
if (iter)
|
||||
{
|
||||
@ -545,7 +552,7 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
if (new_index == -1 || new_index == view->container->num_children - 1)
|
||||
if (new_index == -1 || new_index == container->num_children - 1)
|
||||
{
|
||||
gtk_list_store_move_before (GTK_LIST_STORE (tree_view->model),
|
||||
iter, NULL);
|
||||
@ -658,13 +665,15 @@ gimp_container_tree_view_clear_items (GimpContainerView *view)
|
||||
static void
|
||||
gimp_container_tree_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
GtkWidget *tree_widget;
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
GList *list;
|
||||
gint preview_size;
|
||||
gint border_width;
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
||||
|
||||
tree_widget = GTK_WIDGET (tree_view->view);
|
||||
|
||||
@ -680,9 +689,9 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
|
||||
icon_size = gimp_get_icon_size (tree_widget,
|
||||
stock_id,
|
||||
GTK_ICON_SIZE_BUTTON,
|
||||
view->preview_size -
|
||||
preview_size -
|
||||
2 * tree_widget->style->xthickness,
|
||||
view->preview_size -
|
||||
preview_size -
|
||||
2 * tree_widget->style->ythickness);
|
||||
|
||||
g_object_set (list->data, "stock-size", icon_size, NULL);
|
||||
@ -701,9 +710,7 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
|
||||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_preview_renderer_set_size (renderer,
|
||||
view->preview_size,
|
||||
view->preview_border_width);
|
||||
gimp_preview_renderer_set_size (renderer, preview_size, border_width);
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
@ -850,7 +857,7 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
/* a callback invoked by selecting the item may have
|
||||
* destroyed us, so check if the container is still there
|
||||
*/
|
||||
if (container_view->container)
|
||||
if (gimp_container_view_get_container (container_view))
|
||||
{
|
||||
/* another row may have been set by selecting */
|
||||
gtk_tree_view_column_cell_set_cell_data (column,
|
||||
@ -930,8 +937,8 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
if (gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable))
|
||||
{
|
||||
if (container_view->container)
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (tree_view),
|
||||
if (gimp_container_view_get_container (container_view))
|
||||
gimp_container_view_item_context (container_view,
|
||||
renderer->viewable);
|
||||
}
|
||||
break;
|
||||
@ -953,10 +960,13 @@ static void
|
||||
gimp_container_tree_view_renderer_update (GimpPreviewRenderer *renderer,
|
||||
GimpContainerTreeView *tree_view)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
iter = g_hash_table_lookup (view->hash_table, renderer->viewable);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
iter = g_hash_table_lookup (private->hash_table, renderer->viewable);
|
||||
|
||||
if (iter)
|
||||
{
|
||||
|
@ -215,15 +215,6 @@ static void
|
||||
gimp_container_view_init (GimpContainerView *view,
|
||||
GimpContainerViewClass *klass)
|
||||
{
|
||||
view->container = NULL;
|
||||
view->context = NULL;
|
||||
view->hash_table = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
klass->insert_data_free);
|
||||
view->preview_size = 0;
|
||||
view->preview_border_width = 1;
|
||||
view->reorderable = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -259,10 +250,10 @@ gimp_container_view_get_property (GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONTAINER:
|
||||
g_value_set_object (value, view->container);
|
||||
g_value_set_object (value, gimp_container_view_get_container (view));
|
||||
break;
|
||||
case PROP_CONTEXT:
|
||||
g_value_set_object (value, view->context);
|
||||
g_value_set_object (value, gimp_container_view_get_context (view));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
@ -273,157 +264,58 @@ gimp_container_view_get_property (GObject *object,
|
||||
static void
|
||||
gimp_container_view_destroy (GtkObject *object)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (object);
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (object);
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (view->container)
|
||||
if (private->container)
|
||||
gimp_container_view_set_container (view, NULL);
|
||||
|
||||
if (view->context)
|
||||
if (private->context)
|
||||
gimp_container_view_set_context (view, NULL);
|
||||
|
||||
if (view->hash_table)
|
||||
if (private->hash_table)
|
||||
{
|
||||
g_hash_table_destroy (view->hash_table);
|
||||
view->hash_table = NULL;
|
||||
g_hash_table_destroy (private->hash_table);
|
||||
private->hash_table = NULL;
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
GimpContainerViewPrivate *
|
||||
gimp_container_view_get_private (GimpContainerView *view)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (container == NULL || GIMP_IS_CONTAINER (container));
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
if (container != view->container)
|
||||
static GQuark view_private_key = 0;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
|
||||
|
||||
if (! view_private_key)
|
||||
view_private_key = g_quark_from_static_string ("gimp-container-view-private");
|
||||
|
||||
private = g_object_get_qdata ((GObject *) (GObject *) view, view_private_key);
|
||||
|
||||
if (! private)
|
||||
{
|
||||
GIMP_CONTAINER_VIEW_GET_CLASS (view)->set_container (view, container);
|
||||
GimpContainerViewClass *klass = GIMP_CONTAINER_VIEW_GET_CLASS (view);
|
||||
|
||||
g_object_notify (G_OBJECT (view), "container");
|
||||
}
|
||||
}
|
||||
private = g_new0 (GimpContainerViewPrivate, 1);
|
||||
|
||||
static void
|
||||
gimp_container_view_real_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
if (view->container)
|
||||
{
|
||||
GimpContainerViewClass *view_class;
|
||||
private->container = NULL;
|
||||
private->context = NULL;
|
||||
private->hash_table = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
klass->insert_data_free);
|
||||
private->preview_size = 0;
|
||||
private->preview_border_width = 1;
|
||||
private->reorderable = FALSE;
|
||||
|
||||
gimp_container_view_select_item (view, NULL);
|
||||
gimp_container_view_clear_items (view);
|
||||
|
||||
gimp_container_remove_handler (view->container,
|
||||
view->name_changed_handler_id);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
gimp_container_view_add,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
gimp_container_view_remove,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
gimp_container_view_reorder,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
gimp_container_view_freeze,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
gimp_container_view_thaw,
|
||||
view);
|
||||
|
||||
g_hash_table_destroy (view->hash_table);
|
||||
|
||||
view_class = GIMP_CONTAINER_VIEW_GET_CLASS (view);
|
||||
|
||||
view->hash_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL,
|
||||
view_class->insert_data_free);
|
||||
|
||||
if (view->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (view->context,
|
||||
gimp_container_view_context_changed,
|
||||
view);
|
||||
|
||||
if (view->dnd_widget)
|
||||
{
|
||||
gtk_drag_dest_unset (GTK_WIDGET (view->dnd_widget));
|
||||
gimp_dnd_viewable_dest_remove (GTK_WIDGET (view->dnd_widget),
|
||||
view->container->children_type);
|
||||
}
|
||||
}
|
||||
g_object_set_qdata ((GObject *) view, view_private_key, private);
|
||||
}
|
||||
|
||||
view->container = container;
|
||||
|
||||
if (view->container)
|
||||
{
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
viewable_class = g_type_class_ref (container->children_type);
|
||||
|
||||
gimp_container_foreach (view->container,
|
||||
(GFunc) gimp_container_view_add_foreach,
|
||||
view);
|
||||
|
||||
view->name_changed_handler_id =
|
||||
gimp_container_add_handler (view->container,
|
||||
viewable_class->name_changed_signal,
|
||||
G_CALLBACK (gimp_container_view_name_changed),
|
||||
view);
|
||||
|
||||
g_type_class_unref (viewable_class);
|
||||
|
||||
g_signal_connect_object (view->container, "add",
|
||||
G_CALLBACK (gimp_container_view_add),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (view->container, "remove",
|
||||
G_CALLBACK (gimp_container_view_remove),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (view->container, "reorder",
|
||||
G_CALLBACK (gimp_container_view_reorder),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (view->container, "freeze",
|
||||
G_CALLBACK (gimp_container_view_freeze),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (view->container, "thaw",
|
||||
G_CALLBACK (gimp_container_view_thaw),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
if (view->context)
|
||||
{
|
||||
GimpObject *object;
|
||||
const gchar *signal_name;
|
||||
|
||||
signal_name =
|
||||
gimp_context_type_to_signal_name (view->container->children_type);
|
||||
|
||||
g_signal_connect_object (view->context, signal_name,
|
||||
G_CALLBACK (gimp_container_view_context_changed),
|
||||
view,
|
||||
0);
|
||||
|
||||
object = gimp_context_get_by_type (view->context,
|
||||
view->container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
|
||||
if (view->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (view->dnd_widget),
|
||||
view->container->children_type,
|
||||
gimp_container_view_viewable_dropped,
|
||||
view);
|
||||
}
|
||||
}
|
||||
return private;
|
||||
}
|
||||
|
||||
void
|
||||
@ -434,6 +326,8 @@ gimp_container_view_construct (GimpContainerView *view,
|
||||
gint preview_border_width,
|
||||
gboolean reorderable)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (container == NULL || GIMP_IS_CONTAINER (container));
|
||||
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
||||
@ -442,7 +336,9 @@ gimp_container_view_construct (GimpContainerView *view,
|
||||
g_return_if_fail (preview_border_width >= 0 &&
|
||||
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH);
|
||||
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
private->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
gimp_container_view_set_preview_size (view, preview_size,
|
||||
preview_border_width);
|
||||
@ -454,62 +350,232 @@ gimp_container_view_construct (GimpContainerView *view,
|
||||
gimp_container_view_set_context (view, context);
|
||||
}
|
||||
|
||||
GimpContainer *
|
||||
gimp_container_view_get_container (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
return private->container;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (container == NULL || GIMP_IS_CONTAINER (container));
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (container != private->container)
|
||||
{
|
||||
GIMP_CONTAINER_VIEW_GET_CLASS (view)->set_container (view, container);
|
||||
|
||||
g_object_notify (G_OBJECT (view), "container");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_view_real_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (private->container)
|
||||
{
|
||||
GimpContainerViewClass *view_class;
|
||||
|
||||
gimp_container_view_select_item (view, NULL);
|
||||
gimp_container_view_clear_items (view);
|
||||
|
||||
gimp_container_remove_handler (private->container,
|
||||
private->name_changed_handler_id);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (private->container,
|
||||
gimp_container_view_add,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (private->container,
|
||||
gimp_container_view_remove,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (private->container,
|
||||
gimp_container_view_reorder,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (private->container,
|
||||
gimp_container_view_freeze,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (private->container,
|
||||
gimp_container_view_thaw,
|
||||
view);
|
||||
|
||||
g_hash_table_destroy (private->hash_table);
|
||||
|
||||
view_class = GIMP_CONTAINER_VIEW_GET_CLASS (view);
|
||||
|
||||
private->hash_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL,
|
||||
view_class->insert_data_free);
|
||||
|
||||
if (private->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (private->context,
|
||||
gimp_container_view_context_changed,
|
||||
view);
|
||||
|
||||
if (private->dnd_widget)
|
||||
{
|
||||
gtk_drag_dest_unset (private->dnd_widget);
|
||||
gimp_dnd_viewable_dest_remove (private->dnd_widget,
|
||||
private->container->children_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private->container = container;
|
||||
|
||||
if (private->container)
|
||||
{
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
viewable_class = g_type_class_ref (container->children_type);
|
||||
|
||||
gimp_container_foreach (private->container,
|
||||
(GFunc) gimp_container_view_add_foreach,
|
||||
view);
|
||||
|
||||
private->name_changed_handler_id =
|
||||
gimp_container_add_handler (private->container,
|
||||
viewable_class->name_changed_signal,
|
||||
G_CALLBACK (gimp_container_view_name_changed),
|
||||
view);
|
||||
|
||||
g_type_class_unref (viewable_class);
|
||||
|
||||
g_signal_connect_object (private->container, "add",
|
||||
G_CALLBACK (gimp_container_view_add),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (private->container, "remove",
|
||||
G_CALLBACK (gimp_container_view_remove),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (private->container, "reorder",
|
||||
G_CALLBACK (gimp_container_view_reorder),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (private->container, "freeze",
|
||||
G_CALLBACK (gimp_container_view_freeze),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (private->container, "thaw",
|
||||
G_CALLBACK (gimp_container_view_thaw),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
if (private->context)
|
||||
{
|
||||
GimpObject *object;
|
||||
const gchar *signal_name;
|
||||
|
||||
signal_name =
|
||||
gimp_context_type_to_signal_name (private->container->children_type);
|
||||
|
||||
g_signal_connect_object (private->context, signal_name,
|
||||
G_CALLBACK (gimp_container_view_context_changed),
|
||||
view,
|
||||
0);
|
||||
|
||||
object = gimp_context_get_by_type (private->context,
|
||||
private->container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
|
||||
if (private->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (private->dnd_widget,
|
||||
private->container->children_type,
|
||||
gimp_container_view_viewable_dropped,
|
||||
view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GimpContext *
|
||||
gimp_container_view_get_context (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), NULL);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
return private->context;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
|
||||
|
||||
if (context == view->context)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (context == private->context)
|
||||
return;
|
||||
|
||||
if (view->context)
|
||||
if (private->context)
|
||||
{
|
||||
if (view->container)
|
||||
if (private->container)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (view->context,
|
||||
g_signal_handlers_disconnect_by_func (private->context,
|
||||
gimp_container_view_context_changed,
|
||||
view);
|
||||
|
||||
if (view->dnd_widget)
|
||||
if (private->dnd_widget)
|
||||
{
|
||||
gtk_drag_dest_unset (GTK_WIDGET (view->dnd_widget));
|
||||
gimp_dnd_viewable_dest_remove (GTK_WIDGET (view->dnd_widget),
|
||||
view->container->children_type);
|
||||
gtk_drag_dest_unset (private->dnd_widget);
|
||||
gimp_dnd_viewable_dest_remove (private->dnd_widget,
|
||||
private->container->children_type);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (view->context);
|
||||
g_object_unref (private->context);
|
||||
}
|
||||
|
||||
view->context = context;
|
||||
private->context = context;
|
||||
|
||||
if (view->context)
|
||||
if (private->context)
|
||||
{
|
||||
g_object_ref (view->context);
|
||||
g_object_ref (private->context);
|
||||
|
||||
if (view->container)
|
||||
if (private->container)
|
||||
{
|
||||
GimpObject *object;
|
||||
const gchar *signal_name;
|
||||
|
||||
signal_name =
|
||||
gimp_context_type_to_signal_name (view->container->children_type);
|
||||
gimp_context_type_to_signal_name (private->container->children_type);
|
||||
|
||||
g_signal_connect_object (view->context, signal_name,
|
||||
g_signal_connect_object (private->context, signal_name,
|
||||
G_CALLBACK (gimp_container_view_context_changed),
|
||||
view,
|
||||
0);
|
||||
|
||||
object = gimp_context_get_by_type (view->context,
|
||||
view->container->children_type);
|
||||
object = gimp_context_get_by_type (private->context,
|
||||
private->container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
|
||||
if (view->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (view->dnd_widget),
|
||||
view->container->children_type,
|
||||
if (private->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (private->dnd_widget,
|
||||
private->container->children_type,
|
||||
gimp_container_view_viewable_dropped,
|
||||
view);
|
||||
}
|
||||
@ -518,22 +584,42 @@ gimp_container_view_set_context (GimpContainerView *view,
|
||||
g_object_notify (G_OBJECT (view), "context");
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_container_view_get_preview_size (GimpContainerView *view,
|
||||
gint *preview_border_width)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), 0);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (preview_border_width)
|
||||
*preview_border_width = private->preview_border_width;
|
||||
|
||||
return private->preview_size;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_set_preview_size (GimpContainerView *view,
|
||||
gint preview_size,
|
||||
gint preview_border_width)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (preview_size > 0 &&
|
||||
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
|
||||
g_return_if_fail (preview_border_width >= 0 &&
|
||||
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH);
|
||||
|
||||
if (view->preview_size != preview_size ||
|
||||
view->preview_border_width != preview_border_width)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (private->preview_size != preview_size ||
|
||||
private->preview_border_width != preview_border_width)
|
||||
{
|
||||
view->preview_size = preview_size;
|
||||
view->preview_border_width = preview_border_width;
|
||||
private->preview_size = preview_size;
|
||||
private->preview_border_width = preview_border_width;
|
||||
|
||||
GIMP_CONTAINER_VIEW_GET_CLASS (view)->set_preview_size (view);
|
||||
}
|
||||
@ -557,16 +643,19 @@ gboolean
|
||||
gimp_container_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
GimpContainerViewPrivate *private;
|
||||
gboolean success = FALSE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), FALSE);
|
||||
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), FALSE);
|
||||
|
||||
if (view->hash_table)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (private->hash_table)
|
||||
{
|
||||
gpointer insert_data;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[SELECT_ITEM], 0,
|
||||
viewable, insert_data, &success);
|
||||
@ -579,14 +668,18 @@ void
|
||||
gimp_container_view_activate_item (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
||||
|
||||
if (view->hash_table)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (private->hash_table)
|
||||
{
|
||||
gpointer insert_data;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[ACTIVATE_ITEM], 0,
|
||||
viewable, insert_data);
|
||||
@ -597,14 +690,18 @@ void
|
||||
gimp_container_view_context_item (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpContainerViewPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
||||
|
||||
if (view->hash_table)
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
if (private->hash_table)
|
||||
{
|
||||
gpointer insert_data;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[CONTEXT_ITEM], 0,
|
||||
viewable, insert_data);
|
||||
@ -615,28 +712,31 @@ gboolean
|
||||
gimp_container_view_item_selected (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
gboolean success;
|
||||
GimpContainerViewPrivate *private;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
success = gimp_container_view_select_item (view, viewable);
|
||||
|
||||
if (success && view->container && view->context)
|
||||
if (success && private->container && private->context)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
/* ref and remember the context because view->context may
|
||||
/* ref and remember the context because private->context may
|
||||
* become NULL by calling gimp_context_set_by_type()
|
||||
*/
|
||||
context = g_object_ref (view->context);
|
||||
context = g_object_ref (private->context);
|
||||
|
||||
g_signal_handlers_block_by_func (context,
|
||||
gimp_container_view_context_changed,
|
||||
view);
|
||||
|
||||
gimp_context_set_by_type (context,
|
||||
view->container->children_type,
|
||||
private->container->children_type,
|
||||
GIMP_OBJECT (viewable));
|
||||
|
||||
g_signal_handlers_unblock_by_func (context,
|
||||
@ -678,28 +778,28 @@ gimp_container_view_clear_items (GimpContainerView *view)
|
||||
static void
|
||||
gimp_container_view_real_clear_items (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerViewClass *view_class;
|
||||
GimpContainerViewClass *view_class = GIMP_CONTAINER_VIEW_GET_CLASS (view);
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
view_class = GIMP_CONTAINER_VIEW_GET_CLASS (view);
|
||||
g_hash_table_destroy (private->hash_table);
|
||||
|
||||
g_hash_table_destroy (view->hash_table);
|
||||
|
||||
view->hash_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL,
|
||||
view_class->insert_data_free);
|
||||
private->hash_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL,
|
||||
view_class->insert_data_free);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_view_add_foreach (GimpViewable *viewable,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gpointer insert_data;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
|
||||
insert_data = GIMP_CONTAINER_VIEW_GET_CLASS (view)->insert_item (view,
|
||||
viewable,
|
||||
-1);
|
||||
|
||||
g_hash_table_insert (view->hash_table, viewable, insert_data);
|
||||
g_hash_table_insert (private->hash_table, viewable, insert_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -707,8 +807,9 @@ gimp_container_view_add (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
GimpContainer *container)
|
||||
{
|
||||
gpointer insert_data = NULL;
|
||||
gint index;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
gint index;
|
||||
|
||||
if (gimp_container_frozen (container))
|
||||
return;
|
||||
@ -720,7 +821,7 @@ gimp_container_view_add (GimpContainerView *view,
|
||||
viewable,
|
||||
index);
|
||||
|
||||
g_hash_table_insert (view->hash_table, viewable, insert_data);
|
||||
g_hash_table_insert (private->hash_table, viewable, insert_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -728,12 +829,13 @@ gimp_container_view_remove (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
GimpContainer *container)
|
||||
{
|
||||
gpointer insert_data;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
|
||||
if (gimp_container_frozen (container))
|
||||
return;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
if (insert_data)
|
||||
{
|
||||
@ -741,7 +843,7 @@ gimp_container_view_remove (GimpContainerView *view,
|
||||
viewable,
|
||||
insert_data);
|
||||
|
||||
g_hash_table_remove (view->hash_table, viewable);
|
||||
g_hash_table_remove (private->hash_table, viewable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,12 +853,13 @@ gimp_container_view_reorder (GimpContainerView *view,
|
||||
gint new_index,
|
||||
GimpContainer *container)
|
||||
{
|
||||
gpointer insert_data;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
|
||||
if (gimp_container_frozen (container))
|
||||
return;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
if (insert_data)
|
||||
{
|
||||
@ -778,16 +881,18 @@ static void
|
||||
gimp_container_view_thaw (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
gimp_container_foreach (view->container,
|
||||
GimpContext *context = gimp_container_view_get_context (view);
|
||||
|
||||
gimp_container_foreach (container,
|
||||
(GFunc) gimp_container_view_add_foreach,
|
||||
view);
|
||||
|
||||
if (view->context)
|
||||
if (context)
|
||||
{
|
||||
GimpObject *object;
|
||||
|
||||
object = gimp_context_get_by_type (view->context,
|
||||
view->container->children_type);
|
||||
object = gimp_context_get_by_type (context,
|
||||
container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
}
|
||||
@ -797,9 +902,10 @@ static void
|
||||
gimp_container_view_name_changed (GimpViewable *viewable,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gpointer insert_data;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
if (insert_data)
|
||||
{
|
||||
@ -814,10 +920,11 @@ gimp_container_view_context_changed (GimpContext *context,
|
||||
GimpViewable *viewable,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gpointer insert_data;
|
||||
gboolean success = FALSE;
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
gpointer insert_data;
|
||||
gboolean success = FALSE;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
insert_data = g_hash_table_lookup (private->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[SELECT_ITEM], 0,
|
||||
viewable, insert_data, &success);
|
||||
@ -832,10 +939,11 @@ gimp_container_view_viewable_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (data);
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (data);
|
||||
GimpContainer *container = gimp_container_view_get_container (view);
|
||||
GimpContext *context = gimp_container_view_get_context (view);
|
||||
|
||||
gimp_context_set_by_type (view->context,
|
||||
view->container->children_type,
|
||||
gimp_context_set_by_type (context, container->children_type,
|
||||
GIMP_OBJECT (viewable));
|
||||
}
|
||||
|
||||
@ -844,10 +952,10 @@ gimp_container_view_button_viewable_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (data);
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (data);
|
||||
GimpContainer *container = gimp_container_view_get_container (view);
|
||||
|
||||
if (viewable && gimp_container_have (view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_container_view_item_selected (view, viewable);
|
||||
|
||||
|
@ -33,13 +33,19 @@
|
||||
#define GIMP_IS_CONTAINER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER_VIEW))
|
||||
#define GIMP_CONTAINER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONTAINER_VIEW, GimpContainerViewClass))
|
||||
|
||||
#define GIMP_CONTAINER_VIEW_GET_PRIVATE(obj) (gimp_container_view_get_private ((GimpContainerView *) obj));
|
||||
|
||||
typedef struct _GimpContainerViewClass GimpContainerViewClass;
|
||||
|
||||
typedef struct _GimpContainerViewClass GimpContainerViewClass;
|
||||
typedef struct _GimpContainerViewPrivate GimpContainerViewPrivate;
|
||||
|
||||
struct _GimpContainerView
|
||||
{
|
||||
GimpEditor parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpContainerViewPrivate
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
|
||||
@ -96,6 +102,9 @@ struct _GimpContainerViewClass
|
||||
|
||||
GType gimp_container_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpContainerViewPrivate *
|
||||
gimp_container_view_get_private (GimpContainerView *view);
|
||||
|
||||
void gimp_container_view_construct (GimpContainerView *view,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
@ -103,13 +112,19 @@ void gimp_container_view_construct (GimpContainerView *view,
|
||||
gint preview_border_width,
|
||||
gboolean reorderable);
|
||||
|
||||
void gimp_container_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container);
|
||||
void gimp_container_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context);
|
||||
void gimp_container_view_set_preview_size (GimpContainerView *view,
|
||||
gint preview_size,
|
||||
gint preview_border_width);
|
||||
GimpContainer * gimp_container_view_get_container (GimpContainerView *view);
|
||||
void gimp_container_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container);
|
||||
|
||||
GimpContext * gimp_container_view_get_context (GimpContainerView *view);
|
||||
void gimp_container_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context);
|
||||
|
||||
gint gimp_container_view_get_preview_size (GimpContainerView *view,
|
||||
gint *preview_border_width);
|
||||
void gimp_container_view_set_preview_size (GimpContainerView *view,
|
||||
gint preview_size,
|
||||
gint preview_border_width);
|
||||
|
||||
void gimp_container_view_enable_dnd (GimpContainerView *editor,
|
||||
GtkButton *button,
|
||||
|
@ -286,10 +286,13 @@ static void
|
||||
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
|
||||
GimpDataFactoryView *view)
|
||||
{
|
||||
GimpData *data;
|
||||
GimpContext *context;
|
||||
GimpData *data;
|
||||
|
||||
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
|
||||
|
||||
data = (GimpData *)
|
||||
gimp_context_get_by_type (GIMP_CONTAINER_EDITOR (view)->view->context,
|
||||
gimp_context_get_by_type (context,
|
||||
view->factory->container->children_type);
|
||||
|
||||
if (view->data_edit_func && data &&
|
||||
@ -306,13 +309,17 @@ gimp_data_factory_view_new_clicked (GtkWidget *widget,
|
||||
{
|
||||
if (view->factory->data_new_func)
|
||||
{
|
||||
GimpData *data;
|
||||
GimpContext *context;
|
||||
GimpData *data;
|
||||
|
||||
context =
|
||||
gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
|
||||
|
||||
data = gimp_data_factory_data_new (view->factory, _("Untitled"));
|
||||
|
||||
if (data)
|
||||
{
|
||||
gimp_context_set_by_type (GIMP_CONTAINER_EDITOR (view)->view->context,
|
||||
gimp_context_set_by_type (context,
|
||||
view->factory->container->children_type,
|
||||
GIMP_OBJECT (data));
|
||||
|
||||
@ -325,10 +332,13 @@ static void
|
||||
gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpDataFactoryView *view)
|
||||
{
|
||||
GimpData *data;
|
||||
GimpContext *context;
|
||||
GimpData *data;
|
||||
|
||||
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
|
||||
|
||||
data = (GimpData *)
|
||||
gimp_context_get_by_type (GIMP_CONTAINER_EDITOR (view)->view->context,
|
||||
gimp_context_get_by_type (context,
|
||||
view->factory->container->children_type);
|
||||
|
||||
if (data && gimp_container_have (view->factory->container,
|
||||
@ -340,7 +350,7 @@ gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
|
||||
|
||||
if (new_data)
|
||||
{
|
||||
gimp_context_set_by_type (GIMP_CONTAINER_EDITOR (view)->view->context,
|
||||
gimp_context_set_by_type (context,
|
||||
view->factory->container->children_type,
|
||||
GIMP_OBJECT (new_data));
|
||||
|
||||
@ -391,10 +401,13 @@ static void
|
||||
gimp_data_factory_view_delete_clicked (GtkWidget *widget,
|
||||
GimpDataFactoryView *view)
|
||||
{
|
||||
GimpData *data;
|
||||
GimpContext *context;
|
||||
GimpData *data;
|
||||
|
||||
context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view);
|
||||
|
||||
data = (GimpData *)
|
||||
gimp_context_get_by_type (GIMP_CONTAINER_EDITOR (view)->view->context,
|
||||
gimp_context_get_by_type (context,
|
||||
view->factory->container->children_type);
|
||||
|
||||
if (data && data->deletable && gimp_container_have (view->factory->container,
|
||||
|
@ -142,9 +142,10 @@ gimp_document_view_new (GimpViewType view_type,
|
||||
GimpFileOpenDialogFunc file_open_dialog_func,
|
||||
GimpMenuFactory *menu_factory)
|
||||
{
|
||||
GimpDocumentView *document_view;
|
||||
GimpContainerEditor *editor;
|
||||
gchar *str;
|
||||
GimpDocumentView *document_view;
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerViewPrivate *private;
|
||||
gchar *str;
|
||||
|
||||
g_return_val_if_fail (file_open_dialog_func != NULL, NULL);
|
||||
|
||||
@ -166,6 +167,8 @@ gimp_document_view_new (GimpViewType view_type,
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (document_view);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (editor->view);
|
||||
|
||||
str = g_strdup_printf (_("Open the selected entry\n"
|
||||
"%s Raise window if already open\n"
|
||||
"%s Open image dialog"),
|
||||
@ -219,7 +222,7 @@ gimp_document_view_new (GimpViewType view_type,
|
||||
GIMP_TYPE_IMAGEFILE);
|
||||
|
||||
if (view_type == GIMP_VIEW_TYPE_LIST)
|
||||
gimp_dnd_file_source_add (editor->view->dnd_widget,
|
||||
gimp_dnd_file_source_add (private->dnd_widget,
|
||||
gimp_document_view_drag_file,
|
||||
editor);
|
||||
|
||||
@ -230,22 +233,23 @@ static void
|
||||
gimp_document_view_open_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
GimpContainer *container;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
imagefile = gimp_context_get_imagefile (context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
if (imagefile && gimp_container_have (container, GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
gimp_document_view_open_image (view, imagefile);
|
||||
}
|
||||
else
|
||||
{
|
||||
view->file_open_dialog_func (editor->view->context->gimp, NULL,
|
||||
GTK_WIDGET (view));
|
||||
view->file_open_dialog_func (context->gimp, NULL, GTK_WIDGET (view));
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,19 +287,21 @@ gimp_document_view_open_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
GimpContainer *container;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
imagefile = gimp_context_get_imagefile (context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
if (imagefile && gimp_container_have (container, GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
{
|
||||
view->file_open_dialog_func (editor->view->context->gimp,
|
||||
view->file_open_dialog_func (context->gimp,
|
||||
gimp_object_get_name (GIMP_OBJECT (imagefile)),
|
||||
GTK_WIDGET (view));
|
||||
}
|
||||
@ -306,7 +312,7 @@ gimp_document_view_open_extended_clicked (GtkWidget *widget,
|
||||
closure.name = gimp_object_get_name (GIMP_OBJECT (imagefile));
|
||||
closure.found = FALSE;
|
||||
|
||||
gimp_container_foreach (editor->view->context->gimp->displays,
|
||||
gimp_container_foreach (context->gimp->displays,
|
||||
gimp_document_view_raise_display,
|
||||
&closure);
|
||||
|
||||
@ -316,8 +322,7 @@ gimp_document_view_open_extended_clicked (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
view->file_open_dialog_func (editor->view->context->gimp, NULL,
|
||||
GTK_WIDGET (view));
|
||||
view->file_open_dialog_func (context->gimp, NULL, GTK_WIDGET (view));
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,18 +330,19 @@ static void
|
||||
gimp_document_view_remove_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
GimpContainer *container;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
imagefile = gimp_context_get_imagefile (context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
if (imagefile && gimp_container_have (container, GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
gimp_container_remove (editor->view->container,
|
||||
GIMP_OBJECT (imagefile));
|
||||
gimp_container_remove (container, GIMP_OBJECT (imagefile));
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,26 +351,33 @@ gimp_document_view_refresh_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContext *context;
|
||||
GimpContainer *container;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
imagefile = gimp_context_get_imagefile (context);
|
||||
|
||||
if (imagefile && gimp_container_have (container, GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
gimp_imagefile_create_thumbnail (imagefile,
|
||||
editor->view->context,
|
||||
editor->view->preview_size);
|
||||
gint preview_size;
|
||||
|
||||
preview_size = gimp_container_view_get_preview_size (editor->view, NULL);
|
||||
|
||||
gimp_imagefile_create_thumbnail (imagefile, context, preview_size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_delete_dangling_foreach (GimpImagefile *imagefile,
|
||||
GimpContainerView *container_view)
|
||||
GimpContainerView *view)
|
||||
{
|
||||
if (gimp_thumbnail_peek_image (imagefile->thumbnail) == GIMP_THUMB_STATE_NOT_FOUND)
|
||||
if (gimp_thumbnail_peek_image (imagefile->thumbnail) ==
|
||||
GIMP_THUMB_STATE_NOT_FOUND)
|
||||
{
|
||||
gimp_container_remove (container_view->container,
|
||||
gimp_container_remove (gimp_container_view_get_container (view),
|
||||
GIMP_OBJECT (imagefile));
|
||||
}
|
||||
}
|
||||
@ -374,19 +387,20 @@ gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
{
|
||||
gimp_container_foreach (editor->view->container,
|
||||
gimp_container_foreach (container,
|
||||
(GFunc) gimp_document_view_delete_dangling_foreach,
|
||||
editor->view);
|
||||
}
|
||||
else if (state & GDK_SHIFT_MASK)
|
||||
{
|
||||
gimp_container_foreach (editor->view->container,
|
||||
gimp_container_foreach (container,
|
||||
(GFunc) gimp_imagefile_update,
|
||||
editor->view);
|
||||
}
|
||||
@ -396,16 +410,16 @@ static void
|
||||
gimp_document_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpDocumentView *view;
|
||||
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
gboolean remove_sensitive = FALSE;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
view = GIMP_DOCUMENT_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
remove_sensitive = TRUE;
|
||||
}
|
||||
@ -417,15 +431,15 @@ static void
|
||||
gimp_document_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpDocumentView *view;
|
||||
GimpDocumentView *view = GIMP_DOCUMENT_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
||||
|
||||
view = GIMP_DOCUMENT_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_document_view_open_clicked (NULL, view);
|
||||
}
|
||||
@ -435,13 +449,14 @@ static void
|
||||
gimp_document_view_open_image (GimpDocumentView *view,
|
||||
GimpImagefile *imagefile)
|
||||
{
|
||||
Gimp *gimp;
|
||||
const gchar *uri;
|
||||
GimpImage *gimage;
|
||||
GimpPDBStatusType status;
|
||||
GError *error = NULL;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
Gimp *gimp;
|
||||
const gchar *uri;
|
||||
GimpImage *gimage;
|
||||
GimpPDBStatusType status;
|
||||
GError *error = NULL;
|
||||
|
||||
gimp = GIMP_CONTAINER_EDITOR (view)->view->context->gimp;
|
||||
gimp = gimp_container_view_get_context (editor->view)->gimp;
|
||||
|
||||
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
|
||||
|
||||
@ -466,16 +481,11 @@ static GList *
|
||||
gimp_document_view_drag_file (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpViewable *viewable;
|
||||
|
||||
viewable = gimp_dnd_get_drag_data (widget);
|
||||
GimpViewable *viewable = gimp_dnd_get_drag_data (widget);
|
||||
|
||||
if (viewable)
|
||||
{
|
||||
GList *list = NULL;
|
||||
|
||||
return g_list_append (list, g_strdup (gimp_object_get_name (GIMP_OBJECT (viewable))));
|
||||
}
|
||||
return g_list_append (NULL,
|
||||
g_strdup (gimp_object_get_name (GIMP_OBJECT (viewable))));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ gimp_font_view_refresh_clicked (GtkWidget *widget,
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
gimp_fonts_load (editor->view->context->gimp);
|
||||
gimp_fonts_load (gimp_container_view_get_context (editor->view)->gimp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -183,12 +183,16 @@ gimp_image_view_raise_clicked (GtkWidget *widget,
|
||||
GimpImageView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpImage *image;
|
||||
|
||||
image = gimp_context_get_image (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (image && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (image)))
|
||||
image = gimp_context_get_image (context);
|
||||
|
||||
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
|
||||
{
|
||||
if (view->raise_displays_func)
|
||||
view->raise_displays_func (image);
|
||||
@ -200,12 +204,16 @@ gimp_image_view_new_clicked (GtkWidget *widget,
|
||||
GimpImageView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpImage *image;
|
||||
|
||||
image = gimp_context_get_image (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (image && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (image)))
|
||||
image = gimp_context_get_image (context);
|
||||
|
||||
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
|
||||
{
|
||||
gimp_create_display (image->gimp, image, 1.0);
|
||||
}
|
||||
@ -216,12 +224,16 @@ gimp_image_view_delete_clicked (GtkWidget *widget,
|
||||
GimpImageView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpImage *image;
|
||||
|
||||
image = gimp_context_get_image (editor->view->context);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (image && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (image)))
|
||||
image = gimp_context_get_image (context);
|
||||
|
||||
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
|
||||
{
|
||||
if (image->disp_count == 0)
|
||||
g_object_unref (image);
|
||||
@ -233,6 +245,7 @@ gimp_image_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpImageView *view = GIMP_IMAGE_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
|
||||
gboolean raise_sensitive = FALSE;
|
||||
gboolean new_sensitive = FALSE;
|
||||
@ -241,8 +254,9 @@ gimp_image_view_select_item (GimpContainerEditor *editor,
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
raise_sensitive = TRUE;
|
||||
new_sensitive = TRUE;
|
||||
@ -260,15 +274,15 @@ static void
|
||||
gimp_image_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpImageView *view;
|
||||
GimpImageView *view = GIMP_IMAGE_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
||||
|
||||
view = GIMP_IMAGE_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gtk_button_clicked (GTK_BUTTON (view->raise_button));
|
||||
}
|
||||
|
@ -458,13 +458,15 @@ gimp_item_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpItemTreeView *item_view;
|
||||
GObject *object;
|
||||
GtkTreeViewColumn *column;
|
||||
GimpContainerViewPrivate *private;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpItemTreeView *item_view;
|
||||
GObject *object;
|
||||
GtkTreeViewColumn *column;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (object);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (object);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (object);
|
||||
|
||||
@ -513,7 +515,7 @@ gimp_item_tree_view_constructor (GType type,
|
||||
item_view);
|
||||
|
||||
/* disable the default GimpContainerView drop handler */
|
||||
GIMP_CONTAINER_VIEW (tree_view)->dnd_widget = NULL;
|
||||
private->dnd_widget = NULL;
|
||||
|
||||
gimp_dnd_drag_dest_set_by_type (GTK_WIDGET (tree_view->view),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
@ -741,15 +743,16 @@ static void
|
||||
gimp_item_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpItemTreeView *item_view;
|
||||
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
GimpContainer *old_container;
|
||||
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
old_container = gimp_container_view_get_container (view);
|
||||
|
||||
if (view->container)
|
||||
if (old_container)
|
||||
{
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
item_view->visible_changed_handler_id);
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
item_view->linked_changed_handler_id);
|
||||
|
||||
item_view->visible_changed_handler_id = 0;
|
||||
@ -758,14 +761,14 @@ gimp_item_tree_view_set_container (GimpContainerView *view,
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_container (view, container);
|
||||
|
||||
if (view->container)
|
||||
if (container)
|
||||
{
|
||||
item_view->visible_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "visibility_changed",
|
||||
gimp_container_add_handler (container, "visibility_changed",
|
||||
G_CALLBACK (gimp_item_tree_view_visible_changed),
|
||||
view);
|
||||
item_view->linked_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "linked_changed",
|
||||
gimp_container_add_handler (container, "linked_changed",
|
||||
G_CALLBACK (gimp_item_tree_view_linked_changed),
|
||||
view);
|
||||
}
|
||||
@ -821,6 +824,7 @@ gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
{
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *active_item;
|
||||
GimpContainer *container;
|
||||
gint index;
|
||||
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (tree_view);
|
||||
@ -835,15 +839,16 @@ gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
gimp_image_flush (tree_view->gimage);
|
||||
}
|
||||
|
||||
index = gimp_container_get_child_index (view->container,
|
||||
GIMP_OBJECT (item));
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
if (view->container->num_children > 1)
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
if (container->num_children > 1)
|
||||
{
|
||||
if (index > 0)
|
||||
raise_sensitive = TRUE;
|
||||
|
||||
if (index < (view->container->num_children - 1))
|
||||
if (index < (container->num_children - 1))
|
||||
lower_sensitive = TRUE;
|
||||
}
|
||||
|
||||
@ -938,6 +943,7 @@ gimp_item_tree_view_drop (GimpContainerTreeView *tree_view,
|
||||
GimpContainerView *container_view;
|
||||
GimpItemTreeView *item_view;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpContainer *container;
|
||||
GimpObject *src_object;
|
||||
GimpObject *dest_object;
|
||||
gint src_index;
|
||||
@ -946,13 +952,13 @@ gimp_item_tree_view_drop (GimpContainerTreeView *tree_view,
|
||||
container_view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (tree_view);
|
||||
|
||||
container = gimp_container_view_get_container (container_view);
|
||||
|
||||
src_object = GIMP_OBJECT (src_viewable);
|
||||
dest_object = GIMP_OBJECT (dest_viewable);
|
||||
|
||||
src_index = gimp_container_get_child_index (container_view->container,
|
||||
src_object);
|
||||
dest_index = gimp_container_get_child_index (container_view->container,
|
||||
dest_object);
|
||||
src_index = gimp_container_get_child_index (container, src_object);
|
||||
dest_index = gimp_container_get_child_index (container, dest_object);
|
||||
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (item_view);
|
||||
|
||||
@ -1032,12 +1038,12 @@ gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpItemTreeView *view;
|
||||
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (data);
|
||||
GimpContainer *container;
|
||||
|
||||
view = GIMP_ITEM_TREE_VIEW (data);
|
||||
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
||||
|
||||
if (viewable && gimp_container_have (GIMP_CONTAINER_VIEW (view)->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
view->new_item_func (view->gimage, GIMP_ITEM (viewable), FALSE,
|
||||
GTK_WIDGET (view));
|
||||
@ -1096,7 +1102,7 @@ gimp_item_tree_view_raise_clicked (GtkWidget *widget,
|
||||
GimpContainer *container;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
@ -1127,7 +1133,7 @@ gimp_item_tree_view_raise_extended_clicked (GtkWidget *widget,
|
||||
GimpContainer *container;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
@ -1157,7 +1163,7 @@ gimp_item_tree_view_lower_clicked (GtkWidget *widget,
|
||||
GimpContainer *container;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
@ -1188,7 +1194,7 @@ gimp_item_tree_view_lower_extended_clicked (GtkWidget *widget,
|
||||
GimpContainer *container;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
||||
|
||||
@ -1242,15 +1248,15 @@ gimp_item_tree_view_item_changed (GimpImage *gimage,
|
||||
|
||||
static void
|
||||
gimp_item_tree_view_size_changed (GimpImage *gimage,
|
||||
GimpItemTreeView *view)
|
||||
GimpItemTreeView *tree_view)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);;
|
||||
gint preview_size;
|
||||
gint border_width;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (view);
|
||||
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
||||
|
||||
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
|
||||
container_view->preview_size,
|
||||
container_view->preview_border_width);
|
||||
gimp_container_view_set_preview_size (view, preview_size, border_width);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1305,14 +1311,17 @@ static void
|
||||
gimp_item_tree_view_visible_changed (GimpItem *item,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
|
||||
iter = g_hash_table_lookup (container_view->hash_table, item);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (container_view);
|
||||
|
||||
iter = g_hash_table_lookup (private->hash_table, item);
|
||||
|
||||
if (iter)
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
@ -1337,14 +1346,17 @@ static void
|
||||
gimp_item_tree_view_linked_changed (GimpItem *item,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
|
||||
iter = g_hash_table_lookup (container_view->hash_table, item);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (container_view);
|
||||
|
||||
iter = g_hash_table_lookup (private->hash_table, item);
|
||||
|
||||
if (iter)
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
|
@ -472,46 +472,47 @@ static void
|
||||
gimp_layer_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpLayerTreeView *layer_view;
|
||||
GimpLayerTreeView *layer_view = GIMP_LAYER_TREE_VIEW (view);
|
||||
GimpContainer *old_container;
|
||||
|
||||
layer_view = GIMP_LAYER_TREE_VIEW (view);
|
||||
old_container = gimp_container_view_get_container (view);
|
||||
|
||||
if (view->container)
|
||||
if (old_container)
|
||||
{
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
layer_view->mode_changed_handler_id);
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
layer_view->opacity_changed_handler_id);
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
layer_view->preserve_trans_changed_handler_id);
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
layer_view->mask_changed_handler_id);
|
||||
gimp_container_remove_handler (view->container,
|
||||
gimp_container_remove_handler (old_container,
|
||||
layer_view->alpha_changed_handler_id);
|
||||
}
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_container (view, container);
|
||||
|
||||
if (view->container)
|
||||
if (container)
|
||||
{
|
||||
layer_view->mode_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "mode_changed",
|
||||
gimp_container_add_handler (container, "mode_changed",
|
||||
G_CALLBACK (gimp_layer_tree_view_layer_signal_handler),
|
||||
view);
|
||||
layer_view->opacity_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "opacity_changed",
|
||||
gimp_container_add_handler (container, "opacity_changed",
|
||||
G_CALLBACK (gimp_layer_tree_view_layer_signal_handler),
|
||||
view);
|
||||
layer_view->preserve_trans_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "preserve_trans_changed",
|
||||
gimp_container_add_handler (container, "preserve_trans_changed",
|
||||
G_CALLBACK (gimp_layer_tree_view_layer_signal_handler),
|
||||
view);
|
||||
layer_view->mask_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "mask_changed",
|
||||
gimp_container_add_handler (container, "mask_changed",
|
||||
G_CALLBACK (gimp_layer_tree_view_mask_changed),
|
||||
view);
|
||||
layer_view->alpha_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "alpha_changed",
|
||||
gimp_container_add_handler (container, "alpha_changed",
|
||||
G_CALLBACK (gimp_layer_tree_view_alpha_changed),
|
||||
view);
|
||||
}
|
||||
@ -582,9 +583,12 @@ gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpContainer *container;
|
||||
|
||||
container = gimp_container_view_get_container (view);
|
||||
|
||||
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
|
||||
gimp_container_get_child_index (view->container,
|
||||
GIMP_OBJECT (item)))
|
||||
gimp_container_get_child_index (container, GIMP_OBJECT (item)))
|
||||
{
|
||||
raise_sensitive = TRUE;
|
||||
}
|
||||
@ -601,13 +605,14 @@ gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
static void
|
||||
gimp_layer_tree_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpLayerTreeView *layer_view;
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
GimpLayerTreeView *layer_view = GIMP_LAYER_TREE_VIEW (view);
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
gint preview_size;
|
||||
gint border_width;
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
layer_view = GIMP_LAYER_TREE_VIEW (view);
|
||||
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
||||
|
||||
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
|
||||
iter_valid;
|
||||
@ -621,9 +626,7 @@ gimp_layer_tree_view_set_preview_size (GimpContainerView *view)
|
||||
|
||||
if (renderer)
|
||||
{
|
||||
gimp_preview_renderer_set_size (renderer,
|
||||
view->preview_size,
|
||||
view->preview_border_width);
|
||||
gimp_preview_renderer_set_size (renderer, preview_size, border_width);
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
}
|
||||
@ -708,19 +711,22 @@ static void
|
||||
gimp_layer_tree_view_floating_selection_changed (GimpImage *gimage,
|
||||
GimpLayerTreeView *layer_view)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpLayer *floating_sel;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerViewPrivate *private;
|
||||
GimpLayer *floating_sel;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
|
||||
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
floating_sel = gimp_image_floating_sel (gimage);
|
||||
|
||||
if (floating_sel)
|
||||
{
|
||||
iter = g_hash_table_lookup (view->hash_table, floating_sel);
|
||||
iter = g_hash_table_lookup (private->hash_table, floating_sel);
|
||||
|
||||
if (iter)
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
@ -740,7 +746,7 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *gimage,
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
{
|
||||
iter = g_hash_table_lookup (view->hash_table, drawable);
|
||||
iter = g_hash_table_lookup (private->hash_table, drawable);
|
||||
|
||||
if (iter)
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
@ -967,26 +973,26 @@ gimp_layer_tree_view_mask_update (GimpLayerTreeView *layer_view,
|
||||
GtkTreeIter *iter,
|
||||
GimpLayer *layer)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
|
||||
GimpLayerMask *mask;
|
||||
GimpPreviewRenderer *renderer = NULL;
|
||||
gboolean mask_visible = FALSE;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
|
||||
|
||||
mask = gimp_layer_get_mask (layer);
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GClosure *closure;
|
||||
gint preview_size;
|
||||
gint border_width;
|
||||
|
||||
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
||||
|
||||
mask_visible = TRUE;
|
||||
|
||||
renderer = gimp_preview_renderer_new (G_TYPE_FROM_INSTANCE (mask),
|
||||
container_view->preview_size,
|
||||
container_view->preview_border_width,
|
||||
preview_size, border_width,
|
||||
FALSE);
|
||||
gimp_preview_renderer_set_viewable (renderer, GIMP_VIEWABLE (mask));
|
||||
|
||||
@ -1019,12 +1025,11 @@ static void
|
||||
gimp_layer_tree_view_mask_changed (GimpLayer *layer,
|
||||
GimpLayerTreeView *layer_view)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
GtkTreeIter *iter;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
|
||||
iter = g_hash_table_lookup (view->hash_table, layer);
|
||||
iter = g_hash_table_lookup (private->hash_table, layer);
|
||||
|
||||
if (iter)
|
||||
gimp_layer_tree_view_mask_update (layer_view, iter, layer);
|
||||
@ -1034,17 +1039,17 @@ static void
|
||||
gimp_layer_tree_view_renderer_update (GimpPreviewRenderer *renderer,
|
||||
GimpLayerTreeView *layer_view)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpLayerMask *mask;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
|
||||
GimpContainerViewPrivate *private;
|
||||
GimpLayerMask *mask;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
|
||||
mask = GIMP_LAYER_MASK (renderer->viewable);
|
||||
|
||||
iter = g_hash_table_lookup (view->hash_table,
|
||||
iter = g_hash_table_lookup (private->hash_table,
|
||||
gimp_layer_mask_get_layer (mask));
|
||||
|
||||
if (iter)
|
||||
@ -1115,9 +1120,12 @@ static void
|
||||
gimp_layer_tree_view_mask_callback (GimpLayerMask *mask,
|
||||
GimpLayerTreeView *layer_view)
|
||||
{
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerViewPrivate *private;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
iter = g_hash_table_lookup (GIMP_CONTAINER_VIEW (layer_view)->hash_table,
|
||||
private = GIMP_CONTAINER_VIEW_GET_PRIVATE (layer_view);
|
||||
|
||||
iter = g_hash_table_lookup (private->hash_table,
|
||||
gimp_layer_mask_get_layer (mask));
|
||||
|
||||
gimp_layer_tree_view_update_borders (layer_view, iter);
|
||||
@ -1236,12 +1244,11 @@ static void
|
||||
gimp_layer_tree_view_alpha_changed (GimpLayer *layer,
|
||||
GimpLayerTreeView *layer_view)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkTreeIter *iter;
|
||||
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
|
||||
GtkTreeIter *iter;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (layer_view);
|
||||
|
||||
iter = g_hash_table_lookup (view->hash_table, layer);
|
||||
iter = g_hash_table_lookup (private->hash_table, layer);
|
||||
|
||||
if (iter)
|
||||
{
|
||||
|
@ -307,8 +307,9 @@ gimp_session_info_save (GimpSessionInfo *info,
|
||||
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view && view->preview_size >= GIMP_PREVIEW_SIZE_TINY)
|
||||
preview_size = view->preview_size;
|
||||
if (view)
|
||||
preview_size = gimp_container_view_get_preview_size (view,
|
||||
NULL);
|
||||
|
||||
if (preview_size > 0 &&
|
||||
preview_size != entry->preview_size)
|
||||
|
@ -244,19 +244,20 @@ static void
|
||||
gimp_template_view_create_clicked (GtkWidget *widget,
|
||||
GimpTemplateView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
if (template && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (template)))
|
||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||
{
|
||||
if (view->create_image_func)
|
||||
view->create_image_func (editor->view->context->gimp, template,
|
||||
GTK_WIDGET (view));
|
||||
view->create_image_func (context->gimp, template, GTK_WIDGET (view));
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,51 +265,53 @@ static void
|
||||
gimp_template_view_new_clicked (GtkWidget *widget,
|
||||
GimpTemplateView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
if (template && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (template)))
|
||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||
{
|
||||
}
|
||||
|
||||
if (view->new_template_func)
|
||||
view->new_template_func (editor->view->context->gimp, NULL,
|
||||
GTK_WIDGET (view));
|
||||
view->new_template_func (context->gimp, NULL, GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_template_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpTemplateView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
if (template && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (template)))
|
||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||
{
|
||||
GimpTemplate *new_template;
|
||||
|
||||
new_template = gimp_config_duplicate (GIMP_CONFIG (template));
|
||||
|
||||
gimp_list_uniquefy_name (GIMP_LIST (editor->view->container),
|
||||
gimp_list_uniquefy_name (GIMP_LIST (container),
|
||||
GIMP_OBJECT (new_template), TRUE);
|
||||
gimp_container_add (editor->view->container, GIMP_OBJECT (new_template));
|
||||
gimp_container_add (container, GIMP_OBJECT (new_template));
|
||||
|
||||
gimp_context_set_by_type (editor->view->context,
|
||||
editor->view->container->children_type,
|
||||
gimp_context_set_by_type (context, container->children_type,
|
||||
GIMP_OBJECT (new_template));
|
||||
|
||||
if (view->edit_template_func)
|
||||
view->edit_template_func (editor->view->context->gimp, new_template,
|
||||
view->edit_template_func (context->gimp, new_template,
|
||||
GTK_WIDGET (view));
|
||||
|
||||
g_object_unref (new_template);
|
||||
@ -319,19 +322,20 @@ static void
|
||||
gimp_template_view_edit_clicked (GtkWidget *widget,
|
||||
GimpTemplateView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
if (template && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (template)))
|
||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||
{
|
||||
if (view->edit_template_func)
|
||||
view->edit_template_func (editor->view->context->gimp, template,
|
||||
GTK_WIDGET (view));
|
||||
view->edit_template_func (context->gimp, template, GTK_WIDGET (view));
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,15 +371,17 @@ static void
|
||||
gimp_template_view_delete_clicked (GtkWidget *widget,
|
||||
GimpTemplateView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GimpTemplate *template;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
template = gimp_context_get_template (editor->view->context);
|
||||
template = gimp_context_get_template (context);
|
||||
|
||||
if (template && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (template)))
|
||||
if (template && gimp_container_have (container, GIMP_OBJECT (template)))
|
||||
{
|
||||
GimpTemplateDeleteData *delete_data;
|
||||
GtkWidget *dialog;
|
||||
@ -383,7 +389,7 @@ gimp_template_view_delete_clicked (GtkWidget *widget,
|
||||
|
||||
delete_data = g_new0 (GimpTemplateDeleteData, 1);
|
||||
|
||||
delete_data->container = editor->view->container;
|
||||
delete_data->container = container;
|
||||
delete_data->template = template;
|
||||
|
||||
str = g_strdup_printf (_("Are you sure you want to delete template '%s' "
|
||||
@ -413,16 +419,16 @@ static void
|
||||
gimp_template_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpTemplateView *view;
|
||||
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
view = GIMP_TEMPLATE_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
sensitive = TRUE;
|
||||
}
|
||||
@ -437,19 +443,20 @@ static void
|
||||
gimp_template_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpTemplateView *view;
|
||||
GimpTemplateView *view = GIMP_TEMPLATE_VIEW (editor);
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
||||
|
||||
view = GIMP_TEMPLATE_VIEW (editor);
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
||||
{
|
||||
if (view->create_image_func)
|
||||
view->create_image_func (editor->view->context->gimp,
|
||||
GIMP_TEMPLATE (viewable),
|
||||
view->create_image_func (context->gimp, GIMP_TEMPLATE (viewable),
|
||||
GTK_WIDGET (editor));
|
||||
}
|
||||
}
|
||||
@ -473,9 +480,12 @@ gimp_template_view_tree_name_edited (GtkCellRendererText *cell,
|
||||
|
||||
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpPreviewRenderer *renderer;
|
||||
GimpObject *object;
|
||||
|
||||
container = gimp_container_view_get_container (container_view);
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &iter,
|
||||
tree_view->model_column_renderer, &renderer,
|
||||
-1);
|
||||
@ -483,8 +493,7 @@ gimp_template_view_tree_name_edited (GtkCellRendererText *cell,
|
||||
object = GIMP_OBJECT (renderer->viewable);
|
||||
|
||||
gimp_object_set_name (object, new_name);
|
||||
gimp_list_uniquefy_name (GIMP_LIST (container_view->context->gimp->templates),
|
||||
object, TRUE);
|
||||
gimp_list_uniquefy_name (GIMP_LIST (container), object, TRUE);
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
@ -146,22 +146,24 @@ gimp_tool_view_reset_clicked (GtkWidget *widget,
|
||||
GimpToolView *view)
|
||||
{
|
||||
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (view);
|
||||
GimpContainer *tool_infos;
|
||||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
GList *list;
|
||||
gint i = 0;
|
||||
|
||||
tool_infos = editor->view->context->gimp->tool_info_list;
|
||||
container = gimp_container_view_get_container (editor->view);
|
||||
context = gimp_container_view_get_context (editor->view);
|
||||
|
||||
for (list = gimp_tools_get_default_order (editor->view->context->gimp);
|
||||
for (list = gimp_tools_get_default_order (context->gimp);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpObject *object = gimp_container_get_child_by_name (tool_infos,
|
||||
GimpObject *object = gimp_container_get_child_by_name (container,
|
||||
list->data);
|
||||
|
||||
if (object)
|
||||
{
|
||||
gimp_container_reorder (tool_infos, object, i);
|
||||
gimp_container_reorder (container, object, i);
|
||||
|
||||
g_object_set (object, "visible",
|
||||
! g_type_is_a (GIMP_TOOL_INFO (object)->tool_type,
|
||||
|
Reference in New Issue
Block a user