mirror of https://github.com/GNOME/gimp.git
added a title bar showing the dockable's name, a "close" and a "menu"
2003-09-21 Michael Natterer <mitch@gimp.org> * app/widgets/gimpdockable.[ch]: added a title bar showing the dockable's name, a "close" and a "menu" button. Not quite finished, but almost... * app/gui/dialogs-constructors.c: changed accordingly. * themes/Default/images/Makefile.am * themes/Default/images/stock-close-12.png * themes/Default/images/stock-menu-12.png: new icons for the above. * libgimpwidgets/gimpstock.[ch]: register them. * themes/Default/gtkrc: remove any focus spacing from the dockables' new buttons since they can't get the focus anyway.
This commit is contained in:
parent
db979650f0
commit
47b1e3eef8
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2003-09-21 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpdockable.[ch]: added a title bar showing the
|
||||
dockable's name, a "close" and a "menu" button. Not quite
|
||||
finished, but almost...
|
||||
|
||||
* app/gui/dialogs-constructors.c: changed accordingly.
|
||||
|
||||
* themes/Default/images/Makefile.am
|
||||
* themes/Default/images/stock-close-12.png
|
||||
* themes/Default/images/stock-menu-12.png: new icons for the above.
|
||||
|
||||
* libgimpwidgets/gimpstock.[ch]: register them.
|
||||
|
||||
* themes/Default/gtkrc: remove any focus spacing from the
|
||||
dockables' new buttons since they can't get the focus anyway.
|
||||
|
||||
2003-09-21 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/images-menu.c (images_menu_update): fixed typo.
|
||||
|
|
|
@ -117,6 +117,11 @@ static void dialogs_set_image_editor_context_func (GimpDockable *dockable,
|
|||
static void dialogs_set_navigation_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
||||
static GimpItemFactory * dialogs_get_view_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
static GimpItemFactory * dialogs_get_editor_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
|
||||
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *blurb,
|
||||
|
@ -124,7 +129,8 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func);
|
||||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
|
@ -256,7 +262,7 @@ dialogs_tool_options_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_OPTIONS,
|
||||
GIMP_HELP_TOOL_OPTIONS_DIALOG,
|
||||
dialogs_tool_options_preview_func, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -278,7 +284,7 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_DEVICE_STATUS,
|
||||
GIMP_HELP_DEVICE_STATUS_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -300,7 +306,8 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_WARNING,
|
||||
GIMP_HELP_ERRORS_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,7 +331,8 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_IMAGES,
|
||||
GIMP_HELP_IMAGE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -347,7 +355,8 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_DIALOG,
|
||||
dialogs_viewable_preview_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -369,7 +378,8 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
GIMP_HELP_PATTERN_DIALOG,
|
||||
dialogs_viewable_preview_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -391,7 +401,8 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_DIALOG,
|
||||
dialogs_viewable_preview_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -413,7 +424,8 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_DIALOG,
|
||||
dialogs_viewable_preview_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -433,7 +445,8 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_FONT,
|
||||
GIMP_HELP_FONT_DIALOG,
|
||||
dialogs_viewable_preview_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -453,7 +466,8 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_MISSING_IMAGE,
|
||||
GIMP_HELP_TOOL_DIALOG,
|
||||
dialogs_viewable_preview_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -474,7 +488,8 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_PASTE,
|
||||
GIMP_HELP_BUFFER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -496,7 +511,8 @@ dialogs_document_list_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_OPEN,
|
||||
GIMP_HELP_DOCUMENT_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -524,7 +540,8 @@ dialogs_template_list_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TEMPLATE,
|
||||
GIMP_HELP_TEMPLATE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -548,7 +565,8 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_IMAGES,
|
||||
GIMP_HELP_IMAGE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -571,7 +589,8 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_DIALOG,
|
||||
dialogs_viewable_preview_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -593,7 +612,8 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
GIMP_HELP_PATTERN_DIALOG,
|
||||
dialogs_viewable_preview_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -615,7 +635,8 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_DIALOG,
|
||||
dialogs_viewable_preview_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -637,7 +658,8 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_DIALOG,
|
||||
dialogs_viewable_preview_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -657,7 +679,8 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_FONT,
|
||||
GIMP_HELP_FONT_DIALOG,
|
||||
dialogs_viewable_preview_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -677,7 +700,8 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_MISSING_IMAGE,
|
||||
GIMP_HELP_TOOL_DIALOG,
|
||||
dialogs_viewable_preview_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -698,7 +722,8 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_PASTE,
|
||||
GIMP_HELP_BUFFER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -720,7 +745,8 @@ dialogs_document_grid_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_OPEN,
|
||||
GIMP_HELP_DOCUMENT_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -755,7 +781,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_LAYERS,
|
||||
GIMP_HELP_LAYER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -791,7 +818,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_CHANNELS,
|
||||
GIMP_HELP_CHANNEL_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -832,7 +860,8 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_PATHS,
|
||||
GIMP_HELP_PATH_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -857,7 +886,8 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_INDEXED_PALETTE,
|
||||
GIMP_HELP_INDEXED_PALETTE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -891,7 +921,8 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_RECT_SELECT,
|
||||
GIMP_HELP_SELECTION_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
NULL);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -916,7 +947,8 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_UNDO_HISTORY,
|
||||
GIMP_HELP_UNDO_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -948,7 +980,8 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_NAVIGATION,
|
||||
GIMP_HELP_NAVIGATION_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
dialogs_set_navigation_context_func,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -968,7 +1001,8 @@ dialogs_color_editor_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_DEFAULT_COLORS,
|
||||
GIMP_HELP_COLOR_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_color_editor_context_func);
|
||||
dialogs_set_color_editor_context_func,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -990,7 +1024,7 @@ dialogs_brush_editor_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1021,7 +1055,8 @@ dialogs_gradient_editor_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1052,7 +1087,8 @@ dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1302,6 +1338,44 @@ dialogs_set_navigation_context_func (GimpDockable *dockable,
|
|||
GIMP_NAVIGATION_VIEW (widget));
|
||||
}
|
||||
|
||||
static GimpItemFactory *
|
||||
dialogs_get_view_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
if (GIMP_IS_EDITOR (widget))
|
||||
{
|
||||
GimpEditor *editor = GIMP_EDITOR (widget);
|
||||
|
||||
if (item_factory_data)
|
||||
*item_factory_data = editor->item_factory_data;
|
||||
|
||||
return editor->item_factory;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GimpItemFactory *
|
||||
dialogs_get_editor_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
if (GIMP_IS_CONTAINER_EDITOR (widget))
|
||||
{
|
||||
GimpEditor *editor = GIMP_EDITOR (GIMP_CONTAINER_EDITOR (widget)->view);
|
||||
|
||||
if (item_factory_data)
|
||||
*item_factory_data = editor->item_factory_data;
|
||||
|
||||
return editor->item_factory;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
|
@ -1310,14 +1384,16 @@ dialogs_dockable_new (GtkWidget *widget,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func)
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name, blurb, stock_id, help_id,
|
||||
get_preview_func,
|
||||
get_preview_data,
|
||||
set_context_func);
|
||||
set_context_func,
|
||||
get_menu_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
|
|
|
@ -117,6 +117,11 @@ static void dialogs_set_image_editor_context_func (GimpDockable *dockable,
|
|||
static void dialogs_set_navigation_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
||||
static GimpItemFactory * dialogs_get_view_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
static GimpItemFactory * dialogs_get_editor_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
|
||||
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *blurb,
|
||||
|
@ -124,7 +129,8 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func);
|
||||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
|
@ -256,7 +262,7 @@ dialogs_tool_options_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_OPTIONS,
|
||||
GIMP_HELP_TOOL_OPTIONS_DIALOG,
|
||||
dialogs_tool_options_preview_func, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -278,7 +284,7 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_DEVICE_STATUS,
|
||||
GIMP_HELP_DEVICE_STATUS_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -300,7 +306,8 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_WARNING,
|
||||
GIMP_HELP_ERRORS_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,7 +331,8 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_IMAGES,
|
||||
GIMP_HELP_IMAGE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -347,7 +355,8 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_DIALOG,
|
||||
dialogs_viewable_preview_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -369,7 +378,8 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
GIMP_HELP_PATTERN_DIALOG,
|
||||
dialogs_viewable_preview_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -391,7 +401,8 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_DIALOG,
|
||||
dialogs_viewable_preview_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -413,7 +424,8 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_DIALOG,
|
||||
dialogs_viewable_preview_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -433,7 +445,8 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_FONT,
|
||||
GIMP_HELP_FONT_DIALOG,
|
||||
dialogs_viewable_preview_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -453,7 +466,8 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_MISSING_IMAGE,
|
||||
GIMP_HELP_TOOL_DIALOG,
|
||||
dialogs_viewable_preview_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -474,7 +488,8 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_PASTE,
|
||||
GIMP_HELP_BUFFER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -496,7 +511,8 @@ dialogs_document_list_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_OPEN,
|
||||
GIMP_HELP_DOCUMENT_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -524,7 +540,8 @@ dialogs_template_list_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TEMPLATE,
|
||||
GIMP_HELP_TEMPLATE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -548,7 +565,8 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_IMAGES,
|
||||
GIMP_HELP_IMAGE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -571,7 +589,8 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_DIALOG,
|
||||
dialogs_viewable_preview_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -593,7 +612,8 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
GIMP_HELP_PATTERN_DIALOG,
|
||||
dialogs_viewable_preview_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -615,7 +635,8 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_DIALOG,
|
||||
dialogs_viewable_preview_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -637,7 +658,8 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_DIALOG,
|
||||
dialogs_viewable_preview_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -657,7 +679,8 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_FONT,
|
||||
GIMP_HELP_FONT_DIALOG,
|
||||
dialogs_viewable_preview_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -677,7 +700,8 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_MISSING_IMAGE,
|
||||
GIMP_HELP_TOOL_DIALOG,
|
||||
dialogs_viewable_preview_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
dialogs_set_view_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -698,7 +722,8 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_PASTE,
|
||||
GIMP_HELP_BUFFER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -720,7 +745,8 @@ dialogs_document_grid_new (GimpDialogFactory *factory,
|
|||
GTK_STOCK_OPEN,
|
||||
GIMP_HELP_DOCUMENT_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
dialogs_set_editor_context_func,
|
||||
dialogs_get_editor_menu_func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -755,7 +781,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_LAYERS,
|
||||
GIMP_HELP_LAYER_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -791,7 +818,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_CHANNELS,
|
||||
GIMP_HELP_CHANNEL_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -832,7 +860,8 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_PATHS,
|
||||
GIMP_HELP_PATH_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
dialogs_set_image_item_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -857,7 +886,8 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_INDEXED_PALETTE,
|
||||
GIMP_HELP_INDEXED_PALETTE_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -891,7 +921,8 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_RECT_SELECT,
|
||||
GIMP_HELP_SELECTION_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
NULL);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -916,7 +947,8 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_UNDO_HISTORY,
|
||||
GIMP_HELP_UNDO_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
dialogs_set_image_editor_context_func,
|
||||
dialogs_get_view_menu_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
|
@ -948,7 +980,8 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_NAVIGATION,
|
||||
GIMP_HELP_NAVIGATION_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
dialogs_set_navigation_context_func,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -968,7 +1001,8 @@ dialogs_color_editor_new (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_DEFAULT_COLORS,
|
||||
GIMP_HELP_COLOR_DIALOG,
|
||||
NULL, NULL,
|
||||
dialogs_set_color_editor_context_func);
|
||||
dialogs_set_color_editor_context_func,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -990,7 +1024,7 @@ dialogs_brush_editor_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
GIMP_HELP_BRUSH_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1021,7 +1055,8 @@ dialogs_gradient_editor_get (GimpDialogFactory *factory,
|
|||
GIMP_STOCK_TOOL_BLEND,
|
||||
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1052,7 +1087,8 @@ dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
GTK_STOCK_SELECT_COLOR,
|
||||
GIMP_HELP_PALETTE_EDITOR_DIALOG,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
dialogs_get_view_menu_func);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1302,6 +1338,44 @@ dialogs_set_navigation_context_func (GimpDockable *dockable,
|
|||
GIMP_NAVIGATION_VIEW (widget));
|
||||
}
|
||||
|
||||
static GimpItemFactory *
|
||||
dialogs_get_view_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
if (GIMP_IS_EDITOR (widget))
|
||||
{
|
||||
GimpEditor *editor = GIMP_EDITOR (widget);
|
||||
|
||||
if (item_factory_data)
|
||||
*item_factory_data = editor->item_factory_data;
|
||||
|
||||
return editor->item_factory;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GimpItemFactory *
|
||||
dialogs_get_editor_menu_func (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
if (GIMP_IS_CONTAINER_EDITOR (widget))
|
||||
{
|
||||
GimpEditor *editor = GIMP_EDITOR (GIMP_CONTAINER_EDITOR (widget)->view);
|
||||
|
||||
if (item_factory_data)
|
||||
*item_factory_data = editor->item_factory_data;
|
||||
|
||||
return editor->item_factory;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
|
@ -1310,14 +1384,16 @@ dialogs_dockable_new (GtkWidget *widget,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func)
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name, blurb, stock_id, help_id,
|
||||
get_preview_func,
|
||||
get_preview_data,
|
||||
set_context_func);
|
||||
set_context_func,
|
||||
get_menu_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "gimpdockable.h"
|
||||
#include "gimpdockbook.h"
|
||||
#include "gimpitemfactory.h"
|
||||
|
||||
|
||||
static void gimp_dockable_class_init (GimpDockableClass *klass);
|
||||
|
@ -43,6 +44,13 @@ static void gimp_dockable_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation);
|
||||
static void gimp_dockable_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
static gboolean gimp_dockable_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
static void gimp_dockable_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
|
||||
static GtkWidget * gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
|
@ -50,6 +58,14 @@ static GtkWidget * gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
|
|||
GtkIconSize size);
|
||||
static void gimp_dockable_real_set_context (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
static GimpItemFactory * gimp_dockable_real_get_menu (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
|
||||
static gboolean gimp_dockable_menu_button_press (GtkWidget *button,
|
||||
GdkEventButton *bevent,
|
||||
GimpDockable *dockable);
|
||||
static void gimp_dockable_close_clicked (GtkWidget *button,
|
||||
GimpDockable *dockable);
|
||||
|
||||
|
||||
static GtkBinClass *parent_class = NULL;
|
||||
|
@ -86,11 +102,13 @@ gimp_dockable_get_type (void)
|
|||
static void
|
||||
gimp_dockable_class_init (GimpDockableClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkContainerClass *container_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
|
@ -99,9 +117,13 @@ gimp_dockable_class_init (GimpDockableClass *klass)
|
|||
widget_class->size_request = gimp_dockable_size_request;
|
||||
widget_class->size_allocate = gimp_dockable_size_allocate;
|
||||
widget_class->style_set = gimp_dockable_style_set;
|
||||
widget_class->expose_event = gimp_dockable_expose_event;
|
||||
|
||||
container_class->forall = gimp_dockable_forall;
|
||||
|
||||
klass->get_tab_widget = gimp_dockable_real_get_tab_widget;
|
||||
klass->set_context = gimp_dockable_real_set_context;
|
||||
klass->get_menu = gimp_dockable_real_get_menu;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content_border",
|
||||
|
@ -115,6 +137,8 @@ gimp_dockable_class_init (GimpDockableClass *klass)
|
|||
static void
|
||||
gimp_dockable_init (GimpDockable *dockable)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
dockable->name = NULL;
|
||||
dockable->blurb = NULL;
|
||||
dockable->stock_id = NULL;
|
||||
|
@ -125,14 +149,45 @@ gimp_dockable_init (GimpDockable *dockable)
|
|||
dockable->get_preview_func = NULL;
|
||||
dockable->get_preview_data = NULL;
|
||||
dockable->set_context_func = NULL;
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
dockable->menu_button = gtk_button_new ();
|
||||
gtk_widget_pop_composite_child ();
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (dockable->menu_button, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_parent (dockable->menu_button, GTK_WIDGET (dockable));
|
||||
gtk_button_set_relief (GTK_BUTTON (dockable->menu_button), GTK_RELIEF_NONE);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_MENU, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (dockable->menu_button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
g_signal_connect (dockable->menu_button, "button_press_event",
|
||||
G_CALLBACK (gimp_dockable_menu_button_press),
|
||||
dockable);
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
dockable->close_button = gtk_button_new ();
|
||||
gtk_widget_pop_composite_child ();
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (dockable->close_button, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_parent (dockable->close_button, GTK_WIDGET (dockable));
|
||||
gtk_button_set_relief (GTK_BUTTON (dockable->close_button), GTK_RELIEF_NONE);
|
||||
gtk_widget_show (dockable->close_button);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (dockable->close_button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
g_signal_connect (dockable->close_button, "clicked",
|
||||
G_CALLBACK (gimp_dockable_close_clicked),
|
||||
dockable);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockable_destroy (GtkObject *object)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
dockable = GIMP_DOCKABLE (object);
|
||||
GimpDockable *dockable = GIMP_DOCKABLE (object);
|
||||
|
||||
if (dockable->context)
|
||||
gimp_dockable_set_context (dockable, NULL);
|
||||
|
@ -161,6 +216,18 @@ gimp_dockable_destroy (GtkObject *object)
|
|||
dockable->help_id = NULL;
|
||||
}
|
||||
|
||||
if (dockable->menu_button)
|
||||
{
|
||||
gtk_widget_unparent (dockable->menu_button);
|
||||
dockable->menu_button = NULL;
|
||||
}
|
||||
|
||||
if (dockable->close_button)
|
||||
{
|
||||
gtk_widget_unparent (dockable->close_button);
|
||||
dockable->close_button = NULL;
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
|
@ -168,15 +235,30 @@ static void
|
|||
gimp_dockable_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkContainer *container;
|
||||
GtkBin *bin;
|
||||
GimpDockable *dockable;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
|
||||
container = GTK_CONTAINER (widget);
|
||||
bin = GTK_BIN (widget);
|
||||
dockable = GIMP_DOCKABLE (widget);
|
||||
|
||||
requisition->width = container->border_width * 2;
|
||||
requisition->height = container->border_width * 2;
|
||||
|
||||
if (dockable->close_button && GTK_WIDGET_VISIBLE (dockable->close_button))
|
||||
{
|
||||
gtk_widget_size_request (dockable->close_button, &child_requisition);
|
||||
|
||||
if (! bin->child)
|
||||
requisition->width += child_requisition.width;
|
||||
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
|
@ -188,23 +270,61 @@ static void
|
|||
gimp_dockable_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkContainer *container;
|
||||
GtkBin *bin;
|
||||
GimpDockable *dockable;
|
||||
GtkRequisition button_requisition = { 0, };
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
container = GTK_CONTAINER (widget);
|
||||
bin = GTK_BIN (widget);
|
||||
dockable = GIMP_DOCKABLE (widget);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
if (dockable->close_button)
|
||||
{
|
||||
gtk_widget_size_request (dockable->close_button, &button_requisition);
|
||||
|
||||
child_allocation.x = (allocation->x +
|
||||
allocation->width -
|
||||
container->border_width -
|
||||
button_requisition.width);
|
||||
child_allocation.y = (allocation->y +
|
||||
container->border_width);
|
||||
child_allocation.width = button_requisition.width;
|
||||
child_allocation.height = button_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (dockable->close_button, &child_allocation);
|
||||
}
|
||||
|
||||
if (dockable->menu_button)
|
||||
{
|
||||
child_allocation.x = (allocation->x +
|
||||
allocation->width -
|
||||
container->border_width -
|
||||
2 * button_requisition.width);
|
||||
child_allocation.y = allocation->y + container->border_width;
|
||||
child_allocation.width = button_requisition.width;
|
||||
child_allocation.height = button_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (dockable->menu_button, &child_allocation);
|
||||
}
|
||||
|
||||
if (bin->child)
|
||||
{
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
child_allocation.x = allocation->x;
|
||||
child_allocation.y = allocation->y;
|
||||
child_allocation.x = allocation->x + container->border_width;
|
||||
child_allocation.y = allocation->y + container->border_width;
|
||||
child_allocation.width = MAX (allocation->width -
|
||||
GTK_CONTAINER (widget)->border_width * 2,
|
||||
container->border_width * 2,
|
||||
0);
|
||||
child_allocation.height = MAX (allocation->height -
|
||||
GTK_CONTAINER (widget)->border_width * 2,
|
||||
container->border_width * 2 -
|
||||
button_requisition.height,
|
||||
0);
|
||||
|
||||
child_allocation.y += button_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +345,82 @@ gimp_dockable_style_set (GtkWidget *widget,
|
|||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dockable_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
GtkContainer *container;
|
||||
GdkRectangle title_area;
|
||||
GdkRectangle expose_area;
|
||||
|
||||
dockable = GIMP_DOCKABLE (widget);
|
||||
container = GTK_CONTAINER (widget);
|
||||
|
||||
title_area.x = widget->allocation.x + container->border_width;
|
||||
title_area.y = widget->allocation.y + container->border_width;
|
||||
title_area.width = (widget->allocation.width -
|
||||
2 * container->border_width -
|
||||
2 * dockable->close_button->allocation.width);
|
||||
title_area.height = dockable->close_button->allocation.height;
|
||||
|
||||
if (gdk_rectangle_intersect (&title_area, &event->area, &expose_area))
|
||||
{
|
||||
PangoLayout *layout;
|
||||
gint layout_width;
|
||||
gint layout_height;
|
||||
gint text_x;
|
||||
gint text_y;
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, dockable->blurb);
|
||||
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
text_x = title_area.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_x = title_area.x + title_area.width - layout_width;
|
||||
}
|
||||
|
||||
text_y = title_area.y + (title_area.height - layout_height) / 2;
|
||||
|
||||
gtk_paint_layout (widget->style, widget->window,
|
||||
widget->state, TRUE,
|
||||
&expose_area, widget, NULL,
|
||||
text_x, text_y, layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
}
|
||||
}
|
||||
|
||||
return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockable_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GimpDockable *dockable = GIMP_DOCKABLE (container);
|
||||
|
||||
if (include_internals)
|
||||
{
|
||||
if (dockable->menu_button)
|
||||
(* callback) (dockable->menu_button, callback_data);
|
||||
|
||||
if (dockable->close_button)
|
||||
(* callback) (dockable->close_button, callback_data);
|
||||
}
|
||||
|
||||
GTK_CONTAINER_CLASS (parent_class)->forall (container, include_internals,
|
||||
callback, callback_data);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_dockable_new (const gchar *name,
|
||||
const gchar *blurb,
|
||||
|
@ -232,7 +428,8 @@ gimp_dockable_new (const gchar *name,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
|
@ -251,6 +448,10 @@ gimp_dockable_new (const gchar *name,
|
|||
dockable->get_preview_func = get_preview_func;
|
||||
dockable->get_preview_data = get_preview_data;
|
||||
dockable->set_context_func = set_context_func;
|
||||
dockable->get_menu_func = get_menu_func;
|
||||
|
||||
if (get_menu_func)
|
||||
gtk_widget_show (dockable->menu_button);
|
||||
|
||||
if (! get_preview_func)
|
||||
{
|
||||
|
@ -299,6 +500,17 @@ gimp_dockable_set_context (GimpDockable *dockable,
|
|||
GIMP_DOCKABLE_GET_CLASS (dockable)->set_context (dockable, context);
|
||||
}
|
||||
|
||||
GimpItemFactory *
|
||||
gimp_dockable_get_menu (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
||||
g_return_val_if_fail (item_factory_data != NULL, NULL);
|
||||
|
||||
return GIMP_DOCKABLE_GET_CLASS (dockable)->get_menu (dockable,
|
||||
item_factory_data);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
|
@ -382,11 +594,93 @@ static void
|
|||
gimp_dockable_real_set_context (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
||||
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
||||
|
||||
if (dockable->set_context_func)
|
||||
dockable->set_context_func (dockable, context);
|
||||
|
||||
dockable->context = context;
|
||||
}
|
||||
|
||||
static GimpItemFactory *
|
||||
gimp_dockable_real_get_menu (GimpDockable *dockable,
|
||||
gpointer *item_factory_data)
|
||||
{
|
||||
if (dockable->get_menu_func)
|
||||
return dockable->get_menu_func (dockable, item_factory_data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockable_menu_position (GtkMenu *menu,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gpointer data)
|
||||
{
|
||||
GtkRequisition menu_requisition;
|
||||
GtkRequisition button_requisition;
|
||||
GtkWidget *dockable;
|
||||
GtkContainer *container;
|
||||
GdkScreen *screen;
|
||||
|
||||
dockable = GTK_WIDGET (data);
|
||||
container = GTK_CONTAINER (data);
|
||||
|
||||
gdk_window_get_origin (dockable->window, x, y);
|
||||
|
||||
gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition);
|
||||
gtk_widget_size_request (GIMP_DOCKABLE (dockable)->close_button,
|
||||
&button_requisition);
|
||||
|
||||
*x += (dockable->allocation.x + dockable->allocation.width -
|
||||
container->border_width -
|
||||
2 * button_requisition.width -
|
||||
menu_requisition.width);
|
||||
*y += (dockable->allocation.y + container->border_width +
|
||||
button_requisition.height / 2);
|
||||
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
|
||||
|
||||
if (*x + menu_requisition.width > gdk_screen_get_width (screen))
|
||||
*x -= menu_requisition.width;
|
||||
|
||||
if (*x < 0)
|
||||
*x = 0;
|
||||
|
||||
if (*y + menu_requisition.height > gdk_screen_get_height (screen))
|
||||
*y -= menu_requisition.height;
|
||||
|
||||
if (*y < 0)
|
||||
*y = 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dockable_menu_button_press (GtkWidget *button,
|
||||
GdkEventButton *bevent,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
GimpItemFactory *item_factory;
|
||||
gpointer item_factory_data;
|
||||
|
||||
item_factory = gimp_dockable_get_menu (dockable, &item_factory_data);
|
||||
|
||||
if (item_factory)
|
||||
{
|
||||
gimp_item_factory_popup_with_data (item_factory, item_factory_data,
|
||||
gimp_dockable_menu_position,
|
||||
dockable,
|
||||
NULL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockable_close_clicked (GtkWidget *button,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
gimp_dockbook_remove (dockable->dockbook, dockable);
|
||||
}
|
||||
|
|
|
@ -26,12 +26,14 @@
|
|||
#include <gtk/gtkbin.h>
|
||||
|
||||
|
||||
typedef GtkWidget * (* GimpDockableGetPreviewFunc) (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer get_preview_data);
|
||||
typedef void (* GimpDockableSetContextFunc) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
typedef GtkWidget * (* GimpDockableGetPreviewFunc) (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer get_preview_data);
|
||||
typedef void (* GimpDockableSetContextFunc) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
typedef GimpItemFactory * (* GimpDockableGetMenuFunc) (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
|
||||
|
||||
#define GIMP_TYPE_DOCKABLE (gimp_dockable_get_type ())
|
||||
|
@ -58,21 +60,27 @@ struct _GimpDockable
|
|||
|
||||
GimpContext *context;
|
||||
|
||||
GtkWidget *menu_button;
|
||||
GtkWidget *close_button;
|
||||
|
||||
GimpDockableGetPreviewFunc get_preview_func;
|
||||
gpointer get_preview_data;
|
||||
GimpDockableSetContextFunc set_context_func;
|
||||
GimpDockableGetMenuFunc get_menu_func;
|
||||
};
|
||||
|
||||
struct _GimpDockableClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
|
||||
GtkWidget * (* get_tab_widget) (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void (* set_context) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
GtkWidget * (* get_tab_widget) (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void (* set_context) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
GimpItemFactory * (* get_menu) (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
};
|
||||
|
||||
|
||||
|
@ -84,14 +92,17 @@ GtkWidget * gimp_dockable_new (const gchar *name,
|
|||
const gchar *help_id,
|
||||
GimpDockableGetPreviewFunc get_preview_func,
|
||||
gpointer get_preview_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
GimpDockableSetContextFunc set_context_func,
|
||||
GimpDockableGetMenuFunc get_menu_func);
|
||||
|
||||
GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void gimp_dockable_set_context (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void gimp_dockable_set_context (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
GimpItemFactory * gimp_dockable_get_menu (GimpDockable *dockable,
|
||||
gpointer *item_factory_data);
|
||||
|
||||
|
||||
#endif /* __GIMP_DOCKABLE_H__ */
|
||||
|
|
|
@ -451,6 +451,8 @@ gimp_stock_menu_pixbufs[] =
|
|||
{ GIMP_STOCK_PORTRAIT, stock_portrait_16 },
|
||||
{ GIMP_STOCK_LANDSCAPE, stock_landscape_16 },
|
||||
|
||||
{ GIMP_STOCK_CLOSE, stock_close_12 },
|
||||
{ GIMP_STOCK_MENU, stock_menu_12 },
|
||||
{ GIMP_STOCK_DEFAULT_COLORS, stock_default_colors_12 },
|
||||
{ GIMP_STOCK_SWAP_COLORS, stock_swap_colors_12 },
|
||||
|
||||
|
|
|
@ -179,6 +179,8 @@ G_BEGIN_DECLS
|
|||
#define GIMP_STOCK_QMASK_OFF "gimp-qmask-off"
|
||||
#define GIMP_STOCK_QMASK_ON "gimp-qmask-on"
|
||||
|
||||
#define GIMP_STOCK_CLOSE "gimp-close"
|
||||
#define GIMP_STOCK_MENU "gimp-menu"
|
||||
#define GIMP_STOCK_DEFAULT_COLORS "gimp-default-colors"
|
||||
#define GIMP_STOCK_SWAP_COLORS "gimp-swap-colors"
|
||||
|
||||
|
|
|
@ -74,9 +74,18 @@ style "gimp-hscale-style"
|
|||
class "GtkHScale" style "gimp-hscale-style"
|
||||
|
||||
|
||||
style "gimp-grid-view-style" = "gimp-dock-style"
|
||||
style "gimp-grid-view-style" = "gimp-default-style"
|
||||
{
|
||||
bg[NORMAL] = { 1.0, 1.0, 1.0 }
|
||||
}
|
||||
|
||||
widget "*GimpContainerGridView*GtkViewport*" style "gimp-grid-view-style"
|
||||
|
||||
|
||||
style "gimp-dockable-button-style" = "gimp-default-style"
|
||||
{
|
||||
GtkButton::focus_line_width = 0
|
||||
GtkButton::focus_line_padding = 0
|
||||
}
|
||||
|
||||
widget "*GimpDockable.GtkButton*" style "gimp-dockable-button-style"
|
||||
|
|
|
@ -30,6 +30,7 @@ STOCK_MENU_IMAGES = \
|
|||
stock-channel-green-16.png \
|
||||
stock-channel-red-16.png \
|
||||
stock-channels-16.png \
|
||||
stock-close-12.png \
|
||||
stock-convert-grayscale-16.png \
|
||||
stock-convert-indexed-16.png \
|
||||
stock-convert-rgb-16.png \
|
||||
|
@ -61,6 +62,7 @@ STOCK_MENU_IMAGES = \
|
|||
stock-layer-to-imagesize-16.png \
|
||||
stock-layers-16.png \
|
||||
stock-list-16.png \
|
||||
stock-menu-12.png \
|
||||
stock-merge-down-16.png \
|
||||
stock-navigation-16.png \
|
||||
stock-path-16.png \
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 171 B |
Binary file not shown.
After Width: | Height: | Size: 184 B |
Loading…
Reference in New Issue