mirror of https://github.com/GNOME/gimp.git
Added configurable styles for dockable tabs (fixes bug #87376):
2003-07-08 Michael Natterer <mitch@gimp.org> Added configurable styles for dockable tabs (fixes bug #87376): * app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }. * app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON. Renamed "short_name" to "name" and "name" to "blurb". Renamed GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all tab styles in gimp_dockable_real_get_tab_widget() and use the "get_icon_func" only for creating the tab's icon, not the entire tab widget. * app/widgets/gimpdockbook.[ch]: changed accordingly. Create the menu widgets and the DND icon using gimp_dockable_get_tab_widget() with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating tons of code. Made gimp_dockbook_get_tab_widget() public because it's needed for exchanging tabs on-the-fly. * app/widgets/gimpimagedock.c: changed accordingly. * app/widgets/gimpdialogfactory.c: remember the dockables' tab style in sessionrc. * app/gui/dialogs-menu.c: added a submenu to select the tab style for each dockable. * app/gui/dialogs-commands.[ch]: new callback dialogs_tab_style_cmd_callback(). * app/gui/dialogs-constructors.[ch]: added stock_ids to all dockables, swapped the "name" and "blurb" parameters, reordered functions, cleanup. * app/gui/dialogs-menu.c * app/gui/image-menu.c * app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the color editor dockable and renamed it to "FG/BG Color".
This commit is contained in:
parent
efb6ff5b27
commit
6fabca2e17
41
ChangeLog
41
ChangeLog
|
@ -1,3 +1,44 @@
|
|||
2003-07-08 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Added configurable styles for dockable tabs (fixes bug #87376):
|
||||
|
||||
* app/widgets/widgets-enums.[ch]: added new enum GimpTabStyle
|
||||
which can be one on { ICON, NAME, ICON_NAME, ICON_BLURB }.
|
||||
|
||||
* app/widgets/gimpdockable.[ch]: added a GimpTabStyle member to
|
||||
the GimpDockable struct which defaults to GIMP_TAB_STYLE_ICON.
|
||||
Renamed "short_name" to "name" and "name" to "blurb". Renamed
|
||||
GimpDockableGetTabFunc to GimpDockableGetIconFunc. Implemented all
|
||||
tab styles in gimp_dockable_real_get_tab_widget() and use the
|
||||
"get_icon_func" only for creating the tab's icon, not the entire
|
||||
tab widget.
|
||||
|
||||
* app/widgets/gimpdockbook.[ch]: changed accordingly. Create the
|
||||
menu widgets and the DND icon using gimp_dockable_get_tab_widget()
|
||||
with tab_style == GIMP_TAB_STYLE_ICON_BLURB instead of duplicating
|
||||
tons of code. Made gimp_dockbook_get_tab_widget() public because
|
||||
it's needed for exchanging tabs on-the-fly.
|
||||
|
||||
* app/widgets/gimpimagedock.c: changed accordingly.
|
||||
|
||||
* app/widgets/gimpdialogfactory.c: remember the dockables' tab
|
||||
style in sessionrc.
|
||||
|
||||
* app/gui/dialogs-menu.c: added a submenu to select the tab style
|
||||
for each dockable.
|
||||
|
||||
* app/gui/dialogs-commands.[ch]: new callback
|
||||
dialogs_tab_style_cmd_callback().
|
||||
|
||||
* app/gui/dialogs-constructors.[ch]: added stock_ids to all
|
||||
dockables, swapped the "name" and "blurb" parameters, reordered
|
||||
functions, cleanup.
|
||||
|
||||
* app/gui/dialogs-menu.c
|
||||
* app/gui/image-menu.c
|
||||
* app/gui/toolbox-menu.c: use GIMP_STOCK_DEFAULT_COLORS for the
|
||||
color editor dockable and renamed it to "FG/BG Color".
|
||||
|
||||
2003-07-08 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/core-types.h: added GimpGradientSegment typedef.
|
||||
|
|
|
@ -267,6 +267,46 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_tab_style_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
GimpTabStyle tab_style;
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
return;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
tab_style = (gint) action;
|
||||
|
||||
if (dockbook)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
gint page_num;
|
||||
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
||||
|
||||
dockable = (GimpDockable *)
|
||||
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
|
||||
|
||||
if (dockable)
|
||||
{
|
||||
GtkWidget *tab_widget;
|
||||
|
||||
dockable->tab_style = tab_style;
|
||||
|
||||
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
|
||||
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
|
||||
GTK_WIDGET (dockable),
|
||||
tab_widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -43,6 +43,9 @@ void dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
void dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void dialogs_tab_style_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
@ -26,18 +28,12 @@
|
|||
#include "gui-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpgradient.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimppattern.h"
|
||||
#include "core/gimppalette.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "text/gimpfont.h"
|
||||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
@ -50,7 +46,6 @@
|
|||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpcontainertreeview.h"
|
||||
#include "widgets/gimpdataeditor.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimpimagedock.h"
|
||||
|
@ -63,6 +58,8 @@
|
|||
#include "widgets/gimpgradienteditor.h"
|
||||
#include "widgets/gimppaletteeditor.h"
|
||||
#include "widgets/gimppreview.h"
|
||||
#include "widgets/gimppreviewrenderer.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpselectioneditor.h"
|
||||
#include "widgets/gimptemplateview.h"
|
||||
#include "widgets/gimptoolbox.h"
|
||||
|
@ -97,22 +94,14 @@
|
|||
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GimpDockable *dockable);
|
||||
|
||||
static GtkWidget * dialogs_viewable_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
static GtkWidget * dialogs_viewable_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gpointer data);
|
||||
static GtkWidget * dialogs_tool_options_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_stock_text_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
gpointer data);
|
||||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -129,10 +118,10 @@ static void dialogs_set_navigation_context_func (GimpDockable *dockable,
|
|||
|
||||
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
|
@ -261,8 +250,9 @@ dialogs_tool_options_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool Options"), _("Tool Options"), NULL,
|
||||
dialogs_tool_options_tab_func, NULL,
|
||||
_("Tool Options"), _("Tool Options"),
|
||||
GIMP_STOCK_TOOL_OPTIONS,
|
||||
dialogs_tool_options_icon_func, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -281,7 +271,8 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Device Status"), _("Devices"), NULL,
|
||||
_("Devices"), _("Device Status"),
|
||||
GIMP_STOCK_DEVICE_STATUS,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -301,7 +292,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Error Console"), _("Errors"),
|
||||
_("Errors"), _("Error Console"),
|
||||
GIMP_STOCK_WARNING,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
|
@ -324,7 +315,8 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Image List"), _("Images"), NULL,
|
||||
_("Images"), _("Image List"),
|
||||
GIMP_STOCK_IMAGES,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
@ -345,9 +337,9 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Brush List"), _("Brushes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_BRUSH,
|
||||
_("Brushes"), _("Brush List"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
dialogs_viewable_icon_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -366,9 +358,9 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Patterns>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Pattern List"), _("Patterns"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PATTERN,
|
||||
_("Patterns"), _("Pattern List"),
|
||||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
dialogs_viewable_icon_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -387,9 +379,9 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Gradients>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Gradient List"), _("Gradients"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_GRADIENT,
|
||||
_("Gradients"), _("Gradient List"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
dialogs_viewable_icon_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -408,9 +400,9 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Palettes>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Palette List"), _("Palettes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PALETTE,
|
||||
_("Palettes"), _("Palette List"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_viewable_icon_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -427,9 +419,9 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Font List"), _("Fonts"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_FONT,
|
||||
_("Fonts"), _("Font List"),
|
||||
GTK_STOCK_SELECT_FONT,
|
||||
dialogs_viewable_icon_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -446,8 +438,9 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool List"), _("Tools"), NULL,
|
||||
dialogs_tool_tab_func, NULL,
|
||||
_("Tools"), _("Tool List"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
dialogs_viewable_icon_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -465,9 +458,57 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Buffer List"), _("Buffers"),
|
||||
_("Buffers"), _("Buffer List"),
|
||||
GTK_STOCK_PASTE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("History"), _("Document History List"),
|
||||
GTK_STOCK_OPEN,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GimpTemplateView *template_view;
|
||||
|
||||
view = gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->templates,
|
||||
context,
|
||||
preview_size, 0,
|
||||
factory->menu_factory);
|
||||
|
||||
template_view = GIMP_TEMPLATE_VIEW (view);
|
||||
|
||||
template_view->new_template_func = templates_new_template_dialog;
|
||||
template_view->edit_template_func = templates_edit_template_dialog;
|
||||
template_view->create_image_func = templates_file_new_dialog;
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Templates"), _("List of Templates"),
|
||||
GIMP_STOCK_TEMPLATE,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -488,7 +529,8 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Image Grid"), _("Images"), NULL,
|
||||
_("Images"), _("Image Grid"),
|
||||
GIMP_STOCK_IMAGES,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
@ -509,9 +551,9 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Brush Grid"), _("Brushes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_BRUSH,
|
||||
_("Brushes"), _("Brush Grid"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
dialogs_viewable_icon_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -530,9 +572,9 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Patterns>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Pattern Grid"), _("Patterns"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PATTERN,
|
||||
_("Patterns"), _("Pattern Grid"),
|
||||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
dialogs_viewable_icon_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -551,9 +593,9 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Gradients>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Gradient Grid"), _("Gradients"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_GRADIENT,
|
||||
_("Gradients"), _("Gradient Grid"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
dialogs_viewable_icon_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -572,9 +614,9 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Palettes>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Palette Grid"), _("Palettes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PALETTE,
|
||||
_("Palettes"), _("Palette Grid"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_viewable_icon_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -591,9 +633,9 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Font Grid"), _("Fonts"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_FONT,
|
||||
_("Fonts"), _("Font Grid"),
|
||||
GTK_STOCK_SELECT_FONT,
|
||||
dialogs_viewable_icon_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -610,8 +652,9 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool Grid"), _("Tools"), NULL,
|
||||
dialogs_tool_tab_func, NULL,
|
||||
_("Tools"), _("Tool Grid"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
dialogs_viewable_icon_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -629,9 +672,30 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Buffer Grid"), _("Buffers"),
|
||||
_("Buffers"), _("Buffer Grid"),
|
||||
GTK_STOCK_PASTE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("History"), _("Document History Grid"),
|
||||
GTK_STOCK_OPEN,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -663,7 +727,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Layers>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Layer List"), _("Layers"), NULL,
|
||||
_("Layers"), _("Layer List"),
|
||||
GIMP_STOCK_LAYERS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -697,7 +762,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Channels>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Channel List"), _("Channels"), NULL,
|
||||
_("Channels"), _("Channel List"),
|
||||
GIMP_STOCK_CHANNELS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -737,7 +803,8 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
vectors_view->selection_to_vectors_func = vectors_selection_to_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Paths List"), _("Paths"), NULL,
|
||||
_("Paths"), _("Path List"),
|
||||
GIMP_STOCK_PATHS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -760,7 +827,8 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
|
|||
view = gimp_colormap_editor_new (gimage, factory->menu_factory);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Indexed Palette"), _("Colormap"), NULL,
|
||||
_("Colormap"), _("Indexed Palette"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
|
@ -792,9 +860,9 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
selection_editor->selection_to_vectors_func = vectors_selection_to_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Selection Editor"), _("Selection"),
|
||||
_("Selection"), _("Selection Editor"),
|
||||
GIMP_STOCK_TOOL_RECT_SELECT,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
@ -816,9 +884,9 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
view = gimp_undo_editor_new (gimage);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Undo History"), _("Undo"),
|
||||
_("Undo"), _("Undo History"),
|
||||
GTK_STOCK_UNDO,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
@ -827,6 +895,33 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
}
|
||||
|
||||
|
||||
/***** display related dialogs *****/
|
||||
|
||||
GtkWidget *
|
||||
dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
GtkWidget *view;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Navigation"), _("Display Navigation"),
|
||||
GIMP_STOCK_NAVIGATION,
|
||||
NULL, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
||||
/***** misc dockables *****/
|
||||
|
||||
GtkWidget *
|
||||
|
@ -839,81 +934,12 @@ dialogs_color_editor_new (GimpDialogFactory *factory,
|
|||
view = gimp_color_editor_new (context);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Color Editor"), _("Color"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
_("FG/BG"), _("FG/BG Color"),
|
||||
GIMP_STOCK_DEFAULT_COLORS,
|
||||
NULL, NULL,
|
||||
dialogs_set_color_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Document History List"), _("History"),
|
||||
GTK_STOCK_OPEN,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Document History Grid"), _("History"),
|
||||
GTK_STOCK_OPEN,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GimpTemplateView *template_view;
|
||||
|
||||
view = gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->templates,
|
||||
context,
|
||||
preview_size, 0,
|
||||
factory->menu_factory);
|
||||
|
||||
template_view = GIMP_TEMPLATE_VIEW (view);
|
||||
|
||||
template_view->new_template_func = templates_new_template_dialog;
|
||||
template_view->edit_template_func = templates_edit_template_dialog;
|
||||
template_view->create_image_func = templates_file_new_dialog;
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("List of Templates"), _("Templates"),
|
||||
GIMP_STOCK_TEMPLATE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/***** editors *****/
|
||||
|
||||
|
@ -929,7 +955,8 @@ dialogs_brush_editor_get (GimpDialogFactory *factory,
|
|||
brush_editor = gimp_brush_editor_new (context->gimp);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (brush_editor),
|
||||
_("Brush Editor"), _("Brush Editor"), NULL,
|
||||
_("Brush Editor"), _("Brush Editor"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -958,7 +985,8 @@ dialogs_gradient_editor_get (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (gradient_editor),
|
||||
_("Gradient Editor"), _("Gradient Editor"), NULL,
|
||||
_("Gradient Editor"), _("Gradient Editor"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -987,7 +1015,8 @@ dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (palette_editor),
|
||||
_("Palette Editor"), _("Palette Editor"), NULL,
|
||||
_("Palette Editor"), _("Palette Editor"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -1003,33 +1032,6 @@ dialogs_edit_palette_func (GimpData *data)
|
|||
}
|
||||
|
||||
|
||||
/* display views */
|
||||
|
||||
GtkWidget *
|
||||
dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
GtkWidget *view;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
GIMP_STOCK_NAVIGATION,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
|
@ -1064,74 +1066,32 @@ dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_viewable_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
dialogs_viewable_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer icon_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
GType type;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
const gchar *prop_name;
|
||||
gboolean is_tool;
|
||||
|
||||
gtk_icon_size_lookup (size, &width, &height);
|
||||
|
||||
type = (GType) tab_data;
|
||||
prop_name = (const gchar *) icon_data;
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_by_type (context,
|
||||
type)),
|
||||
width, height, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
is_tool = (strcmp (prop_name, "tool") == 0);
|
||||
|
||||
g_signal_connect_object (context,
|
||||
gimp_context_type_to_signal_name (type),
|
||||
G_CALLBACK (gimp_preview_set_viewable),
|
||||
preview,
|
||||
G_CONNECT_SWAPPED);
|
||||
preview = gimp_prop_preview_new (G_OBJECT (context), prop_name, height);
|
||||
GIMP_PREVIEW (preview)->renderer->size = -1;
|
||||
gimp_preview_renderer_set_size_full (GIMP_PREVIEW (preview)->renderer,
|
||||
width, height,
|
||||
is_tool ? 0 : 1);
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_tool_tab_tool_changed (GimpContext *context,
|
||||
GimpToolInfo *tool_info,
|
||||
GtkImage *image)
|
||||
{
|
||||
const gchar *stock_id;
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
|
||||
gtk_image_set_from_stock (image, stock_id, image->icon_size);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_tool_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpViewable *viewable;
|
||||
GtkWidget *image;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
viewable = GIMP_VIEWABLE (gimp_context_get_tool (context));
|
||||
|
||||
image = gtk_image_new_from_stock (gimp_viewable_get_stock_id (viewable),
|
||||
size);
|
||||
|
||||
g_signal_connect_object (context, "tool_changed",
|
||||
G_CALLBACK (dialogs_tool_tab_tool_changed),
|
||||
image,
|
||||
0);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_tool_options_tool_changed (GimpContext *context,
|
||||
GimpToolInfo *tool_info,
|
||||
|
@ -1155,12 +1115,11 @@ dialogs_tool_options_tool_changed (GimpContext *context,
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
dialogs_tool_options_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer icon_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
|
@ -1169,8 +1128,6 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
gint height;
|
||||
const gchar *stock_id;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
gtk_icon_size_lookup (size, &width, &height);
|
||||
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
@ -1197,198 +1154,139 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
return hbox;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_stock_text_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
|
||||
image = gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
label = gtk_label_new (dockable->short_name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (view)
|
||||
gimp_container_view_set_context (view, context);
|
||||
if (GIMP_IS_CONTAINER_VIEW (widget))
|
||||
gimp_container_view_set_context (GIMP_CONTAINER_VIEW (widget), context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
editor = (GimpContainerEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (editor)
|
||||
gimp_container_view_set_context (editor->view, context);
|
||||
if (GIMP_IS_CONTAINER_EDITOR (widget))
|
||||
gimp_container_view_set_context (GIMP_CONTAINER_EDITOR (widget)->view,
|
||||
context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_color_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpColorEditor *editor;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
editor = (GimpColorEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (editor)
|
||||
gimp_color_editor_set_context (editor, context);
|
||||
if (GIMP_IS_COLOR_EDITOR (widget))
|
||||
gimp_color_editor_set_context (GIMP_COLOR_EDITOR (widget), context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_image_item_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_CONTAINER_VIEW (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_item_view_image_changed,
|
||||
view);
|
||||
}
|
||||
if (dockable->context)
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_item_view_image_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "image_changed",
|
||||
G_CALLBACK (dialogs_image_item_view_image_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_image_item_view_image_changed (context,
|
||||
gimp_context_get_image (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_image_item_view_image_changed (NULL, NULL, view);
|
||||
gimage = gimp_context_get_image (context);
|
||||
}
|
||||
|
||||
dialogs_image_item_view_image_changed (context, gimage,
|
||||
GIMP_CONTAINER_VIEW (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_image_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpImageEditor *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
view = (GimpImageEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_IMAGE_EDITOR (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_editor_image_changed,
|
||||
view);
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_editor_image_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "image_changed",
|
||||
G_CALLBACK (dialogs_image_editor_image_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_image_editor_image_changed (context,
|
||||
gimp_context_get_image (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_image_editor_image_changed (NULL, NULL, view);
|
||||
gimage = gimp_context_get_image (context);
|
||||
}
|
||||
|
||||
dialogs_image_editor_image_changed (context, gimage,
|
||||
GIMP_IMAGE_EDITOR (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_navigation_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpNavigationView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpDisplay *gdisp = NULL;
|
||||
|
||||
view = (GimpNavigationView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_NAVIGATION_VIEW (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_navigation_display_changed,
|
||||
view);
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_navigation_display_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "display_changed",
|
||||
G_CALLBACK (dialogs_navigation_display_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_navigation_display_changed (context,
|
||||
gimp_context_get_display (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_navigation_display_changed (NULL, NULL, view);
|
||||
gdisp = gimp_context_get_display (context);
|
||||
}
|
||||
|
||||
dialogs_navigation_display_changed (context, gdisp,
|
||||
GIMP_NAVIGATION_VIEW (widget));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name,
|
||||
short_name,
|
||||
stock_id,
|
||||
get_tab_func,
|
||||
get_tab_data,
|
||||
dockable = gimp_dockable_new (name, blurb, stock_id,
|
||||
get_icon_func,
|
||||
get_icon_data,
|
||||
set_context_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_set_data (G_OBJECT (dockable), "gimp-dialogs-view", widget);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@ GtkWidget * dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -113,6 +119,9 @@ GtkWidget * dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -136,21 +145,14 @@ GtkWidget * dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_color_editor_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_brush_editor_get (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
@ -166,9 +168,5 @@ GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
gint preview_size);
|
||||
void dialogs_edit_palette_func (GimpData *data);
|
||||
|
||||
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_CONSTRUCTORS_H__ */
|
||||
|
|
|
@ -267,6 +267,46 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_tab_style_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
GimpTabStyle tab_style;
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
return;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
tab_style = (gint) action;
|
||||
|
||||
if (dockbook)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
gint page_num;
|
||||
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
||||
|
||||
dockable = (GimpDockable *)
|
||||
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
|
||||
|
||||
if (dockable)
|
||||
{
|
||||
GtkWidget *tab_widget;
|
||||
|
||||
dockable->tab_style = tab_style;
|
||||
|
||||
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
|
||||
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
|
||||
GTK_WIDGET (dockable),
|
||||
tab_widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -43,6 +43,9 @@ void dialogs_toggle_view_cmd_callback (GtkWidget *widget,
|
|||
void dialogs_preview_size_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void dialogs_tab_style_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
@ -26,18 +28,12 @@
|
|||
#include "gui-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpgradient.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimppattern.h"
|
||||
#include "core/gimppalette.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "text/gimpfont.h"
|
||||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
@ -50,7 +46,6 @@
|
|||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpcontainertreeview.h"
|
||||
#include "widgets/gimpdataeditor.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimpimagedock.h"
|
||||
|
@ -63,6 +58,8 @@
|
|||
#include "widgets/gimpgradienteditor.h"
|
||||
#include "widgets/gimppaletteeditor.h"
|
||||
#include "widgets/gimppreview.h"
|
||||
#include "widgets/gimppreviewrenderer.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpselectioneditor.h"
|
||||
#include "widgets/gimptemplateview.h"
|
||||
#include "widgets/gimptoolbox.h"
|
||||
|
@ -97,22 +94,14 @@
|
|||
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GimpDockable *dockable);
|
||||
|
||||
static GtkWidget * dialogs_viewable_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
static GtkWidget * dialogs_viewable_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
gpointer data);
|
||||
static GtkWidget * dialogs_tool_options_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
static GtkWidget * dialogs_stock_text_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data);
|
||||
gpointer data);
|
||||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -129,10 +118,10 @@ static void dialogs_set_navigation_context_func (GimpDockable *dockable,
|
|||
|
||||
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
|
@ -261,8 +250,9 @@ dialogs_tool_options_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool Options"), _("Tool Options"), NULL,
|
||||
dialogs_tool_options_tab_func, NULL,
|
||||
_("Tool Options"), _("Tool Options"),
|
||||
GIMP_STOCK_TOOL_OPTIONS,
|
||||
dialogs_tool_options_icon_func, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -281,7 +271,8 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Device Status"), _("Devices"), NULL,
|
||||
_("Devices"), _("Device Status"),
|
||||
GIMP_STOCK_DEVICE_STATUS,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -301,7 +292,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Error Console"), _("Errors"),
|
||||
_("Errors"), _("Error Console"),
|
||||
GIMP_STOCK_WARNING,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
|
@ -324,7 +315,8 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Image List"), _("Images"), NULL,
|
||||
_("Images"), _("Image List"),
|
||||
GIMP_STOCK_IMAGES,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
@ -345,9 +337,9 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Brush List"), _("Brushes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_BRUSH,
|
||||
_("Brushes"), _("Brush List"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
dialogs_viewable_icon_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -366,9 +358,9 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Patterns>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Pattern List"), _("Patterns"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PATTERN,
|
||||
_("Patterns"), _("Pattern List"),
|
||||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
dialogs_viewable_icon_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -387,9 +379,9 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Gradients>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Gradient List"), _("Gradients"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_GRADIENT,
|
||||
_("Gradients"), _("Gradient List"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
dialogs_viewable_icon_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -408,9 +400,9 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Palettes>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Palette List"), _("Palettes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PALETTE,
|
||||
_("Palettes"), _("Palette List"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_viewable_icon_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -427,9 +419,9 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Font List"), _("Fonts"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_FONT,
|
||||
_("Fonts"), _("Font List"),
|
||||
GTK_STOCK_SELECT_FONT,
|
||||
dialogs_viewable_icon_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -446,8 +438,9 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool List"), _("Tools"), NULL,
|
||||
dialogs_tool_tab_func, NULL,
|
||||
_("Tools"), _("Tool List"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
dialogs_viewable_icon_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -465,9 +458,57 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Buffer List"), _("Buffers"),
|
||||
_("Buffers"), _("Buffer List"),
|
||||
GTK_STOCK_PASTE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("History"), _("Document History List"),
|
||||
GTK_STOCK_OPEN,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GimpTemplateView *template_view;
|
||||
|
||||
view = gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->templates,
|
||||
context,
|
||||
preview_size, 0,
|
||||
factory->menu_factory);
|
||||
|
||||
template_view = GIMP_TEMPLATE_VIEW (view);
|
||||
|
||||
template_view->new_template_func = templates_new_template_dialog;
|
||||
template_view->edit_template_func = templates_edit_template_dialog;
|
||||
template_view->create_image_func = templates_file_new_dialog;
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Templates"), _("List of Templates"),
|
||||
GIMP_STOCK_TEMPLATE,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -488,7 +529,8 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Image Grid"), _("Images"), NULL,
|
||||
_("Images"), _("Image Grid"),
|
||||
GIMP_STOCK_IMAGES,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
@ -509,9 +551,9 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Brush Grid"), _("Brushes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_BRUSH,
|
||||
_("Brushes"), _("Brush Grid"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
dialogs_viewable_icon_func, "brush",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -530,9 +572,9 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Patterns>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Pattern Grid"), _("Patterns"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PATTERN,
|
||||
_("Patterns"), _("Pattern Grid"),
|
||||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
dialogs_viewable_icon_func, "pattern",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -551,9 +593,9 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Gradients>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Gradient Grid"), _("Gradients"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_GRADIENT,
|
||||
_("Gradients"), _("Gradient Grid"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
dialogs_viewable_icon_func, "gradient",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -572,9 +614,9 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Palettes>");
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Palette Grid"), _("Palettes"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_PALETTE,
|
||||
_("Palettes"), _("Palette Grid"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_viewable_icon_func, "palette",
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -591,9 +633,9 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Font Grid"), _("Fonts"), NULL,
|
||||
dialogs_viewable_tab_func,
|
||||
(gpointer) GIMP_TYPE_FONT,
|
||||
_("Fonts"), _("Font Grid"),
|
||||
GTK_STOCK_SELECT_FONT,
|
||||
dialogs_viewable_icon_func, "font",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -610,8 +652,9 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
FALSE);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Tool Grid"), _("Tools"), NULL,
|
||||
dialogs_tool_tab_func, NULL,
|
||||
_("Tools"), _("Tool Grid"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
dialogs_viewable_icon_func, "tool",
|
||||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
|
@ -629,9 +672,30 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Buffer Grid"), _("Buffers"),
|
||||
_("Buffers"), _("Buffer Grid"),
|
||||
GTK_STOCK_PASTE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("History"), _("Document History Grid"),
|
||||
GTK_STOCK_OPEN,
|
||||
NULL, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
@ -663,7 +727,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Layers>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Layer List"), _("Layers"), NULL,
|
||||
_("Layers"), _("Layer List"),
|
||||
GIMP_STOCK_LAYERS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -697,7 +762,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
factory->menu_factory, "<Channels>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Channel List"), _("Channels"), NULL,
|
||||
_("Channels"), _("Channel List"),
|
||||
GIMP_STOCK_CHANNELS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -737,7 +803,8 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
vectors_view->selection_to_vectors_func = vectors_selection_to_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Paths List"), _("Paths"), NULL,
|
||||
_("Paths"), _("Path List"),
|
||||
GIMP_STOCK_PATHS,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
|
@ -760,7 +827,8 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
|
|||
view = gimp_colormap_editor_new (gimage, factory->menu_factory);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Indexed Palette"), _("Colormap"), NULL,
|
||||
_("Colormap"), _("Indexed Palette"),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
|
@ -792,9 +860,9 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
selection_editor->selection_to_vectors_func = vectors_selection_to_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Selection Editor"), _("Selection"),
|
||||
_("Selection"), _("Selection Editor"),
|
||||
GIMP_STOCK_TOOL_RECT_SELECT,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
@ -816,9 +884,9 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
view = gimp_undo_editor_new (gimage);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Undo History"), _("Undo"),
|
||||
_("Undo"), _("Undo History"),
|
||||
GTK_STOCK_UNDO,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
NULL, NULL,
|
||||
dialogs_set_image_editor_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
@ -827,6 +895,33 @@ dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
}
|
||||
|
||||
|
||||
/***** display related dialogs *****/
|
||||
|
||||
GtkWidget *
|
||||
dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
GtkWidget *view;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Navigation"), _("Display Navigation"),
|
||||
GIMP_STOCK_NAVIGATION,
|
||||
NULL, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
||||
/***** misc dockables *****/
|
||||
|
||||
GtkWidget *
|
||||
|
@ -839,81 +934,12 @@ dialogs_color_editor_new (GimpDialogFactory *factory,
|
|||
view = gimp_color_editor_new (context);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Color Editor"), _("Color"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
_("FG/BG"), _("FG/BG Color"),
|
||||
GIMP_STOCK_DEFAULT_COLORS,
|
||||
NULL, NULL,
|
||||
dialogs_set_color_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Document History List"), _("History"),
|
||||
GTK_STOCK_OPEN,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
context->gimp->documents,
|
||||
context,
|
||||
preview_size, 1,
|
||||
file_file_open_dialog,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Document History Grid"), _("History"),
|
||||
GTK_STOCK_OPEN,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GimpTemplateView *template_view;
|
||||
|
||||
view = gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
context->gimp->templates,
|
||||
context,
|
||||
preview_size, 0,
|
||||
factory->menu_factory);
|
||||
|
||||
template_view = GIMP_TEMPLATE_VIEW (view);
|
||||
|
||||
template_view->new_template_func = templates_new_template_dialog;
|
||||
template_view->edit_template_func = templates_edit_template_dialog;
|
||||
template_view->create_image_func = templates_file_new_dialog;
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("List of Templates"), _("Templates"),
|
||||
GIMP_STOCK_TEMPLATE,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/***** editors *****/
|
||||
|
||||
|
@ -929,7 +955,8 @@ dialogs_brush_editor_get (GimpDialogFactory *factory,
|
|||
brush_editor = gimp_brush_editor_new (context->gimp);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (brush_editor),
|
||||
_("Brush Editor"), _("Brush Editor"), NULL,
|
||||
_("Brush Editor"), _("Brush Editor"),
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -958,7 +985,8 @@ dialogs_gradient_editor_get (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (gradient_editor),
|
||||
_("Gradient Editor"), _("Gradient Editor"), NULL,
|
||||
_("Gradient Editor"), _("Gradient Editor"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -987,7 +1015,8 @@ dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (palette_editor),
|
||||
_("Palette Editor"), _("Palette Editor"), NULL,
|
||||
_("Palette Editor"), _("Palette Editor"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
NULL, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
@ -1003,33 +1032,6 @@ dialogs_edit_palette_func (GimpData *data)
|
|||
}
|
||||
|
||||
|
||||
/* display views */
|
||||
|
||||
GtkWidget *
|
||||
dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell = NULL;
|
||||
GtkWidget *view;
|
||||
|
||||
gdisp = gimp_context_get_display (context);
|
||||
|
||||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
GIMP_STOCK_NAVIGATION,
|
||||
dialogs_stock_text_tab_func, NULL,
|
||||
dialogs_set_navigation_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
|
@ -1064,74 +1066,32 @@ dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_viewable_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
dialogs_viewable_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer icon_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
GType type;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
const gchar *prop_name;
|
||||
gboolean is_tool;
|
||||
|
||||
gtk_icon_size_lookup (size, &width, &height);
|
||||
|
||||
type = (GType) tab_data;
|
||||
prop_name = (const gchar *) icon_data;
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_by_type (context,
|
||||
type)),
|
||||
width, height, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
is_tool = (strcmp (prop_name, "tool") == 0);
|
||||
|
||||
g_signal_connect_object (context,
|
||||
gimp_context_type_to_signal_name (type),
|
||||
G_CALLBACK (gimp_preview_set_viewable),
|
||||
preview,
|
||||
G_CONNECT_SWAPPED);
|
||||
preview = gimp_prop_preview_new (G_OBJECT (context), prop_name, height);
|
||||
GIMP_PREVIEW (preview)->renderer->size = -1;
|
||||
gimp_preview_renderer_set_size_full (GIMP_PREVIEW (preview)->renderer,
|
||||
width, height,
|
||||
is_tool ? 0 : 1);
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_tool_tab_tool_changed (GimpContext *context,
|
||||
GimpToolInfo *tool_info,
|
||||
GtkImage *image)
|
||||
{
|
||||
const gchar *stock_id;
|
||||
|
||||
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
|
||||
gtk_image_set_from_stock (image, stock_id, image->icon_size);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_tool_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpViewable *viewable;
|
||||
GtkWidget *image;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
viewable = GIMP_VIEWABLE (gimp_context_get_tool (context));
|
||||
|
||||
image = gtk_image_new_from_stock (gimp_viewable_get_stock_id (viewable),
|
||||
size);
|
||||
|
||||
g_signal_connect_object (context, "tool_changed",
|
||||
G_CALLBACK (dialogs_tool_tab_tool_changed),
|
||||
image,
|
||||
0);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_tool_options_tool_changed (GimpContext *context,
|
||||
GimpToolInfo *tool_info,
|
||||
|
@ -1155,12 +1115,11 @@ dialogs_tool_options_tool_changed (GimpContext *context,
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_tool_options_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
dialogs_tool_options_icon_func (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer icon_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpToolInfo *tool_info;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
|
@ -1169,8 +1128,6 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
gint height;
|
||||
const gchar *stock_id;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
gtk_icon_size_lookup (size, &width, &height);
|
||||
|
||||
tool_info = gimp_context_get_tool (context);
|
||||
|
@ -1197,198 +1154,139 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
|
|||
return hbox;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_stock_text_tab_func (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size,
|
||||
gpointer tab_data)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
|
||||
context = dockbook->dock->context;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
|
||||
image = gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
label = gtk_label_new (dockable->short_name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (view)
|
||||
gimp_container_view_set_context (view, context);
|
||||
if (GIMP_IS_CONTAINER_VIEW (widget))
|
||||
gimp_container_view_set_context (GIMP_CONTAINER_VIEW (widget), context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
editor = (GimpContainerEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (editor)
|
||||
gimp_container_view_set_context (editor->view, context);
|
||||
if (GIMP_IS_CONTAINER_EDITOR (widget))
|
||||
gimp_container_view_set_context (GIMP_CONTAINER_EDITOR (widget)->view,
|
||||
context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_color_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpColorEditor *editor;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
|
||||
editor = (GimpColorEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (editor)
|
||||
gimp_color_editor_set_context (editor, context);
|
||||
if (GIMP_IS_COLOR_EDITOR (widget))
|
||||
gimp_color_editor_set_context (GIMP_COLOR_EDITOR (widget), context);
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_image_item_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_CONTAINER_VIEW (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_item_view_image_changed,
|
||||
view);
|
||||
}
|
||||
if (dockable->context)
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_item_view_image_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "image_changed",
|
||||
G_CALLBACK (dialogs_image_item_view_image_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_image_item_view_image_changed (context,
|
||||
gimp_context_get_image (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_image_item_view_image_changed (NULL, NULL, view);
|
||||
gimage = gimp_context_get_image (context);
|
||||
}
|
||||
|
||||
dialogs_image_item_view_image_changed (context, gimage,
|
||||
GIMP_CONTAINER_VIEW (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_image_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpImageEditor *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpImage *gimage = NULL;
|
||||
|
||||
view = (GimpImageEditor *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_IMAGE_EDITOR (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_editor_image_changed,
|
||||
view);
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_image_editor_image_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "image_changed",
|
||||
G_CALLBACK (dialogs_image_editor_image_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_image_editor_image_changed (context,
|
||||
gimp_context_get_image (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_image_editor_image_changed (NULL, NULL, view);
|
||||
gimage = gimp_context_get_image (context);
|
||||
}
|
||||
|
||||
dialogs_image_editor_image_changed (context, gimage,
|
||||
GIMP_IMAGE_EDITOR (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
dialogs_set_navigation_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpNavigationView *view;
|
||||
GtkWidget *widget = GTK_BIN (dockable)->child;
|
||||
GimpDisplay *gdisp = NULL;
|
||||
|
||||
view = (GimpNavigationView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
if (! GIMP_IS_NAVIGATION_VIEW (widget))
|
||||
return;
|
||||
|
||||
if (dockable->context)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_navigation_display_changed,
|
||||
view);
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (dockable->context,
|
||||
dialogs_navigation_display_changed,
|
||||
widget);
|
||||
|
||||
if (context)
|
||||
{
|
||||
g_signal_connect (context, "display_changed",
|
||||
G_CALLBACK (dialogs_navigation_display_changed),
|
||||
view);
|
||||
widget);
|
||||
|
||||
dialogs_navigation_display_changed (context,
|
||||
gimp_context_get_display (context),
|
||||
view);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogs_navigation_display_changed (NULL, NULL, view);
|
||||
gdisp = gimp_context_get_display (context);
|
||||
}
|
||||
|
||||
dialogs_navigation_display_changed (context, gdisp,
|
||||
GIMP_NAVIGATION_VIEW (widget));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name,
|
||||
short_name,
|
||||
stock_id,
|
||||
get_tab_func,
|
||||
get_tab_data,
|
||||
dockable = gimp_dockable_new (name, blurb, stock_id,
|
||||
get_icon_func,
|
||||
get_icon_data,
|
||||
set_context_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_set_data (G_OBJECT (dockable), "gimp-dialogs-view", widget);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@ GtkWidget * dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -113,6 +119,9 @@ GtkWidget * dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -136,21 +145,14 @@ GtkWidget * dialogs_undo_history_new (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_color_editor_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_document_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_document_grid_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_template_list_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
GtkWidget * dialogs_brush_editor_get (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
@ -166,9 +168,5 @@ GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
|
|||
gint preview_size);
|
||||
void dialogs_edit_palette_func (GimpData *data);
|
||||
|
||||
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_CONSTRUCTORS_H__ */
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "widgets/gimpcontainerview.h"
|
||||
#include "widgets/gimpcontainerview-utils.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimpdockable.h"
|
||||
#include "widgets/gimpdockbook.h"
|
||||
#include "widgets/gimpimagedock.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
|
@ -46,6 +47,9 @@
|
|||
#define PREVIEW_SIZE(path,size) \
|
||||
{ { (path), NULL, dialogs_preview_size_cmd_callback, \
|
||||
(size), "/Preview Size/Tiny" }, NULL, NULL, NULL }
|
||||
#define TAB_STYLE(path,style) \
|
||||
{ { (path), NULL, dialogs_tab_style_cmd_callback, \
|
||||
(style), "/Tab Style/Icon" }, NULL, NULL, NULL }
|
||||
|
||||
|
||||
GimpItemFactoryEntry dialogs_menu_entries[] =
|
||||
|
@ -78,7 +82,7 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
|
|||
MENU_SEPARATOR ("/Add Tab/---"),
|
||||
|
||||
ADD_TAB (N_("/Add Tab/Colors..."), "gimp-color-editor",
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR),
|
||||
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS),
|
||||
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid",
|
||||
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH),
|
||||
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid",
|
||||
|
@ -112,7 +116,7 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
|
|||
"<StockItem>", GTK_STOCK_REMOVE },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
MENU_SEPARATOR ("/view-type-separator"),
|
||||
MENU_SEPARATOR ("/---"),
|
||||
|
||||
MENU_BRANCH ("/Preview Size"),
|
||||
|
||||
|
@ -130,6 +134,16 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
|
|||
PREVIEW_SIZE (N_("/Preview Size/Enormous"), GIMP_PREVIEW_SIZE_ENORMOUS),
|
||||
PREVIEW_SIZE (N_("/Preview Size/Gigantic"), GIMP_PREVIEW_SIZE_GIGANTIC),
|
||||
|
||||
MENU_BRANCH ("/Tab Style"),
|
||||
|
||||
{ { N_("/Tab Style/Icon"), NULL,
|
||||
dialogs_tab_style_cmd_callback,
|
||||
GIMP_TAB_STYLE_ICON, "<RadioItem>" },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
TAB_STYLE (N_("/Tab Style/Text"), GIMP_TAB_STYLE_NAME),
|
||||
TAB_STYLE (N_("/Tab Style/Icon & Text"), GIMP_TAB_STYLE_ICON_NAME),
|
||||
|
||||
{ { N_("/View as List"), NULL,
|
||||
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "<RadioItem>" },
|
||||
NULL, NULL, NULL },
|
||||
|
@ -149,6 +163,7 @@ GimpItemFactoryEntry dialogs_menu_entries[] =
|
|||
|
||||
#undef ADD_TAB
|
||||
#undef PREVIEW_SIZE
|
||||
#undef TAB_STYLE
|
||||
|
||||
gint n_dialogs_menu_entries = G_N_ELEMENTS (dialogs_menu_entries);
|
||||
|
||||
|
@ -171,6 +186,7 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
gboolean list_view_available = FALSE;
|
||||
gboolean grid_view_available = FALSE;
|
||||
GimpPreviewSize preview_size = -1;
|
||||
GimpTabStyle tab_style;
|
||||
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
|
||||
|
||||
|
@ -213,6 +229,8 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
if (view)
|
||||
preview_size = view->preview_size;
|
||||
|
||||
tab_style = dockable->tab_style;
|
||||
|
||||
#define SET_ACTIVE(path,active) \
|
||||
gimp_item_factory_set_active (factory, (path), (active))
|
||||
#define SET_VISIBLE(path,active) \
|
||||
|
@ -220,9 +238,6 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
#define SET_SENSITIVE(path,sensitive) \
|
||||
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
|
||||
|
||||
SET_VISIBLE ("/view-type-separator",
|
||||
preview_size != -1 || view_type != -1);
|
||||
|
||||
SET_VISIBLE ("/Preview Size", preview_size != -1);
|
||||
|
||||
if (preview_size != -1)
|
||||
|
@ -265,6 +280,13 @@ dialogs_menu_update (GtkItemFactory *factory,
|
|||
}
|
||||
}
|
||||
|
||||
if (tab_style == GIMP_TAB_STYLE_ICON)
|
||||
SET_ACTIVE ("/Tab Style/Icon", TRUE);
|
||||
else if (tab_style == GIMP_TAB_STYLE_NAME)
|
||||
SET_ACTIVE ("/Tab Style/Text", TRUE);
|
||||
else if (tab_style == GIMP_TAB_STYLE_ICON_NAME)
|
||||
SET_ACTIVE ("/Tab Style/Icon & Text", TRUE);
|
||||
|
||||
SET_VISIBLE ("/View as Grid", view_type != -1);
|
||||
SET_VISIBLE ("/View as List", view_type != -1);
|
||||
|
||||
|
|
|
@ -923,7 +923,7 @@ GimpItemFactoryEntry image_menu_entries[] =
|
|||
|
||||
{ { N_("/Dialogs/Colo_rs..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS },
|
||||
"gimp-color-editor",
|
||||
NULL, NULL },
|
||||
{ { N_("/Dialogs/Brus_hes..."), "<control><shift>B",
|
||||
|
|
|
@ -157,7 +157,7 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
|
|||
|
||||
{ { N_("/File/Dialogs/Colo_rs..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS },
|
||||
"gimp-color-editor",
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Dialogs/Brus_hes..."), "<control><shift>B",
|
||||
|
|
|
@ -923,7 +923,7 @@ GimpItemFactoryEntry image_menu_entries[] =
|
|||
|
||||
{ { N_("/Dialogs/Colo_rs..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS },
|
||||
"gimp-color-editor",
|
||||
NULL, NULL },
|
||||
{ { N_("/Dialogs/Brus_hes..."), "<control><shift>B",
|
||||
|
|
|
@ -157,7 +157,7 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
|
|||
|
||||
{ { N_("/File/Dialogs/Colo_rs..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SELECT_COLOR },
|
||||
"<StockItem>", GIMP_STOCK_DEFAULT_COLORS },
|
||||
"gimp-color-editor",
|
||||
NULL, NULL },
|
||||
{ { N_("/File/Dialogs/Brus_hes..."), "<control><shift>B",
|
||||
|
|
|
@ -1146,7 +1146,10 @@ gimp_dialog_factories_save_foreach (gchar *name,
|
|||
GimpDialogFactory *factory,
|
||||
GimpConfigWriter *writer)
|
||||
{
|
||||
GList *list;
|
||||
GEnumClass *enum_class;
|
||||
GList *list;
|
||||
|
||||
enum_class = g_type_class_ref (GIMP_TYPE_TAB_STYLE);
|
||||
|
||||
for (list = factory->session_infos; list; list = g_list_next (list))
|
||||
{
|
||||
|
@ -1249,28 +1252,36 @@ gimp_dialog_factories_save_foreach (gchar *name,
|
|||
if (entry)
|
||||
{
|
||||
GimpContainerView *view;
|
||||
GEnumValue *enum_value;
|
||||
gchar *tab_style = "icon";
|
||||
gint preview_size = -1;
|
||||
|
||||
gimp_config_writer_linefeed (writer);
|
||||
|
||||
enum_value = g_enum_get_value (enum_class,
|
||||
dockable->tab_style);
|
||||
|
||||
if (enum_value)
|
||||
tab_style = enum_value->value_nick;
|
||||
|
||||
view = gimp_container_view_get_by_dockable (dockable);
|
||||
|
||||
if (view && view->preview_size >= GIMP_PREVIEW_SIZE_TINY)
|
||||
{
|
||||
preview_size = view->preview_size;
|
||||
}
|
||||
preview_size = view->preview_size;
|
||||
|
||||
if (preview_size > 0 &&
|
||||
preview_size != entry->preview_size)
|
||||
{
|
||||
gimp_config_writer_printf (writer, "\"%s@%d\"",
|
||||
gimp_config_writer_printf (writer, "\"%s@%s:%d\"",
|
||||
entry->identifier,
|
||||
tab_style,
|
||||
preview_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_writer_printf (writer, "\"%s\"",
|
||||
entry->identifier);
|
||||
gimp_config_writer_printf (writer, "\"%s@%s\"",
|
||||
entry->identifier,
|
||||
tab_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1285,6 +1296,8 @@ gimp_dialog_factories_save_foreach (gchar *name,
|
|||
|
||||
gimp_config_writer_close (writer); /* session-info */
|
||||
}
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1319,11 +1332,14 @@ gimp_dialog_factories_restore_foreach (gchar *name,
|
|||
}
|
||||
else
|
||||
{
|
||||
GimpDock *dock;
|
||||
GList *books;
|
||||
GimpDock *dock;
|
||||
GList *books;
|
||||
GEnumClass *enum_class;
|
||||
|
||||
dock = GIMP_DOCK (gimp_dialog_factory_dock_new (factory));
|
||||
|
||||
enum_class = g_type_class_ref (GIMP_TYPE_TAB_STYLE);
|
||||
|
||||
if (dock && info->aux_info)
|
||||
gimp_dialog_factory_set_aux_info (GTK_WIDGET (dock), info);
|
||||
|
||||
|
@ -1338,24 +1354,51 @@ gimp_dialog_factories_restore_foreach (gchar *name,
|
|||
|
||||
for (pages = books->data; pages; pages = g_list_next (pages))
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
gchar *identifier;
|
||||
gchar *substring;
|
||||
gint preview_size = -1;
|
||||
GtkWidget *dockable;
|
||||
gchar *identifier;
|
||||
gchar *substring;
|
||||
gint preview_size = -1;
|
||||
GimpTabStyle tab_style = GIMP_TAB_STYLE_ICON;
|
||||
|
||||
identifier = (gchar *) pages->data;
|
||||
|
||||
if ((substring = strstr (identifier, "@")))
|
||||
{
|
||||
gchar **split;
|
||||
|
||||
*substring = '\0';
|
||||
substring++;
|
||||
|
||||
preview_size = atoi (substring + 1);
|
||||
split = g_strsplit (substring, ":", 16);
|
||||
|
||||
if (preview_size < GIMP_PREVIEW_SIZE_TINY ||
|
||||
preview_size > GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
preview_size = -1;
|
||||
if (split[0])
|
||||
{
|
||||
if (split[1] || ! g_ascii_isdigit (split[0][0]))
|
||||
{
|
||||
GEnumValue *enum_value;
|
||||
|
||||
enum_value = g_enum_get_value_by_nick (enum_class,
|
||||
split[0]);
|
||||
|
||||
if (enum_value)
|
||||
tab_style = enum_value->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
preview_size = atoi (split[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (split[1])
|
||||
preview_size = atoi (split[1]);
|
||||
|
||||
g_strfreev (split);
|
||||
}
|
||||
|
||||
if (preview_size < GIMP_PREVIEW_SIZE_TINY ||
|
||||
preview_size > GIMP_PREVIEW_SIZE_GIGANTIC)
|
||||
preview_size = -1;
|
||||
|
||||
/* use the new dock's dialog factory to create dockables
|
||||
* because it may be different from the dialog factory
|
||||
* the dock was created from.
|
||||
|
@ -1366,6 +1409,8 @@ gimp_dialog_factories_restore_foreach (gchar *name,
|
|||
identifier,
|
||||
preview_size);
|
||||
|
||||
GIMP_DOCKABLE (dockable)->tab_style = tab_style;
|
||||
|
||||
if (dockable)
|
||||
gimp_dockbook_add (GIMP_DOCKBOOK (dockbook),
|
||||
GIMP_DOCKABLE (dockable), -1);
|
||||
|
@ -1380,6 +1425,8 @@ gimp_dialog_factories_restore_foreach (gchar *name,
|
|||
info->sub_dialogs = NULL;
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (dock));
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
}
|
||||
|
||||
g_list_foreach (info->aux_info, (GFunc) g_free, NULL);
|
||||
|
|
|
@ -43,7 +43,8 @@ static void gimp_dockable_style_set (GtkWidget *widget,
|
|||
GtkStyle *prev_style);
|
||||
|
||||
static GtkWidget * gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
static void gimp_dockable_real_set_context (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -113,12 +114,13 @@ static void
|
|||
gimp_dockable_init (GimpDockable *dockable)
|
||||
{
|
||||
dockable->name = NULL;
|
||||
dockable->short_name = NULL;
|
||||
dockable->blurb = NULL;
|
||||
dockable->stock_id = NULL;
|
||||
dockable->tab_style = GIMP_TAB_STYLE_ICON;
|
||||
dockable->dockbook = NULL;
|
||||
dockable->context = NULL;
|
||||
dockable->get_tab_func = NULL;
|
||||
dockable->get_tab_data = NULL;
|
||||
dockable->get_icon_func = NULL;
|
||||
dockable->get_icon_data = NULL;
|
||||
dockable->set_context_func = NULL;
|
||||
}
|
||||
|
||||
|
@ -138,10 +140,10 @@ gimp_dockable_destroy (GtkObject *object)
|
|||
dockable->name = NULL;
|
||||
}
|
||||
|
||||
if (dockable->short_name)
|
||||
if (dockable->blurb)
|
||||
{
|
||||
g_free (dockable->short_name);
|
||||
dockable->short_name = NULL;
|
||||
g_free (dockable->blurb);
|
||||
dockable->blurb = NULL;
|
||||
}
|
||||
|
||||
if (dockable->stock_id)
|
||||
|
@ -216,25 +218,26 @@ gimp_dockable_style_set (GtkWidget *widget,
|
|||
|
||||
GtkWidget *
|
||||
gimp_dockable_new (const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (short_name != NULL, NULL);
|
||||
g_return_val_if_fail (blurb != NULL, NULL);
|
||||
g_return_val_if_fail (stock_id != NULL, NULL);
|
||||
|
||||
dockable = g_object_new (GIMP_TYPE_DOCKABLE, NULL);
|
||||
|
||||
dockable->name = g_strdup (name);
|
||||
dockable->short_name = g_strdup (short_name);
|
||||
dockable->stock_id = g_strdup (stock_id);
|
||||
dockable->name = g_strdup (name);
|
||||
dockable->blurb = g_strdup (blurb);
|
||||
dockable->stock_id = g_strdup (stock_id);
|
||||
|
||||
dockable->get_tab_func = get_tab_func;
|
||||
dockable->get_tab_data = get_tab_data;
|
||||
dockable->get_icon_func = get_icon_func;
|
||||
dockable->get_icon_data = get_icon_data;
|
||||
dockable->set_context_func = set_context_func;
|
||||
|
||||
return GTK_WIDGET (dockable);
|
||||
|
@ -242,20 +245,20 @@ gimp_dockable_new (const gchar *name,
|
|||
|
||||
GtkWidget *
|
||||
gimp_dockable_get_tab_widget (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size)
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
||||
return GIMP_DOCKABLE_GET_CLASS (dockable)->get_tab_widget (dockable,
|
||||
dockbook,
|
||||
size);
|
||||
return GIMP_DOCKABLE_GET_CLASS (dockable)->get_tab_widget (dockable, context,
|
||||
tab_style, size);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dockable_set_context (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
GimpContext *context)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
||||
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
||||
|
@ -266,20 +269,58 @@ gimp_dockable_set_context (GimpDockable *dockable,
|
|||
|
||||
static GtkWidget *
|
||||
gimp_dockable_real_get_tab_widget (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GtkIconSize size)
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);
|
||||
GtkWidget *tab_widget = NULL;
|
||||
GtkWidget *label = NULL;
|
||||
GtkWidget *icon = NULL;
|
||||
|
||||
if (dockable->get_tab_func)
|
||||
return dockable->get_tab_func (dockable, dockbook, size,
|
||||
dockable->get_tab_data);
|
||||
if (tab_style == GIMP_TAB_STYLE_NAME ||
|
||||
tab_style == GIMP_TAB_STYLE_ICON_NAME)
|
||||
{
|
||||
label = gtk_label_new (dockable->name);
|
||||
}
|
||||
else if (tab_style == GIMP_TAB_STYLE_ICON_BLURB)
|
||||
{
|
||||
label = gtk_label_new (dockable->blurb);
|
||||
}
|
||||
|
||||
if (dockable->stock_id)
|
||||
return gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
if (tab_style == GIMP_TAB_STYLE_ICON ||
|
||||
tab_style == GIMP_TAB_STYLE_ICON_NAME ||
|
||||
tab_style == GIMP_TAB_STYLE_ICON_BLURB)
|
||||
{
|
||||
if (dockable->get_icon_func)
|
||||
icon = dockable->get_icon_func (dockable, context, size,
|
||||
dockable->get_icon_data);
|
||||
else
|
||||
icon = gtk_image_new_from_stock (dockable->stock_id, size);
|
||||
}
|
||||
|
||||
return gtk_label_new (dockable->short_name);
|
||||
switch (tab_style)
|
||||
{
|
||||
case GIMP_TAB_STYLE_ICON:
|
||||
tab_widget = icon;
|
||||
break;
|
||||
|
||||
case GIMP_TAB_STYLE_NAME:
|
||||
tab_widget = label;
|
||||
break;
|
||||
|
||||
case GIMP_TAB_STYLE_ICON_NAME:
|
||||
case GIMP_TAB_STYLE_ICON_BLURB:
|
||||
tab_widget = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (tab_widget), icon, FALSE, FALSE, 0);
|
||||
gtk_widget_show (icon);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (tab_widget), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
break;
|
||||
}
|
||||
|
||||
return tab_widget;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
#include <gtk/gtkbin.h>
|
||||
|
||||
|
||||
typedef GtkWidget * (* GimpDockableGetTabFunc) (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
typedef GtkWidget * (* GimpDockableGetIconFunc) (GimpDockable *dockable,
|
||||
GimpContext *context,
|
||||
GtkIconSize size,
|
||||
gpointer get_tab_data);
|
||||
gpointer get_icon_data);
|
||||
typedef void (* GimpDockableSetContextFunc) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
||||
|
@ -49,15 +49,16 @@ struct _GimpDockable
|
|||
GtkBin parent_instance;
|
||||
|
||||
gchar *name;
|
||||
gchar *short_name;
|
||||
gchar *blurb;
|
||||
gchar *stock_id;
|
||||
GimpTabStyle tab_style;
|
||||
|
||||
GimpDockbook *dockbook;
|
||||
|
||||
GimpContext *context;
|
||||
|
||||
GimpDockableGetTabFunc get_tab_func;
|
||||
gpointer get_tab_data;
|
||||
GimpDockableGetIconFunc get_icon_func;
|
||||
gpointer get_icon_data;
|
||||
GimpDockableSetContextFunc set_context_func;
|
||||
};
|
||||
|
||||
|
@ -66,7 +67,8 @@ struct _GimpDockableClass
|
|||
GtkBinClass parent_class;
|
||||
|
||||
GtkWidget * (* get_tab_widget) (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void (* set_context) (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -76,14 +78,15 @@ struct _GimpDockableClass
|
|||
GType gimp_dockable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_dockable_new (const gchar *name,
|
||||
const gchar *short_name,
|
||||
const gchar *blurb,
|
||||
const gchar *stock_id,
|
||||
GimpDockableGetTabFunc get_tab_func,
|
||||
gpointer get_tab_data,
|
||||
GimpDockableGetIconFunc get_icon_func,
|
||||
gpointer get_icon_data,
|
||||
GimpDockableSetContextFunc set_context_func);
|
||||
|
||||
GtkWidget * gimp_dockable_get_tab_widget (GimpDockable *dockable,
|
||||
GimpDockbook *dockbook,
|
||||
GimpContext *context,
|
||||
GimpTabStyle tab_style,
|
||||
GtkIconSize size);
|
||||
void gimp_dockable_set_context (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
|
|
@ -71,8 +71,6 @@ static gboolean gimp_dockbook_drag_drop (GtkWidget *widget,
|
|||
gint y,
|
||||
guint time);
|
||||
|
||||
static GtkWidget * gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable);
|
||||
static void gimp_dockbook_menu_switch_page (GtkWidget *widget,
|
||||
GimpDockable *dockable);
|
||||
static void gimp_dockbook_menu_end (GimpDockbook *dockbook);
|
||||
|
@ -339,35 +337,13 @@ gimp_dockbook_add (GimpDockbook *dockbook,
|
|||
|
||||
g_return_if_fail (GTK_IS_WIDGET (tab_widget));
|
||||
|
||||
menu_widget = gimp_dockable_get_tab_widget (dockable, dockbook,
|
||||
menu_widget = gimp_dockable_get_tab_widget (dockable,
|
||||
dockbook->dock->context,
|
||||
GIMP_TAB_STYLE_ICON_BLURB,
|
||||
MENU_WIDGET_ICON_SIZE);
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (menu_widget));
|
||||
|
||||
if (GIMP_IS_PREVIEW (menu_widget) || GTK_IS_IMAGE (menu_widget))
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, MENU_WIDGET_SPACING);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), menu_widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (menu_widget);
|
||||
|
||||
label = gtk_label_new (dockable->name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
menu_widget = hbox;
|
||||
}
|
||||
else if (GTK_IS_LABEL (menu_widget))
|
||||
{
|
||||
gtk_widget_destroy (menu_widget);
|
||||
|
||||
menu_widget = gtk_label_new (dockable->name);
|
||||
gtk_misc_set_alignment (GTK_MISC (menu_widget), 0.0, 0.5);
|
||||
}
|
||||
|
||||
if (position == -1)
|
||||
{
|
||||
gtk_notebook_append_page_menu (GTK_NOTEBOOK (dockbook),
|
||||
|
@ -471,7 +447,7 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
|
|||
g_list_free (children);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
GtkWidget *
|
||||
gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
|
@ -482,7 +458,10 @@ gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
|
|||
"tab_icon_size", &tab_size,
|
||||
NULL);
|
||||
|
||||
tab_widget = gimp_dockable_get_tab_widget (dockable, dockbook, tab_size);
|
||||
tab_widget = gimp_dockable_get_tab_widget (dockable,
|
||||
dockbook->dock->context,
|
||||
dockable->tab_style,
|
||||
tab_size);
|
||||
|
||||
if (! GIMP_IS_PREVIEW (tab_widget))
|
||||
{
|
||||
|
@ -495,7 +474,7 @@ gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
|
|||
tab_widget = event_box;
|
||||
}
|
||||
|
||||
gimp_help_set_help_data (tab_widget, dockable->name, NULL);
|
||||
gimp_help_set_help_data (tab_widget, dockable->blurb, NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (tab_widget), "gimp-dockable", dockable);
|
||||
|
||||
|
@ -651,34 +630,10 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
preview = gimp_dockable_get_tab_widget (dockable, dockable->dockbook,
|
||||
preview = gimp_dockable_get_tab_widget (dockable,
|
||||
dockable->context,
|
||||
GIMP_TAB_STYLE_ICON_BLURB,
|
||||
DND_WIDGET_ICON_SIZE);
|
||||
|
||||
if (GIMP_IS_PREVIEW (preview))
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
label = gtk_label_new (dockable->name);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||
gtk_widget_show (label);
|
||||
|
||||
preview = hbox;
|
||||
}
|
||||
else if (GTK_IS_LABEL (preview))
|
||||
{
|
||||
gtk_widget_destroy (preview);
|
||||
|
||||
preview = gtk_label_new (dockable->name);
|
||||
gtk_misc_set_padding (GTK_MISC (preview), 10, 5);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
|
|
|
@ -57,15 +57,18 @@ struct _GimpDockbookClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_dockbook_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_dockbook_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_dockbook_new (GimpMenuFactory *menu_factory);
|
||||
GtkWidget * gimp_dockbook_new (GimpMenuFactory *menu_factory);
|
||||
|
||||
void gimp_dockbook_add (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable,
|
||||
gint position);
|
||||
void gimp_dockbook_remove (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable);
|
||||
void gimp_dockbook_add (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable,
|
||||
gint position);
|
||||
void gimp_dockbook_remove (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable);
|
||||
|
||||
GtkWidget * gimp_dockbook_get_tab_widget (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable);
|
||||
|
||||
|
||||
#endif /* __GIMP_DOCKBOOK_H__ */
|
||||
|
|
|
@ -409,7 +409,7 @@ gimp_image_dock_update_title_idle (GimpImageDock *image_dock)
|
|||
{
|
||||
GimpDockable *dockable = child->data;
|
||||
|
||||
g_string_append (title, dockable->short_name);
|
||||
g_string_append (title, dockable->name);
|
||||
|
||||
if (g_list_next (child))
|
||||
g_string_append (title, ", ");
|
||||
|
|
|
@ -409,7 +409,7 @@ gimp_image_dock_update_title_idle (GimpImageDock *image_dock)
|
|||
{
|
||||
GimpDockable *dockable = child->data;
|
||||
|
||||
g_string_append (title, dockable->short_name);
|
||||
g_string_append (title, dockable->name);
|
||||
|
||||
if (g_list_next (child))
|
||||
g_string_append (title, ", ");
|
||||
|
|
|
@ -66,6 +66,27 @@ gimp_histogram_scale_get_type (void)
|
|||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_tab_style_enum_values[] =
|
||||
{
|
||||
{ GIMP_TAB_STYLE_ICON, N_("Icon"), "icon" },
|
||||
{ GIMP_TAB_STYLE_NAME, N_("Text"), "name" },
|
||||
{ GIMP_TAB_STYLE_ICON_NAME, N_("Icon & Text"), "icon-name" },
|
||||
{ GIMP_TAB_STYLE_ICON_BLURB, N_("Icon & Desc"), "icon-blurb" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_tab_style_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
if (!enum_type)
|
||||
enum_type = g_enum_register_static ("GimpTabStyle", gimp_tab_style_enum_values);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_view_type_enum_values[] =
|
||||
{
|
||||
{ GIMP_VIEW_TYPE_LIST, N_("View as List"), "list" },
|
||||
|
|
|
@ -58,6 +58,19 @@ typedef enum
|
|||
} GimpHistogramScale;
|
||||
|
||||
|
||||
#define GIMP_TYPE_TAB_STYLE (gimp_tab_style_get_type ())
|
||||
|
||||
GType gimp_tab_style_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_TAB_STYLE_ICON, /*< desc="Icon" >*/
|
||||
GIMP_TAB_STYLE_NAME, /*< desc="Text" >*/
|
||||
GIMP_TAB_STYLE_ICON_NAME, /*< desc="Icon & Text" >*/
|
||||
GIMP_TAB_STYLE_ICON_BLURB /*< desc="Icon & Desc" >*/
|
||||
} GimpTabStyle;
|
||||
|
||||
|
||||
#define GIMP_TYPE_VIEW_TYPE (gimp_view_type_get_type ())
|
||||
|
||||
GType gimp_view_type_get_type (void) G_GNUC_CONST;
|
||||
|
|
Loading…
Reference in New Issue