Commit 181a2c48 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added new pure virtual function GimpDock::setup() which configures a dock

2003-10-08  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdock.[ch]: added new pure virtual function
	GimpDock::setup() which configures a dock like a passed template
	dock.

	* app/widgets/gimpimagedock.c: implement it and set
	"show_image_menu" and "auto_follow_active" accordingly.

	* app/widgets/gimpdockable.c (gimp_dockable_detach): call
	gimp_dock_setup() to configure the new dock like the old one.
	Removed inclusion if "gimpimagedock.h".

	* app/gui/dialogs-commands.c: minor code cleanups.
parent 96e9f052
2003-10-08 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdock.[ch]: added new pure virtual function
GimpDock::setup() which configures a dock like a passed template
dock.
* app/widgets/gimpimagedock.c: implement it and set
"show_image_menu" and "auto_follow_active" accordingly.
* app/widgets/gimpdockable.c (gimp_dockable_detach): call
gimp_dock_setup() to configure the new dock like the old one.
Removed inclusion if "gimpimagedock.h".
* app/gui/dialogs-commands.c: minor code cleanups.
2003-10-08 Michael Natterer <mitch@gimp.org>
 
Fixed bug #119423. There was no speed regression with the actual
......@@ -292,12 +292,9 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
view = gimp_container_view_get_by_dockable (dockable);
if (view)
{
if (view->preview_size != preview_size)
gimp_container_view_set_preview_size (view, preview_size,
view->preview_border_width);
}
if (view && view->preview_size != preview_size)
gimp_container_view_set_preview_size (view, preview_size,
view->preview_border_width);
}
}
......@@ -321,20 +318,17 @@ dialogs_tab_style_cmd_callback (GtkWidget *widget,
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
if (dockable && dockable->tab_style != tab_style)
{
if (dockable->tab_style != tab_style)
{
GtkWidget *tab_widget;
GtkWidget *tab_widget;
dockable->tab_style = tab_style;
dockable->tab_style = tab_style;
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable),
tab_widget);
}
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable),
tab_widget);
}
}
......@@ -346,10 +340,8 @@ dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
......@@ -360,10 +352,8 @@ dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
......
......@@ -292,12 +292,9 @@ dialogs_preview_size_cmd_callback (GtkWidget *widget,
view = gimp_container_view_get_by_dockable (dockable);
if (view)
{
if (view->preview_size != preview_size)
gimp_container_view_set_preview_size (view, preview_size,
view->preview_border_width);
}
if (view && view->preview_size != preview_size)
gimp_container_view_set_preview_size (view, preview_size,
view->preview_border_width);
}
}
......@@ -321,20 +318,17 @@ dialogs_tab_style_cmd_callback (GtkWidget *widget,
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
if (dockable)
if (dockable && dockable->tab_style != tab_style)
{
if (dockable->tab_style != tab_style)
{
GtkWidget *tab_widget;
GtkWidget *tab_widget;
dockable->tab_style = tab_style;
dockable->tab_style = tab_style;
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable),
tab_widget);
}
gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable),
tab_widget);
}
}
......@@ -346,10 +340,8 @@ dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
......@@ -360,10 +352,8 @@ dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
GimpDockbook *dockbook = GIMP_DOCKBOOK (data);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
......
......@@ -162,6 +162,7 @@ gimp_dock_class_init (GimpDockClass *klass)
widget_class->style_set = gimp_dock_style_set;
klass->setup = NULL;
klass->book_added = gimp_dock_real_book_added;
klass->book_removed = gimp_dock_real_book_removed;
......@@ -318,6 +319,17 @@ gimp_dock_construct (GimpDock *dock,
return TRUE;
}
void
gimp_dock_setup (GimpDock *dock,
const GimpDock *template)
{
g_return_if_fail (GIMP_IS_DOCK (dock));
g_return_if_fail (GIMP_IS_DOCK (template));
if (GIMP_DOCK_GET_CLASS (dock)->setup)
GIMP_DOCK_GET_CLASS (dock)->setup (dock, template);
}
void
gimp_dock_add (GimpDock *dock,
GimpDockable *dockable,
......
......@@ -53,10 +53,15 @@ struct _GimpDockClass
{
GtkWindowClass parent_class;
void (* book_added) (GimpDock *dock,
GimpDockbook *dockbook);
void (* book_removed) (GimpDock *dock,
GimpDockbook *dockbook);
/* virtual functions */
void (* setup) (GimpDock *dock,
const GimpDock *template);
/* signals */
void (* book_added) (GimpDock *dock,
GimpDockbook *dockbook);
void (* book_removed) (GimpDock *dock,
GimpDockbook *dockbook);
};
......@@ -65,6 +70,8 @@ GType gimp_dock_get_type (void) G_GNUC_CONST;
gboolean gimp_dock_construct (GimpDock *dock,
GimpDialogFactory *dialog_factory,
GimpContext *context);
void gimp_dock_setup (GimpDock *dock,
const GimpDock *template);
void gimp_dock_add (GimpDock *dock,
GimpDockable *dockable,
......
......@@ -31,9 +31,9 @@
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpdockbook.h"
#include "gimpimagedock.h"
#include "gimpitemfactory.h"
#include "gimpwidgets-utils.h"
......@@ -684,20 +684,7 @@ gimp_dockable_detach (GimpDockable *dockable)
src_dock = dockable->dockbook->dock;
dock = gimp_dialog_factory_dock_new (src_dock->dialog_factory);
if (GIMP_IS_IMAGE_DOCK (dock) && GIMP_IS_IMAGE_DOCK (src_dock))
{
gboolean auto_follow_active;
gboolean show_image_menu;
auto_follow_active = GIMP_IMAGE_DOCK (src_dock)->auto_follow_active;
show_image_menu = GIMP_IMAGE_DOCK (src_dock)->show_image_menu;
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dock),
auto_follow_active);
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock),
show_image_menu);
}
gimp_dock_setup (GIMP_DOCK (dock), src_dock);
gtk_window_set_position (GTK_WINDOW (dock), GTK_WIN_POS_MOUSE);
......
......@@ -46,35 +46,37 @@
#define DEFAULT_MENU_PREVIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_setup (GimpDock *dock,
const GimpDock *template);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static GimpDockClass *parent_class = NULL;
......@@ -125,6 +127,7 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
widget_class->style_set = gimp_image_dock_style_set;
dock_class->setup = gimp_image_dock_setup;
dock_class->book_added = gimp_image_dock_book_added;
dock_class->book_removed = gimp_image_dock_book_removed;
......@@ -261,6 +264,25 @@ gimp_image_dock_style_set (GtkWidget *widget,
focus_line_width));
}
static void
gimp_image_dock_setup (GimpDock *dock,
const GimpDock *template)
{
if (GIMP_IS_IMAGE_DOCK (template))
{
gboolean auto_follow_active;
gboolean show_image_menu;
auto_follow_active = GIMP_IMAGE_DOCK (template)->auto_follow_active;
show_image_menu = GIMP_IMAGE_DOCK (template)->show_image_menu;
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dock),
auto_follow_active);
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock),
show_image_menu);
}
}
static void
gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook)
......
......@@ -46,35 +46,37 @@
#define DEFAULT_MENU_PREVIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static void gimp_image_dock_class_init (GimpImageDockClass *klass);
static void gimp_image_dock_init (GimpImageDock *dock);
static void gimp_image_dock_destroy (GtkObject *object);
static void gimp_image_dock_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_image_dock_setup (GimpDock *dock,
const GimpDock *template);
static void gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_book_removed (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_image_dock_dockbook_changed (GimpDockbook *dockbook,
GimpDockable *dockable,
GimpImageDock *dock);
static void gimp_image_dock_update_title (GimpImageDock *dock);
static void gimp_image_dock_factory_display_changed (GimpContext *context,
GimpObject *gdisp,
GimpDock *dock);
static void gimp_image_dock_factory_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDock *dock);
static void gimp_image_dock_auto_clicked (GtkWidget *widget,
GimpDock *dock);
static GimpDockClass *parent_class = NULL;
......@@ -125,6 +127,7 @@ gimp_image_dock_class_init (GimpImageDockClass *klass)
widget_class->style_set = gimp_image_dock_style_set;
dock_class->setup = gimp_image_dock_setup;
dock_class->book_added = gimp_image_dock_book_added;
dock_class->book_removed = gimp_image_dock_book_removed;
......@@ -261,6 +264,25 @@ gimp_image_dock_style_set (GtkWidget *widget,
focus_line_width));
}
static void
gimp_image_dock_setup (GimpDock *dock,
const GimpDock *template)
{
if (GIMP_IS_IMAGE_DOCK (template))
{
gboolean auto_follow_active;
gboolean show_image_menu;
auto_follow_active = GIMP_IMAGE_DOCK (template)->auto_follow_active;
show_image_menu = GIMP_IMAGE_DOCK (template)->show_image_menu;
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dock),
auto_follow_active);
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock),
show_image_menu);
}
}
static void
gimp_image_dock_book_added (GimpDock *dock,
GimpDockbook *dockbook)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment