removed color_notebook_new() and renamed color_notebook_viewable_new() to

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

	* app/gui/color-notebook.[ch]: removed color_notebook_new() and
	renamed color_notebook_viewable_new() to color_notebook_new().

	* app/gui/gradient-editor-commands.c
	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimppaletteeditor.c
	* app/widgets/gimpcolorpanel.c
	* app/widgets/gimptoolbox-color-area.c: changed accordingly.
This commit is contained in:
Michael Natterer 2003-11-10 17:55:44 +00:00 committed by Michael Natterer
parent 9dd96bd37e
commit 372c253a7f
13 changed files with 437 additions and 656 deletions

View File

@ -1,3 +1,14 @@
2003-11-10 Michael Natterer <mitch@gimp.org>
* app/gui/color-notebook.[ch]: removed color_notebook_new() and
renamed color_notebook_viewable_new() to color_notebook_new().
* app/gui/gradient-editor-commands.c
* app/widgets/gimpcolormapeditor.c
* app/widgets/gimppaletteeditor.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimptoolbox-color-area.c: changed accordingly.
2003-11-10 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcolorselection.c: added API docs for all

View File

@ -82,18 +82,16 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
editor->left_saved_segments = gradient_editor_save_selection (editor);
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed,
editor,
editor->instant_update,
TRUE);
color_notebook_new (GIMP_VIEWABLE (gradient),
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed, editor,
editor->instant_update, TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
@ -201,18 +199,16 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
editor->right_saved_segments = gradient_editor_save_selection (editor);
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed,
editor,
editor->instant_update,
TRUE);
color_notebook_new (GIMP_VIEWABLE (gradient),
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed, editor,
editor->instant_update, TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
@ -632,7 +628,7 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
title, "gimp-gradient-segment_split-uniformly",
title, "gimp-gradient-segment-split-uniformly",
GIMP_STOCK_TOOL_BLEND, desc,
GTK_WIDGET (editor),
gimp_standard_help_func,

View File

@ -32,6 +32,8 @@
#include "gui-types.h"
#include "core/gimpviewable.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
@ -59,21 +61,6 @@ struct _ColorNotebook
};
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha);
static void color_notebook_help_func (const gchar *help_id,
gpointer help_data);
@ -98,7 +85,10 @@ static GList *color_notebooks = NULL;
/* public functions */
ColorNotebook *
color_notebook_new (const gchar *title,
color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
@ -107,149 +97,6 @@ color_notebook_new (const gchar *title,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (NULL,
title,
"gimp-color-selection",
NULL,
NULL,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
ColorNotebook *
color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (viewable,
title,
"gimp-color-selection",
stock_id,
desc,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
ColorNotebook *cnp;
GtkWidget *table;
@ -257,6 +104,7 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
@ -272,7 +120,7 @@ color_notebook_new_internal (GimpViewable *viewable,
if (desc)
{
cnp->shell = gimp_viewable_dialog_new (viewable, title, role,
cnp->shell = gimp_viewable_dialog_new (viewable, title, dialog_identifier,
stock_id, desc,
parent,
color_notebook_help_func, NULL,
@ -282,7 +130,7 @@ color_notebook_new_internal (GimpViewable *viewable,
}
else
{
cnp->shell = gimp_dialog_new (title, role,
cnp->shell = gimp_dialog_new (title, dialog_identifier,
parent, 0,
color_notebook_help_func, NULL,
NULL);
@ -385,6 +233,94 @@ color_notebook_new_internal (GimpViewable *viewable,
return cnp;
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static void
color_notebook_help_func (const gchar *help_id,
gpointer help_data)

View File

@ -34,43 +34,33 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
gpointer callback_data);
ColorNotebook * color_notebook_new (const gchar *title,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_aplha);
ColorNotebook * color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
#endif /* __COLOR_NOTEBOOK_H__ */

View File

@ -32,6 +32,8 @@
#include "gui-types.h"
#include "core/gimpviewable.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
@ -59,21 +61,6 @@ struct _ColorNotebook
};
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha);
static void color_notebook_help_func (const gchar *help_id,
gpointer help_data);
@ -98,7 +85,10 @@ static GList *color_notebooks = NULL;
/* public functions */
ColorNotebook *
color_notebook_new (const gchar *title,
color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
@ -107,149 +97,6 @@ color_notebook_new (const gchar *title,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (NULL,
title,
"gimp-color-selection",
NULL,
NULL,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
ColorNotebook *
color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (viewable,
title,
"gimp-color-selection",
stock_id,
desc,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
ColorNotebook *cnp;
GtkWidget *table;
@ -257,6 +104,7 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
@ -272,7 +120,7 @@ color_notebook_new_internal (GimpViewable *viewable,
if (desc)
{
cnp->shell = gimp_viewable_dialog_new (viewable, title, role,
cnp->shell = gimp_viewable_dialog_new (viewable, title, dialog_identifier,
stock_id, desc,
parent,
color_notebook_help_func, NULL,
@ -282,7 +130,7 @@ color_notebook_new_internal (GimpViewable *viewable,
}
else
{
cnp->shell = gimp_dialog_new (title, role,
cnp->shell = gimp_dialog_new (title, dialog_identifier,
parent, 0,
color_notebook_help_func, NULL,
NULL);
@ -385,6 +233,94 @@ color_notebook_new_internal (GimpViewable *viewable,
return cnp;
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static void
color_notebook_help_func (const gchar *help_id,
gpointer help_data)

View File

@ -34,43 +34,33 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
gpointer callback_data);
ColorNotebook * color_notebook_new (const gchar *title,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_aplha);
ColorNotebook * color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
#endif /* __COLOR_NOTEBOOK_H__ */

View File

@ -82,18 +82,16 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
editor->left_saved_segments = gradient_editor_save_selection (editor);
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed,
editor,
editor->instant_update,
TRUE);
color_notebook_new (GIMP_VIEWABLE (gradient),
_("Left Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Left Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->left_color,
gradient_editor_left_color_changed, editor,
editor->instant_update, TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
@ -201,18 +199,16 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
editor->right_saved_segments = gradient_editor_save_selection (editor);
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed,
editor,
editor->instant_update,
TRUE);
color_notebook_new (GIMP_VIEWABLE (gradient),
_("Right Endpoint Color"),
GIMP_STOCK_TOOL_BLEND,
_("Gradient Segment's Right Endpoint Color"),
GTK_WIDGET (editor),
global_dialog_factory,
"gimp-gradient-editor-color-dialog",
&editor->control_sel_l->right_color,
gradient_editor_right_color_changed, editor,
editor->instant_update, TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
@ -632,7 +628,7 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
title, "gimp-gradient-segment_split-uniformly",
title, "gimp-gradient-segment-split-uniformly",
GIMP_STOCK_TOOL_BLEND, desc,
GTK_WIDGET (editor),
gimp_standard_help_func,

View File

@ -32,6 +32,8 @@
#include "gui-types.h"
#include "core/gimpviewable.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpviewabledialog.h"
@ -59,21 +61,6 @@ struct _ColorNotebook
};
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha);
static void color_notebook_help_func (const gchar *help_id,
gpointer help_data);
@ -98,7 +85,10 @@ static GList *color_notebooks = NULL;
/* public functions */
ColorNotebook *
color_notebook_new (const gchar *title,
color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
@ -107,149 +97,6 @@ color_notebook_new (const gchar *title,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (NULL,
title,
"gimp-color-selection",
NULL,
NULL,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
ColorNotebook *
color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
return color_notebook_new_internal (viewable,
title,
"gimp-color-selection",
stock_id,
desc,
parent,
dialog_factory,
dialog_identifier,
color,
callback, client_data,
wants_updates, show_alpha);
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static ColorNotebook *
color_notebook_new_internal (GimpViewable *viewable,
const gchar *title,
const gchar *role,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer client_data,
gboolean wants_updates,
gboolean show_alpha)
{
ColorNotebook *cnp;
GtkWidget *table;
@ -257,6 +104,7 @@ color_notebook_new_internal (GimpViewable *viewable,
GtkWidget *arrow;
gint i;
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
@ -272,7 +120,7 @@ color_notebook_new_internal (GimpViewable *viewable,
if (desc)
{
cnp->shell = gimp_viewable_dialog_new (viewable, title, role,
cnp->shell = gimp_viewable_dialog_new (viewable, title, dialog_identifier,
stock_id, desc,
parent,
color_notebook_help_func, NULL,
@ -282,7 +130,7 @@ color_notebook_new_internal (GimpViewable *viewable,
}
else
{
cnp->shell = gimp_dialog_new (title, role,
cnp->shell = gimp_dialog_new (title, dialog_identifier,
parent, 0,
color_notebook_help_func, NULL,
NULL);
@ -385,6 +233,94 @@ color_notebook_new_internal (GimpViewable *viewable,
return cnp;
}
void
color_notebook_free (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
color_notebooks = g_list_remove (color_notebooks, cnp);
/* 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);
}
void
color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable)
{
g_return_if_fail (cnb != NULL);
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
viewable);
}
void
color_notebook_set_title (ColorNotebook *cnb,
const gchar *title)
{
g_return_if_fail (cnb != NULL);
g_return_if_fail (title != NULL);
gtk_window_set_title (GTK_WINDOW (cnb->shell), title);
}
void
color_notebook_set_color (ColorNotebook *cnp,
const GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
g_signal_handlers_block_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
gimp_color_selection_set_color (GIMP_COLOR_SELECTION (cnp->selection), color);
gimp_color_selection_set_old_color (GIMP_COLOR_SELECTION (cnp->selection),
color);
g_signal_handlers_unblock_by_func (cnp->selection,
color_notebook_color_changed,
cnp);
}
void
color_notebook_get_color (ColorNotebook *cnp,
GimpRGB *color)
{
g_return_if_fail (cnp != NULL);
g_return_if_fail (color != NULL);
gimp_color_selection_get_color (GIMP_COLOR_SELECTION (cnp->selection), color);
}
void
color_notebook_show (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_window_present (GTK_WINDOW (cnp->shell));
}
void
color_notebook_hide (ColorNotebook *cnp)
{
g_return_if_fail (cnp != NULL);
gtk_widget_hide (cnp->shell);
}
/* private functions */
static void
color_notebook_help_func (const gchar *help_id,
gpointer help_data)

View File

@ -34,43 +34,33 @@ typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
gpointer callback_data);
ColorNotebook * color_notebook_new (const gchar *title,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_aplha);
ColorNotebook * color_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
const gchar *title,
const gchar *stock_id,
const gchar *desc,
GtkWidget *parent,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const GimpRGB *color,
ColorNotebookCallback callback,
gpointer callback_data,
gboolean wants_update,
gboolean show_alpha);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_free (ColorNotebook *cnb);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_set_viewable (ColorNotebook *cnb,
GimpViewable *viewable);
void color_notebook_set_title (ColorNotebook *cnb,
const gchar *title);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_show (ColorNotebook *cnb);
void color_notebook_hide (ColorNotebook *cnb);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
void color_notebook_set_color (ColorNotebook *cnb,
const GimpRGB *color);
void color_notebook_get_color (ColorNotebook *cnb,
GimpRGB *color);
#endif /* __COLOR_NOTEBOOK_H__ */

View File

@ -925,17 +925,17 @@ gimp_colormap_edit_clicked (GtkWidget *widget,
toplevel_factory = gimp_dialog_factory_from_name ("toplevel");
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (gimage),
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
gimp_colormap_color_notebook_callback,
editor,
FALSE, FALSE);
color_notebook_new (GIMP_VIEWABLE (gimage),
_("Edit Indexed Color"),
GIMP_STOCK_CONVERT_INDEXED,
_("Edit Indexed Image Palette Color"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-colormap-editor-color-dialog",
(const GimpRGB *) &color,
gimp_colormap_color_notebook_callback,
editor,
FALSE, FALSE);
}
else
{

View File

@ -257,7 +257,7 @@ gimp_color_panel_clicked (GtkButton *button)
if (! panel->color_notebook)
{
panel->color_notebook =
color_notebook_new (GIMP_COLOR_BUTTON (button)->title,
color_notebook_new (NULL, GIMP_COLOR_BUTTON (button)->title, NULL, NULL,
GTK_WIDGET (button),
NULL, NULL,
(const GimpRGB *) &color,

View File

@ -1088,17 +1088,17 @@ palette_editor_edit_clicked (GtkWidget *widget,
toplevel_factory = gimp_dialog_factory_from_name ("toplevel");
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (palette),
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
FALSE, FALSE);
color_notebook_new (GIMP_VIEWABLE (palette),
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
GTK_WIDGET (editor),
toplevel_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
FALSE, FALSE);
}
else
{

View File

@ -380,7 +380,7 @@ color_area_edit (GimpContext *context,
toplevel_factory = gimp_dialog_factory_from_name ("toplevel");
color_notebook = color_notebook_new (title,
color_notebook = color_notebook_new (NULL, title, NULL, NULL,
widget,
toplevel_factory,
"gimp-toolbox-color-dialog",