Commit a8598c69 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added dialog_factory and dialog_identifier parameters to the constructors

2003-05-16  Michael Natterer  <mitch@gimp.org>

	* app/gui/color-notebook.[ch]: added dialog_factory and
	dialog_identifier parameters to the constructors and register the
	color_notebook with the passed factory as foreign dialog.

	* app/widgets/gimpcolorpanel.c: changed accordingly.

	* app/gui/dialogs.c
	* app/gui/colormap-editor-commands.c
	* app/gui/gradient-editor-commands.c
	* app/gui/palette-editor-commands.c
	* app/widgets/gimptoolbox-color-area.c: added session management for
	the color notebooks created here.
parent 4dcf2131
2003-05-16 Michael Natterer <mitch@gimp.org>
* app/gui/color-notebook.[ch]: added dialog_factory and
dialog_identifier parameters to the constructors and register the
color_notebook with the passed factory as foreign dialog.
* app/widgets/gimpcolorpanel.c: changed accordingly.
* app/gui/dialogs.c
* app/gui/colormap-editor-commands.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/widgets/gimptoolbox-color-area.c: added session management for
the color notebooks created here.
2003-05-16 Michael Natterer <mitch@gimp.org>
* app/gui/vectors-commands.c (vectors_sel_to_vectors_cmd_callback):
......@@ -33,6 +33,7 @@
#include "widgets/gimpcolormapeditor.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "colormap-editor-commands.h"
#include "gimp-intl.h"
......@@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
global_dialog_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
colormap_editor_color_notebook_callback,
editor,
......
......@@ -33,6 +33,7 @@
#include "widgets/gimpcolormapeditor.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "colormap-editor-commands.h"
#include "gimp-intl.h"
......@@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
global_dialog_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
colormap_editor_color_notebook_callback,
editor,
......
......@@ -32,6 +32,7 @@
#include "widgets/gimpviewabledialog.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "gradient-editor-commands.h"
#include "gimp-intl.h"
......@@ -83,6 +84,8 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed,
editor,
......@@ -199,6 +202,8 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed,
editor,
......
......@@ -32,6 +32,7 @@
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "palette-editor-commands.h"
#include "gimp-intl.h"
......@@ -96,6 +97,8 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
global_dialog_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
......
......@@ -32,6 +32,7 @@
#include "gui-types.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "color-history.h"
......@@ -86,6 +87,8 @@ static ColorNotebook *
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -138,6 +141,8 @@ static GList *color_notebooks = NULL;
ColorNotebook *
color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -149,6 +154,8 @@ color_notebook_new (const gchar *title,
"color_selection",
NULL,
NULL,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
"color_selection",
stock_id,
desc,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp)
color_notebooks = g_list_remove (color_notebooks, cnp);
gtk_widget_destroy (cnp->shell);
/* may be already destroyed by dialog factory */
if (cnp->shell)
{
g_object_remove_weak_pointer (G_OBJECT (cnp->shell),
(gpointer *) &cnp->shell);
gtk_widget_destroy (cnp->shell);
}
g_free (cnp);
}
......@@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL,
NULL);
g_return_val_if_fail (color != NULL, NULL);
cnp = g_new0 (ColorNotebook, 1);
......@@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable,
NULL);
g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell);
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier,
cnp->shell);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
......
......@@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
ColorNotebook * color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......@@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......
......@@ -77,6 +77,16 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp-perspective-tool-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-toolbox-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-gradient-editor-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-palette-editor-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-colormap-editor-color-dialog",
NULL, 0, FALSE, TRUE, FALSE, FALSE },
/* ordinary toplevels */
{ "gimp-file-new-dialog", dialogs_file_new_new,
0, FALSE, TRUE, FALSE, FALSE },
......
......@@ -32,6 +32,7 @@
#include "gui-types.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "color-history.h"
......@@ -86,6 +87,8 @@ static ColorNotebook *
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -138,6 +141,8 @@ static GList *color_notebooks = NULL;
ColorNotebook *
color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -149,6 +154,8 @@ color_notebook_new (const gchar *title,
"color_selection",
NULL,
NULL,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
"color_selection",
stock_id,
desc,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp)
color_notebooks = g_list_remove (color_notebooks, cnp);
gtk_widget_destroy (cnp->shell);
/* may be already destroyed by dialog factory */
if (cnp->shell)
{
g_object_remove_weak_pointer (G_OBJECT (cnp->shell),
(gpointer *) &cnp->shell);
gtk_widget_destroy (cnp->shell);
}
g_free (cnp);
}
......@@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL,
NULL);
g_return_val_if_fail (color != NULL, NULL);
cnp = g_new0 (ColorNotebook, 1);
......@@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable,
NULL);
g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell);
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier,
cnp->shell);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
......
......@@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
ColorNotebook * color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......@@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......
......@@ -33,6 +33,7 @@
#include "widgets/gimpcolormapeditor.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "colormap-editor-commands.h"
#include "gimp-intl.h"
......@@ -100,6 +101,8 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
global_dialog_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
colormap_editor_color_notebook_callback,
editor,
......
......@@ -77,6 +77,16 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp-perspective-tool-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-toolbox-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-gradient-editor-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-palette-editor-color-dialog",
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-colormap-editor-color-dialog",
NULL, 0, FALSE, TRUE, FALSE, FALSE },
/* ordinary toplevels */
{ "gimp-file-new-dialog", dialogs_file_new_new,
0, FALSE, TRUE, FALSE, FALSE },
......
......@@ -32,6 +32,7 @@
#include "widgets/gimpviewabledialog.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "gradient-editor-commands.h"
#include "gimp-intl.h"
......@@ -83,6 +84,8 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed,
editor,
......@@ -199,6 +202,8 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed,
editor,
......
......@@ -32,6 +32,7 @@
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "palette-editor-commands.h"
#include "gimp-intl.h"
......@@ -96,6 +97,8 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
global_dialog_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
......
......@@ -32,6 +32,7 @@
#include "gui-types.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "color-history.h"
......@@ -86,6 +87,8 @@ static ColorNotebook *
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -138,6 +141,8 @@ static GList *color_notebooks = NULL;
ColorNotebook *
color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -149,6 +154,8 @@ color_notebook_new (const gchar *title,
"color_selection",
NULL,
NULL,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -159,6 +166,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -170,6 +179,8 @@ color_notebook_viewable_new (GimpViewable *viewable,
"color_selection",
stock_id,
desc,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
......@@ -182,7 +193,13 @@ color_notebook_free (ColorNotebook *cnp)
color_notebooks = g_list_remove (color_notebooks, cnp);
gtk_widget_destroy (cnp->shell);
/* may be already destroyed by dialog factory */
if (cnp->shell)
{
g_object_remove_weak_pointer (G_OBJECT (cnp->shell),
(gpointer *) &cnp->shell);
gtk_widget_destroy (cnp->shell);
}
g_free (cnp);
}
......@@ -262,6 +279,8 @@ color_notebook_new_internal (GimpViewable *viewable,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
......@@ -280,6 +299,10 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
g_return_val_if_fail (dialog_factory == NULL || dialog_identifier != NULL,
NULL);
g_return_val_if_fail (color != NULL, NULL);
cnp = g_new0 (ColorNotebook, 1);
......@@ -327,6 +350,11 @@ color_notebook_new_internal (GimpViewable *viewable,
NULL);
g_object_add_weak_pointer (G_OBJECT (cnp->shell), (gpointer *) &cnp->shell);
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier,
cnp->shell);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
......
......@@ -35,6 +35,8 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
ColorNotebook * color_notebook_new (const gchar *title,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......@@ -45,6 +47,8 @@ ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
......
......@@ -260,6 +260,7 @@ gimp_color_panel_clicked (GtkButton *button)
{
panel->color_notebook =
color_notebook_new (GIMP_COLOR_BUTTON (button)->title,
NULL, NULL,
(const GimpRGB *) &color,
gimp_color_panel_select_callback,
panel,
......
......@@ -35,11 +35,13 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimptoolbox.h"
#include "gimptoolbox-color-area.h"
#include "gui/color-notebook.h"
#include "gui/dialogs.h"
#ifdef DISPLAY_FILTERS
#include "gdisplay_color.h"
......@@ -371,7 +373,8 @@ color_area_select_callback (ColorNotebook *color_notebook,
static void
color_area_edit (GimpContext *context)
{
GimpRGB color;
GimpRGB color;
const gchar *title;
if (! color_notebook_active)
{
......@@ -386,13 +389,16 @@ color_area_edit (GimpContext *context)
edit_color = active_color;
#define FG_TITLE _("Change Foreground Color")
#define BG_TITLE _("Change Background Color")
if (active_color == FOREGROUND)
title = _("Change Foreground Color");
else
title = _("Change Background Color");
if (! color_notebook)
{
color_notebook = color_notebook_new (active_color == FOREGROUND ?
FG_TITLE : BG_TITLE,
color_notebook = color_notebook_new (title,
global_dialog_factory,
"gimp-toolbox-color-dialog",
(const GimpRGB *) &color,
color_area_select_callback,
context, TRUE, FALSE);
......@@ -400,9 +406,7 @@ color_area_edit (GimpContext *context)
}
else
{
color_notebook_set_title (color_notebook,
active_color == FOREGROUND ?
FG_TITLE : BG_TITLE);
color_notebook_set_title (color_notebook, title);
color_notebook_set_color (color_notebook, &color);
if (! color_notebook_active)
......
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