mirror of https://github.com/GNOME/gimp.git
connect to "realize" of the scrolled window's viewport and scroll to the
2003-04-13 Michael Natterer <mitch@gimp.org> * app/widgets/gimpcontainergridview.c: connect to "realize" of the scrolled window's viewport and scroll to the correct item (because GtkViewport is too dumb to this by itself). * app/widgets/gimpcontainerpopup.[ch]: added a "view_type" parameter. * app/widgets/gimpviewablebutton.[ch]: added new function gimp_viewable_button_set_view_type() and pass the view_type to the GimpContainerPopup. * app/widgets/gimptemplateeditor.c: default to GIMP_VIEW_TYPE_GRID for the stock icon popup.
This commit is contained in:
parent
753ad21dfb
commit
86ec502c46
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2003-04-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpcontainergridview.c: connect to "realize" of the
|
||||
scrolled window's viewport and scroll to the correct item
|
||||
(because GtkViewport is too dumb to this by itself).
|
||||
|
||||
* app/widgets/gimpcontainerpopup.[ch]: added a "view_type"
|
||||
parameter.
|
||||
|
||||
* app/widgets/gimpviewablebutton.[ch]: added new function
|
||||
gimp_viewable_button_set_view_type() and pass the view_type
|
||||
to the GimpContainerPopup.
|
||||
|
||||
* app/widgets/gimptemplateeditor.c: default to GIMP_VIEW_TYPE_GRID
|
||||
for the stock icon popup.
|
||||
|
||||
2003-04-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpdrawable-desaturate.c (gimp_drawable_desaturate):
|
||||
|
|
|
@ -88,6 +88,8 @@ static void gimp_container_grid_view_highlight_item (GimpContainerView *v
|
|||
static void gimp_container_grid_view_vieport_resized (GtkWidget *widget,
|
||||
GtkAllocation *allocation,
|
||||
GimpContainerGridView *view);
|
||||
static void gimp_container_grid_view_vieport_realize (GtkWidget *widget,
|
||||
GimpContainerGridView *view);
|
||||
|
||||
|
||||
static GimpContainerViewClass *parent_class = NULL;
|
||||
|
@ -212,6 +214,9 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
|
|||
g_signal_connect (grid_view->wrap_box->parent, "size_allocate",
|
||||
G_CALLBACK (gimp_container_grid_view_vieport_resized),
|
||||
grid_view);
|
||||
g_signal_connect (grid_view->wrap_box->parent, "realize",
|
||||
G_CALLBACK (gimp_container_grid_view_vieport_realize),
|
||||
grid_view);
|
||||
|
||||
gtk_container_set_focus_vadjustment
|
||||
(GTK_CONTAINER (grid_view->wrap_box->parent),
|
||||
|
@ -538,7 +543,7 @@ gimp_container_grid_view_highlight_item (GimpContainerView *view,
|
|||
adj = gtk_scrolled_window_get_vadjustment
|
||||
(GTK_SCROLLED_WINDOW (view->scrolled_win));
|
||||
|
||||
item_height = GTK_WIDGET (preview)->allocation.height;
|
||||
item_height = GTK_WIDGET (preview)->requisition.height;
|
||||
|
||||
index = gimp_container_get_child_index (view->container,
|
||||
GIMP_OBJECT (viewable));
|
||||
|
@ -621,3 +626,25 @@ gimp_container_grid_view_vieport_resized (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_grid_view_vieport_realize (GtkWidget *widget,
|
||||
GimpContainerGridView *grid_view)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
|
||||
if (view->container)
|
||||
{
|
||||
GimpPreview *preview;
|
||||
|
||||
preview = g_object_get_data (G_OBJECT (view),
|
||||
"last_selected_item");
|
||||
|
||||
if (preview)
|
||||
gimp_container_grid_view_highlight_item (view,
|
||||
preview->viewable,
|
||||
preview);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,6 +360,7 @@ gimp_container_popup_context_changed (GimpContext *context,
|
|||
GtkWidget *
|
||||
gimp_container_popup_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GimpViewType view_type,
|
||||
gint preview_size,
|
||||
gint preview_border_width,
|
||||
GimpDialogFactory *dialog_factory,
|
||||
|
@ -410,7 +411,7 @@ gimp_container_popup_new (GimpContainer *container,
|
|||
popup->dialog_tooltip = g_strdup (dialog_tooltip);
|
||||
}
|
||||
|
||||
gimp_container_popup_create_view (popup, GIMP_VIEW_TYPE_LIST);
|
||||
gimp_container_popup_create_view (popup, view_type);
|
||||
|
||||
return GTK_WIDGET (popup);
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ GType gimp_container_popup_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GtkWidget * gimp_container_popup_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GimpViewType view_type,
|
||||
gint preview_size,
|
||||
gint preview_border_width,
|
||||
GimpDialogFactory *dialog_factory,
|
||||
|
|
|
@ -429,6 +429,8 @@ gimp_template_editor_new (Gimp *gimp,
|
|||
editor->stock_id_context,
|
||||
GIMP_PREVIEW_SIZE_SMALL, 0,
|
||||
NULL, NULL, NULL, NULL);
|
||||
gimp_viewable_button_set_view_type (GIMP_VIEWABLE_BUTTON (button),
|
||||
GIMP_VIEW_TYPE_GRID);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("_Icon:"), 1.0, 0.5,
|
||||
|
|
|
@ -100,6 +100,7 @@ gimp_viewable_button_class_init (GimpViewableButtonClass *klass)
|
|||
static void
|
||||
gimp_viewable_button_init (GimpViewableButton *button)
|
||||
{
|
||||
button->view_type = GIMP_VIEW_TYPE_LIST;
|
||||
button->preview_size = GIMP_PREVIEW_SIZE_SMALL;
|
||||
button->preview_border_width = 1;
|
||||
}
|
||||
|
@ -194,6 +195,7 @@ gimp_viewable_button_clicked (GtkButton *button)
|
|||
|
||||
popup = gimp_container_popup_new (viewable_button->container,
|
||||
viewable_button->context,
|
||||
viewable_button->view_type,
|
||||
viewable_button->preview_size,
|
||||
viewable_button->preview_border_width,
|
||||
viewable_button->dialog_factory,
|
||||
|
@ -257,3 +259,12 @@ gimp_viewable_button_new (GimpContainer *container,
|
|||
|
||||
return GTK_WIDGET (button);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_viewable_button_set_view_type (GimpViewableButton *button,
|
||||
GimpViewType view_type)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE_BUTTON (button));
|
||||
|
||||
button->view_type = view_type;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ struct _GimpViewableButton
|
|||
GimpContainer *container;
|
||||
GimpContext *context;
|
||||
|
||||
GimpViewType view_type;
|
||||
gint preview_size;
|
||||
gint preview_border_width;
|
||||
|
||||
|
@ -62,14 +63,17 @@ struct _GimpViewableButtonClass
|
|||
|
||||
GType gimp_viewable_button_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_viewable_button_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint preview_border_width,
|
||||
GimpDialogFactory *dialog_factory,
|
||||
const gchar *dialog_identifier,
|
||||
const gchar *dialog_stock_id,
|
||||
const gchar *dialog_tooltip);
|
||||
GtkWidget * gimp_viewable_button_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint preview_border_width,
|
||||
GimpDialogFactory *dialog_factory,
|
||||
const gchar *dialog_identifier,
|
||||
const gchar *dialog_stock_id,
|
||||
const gchar *dialog_tooltip);
|
||||
void gimp_viewable_button_set_view_type (GimpViewableButton *button,
|
||||
GimpViewType view_type);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in New Issue