app/fileops.c Make sure that we don't try to destroy query_boxes twice or

2000-11-18  Michael Natterer  <mitch@gimp.org>

	* app/fileops.c
	* libgimp/gimpquerybox.[ch]: Make sure that we don't try to destroy
	query_boxes twice or try to disconnect not-any-more connected
	handlers.

	* app/color_notebook.c
	* app/gimpcontext.[ch]
	* app/gimphelp.[ch]
	* app/lc_dialog.[ch]
	* app/menus.h
	* app/preferences_dialog.c
	* app/tools.[ch]
	* libgimp/gimpcolorbutton.[ch]
	* libgimp/gimpdialog.[ch]
	* libgimp/gimpexport.[ch]
	* libgimp/gimpfileselection.[ch]
	* libgimp/gimphelpui.[ch]
	* libgimp/gimppatheditor.[ch]
	* libgimp/gimppixmap.[ch]
	* libgimp/gimpsizeentry.[ch]
	* libgimp/gimpui.[ch]
	* libgimp/gimpunitmenu.[ch]
	* libgimp/gimpwidgets.[ch]: in a coding attack, changed help_data
	and many other strings passed to UI functions to (const gchar *).
	As a consequence, I had to fix lots of warnings ;)

	* plug-ins/common/tga.c
	* plug-ins/imagemap/imap_main.c: fixed warnings.

	Code cleanup and indentation all over the place.
This commit is contained in:
Michael Natterer 2000-11-18 00:25:42 +00:00 committed by Michael Natterer
parent e1234e642f
commit cdd0a5147d
77 changed files with 1685 additions and 1387 deletions

View file

@ -1,3 +1,36 @@
2000-11-18 Michael Natterer <mitch@gimp.org>
* app/fileops.c
* libgimp/gimpquerybox.[ch]: Make sure that we don't try to destroy
query_boxes twice or try to disconnect not-any-more connected
handlers.
* app/color_notebook.c
* app/gimpcontext.[ch]
* app/gimphelp.[ch]
* app/lc_dialog.[ch]
* app/menus.h
* app/preferences_dialog.c
* app/tools.[ch]
* libgimp/gimpcolorbutton.[ch]
* libgimp/gimpdialog.[ch]
* libgimp/gimpexport.[ch]
* libgimp/gimpfileselection.[ch]
* libgimp/gimphelpui.[ch]
* libgimp/gimppatheditor.[ch]
* libgimp/gimppixmap.[ch]
* libgimp/gimpsizeentry.[ch]
* libgimp/gimpui.[ch]
* libgimp/gimpunitmenu.[ch]
* libgimp/gimpwidgets.[ch]: in a coding attack, changed help_data
and many other strings passed to UI functions to (const gchar *).
As a consequence, I had to fix lots of warnings ;)
* plug-ins/common/tga.c
* plug-ins/imagemap/imap_main.c: fixed warnings.
Code cleanup and indentation all over the place.
2000-11-16 Sven Neumann <sven@gimp.org> 2000-11-16 Sven Neumann <sven@gimp.org>
* plug-ins/print/Makefile.am * plug-ins/print/Makefile.am

View file

@ -35,19 +35,6 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer,
gint,
gint,
gint);
static void color_notebook_page_switch (GtkWidget *,
GtkNotebookPage *,
guint);
static void color_notebook_help_func (gchar *help_data);
/* information we keep on each registered colour selector */ /* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo ColorSelectorInfo; typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
ColorSelectorInstance *next; ColorSelectorInstance *next;
}; };
static void selector_death (ColorSelectorInfo *info);
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer data,
gint red,
gint green,
gint blue);
static void color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_selector_death (ColorSelectorInfo *info);
/* master list of all registered colour selectors */ /* master list of all registered colour selectors */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell = cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection", gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp, color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE, GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--; csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active) if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info); color_notebook_selector_death (csel->info);
g_free (csel); g_free (csel);
csel = next; csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
} }
static void static void
color_notebook_help_func (gchar *data) color_notebook_help_func (const gchar *data)
{ {
ColorNotebook *cnp; ColorNotebook *cnp;
gchar *help_path; gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback; info->death_callback = callback;
info->death_data = data; info->death_data = data;
if (info->refs == 0) if (info->refs == 0)
selector_death (info); color_notebook_selector_death (info);
return TRUE; return TRUE;
} }
info = info->next; info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
} }
static void static void
selector_death (ColorSelectorInfo *info) color_notebook_selector_death (ColorSelectorInfo *info)
{ {
ColorSelectorInfo *here, *prev; ColorSelectorInfo *here, *prev;

View file

@ -575,7 +575,7 @@ gimp_context_get_type (void)
} }
GimpContext * GimpContext *
gimp_context_new (gchar *name, gimp_context_new (const gchar *name,
GimpContext *template) GimpContext *template)
{ {
GimpContext *context; GimpContext *context;
@ -663,7 +663,7 @@ gimp_context_get_name (GimpContext *context)
void void
gimp_context_set_name (GimpContext *context, gimp_context_set_name (GimpContext *context,
gchar *name) const gchar *name)
{ {
context_check_current (context); context_check_current (context);
context_return_if_fail (context); context_return_if_fail (context);

View file

@ -147,7 +147,7 @@ struct _GimpContextClass
}; };
GtkType gimp_context_get_type (void); GtkType gimp_context_get_type (void);
GimpContext * gimp_context_new (gchar *name, GimpContext * gimp_context_new (const gchar *name,
GimpContext *template); GimpContext *template);
/* TODO: - gimp_context_find () /* TODO: - gimp_context_find ()
@ -179,7 +179,7 @@ GimpContext * gimp_context_get_standard (void);
*/ */
gchar * gimp_context_get_name (GimpContext *context); gchar * gimp_context_get_name (GimpContext *context);
void gimp_context_set_name (GimpContext *context, void gimp_context_set_name (GimpContext *context,
gchar *name); const gchar *name);
GimpContext * gimp_context_get_parent (GimpContext *context); GimpContext * gimp_context_get_parent (GimpContext *context);
void gimp_context_set_parent (GimpContext *context, void gimp_context_set_parent (GimpContext *context,

View file

@ -35,19 +35,6 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer,
gint,
gint,
gint);
static void color_notebook_page_switch (GtkWidget *,
GtkNotebookPage *,
guint);
static void color_notebook_help_func (gchar *help_data);
/* information we keep on each registered colour selector */ /* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo ColorSelectorInfo; typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
ColorSelectorInstance *next; ColorSelectorInstance *next;
}; };
static void selector_death (ColorSelectorInfo *info);
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer data,
gint red,
gint green,
gint blue);
static void color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_selector_death (ColorSelectorInfo *info);
/* master list of all registered colour selectors */ /* master list of all registered colour selectors */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell = cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection", gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp, color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE, GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--; csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active) if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info); color_notebook_selector_death (csel->info);
g_free (csel); g_free (csel);
csel = next; csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
} }
static void static void
color_notebook_help_func (gchar *data) color_notebook_help_func (const gchar *data)
{ {
ColorNotebook *cnp; ColorNotebook *cnp;
gchar *help_path; gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback; info->death_callback = callback;
info->death_data = data; info->death_data = data;
if (info->refs == 0) if (info->refs == 0)
selector_death (info); color_notebook_selector_death (info);
return TRUE; return TRUE;
} }
info = info->next; info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
} }
static void static void
selector_death (ColorSelectorInfo *info) color_notebook_selector_death (ColorSelectorInfo *info)
{ {
ColorSelectorInfo *here, *prev; ColorSelectorInfo *here, *prev;

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */ /* preferences local functions */
static PrefsState prefs_check_settings (void); static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *); static void prefs_ok_callback (GtkWidget *widget,
static void prefs_save_callback (GtkWidget *, GtkWidget *); GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *); static void prefs_save_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_toggle_callback (GtkWidget *widget, gpointer data); static void prefs_toggle_callback (GtkWidget *widget,
static void prefs_preview_size_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data); static void prefs_preview_size_callback (GtkWidget *widget,
static void prefs_string_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data); static void prefs_nav_preview_size_callback (GtkWidget *widget,
static void prefs_filename_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_path_callback (GtkWidget *widget, gpointer data); static void prefs_string_callback (GtkWidget *widget,
static void prefs_clear_session_info_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_default_size_callback (GtkWidget *widget, gpointer data); static void prefs_text_callback (GtkWidget *widget,
static void prefs_default_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_res_source_callback (GtkWidget *widget, gpointer data); static void prefs_filename_callback (GtkWidget *widget,
static void prefs_monitor_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget, gpointer data); static void prefs_path_callback (GtkWidget *widget,
gpointer data);
static void prefs_clear_session_info_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_res_source_callback (GtkWidget *widget,
gpointer data);
static void prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
gpointer data);
static void prefs_restart_notification (void); static void prefs_restart_notification (void);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
} }
static void static void
prefs_help_func (gchar *help_data) prefs_help_func (const gchar *help_data)
{ {
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *event_box; GtkWidget *event_box;

View file

@ -629,18 +629,14 @@ file_revert_callback (GtkWidget *widget,
FALSE, FALSE,
text, text,
_("Yes"), _("No"), _("Yes"), _("No"),
NULL, NULL, GTK_OBJECT (gimage), "destroy",
file_revert_confirm_callback, file_revert_confirm_callback,
gimage); gimage);
gtk_object_set_data (GTK_OBJECT (gimage), REVERT_DATA_KEY, query_box);
gtk_signal_connect_object_while_alive (GTK_OBJECT (gimage), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (query_box));
g_free (text); g_free (text);
gtk_object_set_data (GTK_OBJECT (gimage), REVERT_DATA_KEY, query_box);
gtk_widget_show (query_box); gtk_widget_show (query_box);
} }
} }

View file

