mirror of https://github.com/GNOME/gimp.git
added gimp_container_view_construct(). The new function calls
2003-03-26 Michael Natterer <mitch@gimp.org> * app/widgets/gimpcontainerview.[ch]: added gimp_container_view_construct(). The new function calls gimp_container_view_set_preview_size() instead of simply assigning view->preview_size (Fixes wrongly-sized toggle cells spotted by Jimmac). * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpitemtreeview.c: call when creating a view. * app/widgets/gimpchanneltreeview.c: check view->component_editor for being non-NULL before accessing it.
This commit is contained in:
parent
ba8060a839
commit
bda4188ab1
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2003-03-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpcontainerview.[ch]: added
|
||||
gimp_container_view_construct(). The new function calls
|
||||
gimp_container_view_set_preview_size() instead of simply assigning
|
||||
view->preview_size (Fixes wrongly-sized toggle cells spotted by
|
||||
Jimmac).
|
||||
|
||||
* app/widgets/gimpcontainereditor.c
|
||||
* app/widgets/gimpcontainergridview.c
|
||||
* app/widgets/gimpcontainertreeview.c
|
||||
* app/widgets/gimpitemtreeview.c: call when creating a view.
|
||||
|
||||
* app/widgets/gimpchanneltreeview.c: check view->component_editor
|
||||
for being non-NULL before accessing it.
|
||||
|
||||
2003-03-26 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/gimp-remote.c: include X11/Xmu/WinUtil.h after including
|
||||
|
|
|
@ -234,8 +234,9 @@ gimp_channel_tree_view_set_preview_size (GimpContainerView *view)
|
|||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size (view);
|
||||
|
||||
gimp_component_editor_set_preview_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
||||
view->preview_size);
|
||||
if (channel_view->component_editor)
|
||||
gimp_component_editor_set_preview_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
||||
view->preview_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -121,8 +121,8 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
|
|||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (preview_size > 0 &&
|
||||
preview_size <= GIMP_PREVIEW_MAX_SIZE, FALSE);
|
||||
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_x <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_y <= 64, FALSE);
|
||||
g_return_val_if_fail (menu_factory == NULL ||
|
||||
GIMP_IS_MENU_FACTORY (menu_factory), FALSE);
|
||||
|
||||
|
|
|
@ -183,32 +183,21 @@ gimp_container_grid_view_new (GimpContainer *container,
|
|||
gint min_items_y)
|
||||
{
|
||||
GimpContainerGridView *grid_view;
|
||||
GimpContainerView *view;
|
||||
|
||||
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
|
||||
NULL);
|
||||
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (preview_size > 0 &&
|
||||
preview_size <= GIMP_PREVIEW_MAX_SIZE, NULL);
|
||||
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, NULL);
|
||||
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, NULL);
|
||||
g_return_val_if_fail (min_items_x <= 64, NULL);
|
||||
g_return_val_if_fail (min_items_y <= 64, NULL);
|
||||
|
||||
grid_view = g_object_new (GIMP_TYPE_CONTAINER_GRID_VIEW, NULL);
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
gimp_container_view_set_size_request (view,
|
||||
(preview_size + 2) * min_items_x,
|
||||
(preview_size + 2) * min_items_y);
|
||||
|
||||
if (container)
|
||||
gimp_container_view_set_container (view, container);
|
||||
|
||||
if (context)
|
||||
gimp_container_view_set_context (view, context);
|
||||
gimp_container_view_construct (GIMP_CONTAINER_VIEW (grid_view),
|
||||
container, context,
|
||||
preview_size, reorderable,
|
||||
min_items_x, min_items_y);
|
||||
|
||||
return GTK_WIDGET (grid_view);
|
||||
}
|
||||
|
|
|
@ -258,7 +258,6 @@ gimp_container_tree_view_new (GimpContainer *container,
|
|||
gint min_items_y)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpContainerView *view;
|
||||
|
||||
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
|
||||
NULL);
|
||||
|
@ -270,20 +269,10 @@ gimp_container_tree_view_new (GimpContainer *container,
|
|||
|
||||
tree_view = g_object_new (GIMP_TYPE_CONTAINER_TREE_VIEW, NULL);
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
gimp_container_view_set_size_request (view,
|
||||
(preview_size + 2) * min_items_x,
|
||||
(preview_size + 2) * min_items_y);
|
||||
|
||||
if (container)
|
||||
gimp_container_view_set_container (view, container);
|
||||
|
||||
if (context)
|
||||
gimp_container_view_set_context (view, context);
|
||||
gimp_container_view_construct (GIMP_CONTAINER_VIEW (tree_view),
|
||||
container, context,
|
||||
preview_size, reorderable,
|
||||
min_items_x, min_items_y);
|
||||
|
||||
return GTK_WIDGET (tree_view);
|
||||
}
|
||||
|
|
|
@ -341,6 +341,37 @@ gimp_container_view_real_set_container (GimpContainerView *view,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_construct (GimpContainerView *view,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y)
|
||||
{
|
||||
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));
|
||||
g_return_if_fail (preview_size > 0 && preview_size <= GIMP_PREVIEW_MAX_SIZE);
|
||||
g_return_if_fail (min_items_x <= 64);
|
||||
g_return_if_fail (min_items_y <= 64);
|
||||
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
gimp_container_view_set_preview_size (view, preview_size);
|
||||
|
||||
gimp_container_view_set_size_request (view,
|
||||
(preview_size + 2) * min_items_x,
|
||||
(preview_size + 2) * min_items_y);
|
||||
|
||||
if (container)
|
||||
gimp_container_view_set_container (view, container);
|
||||
|
||||
if (context)
|
||||
gimp_container_view_set_context (view, context);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_container_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context)
|
||||
|
@ -453,8 +484,8 @@ gimp_container_view_set_size_request (GimpContainerView *view,
|
|||
gint border_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (width >= view->preview_size);
|
||||
g_return_if_fail (height >= view->preview_size);
|
||||
g_return_if_fail (width <= 0 || width >= view->preview_size);
|
||||
g_return_if_fail (height <= 0 || height >= view->preview_size);
|
||||
|
||||
sw_class = GTK_SCROLLED_WINDOW_GET_CLASS (view->scrolled_win);
|
||||
|
||||
|
@ -473,8 +504,8 @@ gimp_container_view_set_size_request (GimpContainerView *view,
|
|||
border_y = view->scrolled_win->style->ythickness * 2;
|
||||
|
||||
gtk_widget_set_size_request (view->scrolled_win,
|
||||
width + border_x,
|
||||
height + border_y);
|
||||
width > 0 ? width + border_x : -1,
|
||||
height > 0 ? height + border_y : -1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -94,6 +94,14 @@ struct _GimpContainerViewClass
|
|||
|
||||
GType gimp_container_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_container_view_construct (GimpContainerView *view,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y);
|
||||
|
||||
void gimp_container_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container);
|
||||
void gimp_container_view_set_context (GimpContainerView *view,
|
||||
|
|
|
@ -385,8 +385,11 @@ gimp_item_tree_view_new (gint preview_size,
|
|||
view = GIMP_CONTAINER_VIEW (item_view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (item_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
gimp_container_view_construct (GIMP_CONTAINER_VIEW (item_view),
|
||||
NULL, NULL,
|
||||
preview_size, TRUE,
|
||||
-1, -1);
|
||||
|
||||
view->dnd_widget = NULL;
|
||||
|
||||
gimp_dnd_drag_dest_set_by_type (GTK_WIDGET (tree_view->view),
|
||||
|
|
Loading…
Reference in New Issue