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>
* plug-ins/print/Makefile.am

View file

@ -35,19 +35,6 @@
#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 */
typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
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 */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp,
color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info);
color_notebook_selector_death (csel->info);
g_free (csel);
csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
}
static void
color_notebook_help_func (gchar *data)
color_notebook_help_func (const gchar *data)
{
ColorNotebook *cnp;
gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback;
info->death_data = data;
if (info->refs == 0)
selector_death (info);
color_notebook_selector_death (info);
return TRUE;
}
info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
}
static void
selector_death (ColorSelectorInfo *info)
color_notebook_selector_death (ColorSelectorInfo *info)
{
ColorSelectorInfo *here, *prev;

View file

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

View file

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

View file

@ -35,19 +35,6 @@
#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 */
typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
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 */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp,
color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info);
color_notebook_selector_death (csel->info);
g_free (csel);
csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
}
static void
color_notebook_help_func (gchar *data)
color_notebook_help_func (const gchar *data)
{
ColorNotebook *cnp;
gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback;
info->death_data = data;
if (info->refs == 0)
selector_death (info);
color_notebook_selector_death (info);
return TRUE;
}
info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
}
static void
selector_death (ColorSelectorInfo *info)
color_notebook_selector_death (ColorSelectorInfo *info)
{
ColorSelectorInfo *here, *prev;

View file

@ -1,5 +1,5 @@
/* 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
* it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */
static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *);
static void prefs_save_callback (GtkWidget *, GtkWidget *);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg);
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_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_string_callback (GtkWidget *widget, gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data);
static void prefs_filename_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_toggle_callback (GtkWidget *widget,
gpointer data);
static void prefs_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_string_callback (GtkWidget *widget,
gpointer data);
static void prefs_text_callback (GtkWidget *widget,
gpointer data);
static void prefs_filename_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);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
}
static void
prefs_help_func (gchar *help_data)
prefs_help_func (const gchar *help_data)
{
GtkWidget *notebook;
GtkWidget *event_box;

View file

@ -629,18 +629,14 @@ file_revert_callback (GtkWidget *widget,
FALSE,
text,
_("Yes"), _("No"),
NULL, NULL,
GTK_OBJECT (gimage), "destroy",
file_revert_confirm_callback,
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);
gtk_object_set_data (GTK_OBJECT (gimage), REVERT_DATA_KEY, query_box);
gtk_widget_show (query_box);
}
}

View file

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

