[gimp] Derive GimpDisplayShell from GtkVBox instead of GimpImageWindow
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Derive GimpDisplayShell from GtkVBox instead of GimpImageWindow
- Date: Tue, 29 Sep 2009 18:57:04 +0000 (UTC)
commit 59274856ad470a09507060ac6f43a3173ebab48f
Author: Michael Natterer <mitch gimp org>
Date: Tue Sep 29 20:56:14 2009 +0200
Derive GimpDisplayShell from GtkVBox instead of GimpImageWindow
...and pack the widget into a separately created GimpImageWindow.
app/display/gimpdisplay.c | 24 ++++++++++++++++++------
app/display/gimpdisplayshell.c | 34 ++++++++++------------------------
app/display/gimpdisplayshell.h | 13 +++----------
app/display/gimpimagewindow.c | 5 ++---
4 files changed, 33 insertions(+), 43 deletions(-)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index d8c92c7..219d3b5 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -42,6 +42,7 @@
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-icon.h"
#include "gimpdisplayshell-transform.h"
+#include "gimpimagewindow.h"
#include "gimp-intl.h"
@@ -353,6 +354,7 @@ gimp_display_new (Gimp *gimp,
GimpDialogFactory *display_factory)
{
GimpDisplay *display;
+ GtkWidget *window;
gint ID;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
@@ -381,24 +383,34 @@ gimp_display_new (Gimp *gimp,
gimp_display_connect (display, image);
/* create the shell for the image */
+ window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
+ "menu-factory", menu_factory,
+ "display-factory", display_factory,
+ /* The window position will be overridden by the
+ * dialog factory, it is only really used on first
+ * startup.
+ */
+ display->image ? NULL : "window-position",
+ GTK_WIN_POS_CENTER,
+ NULL);
+
display->shell = gimp_display_shell_new (display, unit, scale,
- menu_factory, popup_manager,
- display_factory);
+ popup_manager);
/* FIXME image window */
- gimp_image_window_add_shell (GIMP_IMAGE_WINDOW (display->shell),
+ gimp_image_window_add_shell (GIMP_IMAGE_WINDOW (window),
GIMP_DISPLAY_SHELL (display->shell));
/* FIXME image window */
- gimp_image_window_set_active_shell (GIMP_IMAGE_WINDOW (display->shell),
+ gimp_image_window_set_active_shell (GIMP_IMAGE_WINDOW (window),
GIMP_DISPLAY_SHELL (display->shell));
/* FIXME image window */
- g_signal_connect (GIMP_IMAGE_WINDOW (display->shell)->statusbar, "cancel",
+ g_signal_connect (GIMP_IMAGE_WINDOW (window)->statusbar, "cancel",
G_CALLBACK (gimp_display_progress_canceled),
display);
- gtk_widget_show (display->shell);
+ gtk_widget_show (window);
/* add the display to the list */
gimp_container_add (gimp->displays, GIMP_OBJECT (display));
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 93f675a..c82cfe2 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -74,6 +74,7 @@
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-title.h"
#include "gimpdisplayshell-transform.h"
+#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
#include "gimp-log.h"
@@ -136,7 +137,7 @@ static const guint8 * gimp_display_shell_get_icc_profile
G_DEFINE_TYPE_WITH_CODE (GimpDisplayShell, gimp_display_shell,
- GIMP_TYPE_IMAGE_WINDOW,
+ GTK_TYPE_VBOX,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
gimp_display_shell_progress_iface_init)
G_IMPLEMENT_INTERFACE (GIMP_TYPE_COLOR_MANAGED,
@@ -381,6 +382,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
GDK_VISIBILITY_NOTIFY_MASK |
GDK_SCROLL_MASK));
+ gtk_box_set_spacing (GTK_BOX (shell), 1);
+
/* zoom model callback */
g_signal_connect_swapped (shell->zoom, "zoomed",
G_CALLBACK (gimp_display_shell_scale_changed),
@@ -764,9 +767,7 @@ GtkWidget *
gimp_display_shell_new (GimpDisplay *display,
GimpUnit unit,
gdouble scale,
- GimpMenuFactory *menu_factory,
- GimpUIManager *popup_manager,
- GimpDialogFactory *display_factory)
+ GimpUIManager *popup_manager)
{
GimpDisplayShell *shell;
GimpColorDisplayStack *filter;
@@ -783,23 +784,13 @@ gimp_display_shell_new (GimpDisplay *display,
gint shell_height;
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
- g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
g_return_val_if_fail (GIMP_IS_UI_MANAGER (popup_manager), NULL);
- g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (display_factory), NULL);
/* the toplevel shell */
shell = g_object_new (GIMP_TYPE_DISPLAY_SHELL,
- "menu-factory", menu_factory,
- "display-factory", display_factory,
- "popup-manager", popup_manager,
- "display", display,
- "unit", unit,
- /* The window position will be overridden by the
- * dialog factory, it is only really used on first
- * startup.
- */
- display->image ? NULL : "window-position",
- GTK_WIN_POS_CENTER,
+ "popup-manager", popup_manager,
+ "display", display,
+ "unit", unit,
NULL);
if (display->image)
@@ -879,14 +870,9 @@ gimp_display_shell_new (GimpDisplay *display,
/* first, set up the container hierarchy *********************************/
- /* the vbox containing all widgets */
-
- /* FIXME this will be the shell */
- shell->disp_vbox = gtk_vbox_new (FALSE, 1);
-
/* a hbox for the inner_table and the vertical scrollbar */
upper_hbox = gtk_hbox_new (FALSE, 1);
- gtk_box_pack_start (GTK_BOX (shell->disp_vbox), upper_hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (shell), upper_hbox, TRUE, TRUE, 0);
gtk_widget_show (upper_hbox);
/* the table containing origin, rulers and the canvas */
@@ -904,7 +890,7 @@ gimp_display_shell_new (GimpDisplay *display,
/* the hbox containing the quickmask button, vertical scrollbar and
the navigation button */
lower_hbox = gtk_hbox_new (FALSE, 1);
- gtk_box_pack_start (GTK_BOX (shell->disp_vbox), lower_hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (shell), lower_hbox, FALSE, FALSE, 0);
gtk_widget_show (lower_hbox);
/* create the scrollbars *************************************************/
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index e183d2b..33d008c 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -19,9 +19,6 @@
#define __GIMP_DISPLAY_SHELL_H__
-#include "gimpimagewindow.h"
-
-
/* Apply to a float the same rounding mode used in the renderer */
#define PROJ_ROUND(coord) ((gint) RINT (coord))
#define PROJ_ROUND64(coord) ((gint64) RINT (coord))
@@ -60,12 +57,10 @@ typedef struct _GimpDisplayShellClass GimpDisplayShellClass;
struct _GimpDisplayShell
{
- GimpImageWindow parent_instance;
+ GtkVBox parent_instance;
/* --- cacheline 2 boundary (128 bytes) was 20 bytes ago --- */
- GtkWidget *disp_vbox; /* FIXME temp hack */
-
GimpDisplay *display;
GimpUIManager *popup_manager;
@@ -215,7 +210,7 @@ struct _GimpDisplayShell
struct _GimpDisplayShellClass
{
- GimpImageWindowClass parent_class;
+ GtkVBoxClass parent_class;
void (* scaled) (GimpDisplayShell *shell);
void (* scrolled) (GimpDisplayShell *shell);
@@ -228,9 +223,7 @@ GType gimp_display_shell_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_display_shell_new (GimpDisplay *display,
GimpUnit unit,
gdouble scale,
- GimpMenuFactory *menu_factory,
- GimpUIManager *popup_manager,
- GimpDialogFactory *display_factory);
+ GimpUIManager *popup_manager);
GimpImageWindow * gimp_display_shell_get_window (GimpDisplayShell *shell);
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 1c17aad..90d0586 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -478,10 +478,9 @@ gimp_image_window_add_shell (GimpImageWindow *window,
window->shells = g_list_append (window->shells, shell);
/* FIXME multiple shells */
- gtk_box_pack_start (GTK_BOX (window->main_vbox),
- shell->disp_vbox,
+ gtk_box_pack_start (GTK_BOX (window->main_vbox), GTK_WIDGET (shell),
TRUE, TRUE, 0);
- gtk_widget_show (shell->disp_vbox);
+ gtk_widget_show (GTK_WIDGET (shell));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]