Derive GimpDisplayShell from GtkVBox instead of GimpImageWindow
...and pack the widget into a separately created GimpImageWindow.
This commit is contained in:
@ -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));
|
||||
|
@ -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 *************************************************/
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user