View file

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

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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
* it under the terms of the GNU General Public License as published by
@ -54,12 +54,12 @@ struct _GimpIdleHelp
/* local function prototypes */
static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (gchar *help_path,
gchar *current_locale,
gchar *help_data);
static void gimp_help_netscape (gchar *help_path,
gchar *current_locale,
gchar *help_data);
static gboolean gimp_help_internal (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
static void gimp_help_netscape (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
/**********************/
/* public functions */
@ -67,15 +67,15 @@ static void gimp_help_netscape (gchar *help_path,
/* The standard help function */
void
gimp_standard_help_func (gchar *help_data)
gimp_standard_help_func (const gchar *help_data)
{
gimp_help (NULL, help_data);
}
/* the main help function */
void
gimp_help (gchar *help_path,
gchar *help_data)
gimp_help (const gchar *help_path,
const gchar *help_data)
{
if (use_help)
{
@ -169,9 +169,9 @@ gimp_help_internal_not_found_callback (GtkWidget *widget,
}
static gboolean
gimp_help_internal (gchar *help_path,
gchar *current_locale,
gchar *help_data)
gimp_help_internal (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
ProcRecord *proc_rec;
@ -207,11 +207,11 @@ gimp_help_internal (gchar *help_path,
args[0].arg_type = PDB_INT32;
args[0].value.pdb_int = RUN_INTERACTIVE;
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].value.pdb_pointer = current_locale;
args[2].value.pdb_pointer = (gpointer) current_locale;
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);
@ -237,9 +237,9 @@ gimp_help_internal (gchar *help_path,
}
static void
gimp_help_netscape (gchar *help_path,
gchar *current_locale,
gchar *help_data)
gimp_help_netscape (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
Argument *return_vals;
gint nreturn_vals;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__
#include <gtk/gtk.h>
#include "libgimp/gimphelpui.h"
enum
{
HELP_BROWSER_GIMP,
HELP_BROWSER_NETSCAPE
};
/* the main help function */
void gimp_help (gchar *help_path,
gchar *help_data);
void gimp_help (const gchar *help_path,
const gchar *help_data);
#endif /* __GIMP_HELP_H__ */

View file

@ -35,19 +35,6 @@
#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 */
typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
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 */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp,
color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info);
color_notebook_selector_death (csel->info);
g_free (csel);
csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
}
static void
color_notebook_help_func (gchar *data)
color_notebook_help_func (const gchar *data)
{
ColorNotebook *cnp;
gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback;
info->death_data = data;
if (info->refs == 0)
selector_death (info);
color_notebook_selector_death (info);
return TRUE;
}
info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
}
static void
selector_death (ColorSelectorInfo *info)
color_notebook_selector_death (ColorSelectorInfo *info)
{
ColorSelectorInfo *here, *prev;

View file

@ -26,7 +26,7 @@ struct _GimpItemFactoryEntry
{
GtkItemFactoryEntry entry;
gchar *help_page;
const gchar *help_page;
gchar *description;
};

View file

@ -1,5 +1,5 @@
/* 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
* it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */
static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *);
static void prefs_save_callback (GtkWidget *, GtkWidget *);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg);
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_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_string_callback (GtkWidget *widget, gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data);
static void prefs_filename_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_toggle_callback (GtkWidget *widget,
gpointer data);
static void prefs_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_string_callback (GtkWidget *widget,
gpointer data);
static void prefs_text_callback (GtkWidget *widget,
gpointer data);
static void prefs_filename_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);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
}
static void
prefs_help_func (gchar *help_data)
prefs_help_func (const gchar *help_data)
{
GtkWidget *notebook;
GtkWidget *event_box;

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "appenv.h"
@ -32,35 +33,52 @@
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpmath.h"
#define MENU_THUMBNAIL_WIDTH 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 *,
gpointer);
static void lc_dialog_fill_preview_with_thumb (GtkWidget *, GimpImage *,
gint, gint);
/* local function prototypes */
static void lc_dialog_update (GimpImage *gimage);
static void lc_dialog_image_menu_callback (GtkWidget *widget,
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 */
static GtkWidget * lc_dialog_create_image_menu (GimpImage **, gint *,
GtkSignalFunc);
static void lc_dialog_create_image_menu_callback (gpointer, gpointer);
static GtkWidget * lc_dialog_create_image_menu (GimpImage **def,
gint *default_index,
GtkSignalFunc callback);
static void lc_dialog_create_image_menu_callback (gpointer image,
gpointer data);
/* the main dialog structure */
LCDialog * lc_dialog = NULL;
/*********************************/
/* Public L&C dialog functions */
/*********************************/
@ -429,13 +447,13 @@ lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
/* Get right aspect ratio */
if (dwidth > dheight)
{
height = (gint)(((gdouble)width * (gdouble)dheight) / (gdouble)dwidth + 0.5);
width = (gint)(((gdouble)dwidth * (gdouble)height) / (gdouble)dheight + 0.5);
height = RINT (((gdouble)width * (gdouble)dheight) / (gdouble)dwidth);
width = RINT (((gdouble)dwidth * (gdouble)height) / (gdouble)dheight);
}
else
{
width = (gint)(((gdouble)height * (gdouble)dwidth) / (gdouble)dheight + 0.5);
height = (gint)(((gdouble)dheight * (gdouble)width) / (gdouble)dwidth + 0.5);
width = RINT (((gdouble)height * (gdouble)dwidth) / (gdouble)dheight);
height = RINT (((gdouble)dheight * (gdouble)width) / (gdouble)dwidth);
}
buf = gimp_image_construct_composite_preview (gimage, width, height);
@ -710,7 +728,7 @@ lc_dialog_change_image (GimpContext *context,
}
static void
lc_dialog_help_func (gchar *help_data)
lc_dialog_help_func (const gchar *help_data)
{
gchar *help_page;
gint page_num;

View file

@ -15,15 +15,20 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LC_DIALOG_H__
#define __LC_DIALOG_H__
#include "gimpimageF.h"
void lc_dialog_create (GimpImage *gimage);
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);

View file

@ -26,7 +26,7 @@ struct _GimpItemFactoryEntry
{
GtkItemFactoryEntry entry;
gchar *help_page;
const gchar *help_page;
gchar *description;
};

View file

@ -26,7 +26,7 @@ struct _GimpItemFactoryEntry
{
GtkItemFactoryEntry entry;
gchar *help_page;
const gchar *help_page;
gchar *description;
};

View file

@ -1,5 +1,5 @@
/* 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
* it under the terms of the GNU General Public License as published by
@ -54,23 +54,39 @@ typedef enum
/* preferences local functions */
static PrefsState prefs_check_settings (void);
static void prefs_ok_callback (GtkWidget *, GtkWidget *);
static void prefs_save_callback (GtkWidget *, GtkWidget *);
static void prefs_cancel_callback (GtkWidget *, GtkWidget *);
static void prefs_ok_callback (GtkWidget *widget,
GtkWidget *dlg);
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_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget, gpointer data);
static void prefs_string_callback (GtkWidget *widget, gpointer data);
static void prefs_text_callback (GtkWidget *widget, gpointer data);
static void prefs_filename_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_toggle_callback (GtkWidget *widget,
gpointer data);
static void prefs_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_nav_preview_size_callback (GtkWidget *widget,
gpointer data);
static void prefs_string_callback (GtkWidget *widget,
gpointer data);
static void prefs_text_callback (GtkWidget *widget,
gpointer data);
static void prefs_filename_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);
@ -1295,7 +1311,7 @@ prefs_frame_new (gchar *label,
}
static void
prefs_help_func (gchar *help_data)
prefs_help_func (const gchar *help_data)
{
GtkWidget *notebook;
GtkWidget *event_box;

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "appenv.h"
@ -1487,7 +1488,7 @@ tools_new_tool (ToolType tool_type)
}
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);
}

View file

@ -104,7 +104,7 @@ struct _ToolInfo
GdkBitmap *icon_mask;
gchar *tool_desc;
gchar *private_tip;
const gchar *private_tip;
ToolType tool_id;
@ -135,7 +135,7 @@ void tools_initialize (ToolType tool_type,
void active_tool_control (ToolAction action,
void *gdisp_ptr);
void tools_help_func (gchar *help_data);
void tools_help_func (const gchar *help_data);
void tools_register (ToolType tool_type,
ToolOptions *tool_options);

View file

@ -15,6 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "appenv.h"
@ -1487,7 +1488,7 @@ tools_new_tool (ToolType tool_type)
}
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);
}

View file

