Commit e985b88e authored by Henrik Brix Andersen's avatar Henrik Brix Andersen

derive GimpGrid from GimpObject (not GObject) allowing us to use

* app/core/gimpgrid.[ch]: derive GimpGrid from GimpObject (not
GObject) allowing us to use gimp_object_get_memsize(). Added
missing copyright notice.

* app/core/gimpimage.c: only call gimp_object_get_memsize() if
gimage->grid != NULL.

* app/gui/grid-dialog.c: added mnemonics, set shell->grid_dialog
to NULL when destroyed.

* app/gui/view-commands.c (view_configure_grid_cmd_callback):
added call to gtk_window_present().
parent f30586d1
2003-06-24 Henrik Brix Andersen <brix@gimp.org>
* app/core/gimpgrid.[ch]: derive GimpGrid from GimpObject (not
GObject) allowing us to use gimp_object_get_memsize(). Added
missing copyright notice.
* app/core/gimpimage.c: only call gimp_object_get_memsize() if
gimage->grid != NULL.
* app/gui/grid-dialog.c: added mnemonics, set shell->grid_dialog
to NULL when destroyed.
* app/gui/view-commands.c (view_configure_grid_cmd_callback):
added call to gtk_window_present()
2003-06-23 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig.[ch]
......@@ -356,17 +356,22 @@ view_configure_grid_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *grid_dialog;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
grid_dialog = grid_dialog_new (GIMP_DISPLAY (gdisp));
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
grid_dialog,
G_CONNECT_SWAPPED);
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (GIMP_DISPLAY (gdisp));
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
shell->grid_dialog,
G_CONNECT_SWAPPED);
}
gtk_widget_show (grid_dialog);
gtk_window_present (GTK_WINDOW (shell->grid_dialog));
}
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpGrid
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
......@@ -59,7 +62,7 @@ static void gimp_grid_set_property (GObject *object,
GParamSpec *pspec);
static GObjectClass *parent_class = NULL;
static GimpObjectClass *parent_class = NULL;
GType
......@@ -88,7 +91,7 @@ gimp_grid_get_type (void)
NULL /* iface_data */
};
grid_type = g_type_register_static (G_TYPE_OBJECT,
grid_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpGrid", &grid_info, 0);
g_type_add_interface_static (grid_type,
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpGrid
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
......@@ -20,6 +23,9 @@
#define __GIMP_GRID_H__
#include "gimpobject.h"
#define GIMP_TYPE_GRID (gimp_grid_get_type ())
#define GIMP_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GRID, GimpGrid))
#define GIMP_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GRID, GimpGridClass))
......@@ -32,7 +38,7 @@ typedef struct _GimpGridClass GimpGridClass;
struct _GimpGrid
{
GObject parent_instance;
GimpObject parent_instance;
gdouble xspacing;
gdouble yspacing;
......@@ -48,7 +54,7 @@ struct _GimpGrid
struct _GimpGridClass
{
GObjectClass parent_class;
GimpObjectClass parent_class;
};
......
......@@ -692,8 +692,6 @@ undo_pop_image_grid (GimpUndo *undo,
gimp_image_set_grid (undo->gimage, gu->grid, FALSE);
gu->grid = tmp;
gimp_image_grid_changed (undo->gimage);
return TRUE;
}
......
......@@ -646,7 +646,8 @@ gimp_image_get_memsize (GimpObject *object)
memsize += (g_list_length (gimage->guides) * (sizeof (GList) +
sizeof (GimpGuide)));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->grid));
if (gimage->grid)
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->grid));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->layers));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->channels));
......
......@@ -129,7 +129,7 @@ grid_dialog_new (GimpDisplay *gdisp)
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
show_button = gtk_check_button_new_with_label (_("Show Grid"));
show_button = gtk_check_button_new_with_mnemonic (_("S_how Grid"));
gtk_box_pack_start (GTK_BOX (vbox), show_button, FALSE, FALSE, 0);
show_grid = gimp_display_shell_get_show_grid (GIMP_DISPLAY_SHELL (shell));
......@@ -137,7 +137,7 @@ grid_dialog_new (GimpDisplay *gdisp)
show_grid);
gtk_widget_show (show_button);
snap_button = gtk_check_button_new_with_label (_("Snap to Grid"));
snap_button = gtk_check_button_new_with_mnemonic (_("S_nap to Grid"));
gtk_box_pack_start (GTK_BOX (vbox), snap_button, FALSE, FALSE, 0);
snap_to_grid = gimp_display_shell_get_snap_to_grid (GIMP_DISPLAY_SHELL (shell));
......@@ -162,7 +162,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GIMP_GRID_TYPE_INTERSECTION,
GIMP_GRID_TYPE_SOLID);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Line Style:"), 1.0, 0.5,
_("Line _Style:"), 1.0, 0.5,
type, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "fgcolor",
......@@ -170,7 +170,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Foreground Color:"), 1.0, 0.5,
_("_Foreground Color:"), 1.0, 0.5,
color_button, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "bgcolor",
......@@ -178,7 +178,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Background Color:"), 1.0, 0.5,
_("_Background Color:"), 1.0, 0.5,
color_button, 1, TRUE);
gtk_widget_show (table);
......@@ -351,15 +351,18 @@ static void
remove_callback (GtkWidget *widget,
GtkWidget *dialog)
{
GimpImage *gimage;
GimpGrid *grid;
GimpImage *gimage;
GimpDisplayShell *shell;
GimpGrid *grid;
gimage = g_object_get_data (G_OBJECT (dialog), "gimage");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
shell = g_object_get_data (G_OBJECT (dialog), "shell");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
gimp_image_set_grid (gimage, NULL, TRUE);
g_object_unref (G_OBJECT (grid));
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
......@@ -367,12 +370,15 @@ static void
cancel_callback (GtkWidget *widget,
GtkWidget *dialog)
{
GimpGrid *grid;
GimpDisplayShell *shell;
GimpGrid *grid;
grid = g_object_get_data (G_OBJECT (dialog), "grid");
shell = g_object_get_data (G_OBJECT (dialog), "shell");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
g_object_unref (G_OBJECT (grid));
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
static void
......@@ -408,4 +414,5 @@ ok_callback (GtkWidget *widget,
gimp_display_shell_set_snap_to_grid (GIMP_DISPLAY_SHELL (shell), snap_to_grid);
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
......@@ -129,7 +129,7 @@ grid_dialog_new (GimpDisplay *gdisp)
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
show_button = gtk_check_button_new_with_label (_("Show Grid"));
show_button = gtk_check_button_new_with_mnemonic (_("S_how Grid"));
gtk_box_pack_start (GTK_BOX (vbox), show_button, FALSE, FALSE, 0);
show_grid = gimp_display_shell_get_show_grid (GIMP_DISPLAY_SHELL (shell));
......@@ -137,7 +137,7 @@ grid_dialog_new (GimpDisplay *gdisp)
show_grid);
gtk_widget_show (show_button);
snap_button = gtk_check_button_new_with_label (_("Snap to Grid"));
snap_button = gtk_check_button_new_with_mnemonic (_("S_nap to Grid"));
gtk_box_pack_start (GTK_BOX (vbox), snap_button, FALSE, FALSE, 0);
snap_to_grid = gimp_display_shell_get_snap_to_grid (GIMP_DISPLAY_SHELL (shell));
......@@ -162,7 +162,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GIMP_GRID_TYPE_INTERSECTION,
GIMP_GRID_TYPE_SOLID);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Line Style:"), 1.0, 0.5,
_("Line _Style:"), 1.0, 0.5,
type, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "fgcolor",
......@@ -170,7 +170,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Foreground Color:"), 1.0, 0.5,
_("_Foreground Color:"), 1.0, 0.5,
color_button, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "bgcolor",
......@@ -178,7 +178,7 @@ grid_dialog_new (GimpDisplay *gdisp)
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Background Color:"), 1.0, 0.5,
_("_Background Color:"), 1.0, 0.5,
color_button, 1, TRUE);
gtk_widget_show (table);
......@@ -351,15 +351,18 @@ static void
remove_callback (GtkWidget *widget,
GtkWidget *dialog)
{
GimpImage *gimage;
GimpGrid *grid;
GimpImage *gimage;
GimpDisplayShell *shell;
GimpGrid *grid;
gimage = g_object_get_data (G_OBJECT (dialog), "gimage");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
shell = g_object_get_data (G_OBJECT (dialog), "shell");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
gimp_image_set_grid (gimage, NULL, TRUE);
g_object_unref (G_OBJECT (grid));
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
......@@ -367,12 +370,15 @@ static void
cancel_callback (GtkWidget *widget,
GtkWidget *dialog)
{
GimpGrid *grid;
GimpDisplayShell *shell;
GimpGrid *grid;
grid = g_object_get_data (G_OBJECT (dialog), "grid");
shell = g_object_get_data (G_OBJECT (dialog), "shell");
grid = g_object_get_data (G_OBJECT (dialog), "grid");
g_object_unref (G_OBJECT (grid));
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
static void
......@@ -408,4 +414,5 @@ ok_callback (GtkWidget *widget,
gimp_display_shell_set_snap_to_grid (GIMP_DISPLAY_SHELL (shell), snap_to_grid);
gtk_widget_destroy (dialog);
shell->grid_dialog = NULL;
}
......@@ -356,17 +356,22 @@ view_configure_grid_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *grid_dialog;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
grid_dialog = grid_dialog_new (GIMP_DISPLAY (gdisp));
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
grid_dialog,
G_CONNECT_SWAPPED);
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (GIMP_DISPLAY (gdisp));
g_signal_connect_object (gdisp, "disconnect",
G_CALLBACK (gtk_widget_destroy),
shell->grid_dialog,
G_CONNECT_SWAPPED);
}
gtk_widget_show (grid_dialog);
gtk_window_present (GTK_WINDOW (shell->grid_dialog));
}
......
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