@ -575,7 +575,7 @@ gimp_context_get_type (void)
} }
GimpContext * GimpContext *
gimp_context_new (gchar *name, gimp_context_new (const gchar *name,
GimpContext *template) GimpContext *template)
{ {
GimpContext *context; GimpContext *context;
@ -663,7 +663,7 @@ gimp_context_get_name (GimpContext *context)
void void
gimp_context_set_name (GimpContext *context, gimp_context_set_name (GimpContext *context,
gchar *name) const gchar *name)
{ {
context_check_current (context); context_check_current (context);
context_return_if_fail (context); context_return_if_fail (context);

View file

@ -147,7 +147,7 @@ struct _GimpContextClass
}; };
GtkType gimp_context_get_type (void); GtkType gimp_context_get_type (void);
GimpContext * gimp_context_new (gchar *name, GimpContext * gimp_context_new (const gchar *name,
GimpContext *template); GimpContext *template);
/* TODO: - gimp_context_find () /* TODO: - gimp_context_find ()
@ -179,7 +179,7 @@ GimpContext * gimp_context_get_standard (void);
*/ */
gchar * gimp_context_get_name (GimpContext *context); gchar * gimp_context_get_name (GimpContext *context);
void gimp_context_set_name (GimpContext *context, void gimp_context_set_name (GimpContext *context,
gchar *name); const gchar *name);
GimpContext * gimp_context_get_parent (GimpContext *context); GimpContext * gimp_context_get_parent (GimpContext *context);
void gimp_context_set_parent (GimpContext *context, void gimp_context_set_parent (GimpContext *context,

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimphelp.c * gimphelp.c
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org> * Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -53,13 +53,13 @@ struct _GimpIdleHelp
}; };
/* local function prototypes */ /* local function prototypes */
static gint gimp_idle_help (gpointer data); static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (gchar *help_path, static gboolean gimp_help_internal (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data); const gchar *help_data);
static void gimp_help_netscape (gchar *help_path, static void gimp_help_netscape (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data); const gchar *help_data);
/**********************/ /**********************/
/* public functions */ /* public functions */
@ -67,15 +67,15 @@ static void gimp_help_netscape (gchar *help_path,
/* The standard help function */ /* The standard help function */
void void
gimp_standard_help_func (gchar *help_data) gimp_standard_help_func (const gchar *help_data)
{ {
gimp_help (NULL, help_data); gimp_help (NULL, help_data);
} }
/* the main help function */ /* the main help function */
void void
gimp_help (gchar *help_path, gimp_help (const gchar *help_path,
gchar *help_data) const gchar *help_data)
{ {
if (use_help) if (use_help)
{ {
@ -169,9 +169,9 @@ gimp_help_internal_not_found_callback (GtkWidget *widget,
} }
static gboolean static gboolean
gimp_help_internal (gchar *help_path, gimp_help_internal (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data) const gchar *help_data)
{ {
ProcRecord *proc_rec; ProcRecord *proc_rec;
@ -207,11 +207,11 @@ gimp_help_internal (gchar *help_path,
args[0].arg_type = PDB_INT32; args[0].arg_type = PDB_INT32;
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].arg_type = PDB_STRING; args[1].arg_type = PDB_STRING;
args[1].value.pdb_pointer = help_path; args[1].value.pdb_pointer = (gpointer) help_path;
args[2].arg_type = PDB_STRING; args[2].arg_type = PDB_STRING;
args[2].value.pdb_pointer = current_locale; args[2].value.pdb_pointer = (gpointer) current_locale;
args[3].arg_type = PDB_STRING; args[3].arg_type = PDB_STRING;
args[3].value.pdb_pointer = help_data; args[3].value.pdb_pointer = (gpointer) help_data;
plug_in_run (proc_rec, args, 4, FALSE, TRUE, 0); plug_in_run (proc_rec, args, 4, FALSE, TRUE, 0);
@ -237,9 +237,9 @@ gimp_help_internal (gchar *help_path,
} }
static void static void
gimp_help_netscape (gchar *help_path, gimp_help_netscape (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data) const gchar *help_data)
{ {
Argument *return_vals; Argument *return_vals;
gint nreturn_vals; gint nreturn_vals;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimphelp.h * gimphelp.h
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org> * Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,21 +18,26 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMP_HELP_H__ #ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__ #define __GIMP_HELP_H__
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimp/gimphelpui.h" #include "libgimp/gimphelpui.h"
enum enum
{ {
HELP_BROWSER_GIMP, HELP_BROWSER_GIMP,
HELP_BROWSER_NETSCAPE HELP_BROWSER_NETSCAPE
}; };
/* the main help function */ /* the main help function */
void gimp_help (gchar *help_path, void gimp_help (const gchar *help_path,
gchar *help_data); const gchar *help_data);
#endif /* __GIMP_HELP_H__ */ #endif /* __GIMP_HELP_H__ */

View file

@ -35,19 +35,6 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer,
gint,
gint,
gint);
static void color_notebook_page_switch (GtkWidget *,
GtkNotebookPage *,
guint);
static void color_notebook_help_func (gchar *help_data);
/* information we keep on each registered colour selector */ /* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo ColorSelectorInfo; typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
ColorSelectorInstance *next; ColorSelectorInstance *next;
}; };
static void selector_death (ColorSelectorInfo *info);
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer data,
gint red,
gint green,
gint blue);
static void color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_selector_death (ColorSelectorInfo *info);
/* master list of all registered colour selectors */ /* master list of all registered colour selectors */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell = cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection", gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp, color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE, GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--; csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active) if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info); color_notebook_selector_death (csel->info);
g_free (csel); g_free (csel);
csel = next; csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
} }
static void static void
color_notebook_help_func (gchar *data) color_notebook_help_func (const gchar *data)
{ {
ColorNotebook *cnp; ColorNotebook *cnp;
gchar *help_path; gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback; info->death_callback = callback;
info->death_data = data; info->death_data = data;
if (info->refs == 0) if (info->refs == 0)
selector_death (info); color_notebook_selector_death (info);
return TRUE; return TRUE;
} }
info = info->next; info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
} }
static void static void
selector_death (ColorSelectorInfo *info) color_notebook_selector_death (ColorSelectorInfo *info)
{ {
ColorSelectorInfo *here, *prev; ColorSelectorInfo *here, *prev;

View file

@ -26,8 +26,8 @@ struct _GimpItemFactoryEntry
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
gchar *help_page; const gchar *help_page;
gchar *description; gchar *description;
}; };
void menus_get_toolbox_menubar (GtkWidget **menubar, void menus_get_toolbox_menubar (GtkWidget **menubar,

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */ /* preferences local functions */
static PrefsState prefs_check_settings (void); static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *); static void prefs_ok_callback (GtkWidget *widget,
static void prefs_save_callback (GtkWidget *, GtkWidget *); GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *); static void prefs_save_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_toggle_callback (GtkWidget *widget, gpointer data); static void prefs_toggle_callback (GtkWidget *widget,
static void prefs_preview_size_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data); static void prefs_preview_size_callback (GtkWidget *widget,
static void prefs_string_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data); static void prefs_nav_preview_size_callback (GtkWidget *widget,
static void prefs_filename_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_path_callback (GtkWidget *widget, gpointer data); static void prefs_string_callback (GtkWidget *widget,
static void prefs_clear_session_info_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_default_size_callback (GtkWidget *widget, gpointer data); static void prefs_text_callback (GtkWidget *widget,
static void prefs_default_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_res_source_callback (GtkWidget *widget, gpointer data); static void prefs_filename_callback (GtkWidget *widget,
static void prefs_monitor_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget, gpointer data); static void prefs_path_callback (GtkWidget *widget,
gpointer data);
static void prefs_clear_session_info_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_res_source_callback (GtkWidget *widget,
gpointer data);
static void prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
gpointer data);
static void prefs_restart_notification (void); static void prefs_restart_notification (void);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
} }
static void static void
prefs_help_func (gchar *help_data) prefs_help_func (const gchar *help_data)
{ {
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *event_box; GtkWidget *event_box;

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -32,48 +33,65 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h" #include "libgimp/gimplimits.h"
#include "libgimp/gimpmath.h"
#define MENU_THUMBNAIL_WIDTH 24
#define MENU_THUMBNAIL_WIDTH 24
#define MENU_THUMBNAIL_HEIGHT 24 #define MENU_THUMBNAIL_HEIGHT 24
/* local function prototypes */
static void lc_dialog_update (GimpImage *);
static void lc_dialog_image_menu_callback (GtkWidget *, gpointer);
static void lc_dialog_auto_callback (GtkWidget *, gpointer);
static gint lc_dialog_close_callback (GtkWidget *, gpointer);
static void lc_dialog_add_callback (GimpSet *, GimpImage *, gpointer);
static void lc_dialog_remove_callback (GimpSet *, GimpImage *, gpointer);
static void lc_dialog_change_image (GimpContext *, GimpImage *,
gpointer);
static void lc_dialog_help_func (gchar *);
static void lc_dialog_image_menu_preview_update_callback (GtkWidget *, /* local function prototypes */
gpointer); static void lc_dialog_update (GimpImage *gimage);
static void lc_dialog_fill_preview_with_thumb (GtkWidget *, GimpImage *, static void lc_dialog_image_menu_callback (GtkWidget *widget,
gint, gint); gpointer data);
static void lc_dialog_auto_callback (GtkWidget *widget,
gpointer data);
static gint lc_dialog_close_callback (GtkWidget *widget,
gpointer data);
static void lc_dialog_add_callback (GimpSet *set,
GimpImage *gimage,
gpointer data);
static void lc_dialog_remove_callback (GimpSet *set,
GimpImage *gimage,
gpointer data);
static void lc_dialog_change_image (GimpContext *context,
GimpImage *gimage,
gpointer data);
static void lc_dialog_help_func (const gchar *help_data);
static void lc_dialog_image_menu_preview_update_callback (GtkWidget *widget,
gpointer data);
static void lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
GimpImage *gimage,
gint width,
gint height);
/* FIXME: move these to a better place */ /* FIXME: move these to a better place */
static GtkWidget * lc_dialog_create_image_menu (GimpImage **, gint *, static GtkWidget * lc_dialog_create_image_menu (GimpImage **def,
GtkSignalFunc); gint *default_index,
static void lc_dialog_create_image_menu_callback (gpointer, gpointer); GtkSignalFunc callback);
static void lc_dialog_create_image_menu_callback (gpointer image,
gpointer data);
/* the main dialog structure */ /* the main dialog structure */
LCDialog * lc_dialog = NULL; LCDialog * lc_dialog = NULL;
/*********************************/ /*********************************/
/* Public L&C dialog functions */ /* Public L&C dialog functions */
/*********************************/ /*********************************/
void void
lc_dialog_create (GimpImage* gimage) lc_dialog_create (GimpImage *gimage)
{ {
GtkWidget *util_box; GtkWidget *util_box;
GtkWidget *auto_button; GtkWidget *auto_button;
GtkWidget *button; GtkWidget *button;
GtkWidget *label; GtkWidget *label;
GtkWidget *separator; GtkWidget *separator;
gint default_index; gint default_index;
if (lc_dialog) if (lc_dialog)
{ {
@ -240,8 +258,8 @@ lc_dialog_free (void)
void void
lc_dialog_rebuild (gint new_preview_size) lc_dialog_rebuild (gint new_preview_size)
{ {
GimpImage* gimage; GimpImage *gimage;
gboolean flag; gboolean flag;
gimage = NULL; gimage = NULL;
flag = FALSE; flag = FALSE;
@ -341,8 +359,8 @@ lc_dialog_image_menu_preview_update_callback (GtkWidget *widget,
void void
lc_dialog_update_image_list (void) lc_dialog_update_image_list (void)
{ {
GimpImage* default_gimage; GimpImage *default_gimage;
gint default_index; gint default_index;
if (lc_dialog == NULL) if (lc_dialog == NULL)
return; return;
@ -382,7 +400,7 @@ lc_dialog_update_image_list (void)
/**********************************/ /**********************************/
static void static void
lc_dialog_update (GimpImage* gimage) lc_dialog_update (GimpImage *gimage)
{ {
if (! lc_dialog || lc_dialog->gimage == gimage) if (! lc_dialog || lc_dialog->gimage == gimage)
return; return;
@ -429,13 +447,13 @@ lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
/* Get right aspect ratio */ /* Get right aspect ratio */
if (dwidth > dheight) if (dwidth > dheight)
{ {
height = (gint)(((gdouble)width * (gdouble)dheight) / (gdouble)dwidth + 0.5); height = RINT (((gdouble)width * (gdouble)dheight) / (gdouble)dwidth);
width = (gint)(((gdouble)dwidth * (gdouble)height) / (gdouble)dheight + 0.5); width = RINT (((gdouble)dwidth * (gdouble)height) / (gdouble)dheight);
} }
else else
{ {
width = (gint)(((gdouble)height * (gdouble)dwidth) / (gdouble)dheight + 0.5); width = RINT (((gdouble)height * (gdouble)dwidth) / (gdouble)dheight);
height = (gint)(((gdouble)dheight * (gdouble)width) / (gdouble)dwidth + 0.5); height = RINT (((gdouble)dheight * (gdouble)width) / (gdouble)dwidth);
} }
buf = gimp_image_construct_composite_preview (gimage, width, height); buf = gimp_image_construct_composite_preview (gimage, width, height);
@ -459,16 +477,16 @@ lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
{ {
if (bpp == 4) if (bpp == 4)
{ {
r = ((gdouble)src[x*4+0])/255.0; r = ((gdouble) src[x * 4 + 0]) / 255.0;
g = ((gdouble)src[x*4+1])/255.0; g = ((gdouble) src[x * 4 + 1]) / 255.0;
b = ((gdouble)src[x*4+2])/255.0; b = ((gdouble) src[x * 4 + 2]) / 255.0;
a = ((gdouble)src[x*4+3])/255.0; a = ((gdouble) src[x * 4 + 3]) / 255.0;
} }
else else
{ {
r = ((gdouble)src[x*bpp+0])/255.0; r = ((gdouble) src[x * bpp + 0]) / 255.0;
g = b = r; g = b = r;
a = ((gdouble)src[x*bpp+1])/255.0; a = ((gdouble) src[x * bpp + 1]) / 255.0;
} }
if ((x / GIMP_CHECK_SIZE_SM) & 1) if ((x / GIMP_CHECK_SIZE_SM) & 1)
@ -710,7 +728,7 @@ lc_dialog_change_image (GimpContext *context,
} }
static void static void
lc_dialog_help_func (gchar *help_data) lc_dialog_help_func (const gchar *help_data)
{ {
gchar *help_page; gchar *help_page;
gint page_num; gint page_num;

View file

@ -15,15 +15,20 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __LC_DIALOG_H__ #ifndef __LC_DIALOG_H__
#define __LC_DIALOG_H__ #define __LC_DIALOG_H__
#include "gimpimageF.h" #include "gimpimageF.h"
void lc_dialog_create (GimpImage *gimage); void lc_dialog_create (GimpImage *gimage);
void lc_dialog_free (void); void lc_dialog_free (void);
void lc_dialog_rebuild (int); /* implies free & create */ /* implies free & create
*/
void lc_dialog_rebuild (gint new_preview_size);
void lc_dialog_flush (void); void lc_dialog_flush (void);

View file

@ -26,8 +26,8 @@ struct _GimpItemFactoryEntry
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
gchar *help_page; const gchar *help_page;
gchar *description; gchar *description;
}; };
void menus_get_toolbox_menubar (GtkWidget **menubar, void menus_get_toolbox_menubar (GtkWidget **menubar,

View file

@ -26,8 +26,8 @@ struct _GimpItemFactoryEntry
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
gchar *help_page; const gchar *help_page;
gchar *description; gchar *description;
}; };
void menus_get_toolbox_menubar (GtkWidget **menubar, void menus_get_toolbox_menubar (GtkWidget **menubar,

View file

@ -1,5 +1,5 @@
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */ /* preferences local functions */
static PrefsState prefs_check_settings (void); static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *); static void prefs_ok_callback (GtkWidget *widget,
static void prefs_save_callback (GtkWidget *, GtkWidget *); GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *); static void prefs_save_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_cancel_callback (GtkWidget *widget,
GtkWidget *dlg);
static void prefs_toggle_callback (GtkWidget *widget, gpointer data); static void prefs_toggle_callback (GtkWidget *widget,
static void prefs_preview_size_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data); static void prefs_preview_size_callback (GtkWidget *widget,
static void prefs_string_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data); static void prefs_nav_preview_size_callback (GtkWidget *widget,
static void prefs_filename_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_path_callback (GtkWidget *widget, gpointer data); static void prefs_string_callback (GtkWidget *widget,
static void prefs_clear_session_info_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_default_size_callback (GtkWidget *widget, gpointer data); static void prefs_text_callback (GtkWidget *widget,
static void prefs_default_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_res_source_callback (GtkWidget *widget, gpointer data); static void prefs_filename_callback (GtkWidget *widget,
static void prefs_monitor_resolution_callback (GtkWidget *widget, gpointer data); gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget, gpointer data); static void prefs_path_callback (GtkWidget *widget,
gpointer data);
static void prefs_clear_session_info_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_default_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_res_source_callback (GtkWidget *widget,
gpointer data);
static void prefs_monitor_resolution_callback (GtkWidget *widget,
gpointer data);
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
gpointer data);
static void prefs_restart_notification (void); static void prefs_restart_notification (void);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
} }
static void static void
prefs_help_func (gchar *help_data) prefs_help_func (const gchar *help_data)
{ {
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *event_box; GtkWidget *event_box;

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -1487,7 +1488,7 @@ tools_new_tool (ToolType tool_type)
} }
void void
tools_help_func (gchar *help_data) tools_help_func (const gchar *help_data)
{ {
gimp_standard_help_func (tool_info[(gint) active_tool->type].private_tip); gimp_standard_help_func (tool_info[(gint) active_tool->type].private_tip);
} }

View file

@ -94,19 +94,19 @@ struct _ToolInfo
{ {
ToolOptions *tool_options; ToolOptions *tool_options;
gchar *tool_name; gchar *tool_name;
gchar *menu_path; gchar *menu_path;
gchar *menu_accel; gchar *menu_accel;
gchar **icon_data; gchar **icon_data;
GdkPixmap *icon_pixmap; GdkPixmap *icon_pixmap;
GdkBitmap *icon_mask; GdkBitmap *icon_mask;
gchar *tool_desc; gchar *tool_desc;
gchar *private_tip; const gchar *private_tip;
ToolType tool_id; ToolType tool_id;
ToolInfoNewFunc new_func; ToolInfoNewFunc new_func;
ToolInfoFreeFunc free_func; ToolInfoFreeFunc free_func;
@ -135,7 +135,7 @@ void tools_initialize (ToolType tool_type,
void active_tool_control (ToolAction action, void active_tool_control (ToolAction action,
void *gdisp_ptr); void *gdisp_ptr);
void tools_help_func (gchar *help_data); void tools_help_func (const gchar *help_data);
void tools_register (ToolType tool_type, void tools_register (ToolType tool_type,
ToolOptions *tool_options); ToolOptions *tool_options);

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "config.h" #include "config.h"
#include "appenv.h" #include "appenv.h"
@ -1487,7 +1488,7 @@ tools_new_tool (ToolType tool_type)
} }
void void
tools_help_func (gchar *help_data) tools_help_func (const gchar *help_data)
{ {
gimp_standard_help_func (tool_info[(gint) active_tool->type].private_tip); gimp_standard_help_func (tool_info[(gint) active_tool->type].private_tip);
} }

View file

@ -94,19 +94,19 @@ struct _ToolInfo
{ {
ToolOptions *tool_options; ToolOptions *tool_options;
gchar *tool_name; gchar *tool_name;
gchar *menu_path; gchar *menu_path;
gchar *menu_accel; gchar *menu_accel;
gchar **icon_data; gchar **icon_data;
GdkPixmap *icon_pixmap; GdkPixmap *icon_pixmap;
GdkBitmap *icon_mask; GdkBitmap *icon_mask;
gchar *tool_desc; gchar *tool_desc;
gchar *private_tip; const gchar *private_tip;
ToolType tool_id; ToolType tool_id;
ToolInfoNewFunc new_func; ToolInfoNewFunc new_func;
ToolInfoFreeFunc free_func; ToolInfoFreeFunc free_func;
@ -135,7 +135,7 @@ void tools_initialize (ToolType tool_type,
void active_tool_control (ToolAction action, void active_tool_control (ToolAction action,
void *gdisp_ptr); void *gdisp_ptr);
void tools_help_func (gchar *help_data); void tools_help_func (const gchar *help_data);
void tools_register (ToolType tool_type, void tools_register (ToolType tool_type,
ToolOptions *tool_options); ToolOptions *tool_options);

View file

@ -35,19 +35,6 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer,
gint,
gint,
gint);
static void color_notebook_page_switch (GtkWidget *,
GtkNotebookPage *,
guint);
static void color_notebook_help_func (gchar *help_data);
/* information we keep on each registered colour selector */ /* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo ColorSelectorInfo; typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
ColorSelectorInstance *next; ColorSelectorInstance *next;
}; };
static void selector_death (ColorSelectorInfo *info);
static void color_notebook_ok_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_notebook_update_callback (gpointer data,
gint red,
gint green,
gint blue);
static void color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_selector_death (ColorSelectorInfo *info);
/* master list of all registered colour selectors */ /* master list of all registered colour selectors */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell = cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection", gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp, color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE, GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--; csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active) if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info); color_notebook_selector_death (csel->info);
g_free (csel); g_free (csel);
csel = next; csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
} }
static void static void
color_notebook_help_func (gchar *data) color_notebook_help_func (const gchar *data)
{ {
ColorNotebook *cnp; ColorNotebook *cnp;
gchar *help_path; gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback; info->death_callback = callback;
info->death_data = data; info->death_data = data;
if (info->refs == 0) if (info->refs == 0)
selector_death (info); color_notebook_selector_death (info);
return TRUE; return TRUE;
} }
info = info->next; info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
} }
static void static void
selector_death (ColorSelectorInfo *info) color_notebook_selector_death (ColorSelectorInfo *info)
{ {
ColorSelectorInfo *here, *prev; ColorSelectorInfo *here, *prev;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimphelp.c * gimphelp.c
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org> * Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -53,13 +53,13 @@ struct _GimpIdleHelp
}; };
/* local function prototypes */ /* local function prototypes */
static gint gimp_idle_help (gpointer data); static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (gchar *help_path, static gboolean gimp_help_internal (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data); const gchar *help_data);
static void gimp_help_netscape (gchar *help_path, static void gimp_help_netscape (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data); const gchar *help_data);
/**********************/ /**********************/
/* public functions */ /* public functions */
@ -67,15 +67,15 @@ static void gimp_help_netscape (gchar *help_path,
/* The standard help function */ /* The standard help function */
void void
gimp_standard_help_func (gchar *help_data) gimp_standard_help_func (const gchar *help_data)
{ {
gimp_help (NULL, help_data); gimp_help (NULL, help_data);
} }
/* the main help function */ /* the main help function */
void void
gimp_help (gchar *help_path, gimp_help (const gchar *help_path,
gchar *help_data) const gchar *help_data)
{ {
if (use_help) if (use_help)
{ {
@ -169,9 +169,9 @@ gimp_help_internal_not_found_callback (GtkWidget *widget,
} }
static gboolean static gboolean
gimp_help_internal (gchar *help_path, gimp_help_internal (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data) const gchar *help_data)
{ {
ProcRecord *proc_rec; ProcRecord *proc_rec;
@ -207,11 +207,11 @@ gimp_help_internal (gchar *help_path,
args[0].arg_type = PDB_INT32; args[0].arg_type = PDB_INT32;
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].arg_type = PDB_STRING; args[1].arg_type = PDB_STRING;
args[1].value.pdb_pointer = help_path; args[1].value.pdb_pointer = (gpointer) help_path;
args[2].arg_type = PDB_STRING; args[2].arg_type = PDB_STRING;
args[2].value.pdb_pointer = current_locale; args[2].value.pdb_pointer = (gpointer) current_locale;
args[3].arg_type = PDB_STRING; args[3].arg_type = PDB_STRING;
args[3].value.pdb_pointer = help_data; args[3].value.pdb_pointer = (gpointer) help_data;
plug_in_run (proc_rec, args, 4, FALSE, TRUE, 0); plug_in_run (proc_rec, args, 4, FALSE, TRUE, 0);
@ -237,9 +237,9 @@ gimp_help_internal (gchar *help_path,
} }
static void static void
gimp_help_netscape (gchar *help_path, gimp_help_netscape (const gchar *help_path,
gchar *current_locale, const gchar *current_locale,
gchar *help_data) const gchar *help_data)
{ {
Argument *return_vals; Argument *return_vals;
gint nreturn_vals; gint nreturn_vals;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimphelp.h * gimphelp.h
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org> * Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,21 +18,26 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __GIMP_HELP_H__ #ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__ #define __GIMP_HELP_H__
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimp/gimphelpui.h" #include "libgimp/gimphelpui.h"
enum enum
{ {
HELP_BROWSER_GIMP, HELP_BROWSER_GIMP,
HELP_BROWSER_NETSCAPE HELP_BROWSER_NETSCAPE
}; };
/* the main help function */ /* the main help function */
void gimp_help (gchar *help_path, void gimp_help (const gchar *help_path,
gchar *help_data); const gchar *help_data);
#endif /* __GIMP_HELP_H__ */ #endif /* __GIMP_HELP_H__ */

View file

@ -26,8 +26,8 @@ struct _GimpItemFactoryEntry
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
gchar *help_page; const gchar *help_page;
gchar *description; gchar *description;
}; };
void menus_get_toolbox_menubar (GtkWidget **menubar, void menus_get_toolbox_menubar (GtkWidget **menubar,

View file

@ -56,7 +56,6 @@ helpdata_DATA = \
gauss_rle.html \ gauss_rle.html \
gbr.html \ gbr.html \
gdyntext.html \ gdyntext.html \
gee.html \
gfig.html \ gfig.html \
gflare.html \ gflare.html \
gfli.html \ gfli.html \

View file

@ -1,31 +0,0 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<title>Help Page for gee</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF"
vlink="#FF0000" alink="#000088">
<table width="100%" cellspacing="1" cellpadding="1">
<tr bgcolor="black">
<td width="100%" align="center">
<font size="+2" color="white">gee help page</font>
</td>
</tr>
<tr bgcolor="white" >
<td width="100%" align="left">
<p>
<a href="index.html">Index</a><p>
(/filters/gee.html)<p>
Sorry but the help file for gee is not yet done.
<p>
/Karin & Olof
<p>
</td>
</tr>
</table>
</body>
</html>

View file

@ -63,8 +63,10 @@ static void gimp_color_button_drag_handle (GtkWidget *widget,
guint info, guint info,
guint time, guint time,
gpointer data); gpointer data);
static const GtkTargetEntry targets[] = { { "application/x-color", 0 } }; static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
/* end of DND */ /* end of DND */
struct _GimpColorButton struct _GimpColorButton
@ -89,48 +91,50 @@ struct _GimpColorButton
}; };
static void gimp_color_button_destroy (GtkObject *object); static void gimp_color_button_destroy (GtkObject *object);
static void gimp_color_button_clicked (GtkButton *button); static void gimp_color_button_clicked (GtkButton *button);
static void gimp_color_button_paint (GimpColorButton *gcb); static void gimp_color_button_paint (GimpColorButton *gcb);
static void gimp_color_button_state_changed (GtkWidget *widget, static void gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state); GtkStateType previous_state);
static void gimp_color_button_dialog_ok (GtkWidget *widget, static void gimp_color_button_dialog_ok (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_color_button_dialog_cancel (GtkWidget *widget, static void gimp_color_button_dialog_cancel (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_color_button_use_fg (gpointer callback_data, static void gimp_color_button_use_fg (gpointer callback_data,
guint callback_action, guint callback_action,
GtkWidget *widget); GtkWidget *widget);
static void gimp_color_button_use_bg (gpointer callback_data, static void gimp_color_button_use_bg (gpointer callback_data,
guint callback_action, guint callback_action,
GtkWidget *widget); GtkWidget *widget);
static gint gimp_color_button_menu_popup (GtkWidget *widget, static gint gimp_color_button_menu_popup (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer data); gpointer data);
static gchar* gimp_color_button_menu_translate (const gchar *path, static gchar* gimp_color_button_menu_translate (const gchar *path,
gpointer func_data); gpointer func_data);
static GtkItemFactoryEntry menu_items[] = { static GtkItemFactoryEntry menu_items[] =
{
{ N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL }, { N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL },
{ N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL } { N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL }
}; };
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
enum { enum
{
COLOR_CHANGED, COLOR_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 }; static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL; static GtkWidgetClass *parent_class = NULL;
static void static void
gimp_color_button_destroy (GtkObject *object) gimp_color_button_destroy (GtkObject *object)
{ {
@ -148,7 +152,7 @@ gimp_color_button_destroy (GtkObject *object)
g_free (gcb->odd); g_free (gcb->odd);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
@ -156,12 +160,12 @@ static void
gimp_color_button_class_init (GimpColorButtonClass *class) gimp_color_button_class_init (GimpColorButtonClass *class)
{ {
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkButtonClass *button_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
object_class = (GtkObjectClass*) class; object_class = (GtkObjectClass*) class;
button_class = (GtkButtonClass*) class;
widget_class = (GtkWidgetClass*) class; widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
parent_class = gtk_type_class (gtk_widget_get_type ()); parent_class = gtk_type_class (gtk_widget_get_type ());
@ -172,13 +176,15 @@ gimp_color_button_class_init (GimpColorButtonClass *class)
GTK_SIGNAL_OFFSET (GimpColorButtonClass, GTK_SIGNAL_OFFSET (GimpColorButtonClass,
color_changed), color_changed),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_color_button_signals, gtk_object_class_add_signals (object_class, gimp_color_button_signals,
LAST_SIGNAL); LAST_SIGNAL);
class->color_changed = NULL; class->color_changed = NULL;
object_class->destroy = gimp_color_button_destroy; object_class->destroy = gimp_color_button_destroy;
button_class->clicked = gimp_color_button_clicked;
widget_class->state_changed = gimp_color_button_state_changed; widget_class->state_changed = gimp_color_button_state_changed;
button_class->clicked = gimp_color_button_clicked;
} }
@ -225,12 +231,12 @@ gimp_color_button_get_type (void)
} }
static GtkWidget * static GtkWidget *
_gimp_color_button_new (gboolean double_color, _gimp_color_button_new (gboolean double_color,
gchar *title, const gchar *title,
gint width, gint width,
gint height, gint height,
gpointer color, gpointer color,
gint bpp) gint bpp)
{ {
GimpColorButton *gcb; GimpColorButton *gcb;
gint i; gint i;
@ -297,25 +303,21 @@ _gimp_color_button_new (gboolean double_color,
targets, 1, targets, 1,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_begin",
"drag_begin",
GTK_SIGNAL_FUNC (gimp_color_button_drag_begin), GTK_SIGNAL_FUNC (gimp_color_button_drag_begin),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_end",
"drag_end",
GTK_SIGNAL_FUNC (gimp_color_button_drag_end), GTK_SIGNAL_FUNC (gimp_color_button_drag_end),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_get",
"drag_data_get",
GTK_SIGNAL_FUNC (gimp_color_button_drag_handle), GTK_SIGNAL_FUNC (gimp_color_button_drag_handle),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_received",
"drag_data_received",
GTK_SIGNAL_FUNC (gimp_color_button_drop_handle), GTK_SIGNAL_FUNC (gimp_color_button_drop_handle),
gcb); gcb);
/* end of DND */ /* end of DND */
return (GTK_WIDGET (gcb)); return GTK_WIDGET (gcb);
} }
/** /**
@ -335,13 +337,13 @@ _gimp_color_button_new (gboolean double_color,
* signal is emitted. * signal is emitted.
* *
* Returns: Pointer to the new #GimpColorButton widget. * Returns: Pointer to the new #GimpColorButton widget.
*/ **/
GtkWidget * GtkWidget *
gimp_color_button_new (gchar *title, gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
guchar *color, guchar *color,
gint bpp) gint bpp)
{ {
return _gimp_color_button_new (FALSE, title, width, height, return _gimp_color_button_new (FALSE, title, width, height,
(gpointer) color, bpp); (gpointer) color, bpp);
@ -364,13 +366,13 @@ gimp_color_button_new (gchar *title,
* signal is emitted. * signal is emitted.
* *
* Returns: Pointer to the new GimpColorButton widget. * Returns: Pointer to the new GimpColorButton widget.
*/ **/
GtkWidget * GtkWidget *
gimp_color_button_double_new (gchar *title, gimp_color_button_double_new (const gchar *title,
gint width, gint width,
gint height, gint height,
gdouble *color, gdouble *color,
gint bpp) gint bpp)
{ {
return _gimp_color_button_new (TRUE, title, width, height, return _gimp_color_button_new (TRUE, title, width, height,
(gpointer) color, bpp); (gpointer) color, bpp);
@ -383,12 +385,13 @@ gimp_color_button_double_new (gchar *title,
* Should be used after the color controlled by a #GimpColorButton * Should be used after the color controlled by a #GimpColorButton
* was changed. The color is then reread and the change is propagated * was changed. The color is then reread and the change is propagated
* to the preview and the GtkColorSelectionDialog if one is open. * to the preview and the GtkColorSelectionDialog if one is open.
*/ **/
void void
gimp_color_button_update (GimpColorButton *gcb) gimp_color_button_update (GimpColorButton *gcb)
{ {
gint i; gint i;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
if (gcb->double_color) if (gcb->double_color)
@ -413,13 +416,14 @@ static void
gimp_color_button_state_changed (GtkWidget *widget, gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state) GtkStateType previous_state)
{ {
g_return_if_fail (widget != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog) if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog); gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
if (GTK_WIDGET_CLASS (parent_class)->state_changed) if (GTK_WIDGET_CLASS (parent_class)->state_changed)
(* GTK_WIDGET_CLASS (parent_class)->state_changed) (widget, previous_state); GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
} }
static gint static gint
@ -432,7 +436,9 @@ gimp_color_button_menu_popup (GtkWidget *widget,
gint x; gint x;
gint y; gint y;
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE); g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE);
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
if (event->type != GDK_BUTTON_PRESS) if (event->type != GDK_BUTTON_PRESS)
@ -457,7 +463,9 @@ gimp_color_button_clicked (GtkButton *button)
GimpColorButton *gcb; GimpColorButton *gcb;
GtkColorSelection *colorsel; GtkColorSelection *colorsel;
g_return_if_fail (button != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
gcb = GIMP_COLOR_BUTTON (button); gcb = GIMP_COLOR_BUTTON (button);
if (!gcb->dialog) if (!gcb->dialog)
@ -479,6 +487,7 @@ gimp_color_button_clicked (GtkButton *button)
(GtkSignalFunc) gimp_color_button_dialog_cancel, gcb); (GtkSignalFunc) gimp_color_button_dialog_cancel, gcb);
gtk_window_set_position (GTK_WINDOW (gcb->dialog), GTK_WIN_POS_MOUSE); gtk_window_set_position (GTK_WINDOW (gcb->dialog), GTK_WIN_POS_MOUSE);
} }
gtk_color_selection_set_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gtk_color_selection_set_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel),
gcb->dcolor); gcb->dcolor);
gtk_widget_show (gcb->dialog); gtk_widget_show (gcb->dialog);
@ -491,6 +500,7 @@ gimp_color_button_paint (GimpColorButton *gcb)
gdouble c0, c1; gdouble c0, c1;
guchar *p0, *p1; guchar *p0, *p1;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
p0 = gcb->even; p0 = gcb->even;
@ -548,8 +558,10 @@ gimp_color_button_dialog_ok (GtkWidget *widget,
GimpColorButton *gcb; GimpColorButton *gcb;
gboolean color_changed = FALSE; gboolean color_changed = FALSE;
gint i; gint i;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
gtk_color_selection_get_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gcb->dcolor); gtk_color_selection_get_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gcb->dcolor);
@ -592,7 +604,9 @@ gimp_color_button_dialog_cancel (GtkWidget *widget,
{ {
GimpColorButton *gcb; GimpColorButton *gcb;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
gtk_widget_hide (gcb->dialog); gtk_widget_hide (gcb->dialog);
@ -608,7 +622,9 @@ gimp_color_button_use_fg (gpointer callback_data,
guchar fg_color[3]; guchar fg_color[3];
gint i; gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data); gcb = GIMP_COLOR_BUTTON (callback_data);
gimp_palette_get_foreground (fg_color, &fg_color[1], &fg_color[2]); gimp_palette_get_foreground (fg_color, &fg_color[1], &fg_color[2]);
@ -640,7 +656,9 @@ gimp_color_button_use_bg (gpointer callback_data,
guchar bg_color[3]; guchar bg_color[3];
gint i; gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data); gcb = GIMP_COLOR_BUTTON (callback_data);
gimp_palette_get_background (bg_color, &bg_color[1], &bg_color[2]); gimp_palette_get_background (bg_color, &bg_color[1], &bg_color[2]);
@ -662,7 +680,7 @@ gimp_color_button_use_bg (gpointer callback_data,
gimp_color_button_signals[COLOR_CHANGED]); gimp_color_button_signals[COLOR_CHANGED]);
} }
static gchar * static gchar *
gimp_color_button_menu_translate (const gchar *path, gimp_color_button_menu_translate (const gchar *path,
gpointer func_data) gpointer func_data)
{ {

View file

@ -52,16 +52,16 @@ struct _GimpColorButtonClass
GtkType gimp_color_button_get_type (void); GtkType gimp_color_button_get_type (void);
GtkWidget * gimp_color_button_new (gchar *title, GtkWidget * gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
guchar *color, guchar *color,
gint bpp); gint bpp);
GtkWidget * gimp_color_button_double_new (gchar *title, GtkWidget * gimp_color_button_double_new (const gchar *title,
gint width, gint width,
gint height, gint height,
gdouble *color, gdouble *color,
gint bpp); gint bpp);
void gimp_color_button_update (GimpColorButton *gcb); void gimp_color_button_update (GimpColorButton *gcb);

View file

@ -99,14 +99,14 @@ GtkWidget *
gimp_dialog_new (const gchar *title, gimp_dialog_new (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
gint auto_shrink, gint auto_shrink,
/* specify action area buttons as va_list: /* specify action area buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -167,7 +167,7 @@ GtkWidget *
gimp_dialog_newv (const gchar *title, gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -237,7 +237,7 @@ void
gimp_dialog_create_action_area (GtkDialog *dialog, gimp_dialog_create_action_area (GtkDialog *dialog,
/* specify action area buttons as va_list: /* specify action area buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -272,7 +272,7 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
GtkWidget *button; GtkWidget *button;
/* action area variables */ /* action area variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
GtkObject *slot_object; GtkObject *slot_object;
@ -286,7 +286,7 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
g_return_if_fail (GTK_IS_DIALOG (dialog)); g_return_if_fail (GTK_IS_DIALOG (dialog));
/* prepare the action_area */ /* prepare the action_area */
label = va_arg (args, gchar *); label = va_arg (args, const gchar *);
if (label) if (label)
{ {

View file

@ -35,7 +35,7 @@ extern "C" {
GtkWidget * gimp_dialog_new (const gchar *title, GtkWidget * gimp_dialog_new (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -43,7 +43,7 @@ GtkWidget * gimp_dialog_new (const gchar *title,
/* specify action area buttons /* specify action area buttons
* as va_list: * as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -57,7 +57,7 @@ GtkWidget * gimp_dialog_new (const gchar *title,
GtkWidget * gimp_dialog_newv (const gchar *title, GtkWidget * gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -70,7 +70,7 @@ void gimp_dialog_create_action_area (GtkDialog *dialog,
/* specify action area buttons /* specify action area buttons
* as va_list: * as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,

View file

@ -30,7 +30,9 @@
#include "libgimp-intl.h" #include "libgimp-intl.h"
typedef void (* ExportFunc) (gint32 imageID, gint32 *drawable_ID); typedef void (* ExportFunc) (gint32 imageID,
gint32 *drawable_ID);
/* the export action structure */ /* the export action structure */
typedef struct typedef struct
@ -307,8 +309,8 @@ export_toggle_callback (GtkWidget *widget,
} }
static gint static gint
export_dialog (GSList *actions, export_dialog (GSList *actions,
gchar *format) const gchar *format)
{ {
GtkWidget *frame; GtkWidget *frame;
GtkWidget *vbox; GtkWidget *vbox;
@ -451,11 +453,11 @@ export_dialog (GSList *actions,
* save_plugin should quit itself with status #STATUS_CANCEL. * save_plugin should quit itself with status #STATUS_CANCEL.
* *
* Returns: An enum of #GimpExportReturnType describing the user_action. * Returns: An enum of #GimpExportReturnType describing the user_action.
*/ **/
GimpExportReturnType GimpExportReturnType
gimp_export_image (gint32 *image_ID, gimp_export_image (gint32 *image_ID,
gint32 *drawable_ID, gint32 *drawable_ID,
gchar *format_name, const gchar *format_name,
GimpExportCapabilities capabilities) GimpExportCapabilities capabilities)
{ {
GSList *actions = NULL; GSList *actions = NULL;

View file

@ -50,7 +50,7 @@ typedef enum
GimpExportReturnType gimp_export_image (gint32 *image_ID, GimpExportReturnType gimp_export_image (gint32 *image_ID,
gint32 *drawable_ID, gint32 *drawable_ID,
gchar *format_name, const gchar *format_name,
GimpExportCapabilities capabilities); GimpExportCapabilities capabilities);

View file

@ -99,7 +99,7 @@ gimp_file_selection_destroy (GtkObject *object)
gdk_bitmap_unref (gfs->no_mask); gdk_bitmap_unref (gfs->no_mask);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
@ -127,7 +127,6 @@ gimp_file_selection_class_init (GimpFileSelectionClass *class)
class->filename_changed = NULL; class->filename_changed = NULL;
object_class->destroy = gimp_file_selection_destroy; object_class->destroy = gimp_file_selection_destroy;
widget_class->realize = gimp_file_selection_realize; widget_class->realize = gimp_file_selection_realize;
} }
@ -201,13 +200,12 @@ gimp_file_selection_get_type (void)
* Creates a new #GimpFileSelection widget. * Creates a new #GimpFileSelection widget.
* *
* Returns: A pointer to the new #GimpFileSelection widget. * Returns: A pointer to the new #GimpFileSelection widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_file_selection_new (gchar *title, gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid) gboolean check_valid)
{ {
GimpFileSelection *gfs; GimpFileSelection *gfs;
@ -229,8 +227,7 @@ gimp_file_selection_new (gchar *title,
* Note that you have to g_free() the returned string. * Note that you have to g_free() the returned string.
* *
* Returns: The file or directory the user has entered. * Returns: The file or directory the user has entered.
* **/
*/
gchar * gchar *
gimp_file_selection_get_filename (GimpFileSelection *gfs) gimp_file_selection_get_filename (GimpFileSelection *gfs)
{ {
@ -252,7 +249,7 @@ gimp_file_selection_get_filename (GimpFileSelection *gfs)
*/ */
void void
gimp_file_selection_set_filename (GimpFileSelection *gfs, gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename) const gchar *filename)
{ {
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
@ -441,6 +438,7 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
if (! gfs->check_valid) if (! gfs->check_valid)
return; return;
if (gfs->file_exists == NULL) if (gfs->file_exists == NULL)
return; return;

View file

@ -69,15 +69,15 @@ struct _GimpFileSelectionClass
GtkType gimp_file_selection_get_type (void); GtkType gimp_file_selection_get_type (void);
GtkWidget* gimp_file_selection_new (gchar *title, GtkWidget* gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid); gboolean check_valid);
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs); gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
void gimp_file_selection_set_filename (GimpFileSelection *gfs, void gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename); const gchar *filename);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -56,8 +56,7 @@ static GtkWidget * tips_query = NULL;
* *
* Currently it only creates a #GtkTooltips object with gtk_tooltips_new() * Currently it only creates a #GtkTooltips object with gtk_tooltips_new()
* which will be used by gimp_help_set_help_data(). * which will be used by gimp_help_set_help_data().
* **/
*/
void void
gimp_help_init (void) gimp_help_init (void)
{ {
@ -69,8 +68,7 @@ gimp_help_init (void)
* *
* This function frees the memory used by the #GtkTooltips created by * This function frees the memory used by the #GtkTooltips created by
* gimp_help_init(). * gimp_help_init().
* **/
*/
void void
gimp_help_free (void) gimp_help_free (void)
{ {
@ -82,8 +80,7 @@ gimp_help_free (void)
* gimp_help_enable_tooltips: * gimp_help_enable_tooltips:
* *
* This function calls gtk_tooltips_enable(). * This function calls gtk_tooltips_enable().
* **/
*/
void void
gimp_help_enable_tooltips (void) gimp_help_enable_tooltips (void)
{ {
@ -94,8 +91,7 @@ gimp_help_enable_tooltips (void)
* gimp_help_disable_tooltips: * gimp_help_disable_tooltips:
* *
* This function calls gtk_tooltips_disable(). * This function calls gtk_tooltips_disable().
* **/
*/
void void
gimp_help_disable_tooltips (void) gimp_help_disable_tooltips (void)
{ {
@ -116,12 +112,11 @@ gimp_help_disable_tooltips (void)
* For convenience, gimp_help_connect_help_accel() calls * For convenience, gimp_help_connect_help_accel() calls
* gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you * gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you
* don't have to worry about this. * don't have to worry about this.
* **/
*/
void void
gimp_help_connect_help_accel (GtkWidget *widget, gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data) const gchar *help_data)
{ {
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
@ -134,7 +129,8 @@ gimp_help_connect_help_accel (GtkWidget *widget,
if (GTK_IS_WINDOW (widget)) if (GTK_IS_WINDOW (widget))
gimp_dialog_set_icon (GTK_WINDOW (widget)); gimp_dialog_set_icon (GTK_WINDOW (widget));
/* set up the help signals and tips query widget */ /* set up the help signals and tips query widget
*/
if (!tips_query) if (!tips_query)
{ {
tips_query = gtk_tips_query_new (); tips_query = gtk_tips_query_new ();
@ -229,20 +225,25 @@ gimp_help_connect_help_accel (GtkWidget *widget,
* help system will automatically ascend the widget hierarchy until it * help system will automatically ascend the widget hierarchy until it
* finds another widget with @help_data attached and concatenates both * finds another widget with @help_data attached and concatenates both
* to a complete help path. * to a complete help path.
* **/
*/
void void
gimp_help_set_help_data (GtkWidget *widget, gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip, const gchar *tooltip,
gchar *help_data) const gchar *help_data)
{ {
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (tooltip) if (tooltip)
gtk_tooltips_set_tip (tool_tips, widget, tooltip, help_data); {
gtk_tooltips_set_tip (tool_tips, widget, tooltip,
(gpointer) help_data);
}
else if (help_data) else if (help_data)
gtk_object_set_data (GTK_OBJECT (widget), "gimp_help_data", help_data); {
gtk_object_set_data (GTK_OBJECT (widget), "gimp_help_data",
(gpointer) help_data);
}
} }
/** /**
@ -258,8 +259,7 @@ gimp_help_set_help_data (GtkWidget *widget,
* be displayed. Otherwise the help system will ascend the widget hierarchy * be displayed. Otherwise the help system will ascend the widget hierarchy
* until it finds an attached @help_data string (which should be the * until it finds an attached @help_data string (which should be the
* case at least for every window/dialog). * case at least for every window/dialog).
* **/
*/
void void
gimp_context_help (void) gimp_context_help (void)
{ {
@ -275,12 +275,12 @@ static void
gimp_help_callback (GtkWidget *widget, gimp_help_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpHelpFunc help_function; GimpHelpFunc help_function;
gchar *help_data; const gchar *help_data;
help_function = (GimpHelpFunc) data; help_function = (GimpHelpFunc) data;
help_data = (gchar *) gtk_object_get_data (GTK_OBJECT (widget), help_data = (const gchar *) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_help_data"); "gimp_help_data");
if (help_function) if (help_function)
(* help_function) (help_data); (* help_function) (help_data);

View file

@ -27,10 +27,12 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
typedef void (* GimpHelpFunc) (gchar *help_data); typedef void (* GimpHelpFunc) (const gchar *help_data);
void gimp_help_init (void); void gimp_help_init (void);
void gimp_help_free (void); void gimp_help_free (void);
@ -41,17 +43,17 @@ void gimp_help_disable_tooltips (void);
/* the standard gimp help function /* the standard gimp help function
* (has different implementations in the main app and in libgimp) * (has different implementations in the main app and in libgimp)
*/ */
void gimp_standard_help_func (gchar *help_data); void gimp_standard_help_func (const gchar *help_data);
/* connect the "F1" accelerator of a window */ /* connect the "F1" accelerator of a window */
void gimp_help_connect_help_accel (GtkWidget *widget, void gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data); const gchar *help_data);
/* set help data for non-window widgets */ /* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget, void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip, const gchar *tooltip,
gchar *help_data); const gchar *help_data);
/* activate the context help inspector */ /* activate the context help inspector */
void gimp_context_help (void); void gimp_context_help (void);

View file

@ -89,8 +89,8 @@ gimp_path_editor_init (GimpPathEditor *gpe)
GtkWidget *button; GtkWidget *button;
GtkWidget *scrolled_window; GtkWidget *scrolled_window;
gpe->file_selection = NULL; gpe->file_selection = NULL;
gpe->selected_item = NULL; gpe->selected_item = NULL;
gpe->number_of_items = 0; gpe->number_of_items = 0;
gpe->upper_hbox = gtk_hbox_new (FALSE, 2); gpe->upper_hbox = gtk_hbox_new (FALSE, 2);
@ -183,16 +183,16 @@ gimp_path_editor_get_type (void)
* #G_SEARCHPATH_SEPARATOR character. * #G_SEARCHPATH_SEPARATOR character.
* *
* Returns: A pointer to the new #GimpPathEditor widget. * Returns: A pointer to the new #GimpPathEditor widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_path_editor_new (gchar *filesel_title, gimp_path_editor_new (const gchar *filesel_title,
gchar *path) const gchar *path)
{ {
GimpPathEditor *gpe; GimpPathEditor *gpe;
GtkWidget *list_item; GtkWidget *list_item;
GList *directory_list; GList *directory_list;
gchar *directory; gchar *directory;
gchar *mypath;
g_return_val_if_fail ((filesel_title != NULL), NULL); g_return_val_if_fail ((filesel_title != NULL), NULL);
g_return_val_if_fail ((path != NULL), NULL); g_return_val_if_fail ((path != NULL), NULL);
@ -209,7 +209,7 @@ gimp_path_editor_new (gchar *filesel_title,
gtk_widget_show (gpe->file_selection); gtk_widget_show (gpe->file_selection);
directory_list = NULL; directory_list = NULL;
directory = path = g_strdup (path); directory = mypath = g_strdup (path);
/* split up the path */ /* split up the path */
while (strlen (directory)) while (strlen (directory))
@ -243,7 +243,7 @@ gimp_path_editor_new (gchar *filesel_title,
break; break;
} }
g_free (path); g_free (mypath);
if (directory_list) if (directory_list)
gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list); gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list);
@ -261,8 +261,7 @@ gimp_path_editor_new (gchar *filesel_title,
* Note that you have to g_free() the returned string. * Note that you have to g_free() the returned string.
* *
* Returns: The search path the user has selected in the path editor. * Returns: The search path the user has selected in the path editor.
* **/
*/
gchar * gchar *
gimp_path_editor_get_path (GimpPathEditor *gpe) gimp_path_editor_get_path (GimpPathEditor *gpe)
{ {

View file

@ -69,8 +69,8 @@ struct _GimpPathEditorClass
GtkType gimp_path_editor_get_type (void); GtkType gimp_path_editor_get_type (void);
GtkWidget * gimp_path_editor_new (gchar *filesel_title, GtkWidget * gimp_path_editor_new (const gchar *filesel_title,
gchar *path); const gchar *path);
gchar * gimp_path_editor_get_path (GimpPathEditor *gpe); gchar * gimp_path_editor_get_path (GimpPathEditor *gpe);

View file

@ -31,8 +31,10 @@ static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget); static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap); static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL; static GtkPixmapClass *parent_class = NULL;
static void static void
gimp_pixmap_destroy (GtkObject *object) gimp_pixmap_destroy (GtkObject *object)
{ {
@ -41,7 +43,7 @@ gimp_pixmap_destroy (GtkObject *object)
g_return_if_fail (pixmap = GIMP_PIXMAP (object)); g_return_if_fail (pixmap = GIMP_PIXMAP (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
@ -56,7 +58,6 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
parent_class = gtk_type_class (gtk_pixmap_get_type ()); parent_class = gtk_type_class (gtk_pixmap_get_type ());
object_class->destroy = gimp_pixmap_destroy; object_class->destroy = gimp_pixmap_destroy;
widget_class->realize = gimp_pixmap_realize; widget_class->realize = gimp_pixmap_realize;
} }
@ -98,8 +99,7 @@ gimp_pixmap_get_type (void)
* Creates a new #GimpPixmap widget. * Creates a new #GimpPixmap widget.
* *
* Returns: A pointer to the new #GimpPixmap widget. * Returns: A pointer to the new #GimpPixmap widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_pixmap_new (gchar **xpm_data) gimp_pixmap_new (gchar **xpm_data)
{ {
@ -119,8 +119,7 @@ gimp_pixmap_new (gchar **xpm_data)
* @xpm_data: A pointer to a XPM data structure as found in XPM files. * @xpm_data: A pointer to a XPM data structure as found in XPM files.
* *
* Sets a new image for an existing #GimpPixmap widget. * Sets a new image for an existing #GimpPixmap widget.
* **/
*/
void void
gimp_pixmap_set (GimpPixmap *pixmap, gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data) gchar **xpm_data)
@ -162,7 +161,7 @@ static void
gimp_pixmap_realize (GtkWidget *widget) gimp_pixmap_realize (GtkWidget *widget)
{ {
if (GTK_WIDGET_CLASS (parent_class)->realize) if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); GTK_WIDGET_CLASS (parent_class)->realize (widget);
gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget)); gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget));
} }

View file

@ -43,7 +43,7 @@ struct _GimpPixmap
{ {
GtkPixmap pixmap; GtkPixmap pixmap;
gchar **xpm_data; gchar **xpm_data;
}; };
struct _GimpPixmapClass struct _GimpPixmapClass

View file

@ -51,50 +51,54 @@ struct _QueryBox
gpointer data; gpointer data;
}; };
static QueryBox * create_query_box (gchar *title,
static QueryBox * create_query_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkSignalFunc ok_callback, GtkSignalFunc ok_callback,
GtkSignalFunc cancel_callback, GtkSignalFunc cancel_callback,
gchar *message, const gchar *message,
gchar *ok_button, const gchar *ok_button,
gchar *cancel_button, const gchar *cancel_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GtkSignalFunc callback, GtkSignalFunc callback,
gpointer data); gpointer data);
static QueryBox * query_box_disconnect (gpointer data); static QueryBox * query_box_disconnect (gpointer data);
static void string_query_box_ok_callback (GtkWidget *widget, static void string_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void int_query_box_ok_callback (GtkWidget *widget, static void int_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void double_query_box_ok_callback (GtkWidget *widget, static void double_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void size_query_box_ok_callback (GtkWidget *widget, static void size_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void query_box_cancel_callback (GtkWidget *widget,
gpointer data);
static void boolean_query_box_true_callback (GtkWidget *widget, static void boolean_query_box_true_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void boolean_query_box_false_callback (GtkWidget *widget, static void boolean_query_box_false_callback (GtkWidget *widget,
gpointer data); gpointer data);
/* create a generic query box without any entry widget */ static void query_box_cancel_callback (GtkWidget *widget,
gpointer data);
/*
* create a generic query box without any entry widget
*/
static QueryBox * static QueryBox *
create_query_box (gchar *title, create_query_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkSignalFunc ok_callback, GtkSignalFunc ok_callback,
GtkSignalFunc cancel_callback, GtkSignalFunc cancel_callback,
gchar *message, const gchar *message,
gchar *ok_button, const gchar *ok_button,
gchar *cancel_button, const gchar *cancel_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GtkSignalFunc callback, GtkSignalFunc callback,
gpointer data) gpointer data)
{ {
@ -103,6 +107,11 @@ create_query_box (gchar *title,
GtkWidget *vbox = NULL; GtkWidget *vbox = NULL;
GtkWidget *label; GtkWidget *label;
/* make sure the object / signal passed are valid
*/
g_return_val_if_fail (object == NULL || GTK_IS_OBJECT (object), NULL);
g_return_val_if_fail (object == NULL || signal != NULL, NULL);
query_box = g_new (QueryBox, 1); query_box = g_new (QueryBox, 1);
qbox = gimp_dialog_new (title, "query_box", qbox = gimp_dialog_new (title, "query_box",
@ -117,13 +126,26 @@ create_query_box (gchar *title,
NULL); NULL);
/* if we are associated with an object, connect to the provided signal */ gtk_signal_connect (GTK_OBJECT (qbox), "destroy",
if (object && GTK_IS_OBJECT (object) && signal) GTK_SIGNAL_FUNC (gtk_widget_destroyed),
gtk_signal_connect (GTK_OBJECT (object), signal, &query_box->qbox);
GTK_SIGNAL_FUNC (query_box_cancel_callback),
query_box); /* if we are associated with an object, connect to the provided signal
*/
if (object)
{
gtk_signal_connect (GTK_OBJECT (object), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&query_box->object);
gtk_signal_connect (GTK_OBJECT (object), signal,
GTK_SIGNAL_FUNC (query_box_cancel_callback),
query_box);
}
else else
object = NULL; {
object = NULL;
}
if (message) if (message)
{ {
@ -160,16 +182,15 @@ create_query_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_string_box (gchar *title, gimp_query_string_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gchar *initial, const gchar *initial,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data) gpointer data)
{ {
@ -184,6 +205,9 @@ gimp_query_string_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0);
if (initial) if (initial)
@ -211,18 +235,17 @@ gimp_query_string_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_int_box (gchar *title, gimp_query_int_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data) gpointer data)
{ {
@ -238,6 +261,9 @@ gimp_query_int_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, 0); 1, 0);
@ -266,19 +292,18 @@ gimp_query_int_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_double_box (gchar *title, gimp_query_double_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data) gpointer data)
{ {
@ -294,6 +319,9 @@ gimp_query_double_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, digits); 1, digits);
@ -327,13 +355,12 @@ gimp_query_double_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_size_box (gchar *title, gimp_query_size_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
@ -342,7 +369,7 @@ gimp_query_size_box (gchar *title,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data) gpointer data)
{ {
@ -357,6 +384,9 @@ gimp_query_size_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100, sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE); GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot) if (dot_for_dot)
@ -394,18 +424,17 @@ gimp_query_size_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_boolean_box (gchar *title, gimp_query_boolean_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gboolean eek, gboolean eek,
gchar *message, const gchar *message,
gchar *true_button, const gchar *true_button,
gchar *false_button, const gchar *false_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data) gpointer data)
{ {
@ -422,7 +451,10 @@ gimp_query_boolean_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (!eek) if (! query_box)
return NULL;
if (! eek)
return query_box->qbox; return query_box->qbox;
hbox = gtk_hbox_new (FALSE, 10); hbox = gtk_hbox_new (FALSE, 10);
@ -441,6 +473,11 @@ gimp_query_boolean_box (gchar *title,
return query_box->qbox; return query_box->qbox;
} }
/*
* private functions
*/
static QueryBox * static QueryBox *
query_box_disconnect (gpointer data) query_box_disconnect (gpointer data)
{ {
@ -474,7 +511,8 @@ string_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -497,7 +535,8 @@ int_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -520,7 +559,8 @@ double_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -544,21 +584,8 @@ size_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
query_box = query_box_disconnect (data);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -576,7 +603,8 @@ boolean_query_box_true_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -594,7 +622,23 @@ boolean_query_box_false_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
query_box = query_box_disconnect (data);
/* Destroy the box */
if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }

View file

@ -55,45 +55,45 @@ typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
gpointer data); gpointer data);
/* some simple query dialogs */ /* some simple query dialogs */
GtkWidget * gimp_query_string_box (gchar *title, GtkWidget * gimp_query_string_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gchar *initial, const gchar *initial,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_int_box (gchar *title, GtkWidget * gimp_query_int_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
char *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_double_box (gchar *title, GtkWidget * gimp_query_double_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_size_box (gchar *title, GtkWidget * gimp_query_size_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
@ -102,19 +102,19 @@ GtkWidget * gimp_query_size_box (gchar *title,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_boolean_box (gchar *title, GtkWidget * gimp_query_boolean_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gboolean eek, gboolean eek,
gchar *message, const gchar *message,
gchar *true_button, const gchar *true_button,
gchar *false_button, const gchar *false_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data); gpointer data);

View file

@ -237,7 +237,7 @@ gimp_size_entry_get_type (void)
GtkWidget * GtkWidget *
gimp_size_entry_new (gint number_of_fields, gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
@ -457,7 +457,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
*/ */
void void
gimp_size_entry_attach_label (GimpSizeEntry *gse, gimp_size_entry_attach_label (GimpSizeEntry *gse,
gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment) gfloat alignment)

View file

@ -82,7 +82,7 @@ GtkType gimp_size_entry_get_type (void);
GtkWidget * gimp_size_entry_new (gint number_of_fields, GtkWidget * gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
@ -94,7 +94,7 @@ void gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkSpinButton *refval_spinbutton); GtkSpinButton *refval_spinbutton);
void gimp_size_entry_attach_label (GimpSizeEntry *gse, void gimp_size_entry_attach_label (GimpSizeEntry *gse,
gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment); gfloat alignment);

View file

@ -37,11 +37,10 @@
* *
* The GIMP's colormap policy can be determinded by the user with the * The GIMP's colormap policy can be determinded by the user with the
* gimprc variables @min_colors and @install_cmap. * gimprc variables @min_colors and @install_cmap.
* **/
*/
void void
gimp_ui_init (gchar *prog_name, gimp_ui_init (const gchar *prog_name,
gboolean preview) gboolean preview)
{ {
gint argc; gint argc;
gchar **argv; gchar **argv;

View file

@ -36,6 +36,7 @@
#include <libgimp/gimpunitmenu.h> #include <libgimp/gimpunitmenu.h>
#include <libgimp/gimpwidgets.h> #include <libgimp/gimpwidgets.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
@ -43,8 +44,8 @@ extern "C" {
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
void gimp_ui_init (gchar *prog_name, void gimp_ui_init (const gchar *prog_name,
gboolean preview); gboolean preview);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -31,10 +31,10 @@
/* private functions */ /* private functions */
static const gchar * gimp_unit_menu_build_string (gchar *format, static const gchar * gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit); GimpUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget, static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data); gpointer data);
enum enum
{ {
@ -144,11 +144,11 @@ gimp_unit_menu_get_type (void)
* *
*/ */
GtkWidget * GtkWidget *
gimp_unit_menu_new (gchar *format, gimp_unit_menu_new (const gchar *format,
GimpUnit unit, GimpUnit unit,
gboolean show_pixels, gboolean show_pixels,
gboolean show_percent, gboolean show_percent,
gboolean show_custom) gboolean show_custom)
{ {
GimpUnitMenu *gum; GimpUnitMenu *gum;
GtkWidget *menu; GtkWidget *menu;
@ -375,8 +375,8 @@ print (gchar *buf,
} }
static const gchar * static const gchar *
gimp_unit_menu_build_string (gchar *format, gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit) GimpUnit unit)
{ {
static gchar buffer[64]; static gchar buffer[64];
gint i = 0; gint i = 0;

View file

@ -67,7 +67,7 @@ struct _GimpUnitMenuClass
GtkType gimp_unit_menu_get_type (void); GtkType gimp_unit_menu_get_type (void);
GtkWidget * gimp_unit_menu_new (gchar *format, GtkWidget * gimp_unit_menu_new (const gchar *format,
GimpUnit unit, GimpUnit unit,
gboolean show_pixels, gboolean show_pixels,
gboolean show_percent, gboolean show_percent,

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpwidgets.c * gimpwidgets.c
* Copyright (C) 2000 Michael Natterer <mitch@gimp.org> * Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
@ -44,13 +44,12 @@
* @...: A #NULL terminated @va_list describing the menu items. * @...: A #NULL terminated @va_list describing the menu items.
* *
* Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only). * Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only).
* **/
*/
GtkWidget * GtkWidget *
gimp_option_menu_new (gboolean menu_only, gimp_option_menu_new (gboolean menu_only,
/* specify menu items as va_list: /* specify menu items as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -64,7 +63,7 @@ gimp_option_menu_new (gboolean menu_only,
GtkWidget *menuitem; GtkWidget *menuitem;
/* menu item variables */ /* menu item variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
gpointer user_data; gpointer user_data;
@ -79,8 +78,10 @@ gimp_option_menu_new (gboolean menu_only,
/* create the menu items */ /* create the menu items */
initial_index = 0; initial_index = 0;
va_start (args, menu_only); va_start (args, menu_only);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
for (i = 0; label; i++) for (i = 0; label; i++)
{ {
callback = va_arg (args, GtkSignalFunc); callback = va_arg (args, GtkSignalFunc);
@ -116,7 +117,7 @@ gimp_option_menu_new (gboolean menu_only,
if (active) if (active)
initial_index = i; initial_index = i;
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -146,18 +147,17 @@ gimp_option_menu_new (gboolean menu_only,
* @...: A #NULL terminated @va_list describing the menu items. * @...: A #NULL terminated @va_list describing the menu items.
* *
* Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only). * Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only).
* **/
*/
GtkWidget * GtkWidget *
gimp_option_menu_new2 (gboolean menu_only, gimp_option_menu_new2 (gboolean menu_only,
GtkSignalFunc menu_item_callback, GtkSignalFunc menu_item_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify menu items as va_list: /* specify menu items as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
@ -166,9 +166,9 @@ gimp_option_menu_new2 (gboolean menu_only,
GtkWidget *menuitem; GtkWidget *menuitem;
/* menu item variables */ /* menu item variables */
gchar *label; const gchar *label;
gpointer user_data; gpointer user_data;
GtkWidget **widget_ptr; GtkWidget **widget_ptr;
va_list args; va_list args;
gint i; gint i;
@ -178,8 +178,10 @@ gimp_option_menu_new2 (gboolean menu_only,
/* create the menu items */ /* create the menu items */
initial_index = 0; initial_index = 0;
va_start (args, initial); va_start (args, initial);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
for (i = 0; label; i++) for (i = 0; label; i++)
{ {
user_data = va_arg (args, gpointer); user_data = va_arg (args, gpointer);
@ -212,7 +214,7 @@ gimp_option_menu_new2 (gboolean menu_only,
if (user_data == initial) if (user_data == initial)
initial_index = i; initial_index = i;
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -237,8 +239,7 @@ gimp_option_menu_new2 (gboolean menu_only,
* @option_menu: A #GtkOptionMenu as returned by gimp_option_menu_new() or * @option_menu: A #GtkOptionMenu as returned by gimp_option_menu_new() or
* gimp_option_menu_new2(). * gimp_option_menu_new2().
* @user_data: The @user_data of the menu item you want to select. * @user_data: The @user_data of the menu item you want to select.
* **/
*/
void void
gimp_option_menu_set_history (GtkOptionMenu *option_menu, gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer user_data) gpointer user_data)
@ -276,14 +277,13 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
* @...: A #NULL terminated @va_list describing the radio buttons. * @...: A #NULL terminated @va_list describing the radio buttons.
* *
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame). * Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
* **/
*/
GtkWidget * GtkWidget *
gimp_radio_group_new (gboolean in_frame, gimp_radio_group_new (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -298,7 +298,7 @@ gimp_radio_group_new (gboolean in_frame,
GSList *group; GSList *group;
/* radio button variables */ /* radio button variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
gpointer user_data; gpointer user_data;
@ -313,7 +313,7 @@ gimp_radio_group_new (gboolean in_frame,
/* create the radio buttons */ /* create the radio buttons */
va_start (args, frame_title); va_start (args, frame_title);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
while (label) while (label)
{ {
callback = va_arg (args, GtkSignalFunc); callback = va_arg (args, GtkSignalFunc);
@ -345,7 +345,7 @@ gimp_radio_group_new (gboolean in_frame,
gtk_widget_show (button); gtk_widget_show (button);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -376,19 +376,18 @@ gimp_radio_group_new (gboolean in_frame,
* @...: A #NULL terminated @va_list describing the radio buttons. * @...: A #NULL terminated @va_list describing the radio buttons.
* *
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame). * Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
* **/
*/
GtkWidget * GtkWidget *
gimp_radio_group_new2 (gboolean in_frame, gimp_radio_group_new2 (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
GtkSignalFunc radio_button_callback, GtkSignalFunc radio_button_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
@ -398,9 +397,9 @@ gimp_radio_group_new2 (gboolean in_frame,
GSList *group; GSList *group;
/* radio button variables */ /* radio button variables */
gchar *label; const gchar *label;
gpointer user_data; gpointer user_data;
GtkWidget **widget_ptr; GtkWidget **widget_ptr;
va_list args; va_list args;
@ -410,7 +409,8 @@ gimp_radio_group_new2 (gboolean in_frame,
/* create the radio buttons */ /* create the radio buttons */
va_start (args, initial); va_start (args, initial);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
while (label) while (label)
{ {
user_data = va_arg (args, gpointer); user_data = va_arg (args, gpointer);
@ -439,7 +439,7 @@ gimp_radio_group_new2 (gboolean in_frame,
gtk_widget_show (button); gtk_widget_show (button);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -476,8 +476,7 @@ gimp_radio_group_new2 (gboolean in_frame,
* setting a standard minimun horizontal size. * setting a standard minimun horizontal size.
* *
* Returns: A #GtkSpinbutton and it's #GtkAdjustment. * Returns: A #GtkSpinbutton and it's #GtkAdjustment.
* **/
*/
GtkWidget * GtkWidget *
gimp_spin_button_new (GtkObject **adjustment, /* return value */ gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value, gfloat value,
@ -545,26 +544,25 @@ gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
* have to initialize GIMP's help system with gimp_help_init() before using it. * have to initialize GIMP's help system with gimp_help_init() before using it.
* *
* Returns: The #GtkSpinButton's #GtkAdjustment. * Returns: The #GtkSpinButton's #GtkAdjustment.
* **/
*/
GtkObject * GtkObject *
gimp_scale_entry_new (GtkTable *table, gimp_scale_entry_new (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *text, const gchar *text,
gint scale_usize, gint scale_usize,
gint spinbutton_usize, gint spinbutton_usize,
gfloat value, gfloat value,
gfloat lower, gfloat lower,
gfloat upper, gfloat upper,
gfloat step_increment, gfloat step_increment,
gfloat page_increment, gfloat page_increment,
guint digits, guint digits,
gboolean constrain, gboolean constrain,
gfloat unconstrained_lower, gfloat unconstrained_lower,
gfloat unconstrained_upper, gfloat unconstrained_upper,
gchar *tooltip, const gchar *tooltip,
gchar *help_data) const gchar *help_data)
{ {
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
@ -682,8 +680,7 @@ gimp_random_seed_toggle_update (GtkWidget *widget,
* *
* Returns: A #GtkHBox containing a #GtkSpinButton for the random seed and * Returns: A #GtkHBox containing a #GtkSpinButton for the random seed and
* a #GtkToggleButton for toggling the @use_time behaviour. * a #GtkToggleButton for toggling the @use_time behaviour.
* **/
*/
GtkWidget * GtkWidget *
gimp_random_seed_new (gint *seed, gimp_random_seed_new (gint *seed,
gint *use_time, gint *use_time,
@ -845,11 +842,10 @@ gimp_coordinates_callback (GtkWidget *widget,
* Returns: A #GimpSizeEntry with two fields for x/y coordinates/sizes with * Returns: A #GimpSizeEntry with two fields for x/y coordinates/sizes with
* a #GimpChainButton attached to constrain either the two fields' * a #GimpChainButton attached to constrain either the two fields'
* values or the ratio between them. * values or the ratio between them.
* **/
*/
GtkWidget * GtkWidget *
gimp_coordinates_new (GimpUnit unit, gimp_coordinates_new (GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gint spinbutton_usize, gint spinbutton_usize,
@ -858,7 +854,7 @@ gimp_coordinates_new (GimpUnit unit,
gboolean chainbutton_active, gboolean chainbutton_active,
gboolean chain_constrains_ratio, gboolean chain_constrains_ratio,
gchar *xlabel, const gchar *xlabel,
gdouble x, gdouble x,
gdouble xres, gdouble xres,
gdouble lower_boundary_x, gdouble lower_boundary_x,
@ -866,7 +862,7 @@ gimp_coordinates_new (GimpUnit unit,
gdouble xsize_0, /* % */ gdouble xsize_0, /* % */
gdouble xsize_100, /* % */ gdouble xsize_100, /* % */
gchar *ylabel, const gchar *ylabel,
gdouble y, gdouble y,
gdouble yres, gdouble yres,
gdouble lower_boundary_y, gdouble lower_boundary_y,
@ -993,7 +989,7 @@ gimp_mem_size_unit_callback (GtkWidget *widget,
* @adjustment: The adjustment containing the memsize and it's limits. * @adjustment: The adjustment containing the memsize and it's limits.
* *
* Returns: A #GtkHBox with a #GtkSpinButton and a #GtkOptionMenu. * Returns: A #GtkHBox with a #GtkSpinButton and a #GtkOptionMenu.
*/ **/
GtkWidget * GtkWidget *
gimp_mem_size_entry_new (GtkAdjustment *adjustment) gimp_mem_size_entry_new (GtkAdjustment *adjustment)
{ {
@ -1063,11 +1059,10 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
* @text: An optional text which will appear right of the pixmap. * @text: An optional text which will appear right of the pixmap.
* *
* Returns: A #GtkButton with a #GimpPixmap and an optional #GtkLabel. * Returns: A #GtkButton with a #GimpPixmap and an optional #GtkLabel.
* **/
*/
GtkWidget * GtkWidget *
gimp_pixmap_button_new (gchar **xpm_data, gimp_pixmap_button_new (gchar **xpm_data,
gchar *text) const gchar *text)
{ {
GtkWidget *button; GtkWidget *button;
GtkWidget *pixmap; GtkWidget *pixmap;
@ -1126,8 +1121,7 @@ gimp_pixmap_button_new (gchar **xpm_data,
* This function can also set the sensitive state according to the toggle * This function can also set the sensitive state according to the toggle
* button's inverse "active" state by attaching widgets with the * button's inverse "active" state by attaching widgets with the
* "inverse_sensitive" key. * "inverse_sensitive" key.
* **/
*/
void void
gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button) gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
{ {
@ -1162,8 +1156,7 @@ gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
* gtk_toggle_button_get_active(). * gtk_toggle_button_get_active().
* *
* Note that this function calls gimp_toggle_button_sensitive_update(). * Note that this function calls gimp_toggle_button_sensitive_update().
* **/
*/
void void
gimp_toggle_button_update (GtkWidget *widget, gimp_toggle_button_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1187,8 +1180,7 @@ gimp_toggle_button_update (GtkWidget *widget,
* (#gint) gtk_object_get_user_data(). * (#gint) gtk_object_get_user_data().
* *
* Note that this function calls gimp_toggle_button_sensitive_update(). * Note that this function calls gimp_toggle_button_sensitive_update().
* **/
*/
void void
gimp_radio_button_update (GtkWidget *widget, gimp_radio_button_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1210,8 +1202,7 @@ gimp_radio_button_update (GtkWidget *widget,
* @widget: A #GtkMenuItem. * @widget: A #GtkMenuItem.
* @data: A pointer to a #gint variable which will store the value of * @data: A pointer to a #gint variable which will store the value of
* (#gint) gtk_object_get_user_data(). * (#gint) gtk_object_get_user_data().
* **/
*/
void void
gimp_menu_item_update (GtkWidget *widget, gimp_menu_item_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1231,8 +1222,7 @@ gimp_menu_item_update (GtkWidget *widget,
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#gint) (value + 0.5). * with (#gint) (value + 0.5).
* **/
*/
void void
gimp_int_adjustment_update (GtkAdjustment *adjustment, gimp_int_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1251,8 +1241,7 @@ gimp_int_adjustment_update (GtkAdjustment *adjustment,
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#guint) (value + 0.5). * with (#guint) (value + 0.5).
* **/
*/
void void
gimp_uint_adjustment_update (GtkAdjustment *adjustment, gimp_uint_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1268,8 +1257,7 @@ gimp_uint_adjustment_update (GtkAdjustment *adjustment,
* @adjustment: A #GtkAdjustment. * @adjustment: A #GtkAdjustment.
* @data: A pointer to a #gfloat varaiable which willl store the adjustment's * @data: A pointer to a #gfloat varaiable which willl store the adjustment's
* value. * value.
* **/
*/
void void
gimp_float_adjustment_update (GtkAdjustment *adjustment, gimp_float_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1285,8 +1273,7 @@ gimp_float_adjustment_update (GtkAdjustment *adjustment,
* @adjustment: A #GtkAdjustment. * @adjustment: A #GtkAdjustment.
* @data: A pointer to a #gdouble variable which will store the adjustment's * @data: A pointer to a #gdouble variable which will store the adjustment's
* value. * value.
* **/
*/
void void
gimp_double_adjustment_update (GtkAdjustment *adjustment, gimp_double_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1310,8 +1297,7 @@ gimp_double_adjustment_update (GtkAdjustment *adjustment,
* *
* See gimp_toggle_button_sensitive_update() for a description of how * See gimp_toggle_button_sensitive_update() for a description of how
* to set up the list. * to set up the list.
* **/
*/
void void
gimp_unit_menu_update (GtkWidget *widget, gimp_unit_menu_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1355,18 +1341,17 @@ gimp_unit_menu_update (GtkWidget *widget,
* *
* Note that the @label_text can be #NULL and that the widget will be attached * Note that the @label_text can be #NULL and that the widget will be attached
* starting at (@column + 1) in this case, too. * starting at (@column + 1) in this case, too.
* **/
*/
void void
gimp_table_attach_aligned (GtkTable *table, gimp_table_attach_aligned (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *label_text, const gchar *label_text,
gfloat xalign, gfloat xalign,
gfloat yalign, gfloat yalign,
GtkWidget *widget, GtkWidget *widget,
gint colspan, gint colspan,
gboolean left_align) gboolean left_align)
{ {
if (label_text) if (label_text)
{ {

View file

@ -65,10 +65,10 @@ void gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer user_data); gpointer user_data);
GtkWidget * gimp_radio_group_new (gboolean in_frame, GtkWidget * gimp_radio_group_new (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -79,13 +79,13 @@ GtkWidget * gimp_radio_group_new (gboolean in_frame,
...); ...);
GtkWidget * gimp_radio_group_new2 (gboolean in_frame, GtkWidget * gimp_radio_group_new2 (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
GtkSignalFunc radio_button_callback, GtkSignalFunc radio_button_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
@ -122,7 +122,7 @@ GtkWidget * gimp_spin_button_new (/* return value: */
GtkObject * gimp_scale_entry_new (GtkTable *table, GtkObject * gimp_scale_entry_new (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *text, const gchar *text,
gint scale_usize, gint scale_usize,
gint spinbutton_usize, gint spinbutton_usize,
gfloat value, gfloat value,
@ -134,8 +134,8 @@ GtkObject * gimp_scale_entry_new (GtkTable *table,
gboolean constrain, gboolean constrain,
gfloat unconstrained_lower, gfloat unconstrained_lower,
gfloat unconstrained_upper, gfloat unconstrained_upper,
gchar *tooltip, const gchar *tooltip,
gchar *help_data); const gchar *help_data);
#define GIMP_RANDOM_SEED_SPINBUTTON(hbox) \ #define GIMP_RANDOM_SEED_SPINBUTTON(hbox) \
GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT( hbox), "spinbutton")) GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT( hbox), "spinbutton"))
@ -157,7 +157,7 @@ GtkWidget * gimp_random_seed_new (gint *seed,
"chainbutton")) "chainbutton"))
GtkWidget * gimp_coordinates_new (GimpUnit unit, GtkWidget * gimp_coordinates_new (GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gint spinbutton_usize, gint spinbutton_usize,
@ -166,7 +166,7 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
gboolean chainbutton_active, gboolean chainbutton_active,
gboolean chain_constrains_ratio, gboolean chain_constrains_ratio,
gchar *xlabel, const gchar *xlabel,
gdouble x, gdouble x,
gdouble xres, gdouble xres,
gdouble lower_boundary_x, gdouble lower_boundary_x,
@ -174,7 +174,7 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
gdouble xsize_0, /* % */ gdouble xsize_0, /* % */
gdouble xsize_100, /* % */ gdouble xsize_100, /* % */
gchar *ylabel, const gchar *ylabel,
gdouble y, gdouble y,
gdouble yres, gdouble yres,
gdouble lower_boundary_y, gdouble lower_boundary_y,
@ -197,7 +197,7 @@ GtkWidget * gimp_mem_size_entry_new (GtkAdjustment *adjustment);
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data, GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
gchar *text); const gchar *text);
/* /*
* Standard Callbacks * Standard Callbacks
@ -236,7 +236,7 @@ void gimp_unit_menu_update (GtkWidget *widget,
void gimp_table_attach_aligned (GtkTable *table, void gimp_table_attach_aligned (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *label_text, const gchar *label_text,
gfloat xalign, gfloat xalign,
gfloat yalign, gfloat yalign,
GtkWidget *widget, GtkWidget *widget,

View file

@ -63,8 +63,10 @@ static void gimp_color_button_drag_handle (GtkWidget *widget,
guint info, guint info,
guint time, guint time,
gpointer data); gpointer data);
static const GtkTargetEntry targets[] = { { "application/x-color", 0 } }; static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
/* end of DND */ /* end of DND */
struct _GimpColorButton struct _GimpColorButton
@ -89,48 +91,50 @@ struct _GimpColorButton
}; };
static void gimp_color_button_destroy (GtkObject *object); static void gimp_color_button_destroy (GtkObject *object);
static void gimp_color_button_clicked (GtkButton *button); static void gimp_color_button_clicked (GtkButton *button);
static void gimp_color_button_paint (GimpColorButton *gcb); static void gimp_color_button_paint (GimpColorButton *gcb);
static void gimp_color_button_state_changed (GtkWidget *widget, static void gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state); GtkStateType previous_state);
static void gimp_color_button_dialog_ok (GtkWidget *widget, static void gimp_color_button_dialog_ok (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_color_button_dialog_cancel (GtkWidget *widget, static void gimp_color_button_dialog_cancel (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_color_button_use_fg (gpointer callback_data, static void gimp_color_button_use_fg (gpointer callback_data,
guint callback_action, guint callback_action,
GtkWidget *widget); GtkWidget *widget);
static void gimp_color_button_use_bg (gpointer callback_data, static void gimp_color_button_use_bg (gpointer callback_data,
guint callback_action, guint callback_action,
GtkWidget *widget); GtkWidget *widget);
static gint gimp_color_button_menu_popup (GtkWidget *widget, static gint gimp_color_button_menu_popup (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer data); gpointer data);
static gchar* gimp_color_button_menu_translate (const gchar *path, static gchar* gimp_color_button_menu_translate (const gchar *path,
gpointer func_data); gpointer func_data);
static GtkItemFactoryEntry menu_items[] = { static GtkItemFactoryEntry menu_items[] =
{
{ N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL }, { N_("/Use Foreground Color"), NULL, gimp_color_button_use_fg, 2, NULL },
{ N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL } { N_("/Use Background Color"), NULL, gimp_color_button_use_bg, 2, NULL }
}; };
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
enum { enum
{
COLOR_CHANGED, COLOR_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 }; static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL; static GtkWidgetClass *parent_class = NULL;
static void static void
gimp_color_button_destroy (GtkObject *object) gimp_color_button_destroy (GtkObject *object)
{ {
@ -148,7 +152,7 @@ gimp_color_button_destroy (GtkObject *object)
g_free (gcb->odd); g_free (gcb->odd);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
@ -156,12 +160,12 @@ static void
gimp_color_button_class_init (GimpColorButtonClass *class) gimp_color_button_class_init (GimpColorButtonClass *class)
{ {
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkButtonClass *button_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
object_class = (GtkObjectClass*) class; object_class = (GtkObjectClass*) class;
button_class = (GtkButtonClass*) class;
widget_class = (GtkWidgetClass*) class; widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
parent_class = gtk_type_class (gtk_widget_get_type ()); parent_class = gtk_type_class (gtk_widget_get_type ());
@ -172,13 +176,15 @@ gimp_color_button_class_init (GimpColorButtonClass *class)
GTK_SIGNAL_OFFSET (GimpColorButtonClass, GTK_SIGNAL_OFFSET (GimpColorButtonClass,
color_changed), color_changed),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_color_button_signals, gtk_object_class_add_signals (object_class, gimp_color_button_signals,
LAST_SIGNAL); LAST_SIGNAL);
class->color_changed = NULL; class->color_changed = NULL;
object_class->destroy = gimp_color_button_destroy; object_class->destroy = gimp_color_button_destroy;
button_class->clicked = gimp_color_button_clicked;
widget_class->state_changed = gimp_color_button_state_changed; widget_class->state_changed = gimp_color_button_state_changed;
button_class->clicked = gimp_color_button_clicked;
} }
@ -225,12 +231,12 @@ gimp_color_button_get_type (void)
} }
static GtkWidget * static GtkWidget *
_gimp_color_button_new (gboolean double_color, _gimp_color_button_new (gboolean double_color,
gchar *title, const gchar *title,
gint width, gint width,
gint height, gint height,
gpointer color, gpointer color,
gint bpp) gint bpp)
{ {
GimpColorButton *gcb; GimpColorButton *gcb;
gint i; gint i;
@ -297,25 +303,21 @@ _gimp_color_button_new (gboolean double_color,
targets, 1, targets, 1,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_begin",
"drag_begin",
GTK_SIGNAL_FUNC (gimp_color_button_drag_begin), GTK_SIGNAL_FUNC (gimp_color_button_drag_begin),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_end",
"drag_end",
GTK_SIGNAL_FUNC (gimp_color_button_drag_end), GTK_SIGNAL_FUNC (gimp_color_button_drag_end),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_get",
"drag_data_get",
GTK_SIGNAL_FUNC (gimp_color_button_drag_handle), GTK_SIGNAL_FUNC (gimp_color_button_drag_handle),
gcb); gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview), gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_received",
"drag_data_received",
GTK_SIGNAL_FUNC (gimp_color_button_drop_handle), GTK_SIGNAL_FUNC (gimp_color_button_drop_handle),
gcb); gcb);
/* end of DND */ /* end of DND */
return (GTK_WIDGET (gcb)); return GTK_WIDGET (gcb);
} }
/** /**
@ -335,13 +337,13 @@ _gimp_color_button_new (gboolean double_color,
* signal is emitted. * signal is emitted.
* *
* Returns: Pointer to the new #GimpColorButton widget. * Returns: Pointer to the new #GimpColorButton widget.
*/ **/
GtkWidget * GtkWidget *
gimp_color_button_new (gchar *title, gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
guchar *color, guchar *color,
gint bpp) gint bpp)
{ {
return _gimp_color_button_new (FALSE, title, width, height, return _gimp_color_button_new (FALSE, title, width, height,
(gpointer) color, bpp); (gpointer) color, bpp);
@ -364,13 +366,13 @@ gimp_color_button_new (gchar *title,
* signal is emitted. * signal is emitted.
* *
* Returns: Pointer to the new GimpColorButton widget. * Returns: Pointer to the new GimpColorButton widget.
*/ **/
GtkWidget * GtkWidget *
gimp_color_button_double_new (gchar *title, gimp_color_button_double_new (const gchar *title,
gint width, gint width,
gint height, gint height,
gdouble *color, gdouble *color,
gint bpp) gint bpp)
{ {
return _gimp_color_button_new (TRUE, title, width, height, return _gimp_color_button_new (TRUE, title, width, height,
(gpointer) color, bpp); (gpointer) color, bpp);
@ -383,12 +385,13 @@ gimp_color_button_double_new (gchar *title,
* Should be used after the color controlled by a #GimpColorButton * Should be used after the color controlled by a #GimpColorButton
* was changed. The color is then reread and the change is propagated * was changed. The color is then reread and the change is propagated
* to the preview and the GtkColorSelectionDialog if one is open. * to the preview and the GtkColorSelectionDialog if one is open.
*/ **/
void void
gimp_color_button_update (GimpColorButton *gcb) gimp_color_button_update (GimpColorButton *gcb)
{ {
gint i; gint i;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
if (gcb->double_color) if (gcb->double_color)
@ -413,13 +416,14 @@ static void
gimp_color_button_state_changed (GtkWidget *widget, gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state) GtkStateType previous_state)
{ {
g_return_if_fail (widget != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog) if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog); gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
if (GTK_WIDGET_CLASS (parent_class)->state_changed) if (GTK_WIDGET_CLASS (parent_class)->state_changed)
(* GTK_WIDGET_CLASS (parent_class)->state_changed) (widget, previous_state); GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
} }
static gint static gint
@ -432,7 +436,9 @@ gimp_color_button_menu_popup (GtkWidget *widget,
gint x; gint x;
gint y; gint y;
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE); g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE);
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
if (event->type != GDK_BUTTON_PRESS) if (event->type != GDK_BUTTON_PRESS)
@ -457,7 +463,9 @@ gimp_color_button_clicked (GtkButton *button)
GimpColorButton *gcb; GimpColorButton *gcb;
GtkColorSelection *colorsel; GtkColorSelection *colorsel;
g_return_if_fail (button != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
gcb = GIMP_COLOR_BUTTON (button); gcb = GIMP_COLOR_BUTTON (button);
if (!gcb->dialog) if (!gcb->dialog)
@ -479,6 +487,7 @@ gimp_color_button_clicked (GtkButton *button)
(GtkSignalFunc) gimp_color_button_dialog_cancel, gcb); (GtkSignalFunc) gimp_color_button_dialog_cancel, gcb);
gtk_window_set_position (GTK_WINDOW (gcb->dialog), GTK_WIN_POS_MOUSE); gtk_window_set_position (GTK_WINDOW (gcb->dialog), GTK_WIN_POS_MOUSE);
} }
gtk_color_selection_set_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gtk_color_selection_set_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel),
gcb->dcolor); gcb->dcolor);
gtk_widget_show (gcb->dialog); gtk_widget_show (gcb->dialog);
@ -491,6 +500,7 @@ gimp_color_button_paint (GimpColorButton *gcb)
gdouble c0, c1; gdouble c0, c1;
guchar *p0, *p1; guchar *p0, *p1;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
p0 = gcb->even; p0 = gcb->even;
@ -548,8 +558,10 @@ gimp_color_button_dialog_ok (GtkWidget *widget,
GimpColorButton *gcb; GimpColorButton *gcb;
gboolean color_changed = FALSE; gboolean color_changed = FALSE;
gint i; gint i;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
gtk_color_selection_get_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gcb->dcolor); gtk_color_selection_get_color (GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (gcb->dialog)->colorsel), gcb->dcolor);
@ -592,7 +604,9 @@ gimp_color_button_dialog_cancel (GtkWidget *widget,
{ {
GimpColorButton *gcb; GimpColorButton *gcb;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data); gcb = GIMP_COLOR_BUTTON (data);
gtk_widget_hide (gcb->dialog); gtk_widget_hide (gcb->dialog);
@ -608,7 +622,9 @@ gimp_color_button_use_fg (gpointer callback_data,
guchar fg_color[3]; guchar fg_color[3];
gint i; gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data); gcb = GIMP_COLOR_BUTTON (callback_data);
gimp_palette_get_foreground (fg_color, &fg_color[1], &fg_color[2]); gimp_palette_get_foreground (fg_color, &fg_color[1], &fg_color[2]);
@ -640,7 +656,9 @@ gimp_color_button_use_bg (gpointer callback_data,
guchar bg_color[3]; guchar bg_color[3];
gint i; gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data)); g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data); gcb = GIMP_COLOR_BUTTON (callback_data);
gimp_palette_get_background (bg_color, &bg_color[1], &bg_color[2]); gimp_palette_get_background (bg_color, &bg_color[1], &bg_color[2]);
@ -662,7 +680,7 @@ gimp_color_button_use_bg (gpointer callback_data,
gimp_color_button_signals[COLOR_CHANGED]); gimp_color_button_signals[COLOR_CHANGED]);
} }
static gchar * static gchar *
gimp_color_button_menu_translate (const gchar *path, gimp_color_button_menu_translate (const gchar *path,
gpointer func_data) gpointer func_data)
{ {

View file

@ -52,16 +52,16 @@ struct _GimpColorButtonClass
GtkType gimp_color_button_get_type (void); GtkType gimp_color_button_get_type (void);
GtkWidget * gimp_color_button_new (gchar *title, GtkWidget * gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
guchar *color, guchar *color,
gint bpp); gint bpp);
GtkWidget * gimp_color_button_double_new (gchar *title, GtkWidget * gimp_color_button_double_new (const gchar *title,
gint width, gint width,
gint height, gint height,
gdouble *color, gdouble *color,
gint bpp); gint bpp);
void gimp_color_button_update (GimpColorButton *gcb); void gimp_color_button_update (GimpColorButton *gcb);

View file

@ -99,14 +99,14 @@ GtkWidget *
gimp_dialog_new (const gchar *title, gimp_dialog_new (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
gint auto_shrink, gint auto_shrink,
/* specify action area buttons as va_list: /* specify action area buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -167,7 +167,7 @@ GtkWidget *
gimp_dialog_newv (const gchar *title, gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -237,7 +237,7 @@ void
gimp_dialog_create_action_area (GtkDialog *dialog, gimp_dialog_create_action_area (GtkDialog *dialog,
/* specify action area buttons as va_list: /* specify action area buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -272,7 +272,7 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
GtkWidget *button; GtkWidget *button;
/* action area variables */ /* action area variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
GtkObject *slot_object; GtkObject *slot_object;
@ -286,7 +286,7 @@ gimp_dialog_create_action_areav (GtkDialog *dialog,
g_return_if_fail (GTK_IS_DIALOG (dialog)); g_return_if_fail (GTK_IS_DIALOG (dialog));
/* prepare the action_area */ /* prepare the action_area */
label = va_arg (args, gchar *); label = va_arg (args, const gchar *);
if (label) if (label)
{ {

View file

@ -35,7 +35,7 @@ extern "C" {
GtkWidget * gimp_dialog_new (const gchar *title, GtkWidget * gimp_dialog_new (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -43,7 +43,7 @@ GtkWidget * gimp_dialog_new (const gchar *title,
/* specify action area buttons /* specify action area buttons
* as va_list: * as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,
@ -57,7 +57,7 @@ GtkWidget * gimp_dialog_new (const gchar *title,
GtkWidget * gimp_dialog_newv (const gchar *title, GtkWidget * gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name, const gchar *wmclass_name,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkWindowPosition position, GtkWindowPosition position,
gint allow_shrink, gint allow_shrink,
gint allow_grow, gint allow_grow,
@ -70,7 +70,7 @@ void gimp_dialog_create_action_area (GtkDialog *dialog,
/* specify action area buttons /* specify action area buttons
* as va_list: * as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* GtkObject *slot_object, * GtkObject *slot_object,

View file

@ -99,7 +99,7 @@ gimp_file_selection_destroy (GtkObject *object)
gdk_bitmap_unref (gfs->no_mask); gdk_bitmap_unref (gfs->no_mask);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
@ -127,7 +127,6 @@ gimp_file_selection_class_init (GimpFileSelectionClass *class)
class->filename_changed = NULL; class->filename_changed = NULL;
object_class->destroy = gimp_file_selection_destroy; object_class->destroy = gimp_file_selection_destroy;
widget_class->realize = gimp_file_selection_realize; widget_class->realize = gimp_file_selection_realize;
} }
@ -201,13 +200,12 @@ gimp_file_selection_get_type (void)
* Creates a new #GimpFileSelection widget. * Creates a new #GimpFileSelection widget.
* *
* Returns: A pointer to the new #GimpFileSelection widget. * Returns: A pointer to the new #GimpFileSelection widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_file_selection_new (gchar *title, gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid) gboolean check_valid)
{ {
GimpFileSelection *gfs; GimpFileSelection *gfs;
@ -229,8 +227,7 @@ gimp_file_selection_new (gchar *title,
* Note that you have to g_free() the returned string. * Note that you have to g_free() the returned string.
* *
* Returns: The file or directory the user has entered. * Returns: The file or directory the user has entered.
* **/
*/
gchar * gchar *
gimp_file_selection_get_filename (GimpFileSelection *gfs) gimp_file_selection_get_filename (GimpFileSelection *gfs)
{ {
@ -252,7 +249,7 @@ gimp_file_selection_get_filename (GimpFileSelection *gfs)
*/ */
void void
gimp_file_selection_set_filename (GimpFileSelection *gfs, gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename) const gchar *filename)
{ {
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
@ -441,6 +438,7 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
if (! gfs->check_valid) if (! gfs->check_valid)
return; return;
if (gfs->file_exists == NULL) if (gfs->file_exists == NULL)
return; return;

View file

@ -69,15 +69,15 @@ struct _GimpFileSelectionClass
GtkType gimp_file_selection_get_type (void); GtkType gimp_file_selection_get_type (void);
GtkWidget* gimp_file_selection_new (gchar *title, GtkWidget* gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid); gboolean check_valid);
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs); gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
void gimp_file_selection_set_filename (GimpFileSelection *gfs, void gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename); const gchar *filename);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -99,7 +99,7 @@ gimp_file_selection_destroy (GtkObject *object)
gdk_bitmap_unref (gfs->no_mask); gdk_bitmap_unref (gfs->no_mask);
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
@ -127,7 +127,6 @@ gimp_file_selection_class_init (GimpFileSelectionClass *class)
class->filename_changed = NULL; class->filename_changed = NULL;
object_class->destroy = gimp_file_selection_destroy; object_class->destroy = gimp_file_selection_destroy;
widget_class->realize = gimp_file_selection_realize; widget_class->realize = gimp_file_selection_realize;
} }
@ -201,13 +200,12 @@ gimp_file_selection_get_type (void)
* Creates a new #GimpFileSelection widget. * Creates a new #GimpFileSelection widget.
* *
* Returns: A pointer to the new #GimpFileSelection widget. * Returns: A pointer to the new #GimpFileSelection widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_file_selection_new (gchar *title, gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid) gboolean check_valid)
{ {
GimpFileSelection *gfs; GimpFileSelection *gfs;
@ -229,8 +227,7 @@ gimp_file_selection_new (gchar *title,
* Note that you have to g_free() the returned string. * Note that you have to g_free() the returned string.
* *
* Returns: The file or directory the user has entered. * Returns: The file or directory the user has entered.
* **/
*/
gchar * gchar *
gimp_file_selection_get_filename (GimpFileSelection *gfs) gimp_file_selection_get_filename (GimpFileSelection *gfs)
{ {
@ -252,7 +249,7 @@ gimp_file_selection_get_filename (GimpFileSelection *gfs)
*/ */
void void
gimp_file_selection_set_filename (GimpFileSelection *gfs, gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename) const gchar *filename)
{ {
g_return_if_fail (gfs != NULL); g_return_if_fail (gfs != NULL);
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs)); g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
@ -441,6 +438,7 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
if (! gfs->check_valid) if (! gfs->check_valid)
return; return;
if (gfs->file_exists == NULL) if (gfs->file_exists == NULL)
return; return;

View file

@ -69,15 +69,15 @@ struct _GimpFileSelectionClass
GtkType gimp_file_selection_get_type (void); GtkType gimp_file_selection_get_type (void);
GtkWidget* gimp_file_selection_new (gchar *title, GtkWidget* gimp_file_selection_new (const gchar *title,
gchar *filename, const gchar *filename,
gboolean dir_only, gboolean dir_only,
gboolean check_valid); gboolean check_valid);
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs); gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
void gimp_file_selection_set_filename (GimpFileSelection *gfs, void gimp_file_selection_set_filename (GimpFileSelection *gfs,
gchar *filename); const gchar *filename);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -56,8 +56,7 @@ static GtkWidget * tips_query = NULL;
* *
* Currently it only creates a #GtkTooltips object with gtk_tooltips_new() * Currently it only creates a #GtkTooltips object with gtk_tooltips_new()
* which will be used by gimp_help_set_help_data(). * which will be used by gimp_help_set_help_data().
* **/
*/
void void
gimp_help_init (void) gimp_help_init (void)
{ {
@ -69,8 +68,7 @@ gimp_help_init (void)
* *
* This function frees the memory used by the #GtkTooltips created by * This function frees the memory used by the #GtkTooltips created by
* gimp_help_init(). * gimp_help_init().
* **/
*/
void void
gimp_help_free (void) gimp_help_free (void)
{ {
@ -82,8 +80,7 @@ gimp_help_free (void)
* gimp_help_enable_tooltips: * gimp_help_enable_tooltips:
* *
* This function calls gtk_tooltips_enable(). * This function calls gtk_tooltips_enable().
* **/
*/
void void
gimp_help_enable_tooltips (void) gimp_help_enable_tooltips (void)
{ {
@ -94,8 +91,7 @@ gimp_help_enable_tooltips (void)
* gimp_help_disable_tooltips: * gimp_help_disable_tooltips:
* *
* This function calls gtk_tooltips_disable(). * This function calls gtk_tooltips_disable().
* **/
*/
void void
gimp_help_disable_tooltips (void) gimp_help_disable_tooltips (void)
{ {
@ -116,12 +112,11 @@ gimp_help_disable_tooltips (void)
* For convenience, gimp_help_connect_help_accel() calls * For convenience, gimp_help_connect_help_accel() calls
* gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you * gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you
* don't have to worry about this. * don't have to worry about this.
* **/
*/
void void
gimp_help_connect_help_accel (GtkWidget *widget, gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data) const gchar *help_data)
{ {
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
@ -134,7 +129,8 @@ gimp_help_connect_help_accel (GtkWidget *widget,
if (GTK_IS_WINDOW (widget)) if (GTK_IS_WINDOW (widget))
gimp_dialog_set_icon (GTK_WINDOW (widget)); gimp_dialog_set_icon (GTK_WINDOW (widget));
/* set up the help signals and tips query widget */ /* set up the help signals and tips query widget
*/
if (!tips_query) if (!tips_query)
{ {
tips_query = gtk_tips_query_new (); tips_query = gtk_tips_query_new ();
@ -229,20 +225,25 @@ gimp_help_connect_help_accel (GtkWidget *widget,
* help system will automatically ascend the widget hierarchy until it * help system will automatically ascend the widget hierarchy until it
* finds another widget with @help_data attached and concatenates both * finds another widget with @help_data attached and concatenates both
* to a complete help path. * to a complete help path.
* **/
*/
void void
gimp_help_set_help_data (GtkWidget *widget, gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip, const gchar *tooltip,
gchar *help_data) const gchar *help_data)
{ {
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (tooltip) if (tooltip)
gtk_tooltips_set_tip (tool_tips, widget, tooltip, help_data); {
gtk_tooltips_set_tip (tool_tips, widget, tooltip,
(gpointer) help_data);
}
else if (help_data) else if (help_data)
gtk_object_set_data (GTK_OBJECT (widget), "gimp_help_data", help_data); {
gtk_object_set_data (GTK_OBJECT (widget), "gimp_help_data",
(gpointer) help_data);
}
} }
/** /**
@ -258,8 +259,7 @@ gimp_help_set_help_data (GtkWidget *widget,
* be displayed. Otherwise the help system will ascend the widget hierarchy * be displayed. Otherwise the help system will ascend the widget hierarchy
* until it finds an attached @help_data string (which should be the * until it finds an attached @help_data string (which should be the
* case at least for every window/dialog). * case at least for every window/dialog).
* **/
*/
void void
gimp_context_help (void) gimp_context_help (void)
{ {
@ -275,12 +275,12 @@ static void
gimp_help_callback (GtkWidget *widget, gimp_help_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpHelpFunc help_function; GimpHelpFunc help_function;
gchar *help_data; const gchar *help_data;
help_function = (GimpHelpFunc) data; help_function = (GimpHelpFunc) data;
help_data = (gchar *) gtk_object_get_data (GTK_OBJECT (widget), help_data = (const gchar *) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_help_data"); "gimp_help_data");
if (help_function) if (help_function)
(* help_function) (help_data); (* help_function) (help_data);

View file

@ -27,10 +27,12 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
typedef void (* GimpHelpFunc) (gchar *help_data); typedef void (* GimpHelpFunc) (const gchar *help_data);
void gimp_help_init (void); void gimp_help_init (void);
void gimp_help_free (void); void gimp_help_free (void);
@ -41,17 +43,17 @@ void gimp_help_disable_tooltips (void);
/* the standard gimp help function /* the standard gimp help function
* (has different implementations in the main app and in libgimp) * (has different implementations in the main app and in libgimp)
*/ */
void gimp_standard_help_func (gchar *help_data); void gimp_standard_help_func (const gchar *help_data);
/* connect the "F1" accelerator of a window */ /* connect the "F1" accelerator of a window */
void gimp_help_connect_help_accel (GtkWidget *widget, void gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data); const gchar *help_data);
/* set help data for non-window widgets */ /* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget, void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip, const gchar *tooltip,
gchar *help_data); const gchar *help_data);
/* activate the context help inspector */ /* activate the context help inspector */
void gimp_context_help (void); void gimp_context_help (void);

View file

@ -89,8 +89,8 @@ gimp_path_editor_init (GimpPathEditor *gpe)
GtkWidget *button; GtkWidget *button;
GtkWidget *scrolled_window; GtkWidget *scrolled_window;
gpe->file_selection = NULL; gpe->file_selection = NULL;
gpe->selected_item = NULL; gpe->selected_item = NULL;
gpe->number_of_items = 0; gpe->number_of_items = 0;
gpe->upper_hbox = gtk_hbox_new (FALSE, 2); gpe->upper_hbox = gtk_hbox_new (FALSE, 2);
@ -183,16 +183,16 @@ gimp_path_editor_get_type (void)
* #G_SEARCHPATH_SEPARATOR character. * #G_SEARCHPATH_SEPARATOR character.
* *
* Returns: A pointer to the new #GimpPathEditor widget. * Returns: A pointer to the new #GimpPathEditor widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_path_editor_new (gchar *filesel_title, gimp_path_editor_new (const gchar *filesel_title,
gchar *path) const gchar *path)
{ {
GimpPathEditor *gpe; GimpPathEditor *gpe;
GtkWidget *list_item; GtkWidget *list_item;
GList *directory_list; GList *directory_list;
gchar *directory; gchar *directory;
gchar *mypath;
g_return_val_if_fail ((filesel_title != NULL), NULL); g_return_val_if_fail ((filesel_title != NULL), NULL);
g_return_val_if_fail ((path != NULL), NULL); g_return_val_if_fail ((path != NULL), NULL);
@ -209,7 +209,7 @@ gimp_path_editor_new (gchar *filesel_title,
gtk_widget_show (gpe->file_selection); gtk_widget_show (gpe->file_selection);
directory_list = NULL; directory_list = NULL;
directory = path = g_strdup (path); directory = mypath = g_strdup (path);
/* split up the path */ /* split up the path */
while (strlen (directory)) while (strlen (directory))
@ -243,7 +243,7 @@ gimp_path_editor_new (gchar *filesel_title,
break; break;
} }
g_free (path); g_free (mypath);
if (directory_list) if (directory_list)
gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list); gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list);
@ -261,8 +261,7 @@ gimp_path_editor_new (gchar *filesel_title,
* Note that you have to g_free() the returned string. * Note that you have to g_free() the returned string.
* *
* Returns: The search path the user has selected in the path editor. * Returns: The search path the user has selected in the path editor.
* **/
*/
gchar * gchar *
gimp_path_editor_get_path (GimpPathEditor *gpe) gimp_path_editor_get_path (GimpPathEditor *gpe)
{ {

View file

@ -69,8 +69,8 @@ struct _GimpPathEditorClass
GtkType gimp_path_editor_get_type (void); GtkType gimp_path_editor_get_type (void);
GtkWidget * gimp_path_editor_new (gchar *filesel_title, GtkWidget * gimp_path_editor_new (const gchar *filesel_title,
gchar *path); const gchar *path);
gchar * gimp_path_editor_get_path (GimpPathEditor *gpe); gchar * gimp_path_editor_get_path (GimpPathEditor *gpe);

View file

@ -31,8 +31,10 @@ static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget); static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap); static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL; static GtkPixmapClass *parent_class = NULL;
static void static void
gimp_pixmap_destroy (GtkObject *object) gimp_pixmap_destroy (GtkObject *object)
{ {
@ -41,7 +43,7 @@ gimp_pixmap_destroy (GtkObject *object)
g_return_if_fail (pixmap = GIMP_PIXMAP (object)); g_return_if_fail (pixmap = GIMP_PIXMAP (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static void static void
@ -56,7 +58,6 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
parent_class = gtk_type_class (gtk_pixmap_get_type ()); parent_class = gtk_type_class (gtk_pixmap_get_type ());
object_class->destroy = gimp_pixmap_destroy; object_class->destroy = gimp_pixmap_destroy;
widget_class->realize = gimp_pixmap_realize; widget_class->realize = gimp_pixmap_realize;
} }
@ -98,8 +99,7 @@ gimp_pixmap_get_type (void)
* Creates a new #GimpPixmap widget. * Creates a new #GimpPixmap widget.
* *
* Returns: A pointer to the new #GimpPixmap widget. * Returns: A pointer to the new #GimpPixmap widget.
* **/
*/
GtkWidget * GtkWidget *
gimp_pixmap_new (gchar **xpm_data) gimp_pixmap_new (gchar **xpm_data)
{ {
@ -119,8 +119,7 @@ gimp_pixmap_new (gchar **xpm_data)
* @xpm_data: A pointer to a XPM data structure as found in XPM files. * @xpm_data: A pointer to a XPM data structure as found in XPM files.
* *
* Sets a new image for an existing #GimpPixmap widget. * Sets a new image for an existing #GimpPixmap widget.
* **/
*/
void void
gimp_pixmap_set (GimpPixmap *pixmap, gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data) gchar **xpm_data)
@ -162,7 +161,7 @@ static void
gimp_pixmap_realize (GtkWidget *widget) gimp_pixmap_realize (GtkWidget *widget)
{ {
if (GTK_WIDGET_CLASS (parent_class)->realize) if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); GTK_WIDGET_CLASS (parent_class)->realize (widget);
gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget)); gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget));
} }

View file

@ -43,7 +43,7 @@ struct _GimpPixmap
{ {
GtkPixmap pixmap; GtkPixmap pixmap;
gchar **xpm_data; gchar **xpm_data;
}; };
struct _GimpPixmapClass struct _GimpPixmapClass

View file

@ -51,50 +51,54 @@ struct _QueryBox
gpointer data; gpointer data;
}; };
static QueryBox * create_query_box (gchar *title,
static QueryBox * create_query_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkSignalFunc ok_callback, GtkSignalFunc ok_callback,
GtkSignalFunc cancel_callback, GtkSignalFunc cancel_callback,
gchar *message, const gchar *message,
gchar *ok_button, const gchar *ok_button,
gchar *cancel_button, const gchar *cancel_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GtkSignalFunc callback, GtkSignalFunc callback,
gpointer data); gpointer data);
static QueryBox * query_box_disconnect (gpointer data); static QueryBox * query_box_disconnect (gpointer data);
static void string_query_box_ok_callback (GtkWidget *widget, static void string_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void int_query_box_ok_callback (GtkWidget *widget, static void int_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void double_query_box_ok_callback (GtkWidget *widget, static void double_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void size_query_box_ok_callback (GtkWidget *widget, static void size_query_box_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void query_box_cancel_callback (GtkWidget *widget,
gpointer data);
static void boolean_query_box_true_callback (GtkWidget *widget, static void boolean_query_box_true_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void boolean_query_box_false_callback (GtkWidget *widget, static void boolean_query_box_false_callback (GtkWidget *widget,
gpointer data); gpointer data);
/* create a generic query box without any entry widget */ static void query_box_cancel_callback (GtkWidget *widget,
gpointer data);
/*
* create a generic query box without any entry widget
*/
static QueryBox * static QueryBox *
create_query_box (gchar *title, create_query_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
GtkSignalFunc ok_callback, GtkSignalFunc ok_callback,
GtkSignalFunc cancel_callback, GtkSignalFunc cancel_callback,
gchar *message, const gchar *message,
gchar *ok_button, const gchar *ok_button,
gchar *cancel_button, const gchar *cancel_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GtkSignalFunc callback, GtkSignalFunc callback,
gpointer data) gpointer data)
{ {
@ -103,6 +107,11 @@ create_query_box (gchar *title,
GtkWidget *vbox = NULL; GtkWidget *vbox = NULL;
GtkWidget *label; GtkWidget *label;
/* make sure the object / signal passed are valid
*/
g_return_val_if_fail (object == NULL || GTK_IS_OBJECT (object), NULL);
g_return_val_if_fail (object == NULL || signal != NULL, NULL);
query_box = g_new (QueryBox, 1); query_box = g_new (QueryBox, 1);
qbox = gimp_dialog_new (title, "query_box", qbox = gimp_dialog_new (title, "query_box",
@ -117,13 +126,26 @@ create_query_box (gchar *title,
NULL); NULL);
/* if we are associated with an object, connect to the provided signal */ gtk_signal_connect (GTK_OBJECT (qbox), "destroy",
if (object && GTK_IS_OBJECT (object) && signal) GTK_SIGNAL_FUNC (gtk_widget_destroyed),
gtk_signal_connect (GTK_OBJECT (object), signal, &query_box->qbox);
GTK_SIGNAL_FUNC (query_box_cancel_callback),
query_box); /* if we are associated with an object, connect to the provided signal
*/
if (object)
{
gtk_signal_connect (GTK_OBJECT (object), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&query_box->object);
gtk_signal_connect (GTK_OBJECT (object), signal,
GTK_SIGNAL_FUNC (query_box_cancel_callback),
query_box);
}
else else
object = NULL; {
object = NULL;
}
if (message) if (message)
{ {
@ -160,16 +182,15 @@ create_query_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_string_box (gchar *title, gimp_query_string_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gchar *initial, const gchar *initial,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data) gpointer data)
{ {
@ -184,6 +205,9 @@ gimp_query_string_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0);
if (initial) if (initial)
@ -211,18 +235,17 @@ gimp_query_string_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_int_box (gchar *title, gimp_query_int_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data) gpointer data)
{ {
@ -238,6 +261,9 @@ gimp_query_int_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, 0); 1, 0);
@ -266,19 +292,18 @@ gimp_query_int_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_double_box (gchar *title, gimp_query_double_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data) gpointer data)
{ {
@ -294,6 +319,9 @@ gimp_query_double_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, digits); 1, digits);
@ -327,13 +355,12 @@ gimp_query_double_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_size_box (gchar *title, gimp_query_size_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
@ -342,7 +369,7 @@ gimp_query_size_box (gchar *title,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data) gpointer data)
{ {
@ -357,6 +384,9 @@ gimp_query_size_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (! query_box)
return NULL;
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100, sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE); GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot) if (dot_for_dot)
@ -394,18 +424,17 @@ gimp_query_size_box (gchar *title,
* @data: The callback's user data. * @data: The callback's user data.
* *
* Returns: A pointer to the new #GtkDialog. * Returns: A pointer to the new #GtkDialog.
* **/
*/
GtkWidget * GtkWidget *
gimp_query_boolean_box (gchar *title, gimp_query_boolean_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gboolean eek, gboolean eek,
gchar *message, const gchar *message,
gchar *true_button, const gchar *true_button,
gchar *false_button, const gchar *false_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data) gpointer data)
{ {
@ -422,7 +451,10 @@ gimp_query_boolean_box (gchar *title,
object, signal, object, signal,
callback, data); callback, data);
if (!eek) if (! query_box)
return NULL;
if (! eek)
return query_box->qbox; return query_box->qbox;
hbox = gtk_hbox_new (FALSE, 10); hbox = gtk_hbox_new (FALSE, 10);
@ -441,6 +473,11 @@ gimp_query_boolean_box (gchar *title,
return query_box->qbox; return query_box->qbox;
} }
/*
* private functions
*/
static QueryBox * static QueryBox *
query_box_disconnect (gpointer data) query_box_disconnect (gpointer data)
{ {
@ -474,7 +511,8 @@ string_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -497,7 +535,8 @@ int_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -520,7 +559,8 @@ double_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -544,21 +584,8 @@ size_query_box_ok_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
query_box = query_box_disconnect (data);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -576,7 +603,8 @@ boolean_query_box_true_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }
@ -594,7 +622,23 @@ boolean_query_box_false_callback (GtkWidget *widget,
query_box->data); query_box->data);
/* Destroy the box */ /* Destroy the box */
gtk_widget_destroy (query_box->qbox); if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
query_box = query_box_disconnect (data);
/* Destroy the box */
if (query_box->qbox)
gtk_widget_destroy (query_box->qbox);
g_free (query_box); g_free (query_box);
} }

View file

@ -55,45 +55,45 @@ typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
gpointer data); gpointer data);
/* some simple query dialogs */ /* some simple query dialogs */
GtkWidget * gimp_query_string_box (gchar *title, GtkWidget * gimp_query_string_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gchar *initial, const gchar *initial,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_int_box (gchar *title, GtkWidget * gimp_query_int_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
char *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_double_box (gchar *title, GtkWidget * gimp_query_double_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_size_box (gchar *title, GtkWidget * gimp_query_size_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
@ -102,19 +102,19 @@ GtkWidget * gimp_query_size_box (gchar *title,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_boolean_box (gchar *title, GtkWidget * gimp_query_boolean_box (const gchar *title,
GimpHelpFunc help_func, GimpHelpFunc help_func,
gchar *help_data, const gchar *help_data,
gboolean eek, gboolean eek,
gchar *message, const gchar *message,
gchar *true_button, const gchar *true_button,
gchar *false_button, const gchar *false_button,
GtkObject *object, GtkObject *object,
gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data); gpointer data);

View file

@ -237,7 +237,7 @@ gimp_size_entry_get_type (void)
GtkWidget * GtkWidget *
gimp_size_entry_new (gint number_of_fields, gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
@ -457,7 +457,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
*/ */
void void
gimp_size_entry_attach_label (GimpSizeEntry *gse, gimp_size_entry_attach_label (GimpSizeEntry *gse,
gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment) gfloat alignment)

View file

@ -82,7 +82,7 @@ GtkType gimp_size_entry_get_type (void);
GtkWidget * gimp_size_entry_new (gint number_of_fields, GtkWidget * gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
@ -94,7 +94,7 @@ void gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkSpinButton *refval_spinbutton); GtkSpinButton *refval_spinbutton);
void gimp_size_entry_attach_label (GimpSizeEntry *gse, void gimp_size_entry_attach_label (GimpSizeEntry *gse,
gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment); gfloat alignment);

View file

@ -31,10 +31,10 @@
/* private functions */ /* private functions */
static const gchar * gimp_unit_menu_build_string (gchar *format, static const gchar * gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit); GimpUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget, static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data); gpointer data);
enum enum
{ {
@ -144,11 +144,11 @@ gimp_unit_menu_get_type (void)
* *
*/ */
GtkWidget * GtkWidget *
gimp_unit_menu_new (gchar *format, gimp_unit_menu_new (const gchar *format,
GimpUnit unit, GimpUnit unit,
gboolean show_pixels, gboolean show_pixels,
gboolean show_percent, gboolean show_percent,
gboolean show_custom) gboolean show_custom)
{ {
GimpUnitMenu *gum; GimpUnitMenu *gum;
GtkWidget *menu; GtkWidget *menu;
@ -375,8 +375,8 @@ print (gchar *buf,
} }
static const gchar * static const gchar *
gimp_unit_menu_build_string (gchar *format, gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit) GimpUnit unit)
{ {
static gchar buffer[64]; static gchar buffer[64];
gint i = 0; gint i = 0;

View file

@ -67,7 +67,7 @@ struct _GimpUnitMenuClass
GtkType gimp_unit_menu_get_type (void); GtkType gimp_unit_menu_get_type (void);
GtkWidget * gimp_unit_menu_new (gchar *format, GtkWidget * gimp_unit_menu_new (const gchar *format,
GimpUnit unit, GimpUnit unit,
gboolean show_pixels, gboolean show_pixels,
gboolean show_percent, gboolean show_percent,

View file

@ -1,5 +1,5 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpwidgets.c * gimpwidgets.c
* Copyright (C) 2000 Michael Natterer <mitch@gimp.org> * Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
@ -44,13 +44,12 @@
* @...: A #NULL terminated @va_list describing the menu items. * @...: A #NULL terminated @va_list describing the menu items.
* *
* Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only). * Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only).
* **/
*/
GtkWidget * GtkWidget *
gimp_option_menu_new (gboolean menu_only, gimp_option_menu_new (gboolean menu_only,
/* specify menu items as va_list: /* specify menu items as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -64,7 +63,7 @@ gimp_option_menu_new (gboolean menu_only,
GtkWidget *menuitem; GtkWidget *menuitem;
/* menu item variables */ /* menu item variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
gpointer user_data; gpointer user_data;
@ -79,8 +78,10 @@ gimp_option_menu_new (gboolean menu_only,
/* create the menu items */ /* create the menu items */
initial_index = 0; initial_index = 0;
va_start (args, menu_only); va_start (args, menu_only);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
for (i = 0; label; i++) for (i = 0; label; i++)
{ {
callback = va_arg (args, GtkSignalFunc); callback = va_arg (args, GtkSignalFunc);
@ -116,7 +117,7 @@ gimp_option_menu_new (gboolean menu_only,
if (active) if (active)
initial_index = i; initial_index = i;
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -146,18 +147,17 @@ gimp_option_menu_new (gboolean menu_only,
* @...: A #NULL terminated @va_list describing the menu items. * @...: A #NULL terminated @va_list describing the menu items.
* *
* Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only). * Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only).
* **/
*/
GtkWidget * GtkWidget *
gimp_option_menu_new2 (gboolean menu_only, gimp_option_menu_new2 (gboolean menu_only,
GtkSignalFunc menu_item_callback, GtkSignalFunc menu_item_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify menu items as va_list: /* specify menu items as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
@ -166,9 +166,9 @@ gimp_option_menu_new2 (gboolean menu_only,
GtkWidget *menuitem; GtkWidget *menuitem;
/* menu item variables */ /* menu item variables */
gchar *label; const gchar *label;
gpointer user_data; gpointer user_data;
GtkWidget **widget_ptr; GtkWidget **widget_ptr;
va_list args; va_list args;
gint i; gint i;
@ -178,8 +178,10 @@ gimp_option_menu_new2 (gboolean menu_only,
/* create the menu items */ /* create the menu items */
initial_index = 0; initial_index = 0;
va_start (args, initial); va_start (args, initial);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
for (i = 0; label; i++) for (i = 0; label; i++)
{ {
user_data = va_arg (args, gpointer); user_data = va_arg (args, gpointer);
@ -212,7 +214,7 @@ gimp_option_menu_new2 (gboolean menu_only,
if (user_data == initial) if (user_data == initial)
initial_index = i; initial_index = i;
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -237,8 +239,7 @@ gimp_option_menu_new2 (gboolean menu_only,
* @option_menu: A #GtkOptionMenu as returned by gimp_option_menu_new() or * @option_menu: A #GtkOptionMenu as returned by gimp_option_menu_new() or
* gimp_option_menu_new2(). * gimp_option_menu_new2().
* @user_data: The @user_data of the menu item you want to select. * @user_data: The @user_data of the menu item you want to select.
* **/
*/
void void
gimp_option_menu_set_history (GtkOptionMenu *option_menu, gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer user_data) gpointer user_data)
@ -276,14 +277,13 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
* @...: A #NULL terminated @va_list describing the radio buttons. * @...: A #NULL terminated @va_list describing the radio buttons.
* *
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame). * Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
* **/
*/
GtkWidget * GtkWidget *
gimp_radio_group_new (gboolean in_frame, gimp_radio_group_new (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -298,7 +298,7 @@ gimp_radio_group_new (gboolean in_frame,
GSList *group; GSList *group;
/* radio button variables */ /* radio button variables */
gchar *label; const gchar *label;
GtkSignalFunc callback; GtkSignalFunc callback;
gpointer data; gpointer data;
gpointer user_data; gpointer user_data;
@ -313,7 +313,7 @@ gimp_radio_group_new (gboolean in_frame,
/* create the radio buttons */ /* create the radio buttons */
va_start (args, frame_title); va_start (args, frame_title);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
while (label) while (label)
{ {
callback = va_arg (args, GtkSignalFunc); callback = va_arg (args, GtkSignalFunc);
@ -345,7 +345,7 @@ gimp_radio_group_new (gboolean in_frame,
gtk_widget_show (button); gtk_widget_show (button);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -376,19 +376,18 @@ gimp_radio_group_new (gboolean in_frame,
* @...: A #NULL terminated @va_list describing the radio buttons. * @...: A #NULL terminated @va_list describing the radio buttons.
* *
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame). * Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
* **/
*/
GtkWidget * GtkWidget *
gimp_radio_group_new2 (gboolean in_frame, gimp_radio_group_new2 (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
GtkSignalFunc radio_button_callback, GtkSignalFunc radio_button_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
@ -398,9 +397,9 @@ gimp_radio_group_new2 (gboolean in_frame,
GSList *group; GSList *group;
/* radio button variables */ /* radio button variables */
gchar *label; const gchar *label;
gpointer user_data; gpointer user_data;
GtkWidget **widget_ptr; GtkWidget **widget_ptr;
va_list args; va_list args;
@ -410,7 +409,8 @@ gimp_radio_group_new2 (gboolean in_frame,
/* create the radio buttons */ /* create the radio buttons */
va_start (args, initial); va_start (args, initial);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
while (label) while (label)
{ {
user_data = va_arg (args, gpointer); user_data = va_arg (args, gpointer);
@ -439,7 +439,7 @@ gimp_radio_group_new2 (gboolean in_frame,
gtk_widget_show (button); gtk_widget_show (button);
label = va_arg (args, gchar*); label = va_arg (args, const gchar *);
} }
va_end (args); va_end (args);
@ -476,8 +476,7 @@ gimp_radio_group_new2 (gboolean in_frame,
* setting a standard minimun horizontal size. * setting a standard minimun horizontal size.
* *
* Returns: A #GtkSpinbutton and it's #GtkAdjustment. * Returns: A #GtkSpinbutton and it's #GtkAdjustment.
* **/
*/
GtkWidget * GtkWidget *
gimp_spin_button_new (GtkObject **adjustment, /* return value */ gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value, gfloat value,
@ -545,26 +544,25 @@ gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
* have to initialize GIMP's help system with gimp_help_init() before using it. * have to initialize GIMP's help system with gimp_help_init() before using it.
* *
* Returns: The #GtkSpinButton's #GtkAdjustment. * Returns: The #GtkSpinButton's #GtkAdjustment.
* **/
*/
GtkObject * GtkObject *
gimp_scale_entry_new (GtkTable *table, gimp_scale_entry_new (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *text, const gchar *text,
gint scale_usize, gint scale_usize,
gint spinbutton_usize, gint spinbutton_usize,
gfloat value, gfloat value,
gfloat lower, gfloat lower,
gfloat upper, gfloat upper,
gfloat step_increment, gfloat step_increment,
gfloat page_increment, gfloat page_increment,
guint digits, guint digits,
gboolean constrain, gboolean constrain,
gfloat unconstrained_lower, gfloat unconstrained_lower,
gfloat unconstrained_upper, gfloat unconstrained_upper,
gchar *tooltip, const gchar *tooltip,
gchar *help_data) const gchar *help_data)
{ {
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
@ -682,8 +680,7 @@ gimp_random_seed_toggle_update (GtkWidget *widget,
* *
* Returns: A #GtkHBox containing a #GtkSpinButton for the random seed and * Returns: A #GtkHBox containing a #GtkSpinButton for the random seed and
* a #GtkToggleButton for toggling the @use_time behaviour. * a #GtkToggleButton for toggling the @use_time behaviour.
* **/
*/
GtkWidget * GtkWidget *
gimp_random_seed_new (gint *seed, gimp_random_seed_new (gint *seed,
gint *use_time, gint *use_time,
@ -845,11 +842,10 @@ gimp_coordinates_callback (GtkWidget *widget,
* Returns: A #GimpSizeEntry with two fields for x/y coordinates/sizes with * Returns: A #GimpSizeEntry with two fields for x/y coordinates/sizes with
* a #GimpChainButton attached to constrain either the two fields' * a #GimpChainButton attached to constrain either the two fields'
* values or the ratio between them. * values or the ratio between them.
* **/
*/
GtkWidget * GtkWidget *
gimp_coordinates_new (GimpUnit unit, gimp_coordinates_new (GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gint spinbutton_usize, gint spinbutton_usize,
@ -858,7 +854,7 @@ gimp_coordinates_new (GimpUnit unit,
gboolean chainbutton_active, gboolean chainbutton_active,
gboolean chain_constrains_ratio, gboolean chain_constrains_ratio,
gchar *xlabel, const gchar *xlabel,
gdouble x, gdouble x,
gdouble xres, gdouble xres,
gdouble lower_boundary_x, gdouble lower_boundary_x,
@ -866,7 +862,7 @@ gimp_coordinates_new (GimpUnit unit,
gdouble xsize_0, /* % */ gdouble xsize_0, /* % */
gdouble xsize_100, /* % */ gdouble xsize_100, /* % */
gchar *ylabel, const gchar *ylabel,
gdouble y, gdouble y,
gdouble yres, gdouble yres,
gdouble lower_boundary_y, gdouble lower_boundary_y,
@ -993,7 +989,7 @@ gimp_mem_size_unit_callback (GtkWidget *widget,
* @adjustment: The adjustment containing the memsize and it's limits. * @adjustment: The adjustment containing the memsize and it's limits.
* *
* Returns: A #GtkHBox with a #GtkSpinButton and a #GtkOptionMenu. * Returns: A #GtkHBox with a #GtkSpinButton and a #GtkOptionMenu.
*/ **/
GtkWidget * GtkWidget *
gimp_mem_size_entry_new (GtkAdjustment *adjustment) gimp_mem_size_entry_new (GtkAdjustment *adjustment)
{ {
@ -1063,11 +1059,10 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
* @text: An optional text which will appear right of the pixmap. * @text: An optional text which will appear right of the pixmap.
* *
* Returns: A #GtkButton with a #GimpPixmap and an optional #GtkLabel. * Returns: A #GtkButton with a #GimpPixmap and an optional #GtkLabel.
* **/
*/
GtkWidget * GtkWidget *
gimp_pixmap_button_new (gchar **xpm_data, gimp_pixmap_button_new (gchar **xpm_data,
gchar *text) const gchar *text)
{ {
GtkWidget *button; GtkWidget *button;
GtkWidget *pixmap; GtkWidget *pixmap;
@ -1126,8 +1121,7 @@ gimp_pixmap_button_new (gchar **xpm_data,
* This function can also set the sensitive state according to the toggle * This function can also set the sensitive state according to the toggle
* button's inverse "active" state by attaching widgets with the * button's inverse "active" state by attaching widgets with the
* "inverse_sensitive" key. * "inverse_sensitive" key.
* **/
*/
void void
gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button) gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
{ {
@ -1162,8 +1156,7 @@ gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
* gtk_toggle_button_get_active(). * gtk_toggle_button_get_active().
* *
* Note that this function calls gimp_toggle_button_sensitive_update(). * Note that this function calls gimp_toggle_button_sensitive_update().
* **/
*/
void void
gimp_toggle_button_update (GtkWidget *widget, gimp_toggle_button_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1187,8 +1180,7 @@ gimp_toggle_button_update (GtkWidget *widget,
* (#gint) gtk_object_get_user_data(). * (#gint) gtk_object_get_user_data().
* *
* Note that this function calls gimp_toggle_button_sensitive_update(). * Note that this function calls gimp_toggle_button_sensitive_update().
* **/
*/
void void
gimp_radio_button_update (GtkWidget *widget, gimp_radio_button_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1210,8 +1202,7 @@ gimp_radio_button_update (GtkWidget *widget,
* @widget: A #GtkMenuItem. * @widget: A #GtkMenuItem.
* @data: A pointer to a #gint variable which will store the value of * @data: A pointer to a #gint variable which will store the value of
* (#gint) gtk_object_get_user_data(). * (#gint) gtk_object_get_user_data().
* **/
*/
void void
gimp_menu_item_update (GtkWidget *widget, gimp_menu_item_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1231,8 +1222,7 @@ gimp_menu_item_update (GtkWidget *widget,
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#gint) (value + 0.5). * with (#gint) (value + 0.5).
* **/
*/
void void
gimp_int_adjustment_update (GtkAdjustment *adjustment, gimp_int_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1251,8 +1241,7 @@ gimp_int_adjustment_update (GtkAdjustment *adjustment,
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#guint) (value + 0.5). * with (#guint) (value + 0.5).
* **/
*/
void void
gimp_uint_adjustment_update (GtkAdjustment *adjustment, gimp_uint_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1268,8 +1257,7 @@ gimp_uint_adjustment_update (GtkAdjustment *adjustment,
* @adjustment: A #GtkAdjustment. * @adjustment: A #GtkAdjustment.
* @data: A pointer to a #gfloat varaiable which willl store the adjustment's * @data: A pointer to a #gfloat varaiable which willl store the adjustment's
* value. * value.
* **/
*/
void void
gimp_float_adjustment_update (GtkAdjustment *adjustment, gimp_float_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1285,8 +1273,7 @@ gimp_float_adjustment_update (GtkAdjustment *adjustment,
* @adjustment: A #GtkAdjustment. * @adjustment: A #GtkAdjustment.
* @data: A pointer to a #gdouble variable which will store the adjustment's * @data: A pointer to a #gdouble variable which will store the adjustment's
* value. * value.
* **/
*/
void void
gimp_double_adjustment_update (GtkAdjustment *adjustment, gimp_double_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -1310,8 +1297,7 @@ gimp_double_adjustment_update (GtkAdjustment *adjustment,
* *
* See gimp_toggle_button_sensitive_update() for a description of how * See gimp_toggle_button_sensitive_update() for a description of how
* to set up the list. * to set up the list.
* **/
*/
void void
gimp_unit_menu_update (GtkWidget *widget, gimp_unit_menu_update (GtkWidget *widget,
gpointer data) gpointer data)
@ -1355,18 +1341,17 @@ gimp_unit_menu_update (GtkWidget *widget,
* *
* Note that the @label_text can be #NULL and that the widget will be attached * Note that the @label_text can be #NULL and that the widget will be attached
* starting at (@column + 1) in this case, too. * starting at (@column + 1) in this case, too.
* **/
*/
void void
gimp_table_attach_aligned (GtkTable *table, gimp_table_attach_aligned (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *label_text, const gchar *label_text,
gfloat xalign, gfloat xalign,
gfloat yalign, gfloat yalign,
GtkWidget *widget, GtkWidget *widget,
gint colspan, gint colspan,
gboolean left_align) gboolean left_align)
{ {
if (label_text) if (label_text)
{ {

View file

@ -65,10 +65,10 @@ void gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer user_data); gpointer user_data);
GtkWidget * gimp_radio_group_new (gboolean in_frame, GtkWidget * gimp_radio_group_new (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* GtkSignalFunc callback, * GtkSignalFunc callback,
* gpointer data, * gpointer data,
* gpointer user_data, * gpointer user_data,
@ -79,13 +79,13 @@ GtkWidget * gimp_radio_group_new (gboolean in_frame,
...); ...);
GtkWidget * gimp_radio_group_new2 (gboolean in_frame, GtkWidget * gimp_radio_group_new2 (gboolean in_frame,
gchar *frame_title, const gchar *frame_title,
GtkSignalFunc radio_button_callback, GtkSignalFunc radio_button_callback,
gpointer data, gpointer data,
gpointer initial, /* user_data */ gpointer initial, /* user_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* gchar *label, * const gchar *label,
* gpointer user_data, * gpointer user_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
@ -122,7 +122,7 @@ GtkWidget * gimp_spin_button_new (/* return value: */
GtkObject * gimp_scale_entry_new (GtkTable *table, GtkObject * gimp_scale_entry_new (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *text, const gchar *text,
gint scale_usize, gint scale_usize,
gint spinbutton_usize, gint spinbutton_usize,
gfloat value, gfloat value,
@ -134,8 +134,8 @@ GtkObject * gimp_scale_entry_new (GtkTable *table,
gboolean constrain, gboolean constrain,
gfloat unconstrained_lower, gfloat unconstrained_lower,
gfloat unconstrained_upper, gfloat unconstrained_upper,
gchar *tooltip, const gchar *tooltip,
gchar *help_data); const gchar *help_data);
#define GIMP_RANDOM_SEED_SPINBUTTON(hbox) \ #define GIMP_RANDOM_SEED_SPINBUTTON(hbox) \
GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT( hbox), "spinbutton")) GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT( hbox), "spinbutton"))
@ -157,7 +157,7 @@ GtkWidget * gimp_random_seed_new (gint *seed,
"chainbutton")) "chainbutton"))
GtkWidget * gimp_coordinates_new (GimpUnit unit, GtkWidget * gimp_coordinates_new (GimpUnit unit,
gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gint spinbutton_usize, gint spinbutton_usize,
@ -166,7 +166,7 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
gboolean chainbutton_active, gboolean chainbutton_active,
gboolean chain_constrains_ratio, gboolean chain_constrains_ratio,
gchar *xlabel, const gchar *xlabel,
gdouble x, gdouble x,
gdouble xres, gdouble xres,
gdouble lower_boundary_x, gdouble lower_boundary_x,
@ -174,7 +174,7 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
gdouble xsize_0, /* % */ gdouble xsize_0, /* % */
gdouble xsize_100, /* % */ gdouble xsize_100, /* % */
gchar *ylabel, const gchar *ylabel,
gdouble y, gdouble y,
gdouble yres, gdouble yres,
gdouble lower_boundary_y, gdouble lower_boundary_y,
@ -197,7 +197,7 @@ GtkWidget * gimp_mem_size_entry_new (GtkAdjustment *adjustment);
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data, GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
gchar *text); const gchar *text);
/* /*
* Standard Callbacks * Standard Callbacks
@ -236,7 +236,7 @@ void gimp_unit_menu_update (GtkWidget *widget,
void gimp_table_attach_aligned (GtkTable *table, void gimp_table_attach_aligned (GtkTable *table,
gint column, gint column,
gint row, gint row,
gchar *label_text, const gchar *label_text,
gfloat xalign, gfloat xalign,
gfloat yalign, gfloat yalign,
GtkWidget *widget, GtkWidget *widget,

View file

@ -113,8 +113,11 @@ static TgaSaveInterface tsint =
/* TRUEVISION-XFILE magic signature string */ /* TRUEVISION-XFILE magic signature string */
static guchar magic[18] = { 0x54, 0x52, 0x55, 0x45, 0x56, 0x49, 0x53, static guchar magic[18] =
0x49, 0x4f, 0x4e, 0x2d, 0x58, 0x46, 0x49, 0x4c, 0x45, 0x2e, 0x0 }; {
0x54, 0x52, 0x55, 0x45, 0x56, 0x49, 0x53, 0x49, 0x4f,
0x4e, 0x2d, 0x58, 0x46, 0x49, 0x4c, 0x45, 0x2e, 0x0
};
typedef struct tga_info_struct typedef struct tga_info_struct
{ {
@ -172,22 +175,24 @@ typedef struct tga_info_struct
/* Declare some local functions. /* Declare some local functions.
*/ */
static void query (void); static void query (void);
static void run (gchar *name, static void run (gchar *name,
gint nparams, gint nparams,
GimpParam *param, GimpParam *param,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals); GimpParam **return_vals);
static gint32 load_image (gchar *filename); static gint32 load_image (gchar *filename);
static gint save_image (gchar *filename, static gint save_image (gchar *filename,
gint32 image_ID, gint32 image_ID,
gint32 drawable_ID); gint32 drawable_ID);
static gint save_dialog (void); static gint save_dialog (void);
static void save_ok_callback (GtkWidget *widget, static void save_ok_callback (GtkWidget *widget,
gpointer data); gpointer data);
static gint32 ReadImage (FILE *fp, tga_info *info, gchar *filename); static gint32 ReadImage (FILE *fp,
tga_info *info,
gchar *filename);
GimpPlugInInfo PLUG_IN_INFO = GimpPlugInInfo PLUG_IN_INFO =
@ -261,17 +266,17 @@ query (void)
} }
static void static void
run (gchar *name, run (gchar *name,
gint nparams, gint nparams,
GimpParam *param, GimpParam *param,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[2]; static GimpParam values[2];
GimpRunModeType run_mode; GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID; gint32 image_ID;
gint32 drawable_ID; gint32 drawable_ID;
GimpExportReturnType export = GIMP_EXPORT_CANCEL; GimpExportReturnType export = GIMP_EXPORT_CANCEL;
#ifdef PROFILE #ifdef PROFILE
@ -404,11 +409,13 @@ run (gchar *name,
static gint32 static gint32
load_image (gchar *filename) load_image (gchar *filename)
{ {
FILE *fp; FILE *fp;
gchar *name_buf; gchar *name_buf;
tga_info info; tga_info info;
guchar header[18], footer[26], extension[495]; guchar header[18];
long offset; guchar footer[26];
guchar extension[495];
long offset;
gint32 image_ID = -1; gint32 image_ID = -1;
@ -424,21 +431,21 @@ load_image (gchar *filename)
g_free (name_buf); g_free (name_buf);
/* Check the footer. */ /* Check the footer. */
if (fseek (fp, -26L, SEEK_END) if (fseek (fp, -26L, SEEK_END) ||
|| fread (footer, sizeof (footer), 1, fp) != 1) fread (footer, sizeof (footer), 1, fp) != 1)
{ {
g_message (_("TGA: Cannot read footer from \"%s\"\n"), filename); g_message (_("TGA: Cannot read footer from \"%s\"\n"), filename);
return -1; return -1;
} }
/* Check the signature. */ /* Check the signature. */
if (memcmp (footer + 8, magic, sizeof(magic)) == 0) if (memcmp (footer + 8, magic, sizeof (magic)) == 0)
{ {
offset= footer[0] + (footer[1] * 256) + (footer[2] * 65536) offset= footer[0] + (footer[1] * 256) + (footer[2] * 65536)
+ (footer[3] * 16777216); + (footer[3] * 16777216);
if (fseek (fp, offset, SEEK_SET) || if (fseek (fp, offset, SEEK_SET) ||
fread (extension, sizeof (extension), 1, fp) != 1) fread (extension, sizeof (extension), 1, fp) != 1)
{ {
g_message (_("TGA: Cannot read extension from \"%s\"\n"), filename); g_message (_("TGA: Cannot read extension from \"%s\"\n"), filename);
return -1; return -1;
@ -454,54 +461,55 @@ load_image (gchar *filename)
return -1; return -1;
} }
switch (header[2]) { switch (header[2])
{
case 1: case 1:
info.imageType= TGA_TYPE_MAPPED; info.imageType = TGA_TYPE_MAPPED;
info.imageCompression= TGA_COMP_NONE; info.imageCompression = TGA_COMP_NONE;
break; break;
case 2: case 2:
info.imageType= TGA_TYPE_COLOR; info.imageType = TGA_TYPE_COLOR;
info.imageCompression= TGA_COMP_NONE; info.imageCompression = TGA_COMP_NONE;
break; break;
case 3: case 3:
info.imageType= TGA_TYPE_GRAY; info.imageType = TGA_TYPE_GRAY;
info.imageCompression= TGA_COMP_NONE; info.imageCompression = TGA_COMP_NONE;
break; break;
case 9: case 9:
info.imageType= TGA_TYPE_MAPPED; info.imageType = TGA_TYPE_MAPPED;
info.imageCompression= TGA_COMP_RLE; info.imageCompression = TGA_COMP_RLE;
break; break;
case 10: case 10:
info.imageType= TGA_TYPE_COLOR; info.imageType = TGA_TYPE_COLOR;
info.imageCompression= TGA_COMP_RLE; info.imageCompression = TGA_COMP_RLE;
break; break;
case 11: case 11:
info.imageType= TGA_TYPE_GRAY; info.imageType = TGA_TYPE_GRAY;
info.imageCompression= TGA_COMP_RLE; info.imageCompression = TGA_COMP_RLE;
break; break;
default: default:
info.imageType= 0; info.imageType = 0;
} }
info.idLength= header[0]; info.idLength = header[0];
info.colorMapType= header[1]; info.colorMapType = header[1];
info.colorMapIndex= header[3] + header[4] * 256; info.colorMapIndex = header[3] + header[4] * 256;
info.colorMapLength= header[5] + header[6] * 256; info.colorMapLength = header[5] + header[6] * 256;
info.colorMapSize= header[7]; info.colorMapSize = header[7];
info.xOrigin= header[8] + header[9] * 256; info.xOrigin = header[8] + header[9] * 256;
info.yOrigin= header[10] + header[11] * 256; info.yOrigin = header[10] + header[11] * 256;
info.width= header[12] + header[13] * 256; info.width = header[12] + header[13] * 256;
info.height= header[14] + header[15] * 256; info.height = header[14] + header[15] * 256;
info.bpp= header[16]; info.bpp = header[16];
info.bytes= (info.bpp + 7) / 8; info.bytes = (info.bpp + 7) / 8;
info.alphaBits= header[17] & 0x0f; /* Just the low 4 bits */ info.alphaBits = header[17] & 0x0f; /* Just the low 4 bits */
info.flipHoriz= (header[17] & 0x10) ? 1 : 0; info.flipHoriz = (header[17] & 0x10) ? 1 : 0;
info.flipVert= (header[17] & 0x20) ? 0 : 1; info.flipVert = (header[17] & 0x20) ? 0 : 1;
switch (info.imageType) switch (info.imageType)
{ {
@ -576,201 +584,283 @@ load_image (gchar *filename)
return image_ID; return image_ID;
} }
static void rle_write(FILE *fp, guchar *buffer, guint width, guint bytes) { static void
int repeat= 0, direct= 0; rle_write (FILE *fp,
guchar *from= buffer; guchar *buffer,
int x; guint width,
guint bytes)
{
gint repeat = 0;
gint direct = 0;
guchar *from = buffer;
gint x;
for (x= 1; x < width; ++x) { for (x = 1; x < width; ++x)
if (memcmp(buffer, buffer + bytes, bytes)) { {
/* next pixel is different */ if (memcmp (buffer, buffer + bytes, bytes))
if (repeat) { {
putc(128 + repeat, fp); /* next pixel is different */
fwrite(from, bytes, 1, fp); if (repeat)
from= buffer+ bytes; /* point to first different pixel */ {
repeat= 0; direct= 0; putc (128 + repeat, fp);
} else { fwrite (from, bytes, 1, fp);
direct+= 1; from = buffer+ bytes; /* point to first different pixel */
} repeat = 0;
} else { direct = 0;
/* next pixel is the same */ }
if (direct) { else
putc(direct - 1, fp); {
fwrite(from, bytes, direct, fp); direct += 1;
from= buffer; /* point to first identical pixel */ }
direct= 0; repeat= 1; }
} else { else
repeat+= 1; {
} /* next pixel is the same */
} if (direct)
if (repeat == 128) { {
putc(255, fp); putc (direct - 1, fp);
fwrite(from, bytes, 1, fp); fwrite (from, bytes, direct, fp);
from= buffer+ bytes; from = buffer; /* point to first identical pixel */
direct= 0; repeat= 0; direct = 0;
} else if (direct == 128) { repeat = 1;
putc(127, fp); }
fwrite(from, bytes, direct, fp); else
from= buffer+ bytes; {
direct= 0; repeat= 0; repeat += 1;
} }
buffer+= bytes; }
}
if (repeat > 0) { if (repeat == 128)
putc(128 + repeat, fp); {
fwrite(from, bytes, 1, fp); putc (255, fp);
} else { fwrite (from, bytes, 1, fp);
putc(direct, fp); from = buffer+ bytes;
fwrite(from, bytes, direct + 1, fp); direct = 0;
} repeat = 0;
}
else if (direct == 128)
{
putc (127, fp);
fwrite (from, bytes, direct, fp);
from = buffer+ bytes;
direct = 0;
repeat = 0;
}
buffer += bytes;
}
if (repeat > 0)
{
putc (128 + repeat, fp);
fwrite (from, bytes, 1, fp);
}
else
{
putc (direct, fp);
fwrite (from, bytes, direct + 1, fp);
}
} }
static int rle_read(FILE *fp, guchar *buffer, tga_info *info) { static gint
rle_read (FILE *fp,
static int repeat= 0, direct= 0; guchar *buffer,
tga_info *info)
{
static gint repeat = 0;
static gint direct = 0;
static guchar sample[4]; static guchar sample[4];
int head; gint head;
int x, k; gint x, k;
for (x= 0; x < info->width; x++) { for (x = 0; x < info->width; x++)
{
if (repeat == 0 && direct == 0)
{
head = getc (fp);
if (repeat == 0 && direct == 0) { if (head == EOF)
head= getc(fp); {
if (head == EOF) { return EOF;
return EOF; }
} else if (head >= 128) { else if (head >= 128)
repeat= head - 127; {
if (fread(sample, info->bytes, 1, fp) < 1) repeat = head - 127;
return EOF;
} else { if (fread (sample, info->bytes, 1, fp) < 1)
direct= head + 1; return EOF;
} }
else
{
direct = head + 1;
}
}
if (repeat > 0)
{
for (k = 0; k < info->bytes; ++k)
{
buffer[k] = sample[k];
}
repeat--;
}
else /* direct > 0 */
{
if (fread (buffer, info->bytes, 1, fp) < 1)
return EOF;
direct--;
}
buffer += info->bytes;
} }
if (repeat > 0) {
for (k = 0; k < info->bytes; ++k) {
buffer[k]= sample[k];
}
repeat--;
} else /* direct > 0 */ {
if (fread(buffer, info->bytes, 1, fp) < 1)
return EOF;
direct--;
}
buffer+= info->bytes;
}
return 0; return 0;
} }
static void flip_line(guchar *buffer, tga_info *info) { static void
guchar temp, *alt; flip_line (guchar *buffer,
int x, s; tga_info *info)
{
guchar temp;
guchar *alt;
gint x, s;
alt= buffer + (info->bytes * (info->width - 1)); alt = buffer + (info->bytes * (info->width - 1));
for (x= 0; x * 2 <= info->width; x++) {
for (s= 0; s < info->bytes; ++s) { for (x = 0; x * 2 <= info->width; x++)
temp= buffer[s]; {
buffer[s]= alt[s]; for (s = 0; s < info->bytes; ++s)
alt[s]= temp; {
temp = buffer[s];
buffer[s] = alt[s];
alt[s] = temp;
}
buffer += info->bytes;
alt -= info->bytes;
} }
buffer+= info->bytes;
alt-= info->bytes;
}
} }
/* Some people write 16-bit RGB TGA files. The spec would probably /* Some people write 16-bit RGB TGA files. The spec would probably
allow 27-bit RGB too, for what it's worth, but I won't fix that allow 27-bit RGB too, for what it's worth, but I won't fix that
unless someone actually provides an existence proof */ unless someone actually provides an existence proof */
static void upsample(guchar *dest, guchar *src, guint width, guint bytes) { static void
int x; upsample (guchar *dest,
guchar *src,
for (x= 0; x < width; x++) { guint width,
guint bytes)
{
gint x;
dest[0]= ((src[1] << 1) & 0xf8); for (x = 0; x < width; x++)
dest[0]+= (dest[0] >> 5); {
dest[0] = ((src[1] << 1) & 0xf8);
dest[0] += (dest[0] >> 5);
dest[1]= ((src[0] & 0xe0) >> 2) + ((src[1] & 0x03) << 6); dest[1] = ((src[0] & 0xe0) >> 2) + ((src[1] & 0x03) << 6);
dest[1]+= (dest[1] >> 5); dest[1] += (dest[1] >> 5);
dest[2]= ((src[0] << 3) & 0xf8); dest[2] = ((src[0] << 3) & 0xf8);
dest[2]+= (dest[2] >> 5); dest[2] += (dest[2] >> 5);
dest+= 3; dest += 3;
src+= bytes; src += bytes;
} }
} }
static void bgr2rgb(guchar *dest, guchar *src, static void
guint width, guint bytes, guint alpha) { bgr2rgb (guchar *dest,
guchar *src,
guint width,
guint bytes,
guint alpha)
{
guint x; guint x;
if (alpha) { if (alpha)
for (x= 0; x < width; x++) { {
*(dest++)= src[2]; for (x = 0; x < width; x++)
*(dest++)= src[1]; {
*(dest++)= src[0]; *(dest++) = src[2];
*(dest++)= src[3]; *(dest++) = src[1];
*(dest++) = src[0];
*(dest++) = src[3];
src+= bytes; src += bytes;
}
} }
} else { else
for (x= 0; x < width; x++) { {
*(dest++)= src[2]; for (x = 0; x < width; x++)
*(dest++)= src[1]; {
*(dest++)= src[0]; *(dest++) = src[2];
*(dest++) = src[1];
*(dest++) = src[0];
src+= bytes; src += bytes;
}
} }
}
} }
static void read_line(FILE *fp, guchar *row, guchar *buffer, static void
tga_info *info, GimpDrawable *drawable) { read_line (FILE *fp,
guchar *row,
if (info->imageCompression == TGA_COMP_RLE) { guchar *buffer,
rle_read(fp, buffer, info); tga_info *info,
} else { GimpDrawable *drawable)
fread(buffer, info->bytes, info->width, fp); {
} if (info->imageCompression == TGA_COMP_RLE)
{
if (info->flipHoriz) { rle_read (fp, buffer, info);
flip_line(buffer, info); }
} else
{
if (info->imageType == TGA_TYPE_COLOR) { fread (buffer, info->bytes, info->width, fp);
if (info->bpp == 16) { }
upsample(row, buffer, info->width, info->bytes);
} else { if (info->flipHoriz)
bgr2rgb(row, buffer,info->width,info->bytes,info->alphaBits); {
flip_line (buffer, info);
}
if (info->imageType == TGA_TYPE_COLOR)
{
if (info->bpp == 16)
{
upsample (row, buffer, info->width, info->bytes);
}
else
{
bgr2rgb (row, buffer,info->width,info->bytes,info->alphaBits);
}
}
else
{
memcpy (row, buffer, info->width * drawable->bpp);
} }
} else {
memcpy(row, buffer, info->width * drawable->bpp);
}
} }
static gint32 static gint32
ReadImage (FILE *fp, tga_info *info, char *filename) ReadImage (FILE *fp,
tga_info *info,
gchar *filename)
{ {
static gint32 image_ID; static gint32 image_ID;
gint32 layer_ID; gint32 layer_ID;
GimpPixelRgn pixel_rgn; GimpPixelRgn pixel_rgn;
GimpDrawable *drawable; GimpDrawable *drawable;
guchar *data, *buffer, *row; guchar *data, *buffer, *row;
GimpImageType dtype; GimpImageType dtype = 0;
GimpImageBaseType itype; GimpImageBaseType itype = 0;
int i, y; gint i, y;
int max_tileheight, tileheight; gint max_tileheight, tileheight;
guint cmap_bytes; guint cmap_bytes;
guchar tga_cmap[4 * 256], gimp_cmap[3 * 256]; guchar tga_cmap[4 * 256], gimp_cmap[3 * 256];
switch (info->imageType) switch (info->imageType)
@ -901,148 +991,182 @@ ReadImage (FILE *fp, tga_info *info, char *filename)
static gint static gint
save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID) save_image (gchar *filename,
gint32 image_ID,
gint32 drawable_ID)
{ {
GimpPixelRgn pixel_rgn; GimpPixelRgn pixel_rgn;
GimpDrawable *drawable; GimpDrawable *drawable;
GimpImageType dtype; GimpImageType dtype;
int width, height; gint width;
gint height;
FILE *fp; FILE *fp;
guchar *name_buf; guchar *name_buf;
int tileheight, out_bpp, status= TRUE; gint tileheight;
int i, row; gint out_bpp = 0;
gboolean status = TRUE;
gint i, row;
guchar header[18], footer[26]; guchar header[18];
guchar *pixels, *data; guchar footer[26];
guchar *pixels;
guchar *data;
guint num_colors; guint num_colors;
guchar *gimp_cmap; guchar *gimp_cmap = NULL;
drawable = gimp_drawable_get(drawable_ID); drawable = gimp_drawable_get (drawable_ID);
dtype = gimp_drawable_type(drawable_ID); dtype = gimp_drawable_type (drawable_ID);
width = drawable->width;
width = drawable->width;
height = drawable->height; height = drawable->height;
name_buf = g_strdup_printf( _("Saving %s:"), filename); name_buf = g_strdup_printf (_("Saving %s:"), filename);
gimp_progress_init((char *)name_buf); gimp_progress_init ((gchar *)name_buf);
g_free(name_buf); g_free (name_buf);
if((fp = fopen(filename, "wb")) == NULL) if ((fp = fopen (filename, "wb")) == NULL)
{ {
g_message ("TGA: can't create \"%s\"\n", filename); g_message ("TGA: can't create \"%s\"\n", filename);
return FALSE; return FALSE;
} }
header[0]= 0; /* No image identifier / description */ header[0] = 0; /* No image identifier / description */
if (dtype == GIMP_INDEXED_IMAGE || dtype == GIMP_INDEXEDA_IMAGE) { if (dtype == GIMP_INDEXED_IMAGE || dtype == GIMP_INDEXEDA_IMAGE)
gimp_cmap= gimp_image_get_cmap(image_ID, &num_colors); {
header[1]= 1; /* cmap type */ gimp_cmap = gimp_image_get_cmap (image_ID, &num_colors);
header[2]= (tsvals.rle) ? 9 : 1;
header[3]= header[4]= 0; /* no offset */ header[1] = 1; /* cmap type */
header[5]= num_colors % 256; header[2] = (tsvals.rle) ? 9 : 1;
header[6]= num_colors / 256; header[3] = header[4]= 0; /* no offset */
header[7]= 24; /* cmap size / bits */ header[5] = num_colors % 256;
} else { header[6] = num_colors / 256;
header[1]= 0; header[7] = 24; /* cmap size / bits */
if (dtype == GIMP_RGB_IMAGE || dtype == GIMP_RGBA_IMAGE) { }
header[2]= (tsvals.rle) ? 10 : 2; else
} else { {
header[2]= (tsvals.rle) ? 11 : 3; header[1]= 0;
if (dtype == GIMP_RGB_IMAGE || dtype == GIMP_RGBA_IMAGE)
{
header[2]= (tsvals.rle) ? 10 : 2;
}
else
{
header[2]= (tsvals.rle) ? 11 : 3;
}
header[3] = header[4] = header[5] = header[6] = header[7] = 0;
} }
header[3]= header[4]= header[5]= header[6]= header[7]= 0; header[8] = header[9] = 0; /* xorigin */
} header[10] = header[11] = 0; /* yorigin */
header[8]= header[9]= 0; /* xorigin */ header[12] = width % 256;
header[10]= header[11]= 0; /* yorigin */ header[13] = width / 256;
header[12]= width % 256; header[14] = height % 256;
header[13]= width / 256; header[15] = height / 256;
header[14]= height % 256; switch (dtype)
header[15]= height / 256; {
case GIMP_INDEXED_IMAGE:
case GIMP_GRAY_IMAGE:
case GIMP_INDEXEDA_IMAGE:
out_bpp = 1;
header[16] = 8; /* bpp */
header[17] = 0x20; /* alpha + orientation */
break;
switch (dtype) { case GIMP_GRAYA_IMAGE:
case GIMP_INDEXED_IMAGE: out_bpp = 2;
case GIMP_GRAY_IMAGE: header[16] = 16; /* bpp */
case GIMP_INDEXEDA_IMAGE: header[17] = 0x28; /* alpha + orientation */
out_bpp= 1; break;
header[16]= 8; /* bpp */
header[17]= 0x20; /* alpha + orientation */
break;
case GIMP_GRAYA_IMAGE: case GIMP_RGB_IMAGE:
out_bpp= 2; out_bpp = 3;
header[16]= 16; /* bpp */ header[16] = 24; /* bpp */
header[17]= 0x28; /* alpha + orientation */ header[17] = 0x20; /* alpha + orientation */
break; break;
case GIMP_RGB_IMAGE:
out_bpp= 3; case GIMP_RGBA_IMAGE:
header[16]= 24; /* bpp */ out_bpp = 4;
header[17]= 0x20; /* alpha + orientation */ header[16] = 32; /* bpp */
break; header[17] = 0x28; /* alpha + orientation */
case GIMP_RGBA_IMAGE: break;
out_bpp= 4; }
header[16]= 32; /* bpp */
header[17]= 0x28; /* alpha + orientation */
break;
}
/* write header to front of file */ /* write header to front of file */
fwrite(header, sizeof(header), 1, fp); fwrite (header, sizeof (header), 1, fp);
if (dtype == GIMP_INDEXED_IMAGE || dtype == GIMP_INDEXEDA_IMAGE) { if (dtype == GIMP_INDEXED_IMAGE || dtype == GIMP_INDEXEDA_IMAGE)
/* write out palette */ {
for (i= 0; i < num_colors; ++i) { /* write out palette */
fputc(gimp_cmap[(i * 3) + 2], fp); for (i= 0; i < num_colors; ++i)
fputc(gimp_cmap[(i * 3) + 1], fp); {
fputc(gimp_cmap[(i * 3) + 0], fp); fputc (gimp_cmap[(i * 3) + 2], fp);
fputc (gimp_cmap[(i * 3) + 1], fp);
fputc (gimp_cmap[(i * 3) + 0], fp);
}
} }
}
/* Allocate a new set of pixels. */ /* Allocate a new set of pixels. */
tileheight = gimp_tile_height (); tileheight = gimp_tile_height ();
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE); gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
pixels= g_new(guchar, width * drawable->bpp); pixels = g_new (guchar, width * drawable->bpp);
data= g_new(guchar, width * out_bpp); data = g_new (guchar, width * out_bpp);
for (row= 0; row < height; ++row) for (row = 0; row < height; ++row)
{ {
gimp_pixel_rgn_get_rect(&pixel_rgn, pixels, 0, row, width, 1); gimp_pixel_rgn_get_rect (&pixel_rgn, pixels, 0, row, width, 1);
if (dtype == GIMP_RGB_IMAGE) { if (dtype == GIMP_RGB_IMAGE)
bgr2rgb(data, pixels, width, drawable->bpp, 0); {
} else if (dtype == GIMP_RGBA_IMAGE) { bgr2rgb(data, pixels, width, drawable->bpp, 0);
bgr2rgb(data, pixels, width, drawable->bpp, 1); }
} else if (dtype == GIMP_INDEXEDA_IMAGE) { else if (dtype == GIMP_RGBA_IMAGE)
for (i= 0; i < width; ++i) { {
data[i]= pixels[i*2]; bgr2rgb(data, pixels, width, drawable->bpp, 1);
} }
} else { else if (dtype == GIMP_INDEXEDA_IMAGE)
memcpy(data, pixels, width * drawable->bpp); {
} for (i = 0; i < width; ++i)
{
data[i]= pixels[i*2];
}
}
else
{
memcpy (data, pixels, width * drawable->bpp);
}
if (tsvals.rle) { if (tsvals.rle)
rle_write(fp, data, width, out_bpp); {
} else { rle_write (fp, data, width, out_bpp);
fwrite(data, width * out_bpp, 1, fp); }
} else
gimp_progress_update ((double) row / (double) height); {
fwrite (data, width * out_bpp, 1, fp);
}
gimp_progress_update ((gdouble) row / (gdouble) height);
} }
gimp_drawable_detach (drawable); gimp_drawable_detach (drawable);
g_free (data); g_free (data);
/* footer must be the last thing written to file */ /* footer must be the last thing written to file */
memset(footer, 0, 8); /* No extensions, no developer directory */ memset (footer, 0, 8); /* No extensions, no developer directory */
memcpy(footer + 8, magic, sizeof(magic)); /* magic signature */ memcpy (footer + 8, magic, sizeof (magic)); /* magic signature */
fwrite(footer, sizeof(footer), 1, fp); fwrite (footer, sizeof (footer), 1, fp);
fclose (fp); fclose (fp);
return status; return status;
} }

View file

@ -1251,13 +1251,13 @@ factory_menu_zoom_out(void)
static Command_t* static Command_t*
factory_zoom_in(void) factory_zoom_in(void)
{ {
return command_new(zoom_in); return command_new((void (*)(void)) zoom_in);
} }
static Command_t* static Command_t*
factory_zoom_out(void) factory_zoom_out(void)
{ {
return command_new(zoom_out); return command_new((void (*)(void)) zoom_out);
} }
static Command_t* static Command_t*