@ -104,7 +104,7 @@ struct _ToolInfo
GdkBitmap *icon_mask;
gchar *tool_desc;
gchar *private_tip;
const gchar *private_tip;
ToolType tool_id;
@ -135,7 +135,7 @@ void tools_initialize (ToolType tool_type,
void active_tool_control (ToolAction action,
void *gdisp_ptr);
void tools_help_func (gchar *help_data);
void tools_help_func (const gchar *help_data);
void tools_register (ToolType tool_type,
ToolOptions *tool_options);

View file

@ -35,19 +35,6 @@
#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 */
typedef struct _ColorSelectorInfo ColorSelectorInfo;
@ -72,7 +59,21 @@ struct _ColorSelectorInstance
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 */
@ -116,7 +117,7 @@ color_notebook_new (gint red,
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
color_notebook_help_func, (gchar *) cnp,
color_notebook_help_func, (const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
@ -235,7 +236,7 @@ color_notebook_free (ColorNotebook *cnp)
csel->info->refs--;
if (csel->info->refs == 0 && !csel->info->active)
selector_death (csel->info);
color_notebook_selector_death (csel->info);
g_free (csel);
csel = next;
@ -352,7 +353,7 @@ color_notebook_page_switch (GtkWidget *widget,
}
static void
color_notebook_help_func (gchar *data)
color_notebook_help_func (const gchar *data)
{
ColorNotebook *cnp;
gchar *help_path;
@ -418,7 +419,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
info->death_callback = callback;
info->death_data = data;
if (info->refs == 0)
selector_death (info);
color_notebook_selector_death (info);
return TRUE;
}
info = info->next;
@ -429,7 +430,7 @@ gimp_color_selector_unregister (GimpColorSelectorID id,
}
static void
selector_death (ColorSelectorInfo *info)
color_notebook_selector_death (ColorSelectorInfo *info)
{
ColorSelectorInfo *here, *prev;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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
* it under the terms of the GNU General Public License as published by
@ -54,12 +54,12 @@ struct _GimpIdleHelp
/* local function prototypes */
static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (gchar *help_path,
gchar *current_locale,
gchar *help_data);
static void gimp_help_netscape (gchar *help_path,
gchar *current_locale,
gchar *help_data);
static gboolean gimp_help_internal (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
static void gimp_help_netscape (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
/**********************/
/* public functions */
@ -67,15 +67,15 @@ static void gimp_help_netscape (gchar *help_path,
/* The standard help function */
void
gimp_standard_help_func (gchar *help_data)
gimp_standard_help_func (const gchar *help_data)
{
gimp_help (NULL, help_data);
}
/* the main help function */
void
gimp_help (gchar *help_path,
gchar *help_data)
gimp_help (const gchar *help_path,
const gchar *help_data)
{
if (use_help)
{
@ -169,9 +169,9 @@ gimp_help_internal_not_found_callback (GtkWidget *widget,
}
static gboolean
gimp_help_internal (gchar *help_path,
gchar *current_locale,
gchar *help_data)
gimp_help_internal (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
ProcRecord *proc_rec;
@ -207,11 +207,11 @@ gimp_help_internal (gchar *help_path,
args[0].arg_type = PDB_INT32;
args[0].value.pdb_int = RUN_INTERACTIVE;
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].value.pdb_pointer = current_locale;
args[2].value.pdb_pointer = (gpointer) current_locale;
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);
@ -237,9 +237,9 @@ gimp_help_internal (gchar *help_path,
}
static void
gimp_help_netscape (gchar *help_path,
gchar *current_locale,
gchar *help_data)
gimp_help_netscape (const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
Argument *return_vals;
gint nreturn_vals;

View file

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__
#include <gtk/gtk.h>
#include "libgimp/gimphelpui.h"
enum
{
HELP_BROWSER_GIMP,
HELP_BROWSER_NETSCAPE
};
/* the main help function */
void gimp_help (gchar *help_path,
gchar *help_data);
void gimp_help (const gchar *help_path,
const gchar *help_data);
#endif /* __GIMP_HELP_H__ */

View file

@ -26,7 +26,7 @@ struct _GimpItemFactoryEntry
{
GtkItemFactoryEntry entry;
gchar *help_page;
const gchar *help_page;
gchar *description;
};

View file

@ -56,7 +56,6 @@ helpdata_DATA = \
gauss_rle.html \
gbr.html \
gdyntext.html \
gee.html \
gfig.html \
gflare.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 time,
gpointer data);
static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
/* end of DND */
struct _GimpColorButton
@ -114,23 +116,25 @@ static gchar* gimp_color_button_menu_translate (const gchar *path,
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 Background Color"), NULL, gimp_color_button_use_bg, 2, NULL }
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
enum {
enum
{
COLOR_CHANGED,
LAST_SIGNAL
};
static guint gimp_color_button_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL;
static void
gimp_color_button_destroy (GtkObject *object)
{
@ -148,7 +152,7 @@ gimp_color_button_destroy (GtkObject *object)
g_free (gcb->odd);
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)
{
GtkObjectClass *object_class;
GtkButtonClass *button_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
object_class = (GtkObjectClass*) class;
button_class = (GtkButtonClass*) class;
widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
parent_class = gtk_type_class (gtk_widget_get_type ());
@ -172,13 +176,15 @@ gimp_color_button_class_init (GimpColorButtonClass *class)
GTK_SIGNAL_OFFSET (GimpColorButtonClass,
color_changed),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_color_button_signals,
LAST_SIGNAL);
class->color_changed = NULL;
object_class->destroy = gimp_color_button_destroy;
button_class->clicked = gimp_color_button_clicked;
widget_class->state_changed = gimp_color_button_state_changed;
button_class->clicked = gimp_color_button_clicked;
}
@ -226,7 +232,7 @@ gimp_color_button_get_type (void)
static GtkWidget *
_gimp_color_button_new (gboolean double_color,
gchar *title,
const gchar *title,
gint width,
gint height,
gpointer color,
@ -297,25 +303,21 @@ _gimp_color_button_new (gboolean double_color,
targets, 1,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect (GTK_OBJECT (gcb->preview),
"drag_begin",
gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_begin",
GTK_SIGNAL_FUNC (gimp_color_button_drag_begin),
gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview),
"drag_end",
gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_end",
GTK_SIGNAL_FUNC (gimp_color_button_drag_end),
gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview),
"drag_data_get",
gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_get",
GTK_SIGNAL_FUNC (gimp_color_button_drag_handle),
gcb);
gtk_signal_connect (GTK_OBJECT (gcb->preview),
"drag_data_received",
gtk_signal_connect (GTK_OBJECT (gcb->preview), "drag_data_received",
GTK_SIGNAL_FUNC (gimp_color_button_drop_handle),
gcb);
/* end of DND */
return (GTK_WIDGET (gcb));
return GTK_WIDGET (gcb);
}
/**
@ -335,9 +337,9 @@ _gimp_color_button_new (gboolean double_color,
* signal is emitted.
*
* Returns: Pointer to the new #GimpColorButton widget.
*/
**/
GtkWidget *
gimp_color_button_new (gchar *title,
gimp_color_button_new (const gchar *title,
gint width,
gint height,
guchar *color,
@ -364,9 +366,9 @@ gimp_color_button_new (gchar *title,
* signal is emitted.
*
* Returns: Pointer to the new GimpColorButton widget.
*/
**/
GtkWidget *
gimp_color_button_double_new (gchar *title,
gimp_color_button_double_new (const gchar *title,
gint width,
gint height,
gdouble *color,
@ -383,12 +385,13 @@ gimp_color_button_double_new (gchar *title,
* Should be used after the color controlled by a #GimpColorButton
* was changed. The color is then reread and the change is propagated
* to the preview and the GtkColorSelectionDialog if one is open.
*/
**/
void
gimp_color_button_update (GimpColorButton *gcb)
{
gint i;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
if (gcb->double_color)
@ -413,13 +416,14 @@ static void
gimp_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
if (!GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
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
@ -432,7 +436,9 @@ gimp_color_button_menu_popup (GtkWidget *widget,
gint x;
gint y;
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (data), FALSE);
gcb = GIMP_COLOR_BUTTON (data);
if (event->type != GDK_BUTTON_PRESS)
@ -457,7 +463,9 @@ gimp_color_button_clicked (GtkButton *button)
GimpColorButton *gcb;
GtkColorSelection *colorsel;
g_return_if_fail (button != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
gcb = GIMP_COLOR_BUTTON (button);
if (!gcb->dialog)
@ -479,6 +487,7 @@ gimp_color_button_clicked (GtkButton *button)
(GtkSignalFunc) gimp_color_button_dialog_cancel, gcb);
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),
gcb->dcolor);
gtk_widget_show (gcb->dialog);
@ -491,6 +500,7 @@ gimp_color_button_paint (GimpColorButton *gcb)
gdouble c0, c1;
guchar *p0, *p1;
g_return_if_fail (gcb != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (gcb));
p0 = gcb->even;
@ -549,7 +559,9 @@ gimp_color_button_dialog_ok (GtkWidget *widget,
gboolean color_changed = FALSE;
gint i;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_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);
@ -592,7 +604,9 @@ gimp_color_button_dialog_cancel (GtkWidget *widget,
{
GimpColorButton *gcb;
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (data));
gcb = GIMP_COLOR_BUTTON (data);
gtk_widget_hide (gcb->dialog);
@ -608,7 +622,9 @@ gimp_color_button_use_fg (gpointer callback_data,
guchar fg_color[3];
gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data);
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];
gint i;
g_return_if_fail (callback_data != NULL);
g_return_if_fail (GIMP_IS_COLOR_BUTTON (callback_data));
gcb = GIMP_COLOR_BUTTON (callback_data);
gimp_palette_get_background (bg_color, &bg_color[1], &bg_color[2]);

View file

@ -52,12 +52,12 @@ struct _GimpColorButtonClass
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 height,
guchar *color,
gint bpp);
GtkWidget * gimp_color_button_double_new (gchar *title,
GtkWidget * gimp_color_button_double_new (const gchar *title,
gint width,
gint height,
gdouble *color,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -56,8 +56,7 @@ static GtkWidget * tips_query = NULL;
*
* Currently it only creates a #GtkTooltips object with gtk_tooltips_new()
* which will be used by gimp_help_set_help_data().
*
*/
**/
void
gimp_help_init (void)
{
@ -69,8 +68,7 @@ gimp_help_init (void)
*
* This function frees the memory used by the #GtkTooltips created by
* gimp_help_init().
*
*/
**/
void
gimp_help_free (void)
{
@ -82,8 +80,7 @@ gimp_help_free (void)
* gimp_help_enable_tooltips:
*
* This function calls gtk_tooltips_enable().
*
*/
**/
void
gimp_help_enable_tooltips (void)
{
@ -94,8 +91,7 @@ gimp_help_enable_tooltips (void)
* gimp_help_disable_tooltips:
*
* This function calls gtk_tooltips_disable().
*
*/
**/
void
gimp_help_disable_tooltips (void)
{
@ -116,12 +112,11 @@ gimp_help_disable_tooltips (void)
* For convenience, gimp_help_connect_help_accel() calls
* gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you
* don't have to worry about this.
*
*/
**/
void
gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gchar *help_data)
const gchar *help_data)
{
GtkAccelGroup *accel_group;
@ -134,7 +129,8 @@ gimp_help_connect_help_accel (GtkWidget *widget,
if (GTK_IS_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)
{
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
* finds another widget with @help_data attached and concatenates both
* to a complete help path.
*
*/
**/
void
gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
gchar *help_data)
const gchar *help_data)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
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)
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
* until it finds an attached @help_data string (which should be the
* case at least for every window/dialog).
*
*/
**/
void
gimp_context_help (void)
{
@ -276,10 +276,10 @@ gimp_help_callback (GtkWidget *widget,
gpointer data)
{
GimpHelpFunc help_function;
gchar *help_data;
const gchar *help_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");
if (help_function)

View file

@ -27,10 +27,12 @@
extern "C" {
#endif /* __cplusplus */
/* 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_free (void);
@ -41,17 +43,17 @@ void gimp_help_disable_tooltips (void);
/* the standard gimp help function
* (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 */
void gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gchar *help_data);
const gchar *help_data);
/* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
gchar *help_data);
const gchar *help_data);
/* activate the context help inspector */
void gimp_context_help (void);

View file

@ -183,16 +183,16 @@ gimp_path_editor_get_type (void)
* #G_SEARCHPATH_SEPARATOR character.
*
* Returns: A pointer to the new #GimpPathEditor widget.
*
*/
**/
GtkWidget *
gimp_path_editor_new (gchar *filesel_title,
gchar *path)
gimp_path_editor_new (const gchar *filesel_title,
const gchar *path)
{
GimpPathEditor *gpe;
GtkWidget *list_item;
GList *directory_list;
gchar *directory;
gchar *mypath;
g_return_val_if_fail ((filesel_title != 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);
directory_list = NULL;
directory = path = g_strdup (path);
directory = mypath = g_strdup (path);
/* split up the path */
while (strlen (directory))
@ -243,7 +243,7 @@ gimp_path_editor_new (gchar *filesel_title,
break;
}
g_free (path);
g_free (mypath);
if (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.
*
* Returns: The search path the user has selected in the path editor.
*
*/
**/
gchar *
gimp_path_editor_get_path (GimpPathEditor *gpe)
{

View file

@ -69,8 +69,8 @@ struct _GimpPathEditorClass
GtkType gimp_path_editor_get_type (void);
GtkWidget * gimp_path_editor_new (gchar *filesel_title,
gchar *path);
GtkWidget * gimp_path_editor_new (const gchar *filesel_title,
const gchar *path);
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_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL;
static void
gimp_pixmap_destroy (GtkObject *object)
{
@ -41,7 +43,7 @@ gimp_pixmap_destroy (GtkObject *object)
g_return_if_fail (pixmap = GIMP_PIXMAP (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -56,7 +58,6 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
parent_class = gtk_type_class (gtk_pixmap_get_type ());
object_class->destroy = gimp_pixmap_destroy;
widget_class->realize = gimp_pixmap_realize;
}
@ -98,8 +99,7 @@ gimp_pixmap_get_type (void)
* Creates a new #GimpPixmap widget.
*
* Returns: A pointer to the new #GimpPixmap widget.
*
*/
**/
GtkWidget *
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.
*
* Sets a new image for an existing #GimpPixmap widget.
*
*/
**/
void
gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data)
@ -162,7 +161,7 @@ static void
gimp_pixmap_realize (GtkWidget *widget)
{
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));
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -36,6 +36,7 @@
#include <libgimp/gimpunitmenu.h>
#include <libgimp/gimpwidgets.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -43,7 +44,7 @@ extern "C" {
/* 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);

View file

@ -31,7 +31,7 @@
/* 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);
static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data);
@ -144,7 +144,7 @@ gimp_unit_menu_get_type (void)
*
*/
GtkWidget *
gimp_unit_menu_new (gchar *format,
gimp_unit_menu_new (const gchar *format,
GimpUnit unit,
gboolean show_pixels,
gboolean show_percent,
@ -375,7 +375,7 @@ print (gchar *buf,
}
static const gchar *
gimp_unit_menu_build_string (gchar *format,
gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit)
{
static gchar buffer[64];

View file

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

View file

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

View file

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

View file

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

View file

@ -52,12 +52,12 @@ struct _GimpColorButtonClass
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 height,
guchar *color,
gint bpp);
GtkWidget * gimp_color_button_double_new (gchar *title,
GtkWidget * gimp_color_button_double_new (const gchar *title,
gint width,
gint height,
gdouble *color,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -56,8 +56,7 @@ static GtkWidget * tips_query = NULL;
*
* Currently it only creates a #GtkTooltips object with gtk_tooltips_new()
* which will be used by gimp_help_set_help_data().
*
*/
**/
void
gimp_help_init (void)
{
@ -69,8 +68,7 @@ gimp_help_init (void)
*
* This function frees the memory used by the #GtkTooltips created by
* gimp_help_init().
*
*/
**/
void
gimp_help_free (void)
{
@ -82,8 +80,7 @@ gimp_help_free (void)
* gimp_help_enable_tooltips:
*
* This function calls gtk_tooltips_enable().
*
*/
**/
void
gimp_help_enable_tooltips (void)
{
@ -94,8 +91,7 @@ gimp_help_enable_tooltips (void)
* gimp_help_disable_tooltips:
*
* This function calls gtk_tooltips_disable().
*
*/
**/
void
gimp_help_disable_tooltips (void)
{
@ -116,12 +112,11 @@ gimp_help_disable_tooltips (void)
* For convenience, gimp_help_connect_help_accel() calls
* gimp_dialog_set_icon() if the passed widget is a #GtkWindow, so you
* don't have to worry about this.
*
*/
**/
void
gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gchar *help_data)
const gchar *help_data)
{
GtkAccelGroup *accel_group;
@ -134,7 +129,8 @@ gimp_help_connect_help_accel (GtkWidget *widget,
if (GTK_IS_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)
{
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
* finds another widget with @help_data attached and concatenates both
* to a complete help path.
*
*/
**/
void
gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
gchar *help_data)
const gchar *help_data)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
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)
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
* until it finds an attached @help_data string (which should be the
* case at least for every window/dialog).
*
*/
**/
void
gimp_context_help (void)
{
@ -276,10 +276,10 @@ gimp_help_callback (GtkWidget *widget,
gpointer data)
{
GimpHelpFunc help_function;
gchar *help_data;
const gchar *help_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");
if (help_function)

View file

@ -27,10 +27,12 @@
extern "C" {
#endif /* __cplusplus */
/* 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_free (void);
@ -41,17 +43,17 @@ void gimp_help_disable_tooltips (void);
/* the standard gimp help function
* (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 */
void gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gchar *help_data);
const gchar *help_data);
/* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
gchar *help_data);
const gchar *help_data);
/* activate the context help inspector */
void gimp_context_help (void);

View file

@ -183,16 +183,16 @@ gimp_path_editor_get_type (void)
* #G_SEARCHPATH_SEPARATOR character.
*
* Returns: A pointer to the new #GimpPathEditor widget.
*
*/
**/
GtkWidget *
gimp_path_editor_new (gchar *filesel_title,
gchar *path)
gimp_path_editor_new (const gchar *filesel_title,
const gchar *path)
{
GimpPathEditor *gpe;
GtkWidget *list_item;
GList *directory_list;
gchar *directory;
gchar *mypath;
g_return_val_if_fail ((filesel_title != 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);
directory_list = NULL;
directory = path = g_strdup (path);
directory = mypath = g_strdup (path);
/* split up the path */
while (strlen (directory))
@ -243,7 +243,7 @@ gimp_path_editor_new (gchar *filesel_title,
break;
}
g_free (path);
g_free (mypath);
if (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.
*
* Returns: The search path the user has selected in the path editor.
*
*/
**/
gchar *
gimp_path_editor_get_path (GimpPathEditor *gpe)
{

View file

@ -69,8 +69,8 @@ struct _GimpPathEditorClass
GtkType gimp_path_editor_get_type (void);
GtkWidget * gimp_path_editor_new (gchar *filesel_title,
gchar *path);
GtkWidget * gimp_path_editor_new (const gchar *filesel_title,
const gchar *path);
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_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL;
static void
gimp_pixmap_destroy (GtkObject *object)
{
@ -41,7 +43,7 @@ gimp_pixmap_destroy (GtkObject *object)
g_return_if_fail (pixmap = GIMP_PIXMAP (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -56,7 +58,6 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
parent_class = gtk_type_class (gtk_pixmap_get_type ());
object_class->destroy = gimp_pixmap_destroy;
widget_class->realize = gimp_pixmap_realize;
}
@ -98,8 +99,7 @@ gimp_pixmap_get_type (void)
* Creates a new #GimpPixmap widget.
*
* Returns: A pointer to the new #GimpPixmap widget.
*
*/
**/
GtkWidget *
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.
*
* Sets a new image for an existing #GimpPixmap widget.
*
*/
**/
void
gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data)
@ -162,7 +161,7 @@ static void
gimp_pixmap_realize (GtkWidget *widget)
{
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));
}

View file

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

View file

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

View file

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

View file

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

View file

@ -31,7 +31,7 @@
/* 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);
static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data);
@ -144,7 +144,7 @@ gimp_unit_menu_get_type (void)
*
*/
GtkWidget *
gimp_unit_menu_new (gchar *format,
gimp_unit_menu_new (const gchar *format,
GimpUnit unit,
gboolean show_pixels,
gboolean show_percent,
@ -375,7 +375,7 @@ print (gchar *buf,
}
static const gchar *
gimp_unit_menu_build_string (gchar *format,
gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit)
{
static gchar buffer[64];

View file

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

View file

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

View file

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

View file

@ -113,8 +113,11 @@ static TgaSaveInterface tsint =
/* TRUEVISION-XFILE magic signature string */
static guchar magic[18] = { 0x54, 0x52, 0x55, 0x45, 0x56, 0x49, 0x53,
0x49, 0x4f, 0x4e, 0x2d, 0x58, 0x46, 0x49, 0x4c, 0x45, 0x2e, 0x0 };
static guchar magic[18] =
{
0x54, 0x52, 0x55, 0x45, 0x56, 0x49, 0x53, 0x49, 0x4f,
0x4e, 0x2d, 0x58, 0x46, 0x49, 0x4c, 0x45, 0x2e, 0x0
};
typedef struct tga_info_struct
{
@ -187,7 +190,9 @@ static gint save_dialog (void);
static void save_ok_callback (GtkWidget *widget,
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 =
@ -407,7 +412,9 @@ load_image (gchar *filename)
FILE *fp;
gchar *name_buf;
tga_info info;
guchar header[18], footer[26], extension[495];
guchar header[18];
guchar footer[26];
guchar extension[495];
long offset;
gint32 image_ID = -1;
@ -424,8 +431,8 @@ load_image (gchar *filename)
g_free (name_buf);
/* Check the footer. */
if (fseek (fp, -26L, SEEK_END)
|| fread (footer, sizeof (footer), 1, fp) != 1)
if (fseek (fp, -26L, SEEK_END) ||
fread (footer, sizeof (footer), 1, fp) != 1)
{
g_message (_("TGA: Cannot read footer from \"%s\"\n"), filename);
return -1;
@ -454,7 +461,8 @@ load_image (gchar *filename)
return -1;
}
switch (header[2]) {
switch (header[2])
{
case 1:
info.imageType = TGA_TYPE_MAPPED;
info.imageCompression = TGA_COMP_NONE;
@ -576,87 +584,132 @@ load_image (gchar *filename)
return image_ID;
}
static void rle_write(FILE *fp, guchar *buffer, guint width, guint bytes) {
int repeat= 0, direct= 0;
static void
rle_write (FILE *fp,
guchar *buffer,
guint width,
guint bytes)
{
gint repeat = 0;
gint direct = 0;
guchar *from = buffer;
int x;
gint x;
for (x= 1; x < width; ++x) {
if (memcmp(buffer, buffer + bytes, bytes)) {
for (x = 1; x < width; ++x)
{
if (memcmp (buffer, buffer + bytes, bytes))
{
/* next pixel is different */
if (repeat) {
if (repeat)
{
putc (128 + repeat, fp);
fwrite (from, bytes, 1, fp);
from = buffer+ bytes; /* point to first different pixel */
repeat= 0; direct= 0;
} else {
repeat = 0;
direct = 0;
}
else
{
direct += 1;
}
} else {
}
else
{
/* next pixel is the same */
if (direct) {
if (direct)
{
putc (direct - 1, fp);
fwrite (from, bytes, direct, fp);
from = buffer; /* point to first identical pixel */
direct= 0; repeat= 1;
} else {
direct = 0;
repeat = 1;
}
else
{
repeat += 1;
}
}
if (repeat == 128) {
if (repeat == 128)
{
putc (255, fp);
fwrite (from, bytes, 1, fp);
from = buffer+ bytes;
direct= 0; repeat= 0;
} else if (direct == 128) {
direct = 0;
repeat = 0;
}
else if (direct == 128)
{
putc (127, fp);
fwrite (from, bytes, direct, fp);
from = buffer+ bytes;
direct= 0; repeat= 0;
direct = 0;
repeat = 0;
}
buffer += bytes;
}
if (repeat > 0) {
if (repeat > 0)
{
putc (128 + repeat, fp);
fwrite (from, bytes, 1, fp);
} else {
}
else
{
putc (direct, fp);
fwrite (from, bytes, direct + 1, fp);
}
}
static int rle_read(FILE *fp, guchar *buffer, tga_info *info) {
static int repeat= 0, direct= 0;
static gint
rle_read (FILE *fp,
guchar *buffer,
tga_info *info)
{
static gint repeat = 0;
static gint direct = 0;
static guchar sample[4];
int head;
int x, k;
gint head;
gint x, k;
for (x= 0; x < info->width; x++) {
if (repeat == 0 && direct == 0) {
for (x = 0; x < info->width; x++)
{
if (repeat == 0 && direct == 0)
{
head = getc (fp);
if (head == EOF) {
if (head == EOF)
{
return EOF;
} else if (head >= 128) {
}
else if (head >= 128)
{
repeat = head - 127;
if (fread (sample, info->bytes, 1, fp) < 1)
return EOF;
} else {
}
else
{
direct = head + 1;
}
}
if (repeat > 0) {
for (k = 0; k < info->bytes; ++k) {
if (repeat > 0)
{
for (k = 0; k < info->bytes; ++k)
{
buffer[k] = sample[k];
}
repeat--;
} else /* direct > 0 */ {
}
else /* direct > 0 */
{
if (fread (buffer, info->bytes, 1, fp) < 1)
return EOF;
direct--;
}
@ -666,13 +719,20 @@ static int rle_read(FILE *fp, guchar *buffer, tga_info *info) {
return 0;
}
static void flip_line(guchar *buffer, tga_info *info) {
guchar temp, *alt;
int x, s;
static void
flip_line (guchar *buffer,
tga_info *info)
{
guchar temp;
guchar *alt;
gint x, s;
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++)
{
for (s = 0; s < info->bytes; ++s)
{
temp = buffer[s];
buffer[s] = alt[s];
alt[s] = temp;
@ -681,18 +741,22 @@ static void flip_line(guchar *buffer, tga_info *info) {
buffer += info->bytes;
alt -= info->bytes;
}
}
/* 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
unless someone actually provides an existence proof */
static void upsample(guchar *dest, guchar *src, guint width, guint bytes) {
int x;
for (x= 0; x < width; x++) {
static void
upsample (guchar *dest,
guchar *src,
guint width,
guint bytes)
{
gint x;
for (x = 0; x < width; x++)
{
dest[0] = ((src[1] << 1) & 0xf8);
dest[0] += (dest[0] >> 5);
@ -707,12 +771,19 @@ static void upsample(guchar *dest, guchar *src, guint width, guint bytes) {
}
}
static void bgr2rgb(guchar *dest, guchar *src,
guint width, guint bytes, guint alpha) {
static void
bgr2rgb (guchar *dest,
guchar *src,
guint width,
guint bytes,
guint alpha)
{
guint x;
if (alpha) {
for (x= 0; x < width; x++) {
if (alpha)
{
for (x = 0; x < width; x++)
{
*(dest++) = src[2];
*(dest++) = src[1];
*(dest++) = src[0];
@ -720,8 +791,11 @@ static void bgr2rgb(guchar *dest, guchar *src,
src += bytes;
}
} else {
for (x= 0; x < width; x++) {
}
else
{
for (x = 0; x < width; x++)
{
*(dest++) = src[2];
*(dest++) = src[1];
*(dest++) = src[0];
@ -731,32 +805,48 @@ static void bgr2rgb(guchar *dest, guchar *src,
}
}
static void read_line(FILE *fp, guchar *row, guchar *buffer,
tga_info *info, GimpDrawable *drawable) {
if (info->imageCompression == TGA_COMP_RLE) {
static void
read_line (FILE *fp,
guchar *row,
guchar *buffer,
tga_info *info,
GimpDrawable *drawable)
{
if (info->imageCompression == TGA_COMP_RLE)
{
rle_read (fp, buffer, info);
} else {
}
else
{
fread (buffer, info->bytes, info->width, fp);
}
if (info->flipHoriz) {
if (info->flipHoriz)
{
flip_line (buffer, info);
}
if (info->imageType == TGA_TYPE_COLOR) {
if (info->bpp == 16) {
if (info->imageType == TGA_TYPE_COLOR)
{
if (info->bpp == 16)
{
upsample (row, buffer, info->width, info->bytes);
} else {
}
else
{
bgr2rgb (row, buffer,info->width,info->bytes,info->alphaBits);
}
} else {
}
else
{
memcpy (row, buffer, info->width * drawable->bpp);
}
}
static gint32
ReadImage (FILE *fp, tga_info *info, char *filename)
ReadImage (FILE *fp,
tga_info *info,
gchar *filename)
{
static gint32 image_ID;
gint32 layer_ID;
@ -764,11 +854,11 @@ ReadImage (FILE *fp, tga_info *info, char *filename)
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
guchar *data, *buffer, *row;
GimpImageType dtype;
GimpImageBaseType itype;
int i, y;
GimpImageType dtype = 0;
GimpImageBaseType itype = 0;
gint i, y;
int max_tileheight, tileheight;
gint max_tileheight, tileheight;
guint cmap_bytes;
guchar tga_cmap[4 * 256], gimp_cmap[3 * 256];
@ -901,31 +991,39 @@ ReadImage (FILE *fp, tga_info *info, char *filename)
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;
GimpDrawable *drawable;
GimpImageType dtype;
int width, height;
gint width;
gint height;
FILE *fp;
guchar *name_buf;
int tileheight, out_bpp, status= TRUE;
int i, row;
gint tileheight;
gint out_bpp = 0;
gboolean status = TRUE;
gint i, row;
guchar header[18], footer[26];
guchar *pixels, *data;
guchar header[18];
guchar footer[26];
guchar *pixels;
guchar *data;
guint num_colors;
guchar *gimp_cmap;
guchar *gimp_cmap = NULL;
drawable = gimp_drawable_get (drawable_ID);
dtype = gimp_drawable_type (drawable_ID);
width = drawable->width;
height = drawable->height;
name_buf = g_strdup_printf (_("Saving %s:"), filename);
gimp_progress_init((char *)name_buf);
gimp_progress_init ((gchar *)name_buf);
g_free (name_buf);
if ((fp = fopen (filename, "wb")) == NULL)
@ -936,19 +1034,27 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
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 */
header[2] = (tsvals.rle) ? 9 : 1;
header[3] = header[4]= 0; /* no offset */
header[5] = num_colors % 256;
header[6] = num_colors / 256;
header[7] = 24; /* cmap size / bits */
} else {
}
else
{
header[1]= 0;
if (dtype == GIMP_RGB_IMAGE || dtype == GIMP_RGBA_IMAGE) {
if (dtype == GIMP_RGB_IMAGE || dtype == GIMP_RGBA_IMAGE)
{
header[2]= (tsvals.rle) ? 10 : 2;
} else {
}
else
{
header[2]= (tsvals.rle) ? 11 : 3;
}
@ -964,7 +1070,8 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
header[14] = height % 256;
header[15] = height / 256;
switch (dtype) {
switch (dtype)
{
case GIMP_INDEXED_IMAGE:
case GIMP_GRAY_IMAGE:
case GIMP_INDEXEDA_IMAGE:
@ -978,11 +1085,13 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
header[16] = 16; /* bpp */
header[17] = 0x28; /* alpha + orientation */
break;
case GIMP_RGB_IMAGE:
out_bpp = 3;
header[16] = 24; /* bpp */
header[17] = 0x20; /* alpha + orientation */
break;
case GIMP_RGBA_IMAGE:
out_bpp = 4;
header[16] = 32; /* bpp */
@ -993,9 +1102,11 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
/* write header to front of file */
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) {
for (i= 0; i < num_colors; ++i)
{
fputc (gimp_cmap[(i * 3) + 2], fp);
fputc (gimp_cmap[(i * 3) + 1], fp);
fputc (gimp_cmap[(i * 3) + 0], fp);
@ -1014,24 +1125,36 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
{
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) {
}
else if (dtype == GIMP_RGBA_IMAGE)
{
bgr2rgb(data, pixels, width, drawable->bpp, 1);
} else if (dtype == GIMP_INDEXEDA_IMAGE) {
for (i= 0; i < width; ++i) {
}
else if (dtype == GIMP_INDEXEDA_IMAGE)
{
for (i = 0; i < width; ++i)
{
data[i]= pixels[i*2];
}
} else {
}
else
{
memcpy (data, pixels, width * drawable->bpp);
}
if (tsvals.rle) {
if (tsvals.rle)
{
rle_write (fp, data, width, out_bpp);
} else {
}
else
{
fwrite (data, width * out_bpp, 1, fp);
}
gimp_progress_update ((double) row / (double) height);
gimp_progress_update ((gdouble) row / (gdouble) height);
}
gimp_drawable_detach (drawable);
@ -1043,6 +1166,7 @@ save_image (gchar *filename, gint32 image_ID, gint32 drawable_ID)
fwrite (footer, sizeof (footer), 1, fp);
fclose (fp);
return status;
}

View file

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