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

changed again to take no paramaters and use _gimp_standard_help_func from

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

	* libgimpwidgets/gimphelpui.[ch] (_gimp_help_init): changed again
	to take no paramaters and use _gimp_standard_help_func from
	gimpwidgets-private.

	* libgimpwidgets/gimpwidgets-private.[ch]: removed the palette
	functions from GimpWidgetVTable. Instead, pass them as
	GimpGetColorFunc to gimp_widgets_init() and make them available as
	_gimp_get_foreground_func and _gimp_get_background_func.

	* libgimpwidgets/gimpcolorbutton.c
	* libgimp/gimpui.c: changed accordingly.

	* app/libgimp_glue.[ch]: removed the palette functions.

	* app/gui/gui.c: added gui_get_foreground_func() and
	gui_get_background_func() and pass them to gimp_widgets_init().
parent 253ed709
2003-05-25 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.[ch] (_gimp_help_init): changed again
to take no paramaters and use _gimp_standard_help_func from
gimpwidgets-private.
* libgimpwidgets/gimpwidgets-private.[ch]: removed the palette
functions from GimpWidgetVTable. Instead, pass them as
GimpGetColorFunc to gimp_widgets_init() and make them available as
_gimp_get_foreground_func and _gimp_get_background_func.
* libgimpwidgets/gimpcolorbutton.c
* libgimp/gimpui.c: changed accordingly.
* app/libgimp_glue.[ch]: removed the palette functions.
* app/gui/gui.c: added gui_get_foreground_func() and
gui_get_background_func() and pass them to gimp_widgets_init().
2003-05-25 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.[ch]: added a GimpHelpFunc parameter to
......@@ -66,6 +66,8 @@
/* local function prototypes */
static void gui_help_func (const gchar *help_data);
static gboolean gui_get_background_func (GimpRGB *color);
static gboolean gui_get_foreground_func (GimpRGB *color);
static void gui_threads_enter (Gimp *gimp);
static void gui_threads_leave (Gimp *gimp);
......@@ -103,10 +105,6 @@ static GHashTable *themes_hash = NULL;
static GimpItemFactory *toolbox_item_factory = NULL;
static GimpItemFactory *image_item_factory = NULL;
/* forward declarations to avoid inclusion of libgimp-glue.h */
gboolean gimp_palette_get_background (GimpRGB *color);
gboolean gimp_palette_get_foreground (GimpRGB *color);
/* public functions */
......@@ -123,9 +121,6 @@ gui_libs_init (gint *argc,
return FALSE;
/* Initialize the eeky vtable needed by libgimpwidgets */
vtable.palette_get_background = gimp_palette_get_background;
vtable.palette_get_foreground = gimp_palette_get_foreground;
vtable.unit_get_number_of_units = gimp_unit_get_number_of_units;
vtable.unit_get_number_of_built_in_units = gimp_unit_get_number_of_built_in_units;
vtable.unit_get_factor = gimp_unit_get_factor;
......@@ -136,7 +131,10 @@ gui_libs_init (gint *argc,
vtable.unit_get_singular = gimp_unit_get_singular;
vtable.unit_get_plural = gimp_unit_get_plural;
gimp_widgets_init (&vtable, gui_help_func);
gimp_widgets_init (&vtable,
gui_help_func,
gui_get_foreground_func,
gui_get_background_func);
g_type_class_ref (GIMP_TYPE_COLOR_SELECT);
......@@ -406,6 +404,26 @@ gui_help_func (const gchar *help_data)
gimp_help (the_gimp, NULL, help_data);
}
static gboolean
gui_get_foreground_func (GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_foreground (gimp_get_user_context (the_gimp), color);
return TRUE;
}
static gboolean
gui_get_background_func (GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_background (gimp_get_user_context (the_gimp), color);
return TRUE;
}
static void
gui_threads_enter (Gimp *gimp)
{
......
......@@ -18,14 +18,10 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include "libgimpcolor/gimpcolor.h"
#include "core/core-types.h"
#include "widgets/widgets-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpunit.h"
#include "app_procs.h"
......@@ -34,47 +30,6 @@
#include "libgimp_glue.h"
gboolean
gimp_palette_set_foreground (const GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_set_foreground (gimp_get_user_context (the_gimp), color);
return TRUE;
}
gboolean
gimp_palette_get_foreground (GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_foreground (gimp_get_user_context (the_gimp), color);
return TRUE;
}
gboolean
gimp_palette_set_background (const GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_set_background (gimp_get_user_context (the_gimp), color);
return TRUE;
}
gboolean
gimp_palette_get_background (GimpRGB *color)
{
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_background (gimp_get_user_context (the_gimp), color);
return TRUE;
}
gint
gimp_unit_get_number_of_units (void)
{
......
......@@ -30,11 +30,6 @@
*/
gboolean gimp_palette_set_foreground (const GimpRGB *color);
gboolean gimp_palette_get_foreground (GimpRGB *color);
gboolean gimp_palette_set_background (const GimpRGB *color);
gboolean gimp_palette_get_background (GimpRGB *color);
gint gimp_unit_get_number_of_units (void);
gint gimp_unit_get_number_of_built_in_units (void) G_GNUC_CONST;
GimpUnit gimp_unit_new (gchar *identifier,
......
......@@ -90,8 +90,6 @@ gimp_ui_init (const gchar *prog_name,
gtk_preview_set_gamma (gimp_gamma ());
/* Initialize the eeky vtable needed by libgimpwidgets */
vtable.palette_get_background = gimp_palette_get_background;
vtable.palette_get_foreground = gimp_palette_get_foreground;
vtable.unit_get_number_of_units = gimp_unit_get_number_of_units;
vtable.unit_get_number_of_built_in_units = gimp_unit_get_number_of_built_in_units;
vtable.unit_get_factor = gimp_unit_get_factor;
......@@ -102,7 +100,10 @@ gimp_ui_init (const gchar *prog_name,
vtable.unit_get_singular = gimp_unit_get_singular;
vtable.unit_get_plural = gimp_unit_get_plural;
gimp_widgets_init (&vtable, gimp_ui_help_func);
gimp_widgets_init (&vtable,
gimp_ui_help_func,
gimp_palette_get_foreground,
gimp_palette_get_background);
if (! gimp_show_tool_tips ())
gimp_help_disable_tooltips ();
......
......@@ -207,9 +207,8 @@ gimp_color_button_destroy (GtkObject *object)
gtk_widget_destroy (button->color_area);
button->color_area = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
......@@ -464,10 +463,12 @@ gimp_color_button_use_color (gpointer callback_data,
switch (type)
{
case GIMP_COLOR_BUTTON_COLOR_FG:
_gimp_eek.palette_get_foreground (&color);
if (_gimp_get_foreground_func)
_gimp_get_foreground_func (&color);
break;
case GIMP_COLOR_BUTTON_COLOR_BG:
_gimp_eek.palette_get_background (&color);
if (_gimp_get_background_func)
_gimp_get_background_func (&color);
break;
case GIMP_COLOR_BUTTON_COLOR_BLACK:
gimp_rgb_set (&color, 0.0, 0.0, 0.0);
......
......@@ -39,6 +39,7 @@
#include "gimpdialog.h"
#include "gimphelpui.h"
#include "gimpwidgets-private.h"
typedef enum
......@@ -66,9 +67,8 @@ static gboolean gimp_help_tips_query_idle_start (gpointer tips_query
/* local variables */
static GimpHelpFunc the_help_func = NULL;
static GtkTooltips *tool_tips = NULL;
static GtkWidget *tips_query = NULL;
static GtkTooltips *tool_tips = NULL;
static GtkWidget *tips_query = NULL;
/* public functions */
......@@ -84,14 +84,13 @@ static GtkWidget *tips_query = NULL;
* Nota that this function is called automatically by gimp_widgets_init().
**/
void
_gimp_help_init (GimpHelpFunc standard_help_func)
_gimp_help_init (void)
{
g_return_if_fail (standard_help_func != NULL);
if (the_help_func)
g_error ("_gimp_help_init() must only be called once!");
the_help_func = standard_help_func;
if (tool_tips)
{
g_warning ("_gimp_help_init() must only be called once!");
return;
}
tool_tips = gtk_tooltips_new ();
......@@ -125,14 +124,14 @@ gimp_help_disable_tooltips (void)
void
gimp_standard_help_func (const gchar *help_data)
{
if (! the_help_func)
if (! _gimp_standard_help_func)
{
g_warning ("gimp_standard_help_func(): you must call _gimp_help_init() "
g_warning ("gimp_standard_help_func(): you must call gimp_widgets_init() "
"before using the help system");
return;
}
(* the_help_func) (help_data);
(* _gimp_standard_help_func) (help_data);
}
/**
......
......@@ -28,7 +28,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
void _gimp_help_init (GimpHelpFunc standard_help_func);
void _gimp_help_init (void);
void gimp_help_enable_tooltips (void);
void gimp_help_disable_tooltips (void);
......
......@@ -35,12 +35,17 @@
#include "themes/Default/images/gimp-wilber-pixbufs.h"
GimpWidgetsVTable _gimp_eek;
GimpWidgetsVTable _gimp_eek = { NULL, };
GimpHelpFunc _gimp_standard_help_func = NULL;
GimpGetColorFunc _gimp_get_foreground_func = NULL;
GimpGetColorFunc _gimp_get_background_func = NULL;
void
gimp_widgets_init (GimpWidgetsVTable *vtable,
GimpHelpFunc standard_help_func)
GimpHelpFunc standard_help_func,
GimpGetColorFunc get_foreground_func,
GimpGetColorFunc get_background_func)
{
static gboolean gimp_widgets_initialized = FALSE;
......@@ -62,7 +67,10 @@ gimp_widgets_init (GimpWidgetsVTable *vtable,
if (gimp_widgets_initialized)
g_error ("gimp_widgets_init() must only be called once!");
_gimp_eek = *vtable;
_gimp_eek = *vtable;
_gimp_standard_help_func = standard_help_func;
_gimp_get_foreground_func = get_foreground_func;
_gimp_get_background_func = get_background_func;
gimp_stock_init ();
......@@ -77,7 +85,7 @@ gimp_widgets_init (GimpWidgetsVTable *vtable,
g_list_foreach (icon_list, (GFunc) g_object_unref, NULL);
g_list_free (icon_list);
_gimp_help_init (standard_help_func);
_gimp_help_init ();
gimp_widgets_initialized = TRUE;
}
......
......@@ -24,13 +24,13 @@
#define __GIMP_WIDGETS_PRIVATE_H__
typedef gboolean (* GimpGetColorFunc) (GimpRGB *color);
typedef struct _GimpWidgetsVTable GimpWidgetsVTable;
struct _GimpWidgetsVTable
{
gboolean (* palette_get_background) (GimpRGB *background);
gboolean (* palette_get_foreground) (GimpRGB *background);
gint (* unit_get_number_of_units) (void);
gint (* unit_get_number_of_built_in_units) (void);
gdouble (* unit_get_factor) (GimpUnit unit);
......@@ -47,14 +47,20 @@ struct _GimpWidgetsVTable
void (* _reserved_4) (void);
};
extern GimpWidgetsVTable _gimp_eek;
extern GimpHelpFunc _gimp_standard_help_func;
extern GimpGetColorFunc _gimp_get_foreground_func;
extern GimpGetColorFunc _gimp_get_background_func;
G_BEGIN_DECLS
void gimp_widgets_init (GimpWidgetsVTable *vtable,
GimpHelpFunc standard_help_func);
GimpHelpFunc standard_help_func,
GimpGetColorFunc get_foreground_func,
GimpGetColorFunc get_background_func);
G_END_DECLS
......
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