generate app/file/Makefile

2001-10-25  Michael Natterer  <mitch@gimp.org>

	* configure.in: generate app/file/Makefile

	* app/Makefile.am
	* app/file-open.[ch]
	* app/file-save.[ch]
	* app/file-utils.[ch]: removed...

	* app/file/Makefile.am
	* app/file/file-open.[ch]
	* app/file/file-save.[ch]
	* app/file/file-utils.[ch]: ...and added here.

	* app/gui/file-commands.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c
	* tools/pdbgen/pdb/fileops.pdb: changed includes accordingly.

	* app/app_procs.[ch]: removed app_exit_finish() and
	app_exit_finish_done() from the public API, call gtk_main() here,
	pass "no_data" to gimp_new() and "restore_session" to
	gui_restore().

	* app/main.c: removed global variable "double_speed", don't
	call gtk_main() in main.c. Added some missing log domains.

	* app/appenv.h: removed "double_speed".

	* app/core/gimp.[ch]: added "gboolean no_data" property which
	must be passed to gimp_new().

	* app/display/gimpdisplay-foreach.[ch]: added gdisplays_set_busy()
	and gdisplays_unset_busy().

	* app/gui/about-dialog.c: don't include "appenv.h", declare
	"double_speed" extern.

	* app/gui/brush-select.[ch]
	* app/gui/gradient-select.[ch]
	* app/gui/palette-select.[ch]
	* app/gui/pattern-select.[ch]: made the list of dialogs and the
	global selection dialogs private. Added functions which get a
	dialog by PDB callback_name. Pass a "Gimp" and the callback_name
	to the constructors. Don't include "app_procs.h" for "the_gimp"
	and "appenv.h" for "no_data" any more. Use the passed "Gimp"
	instead and look at gimp->no_data.

	* app/gui/toolbox.[ch]: pass a "Gimp" to the constructor.

	* app/gui/gui.[ch]: use the new gdisplays_[un]set_busy() functions,
	use the passed "Gimp" all over the place, don't include
	"appenv.h" and "app_procs.h". gui_really_quit_dialog() takes
	a "quit_func" callback now and calls it instead of calling
	app_exit_finish() (which is now private) directly.

	* app/gui/convert-dialog.c
	* app/gui/dialogs-constructors.c
	* app/gui/palette-import-dialog.c
	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/pattern_select.pdb: changed accordingly.

	* app/pdb/brush_select_cmds.c
	* app/pdb/fileops_cmds.c
	* app/pdb/gradient_select_cmds.c
	* app/pdb/pattern_select_cmds.c: regenerated.

2001-10-25  Michael Natterer  <mitch@gimp.org>

	* POTFILES.in: app/file-*.c -> app/file/file-*.c
This commit is contained in:
Michael Natterer 2001-10-25 13:30:01 +00:00 committed by Michael Natterer
parent 21cc5af734
commit 8b5b8df82d
59 changed files with 567 additions and 1786 deletions

View file

@ -1,3 +1,71 @@
2001-10-25 Michael Natterer <mitch@gimp.org>
* configure.in: generate app/file/Makefile
* app/Makefile.am
* app/file-open.[ch]
* app/file-save.[ch]
* app/file-utils.[ch]: removed...
* app/file/Makefile.am
* app/file/file-open.[ch]
* app/file/file-save.[ch]
* app/file/file-utils.[ch]: ...and added here.
* app/gui/file-commands.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c
* tools/pdbgen/pdb/fileops.pdb: changed includes accordingly.
* app/app_procs.[ch]: removed app_exit_finish() and
app_exit_finish_done() from the public API, call gtk_main() here,
pass "no_data" to gimp_new() and "restore_session" to
gui_restore().
* app/main.c: removed global variable "double_speed", don't
call gtk_main() in main.c. Added some missing log domains.
* app/appenv.h: removed "double_speed".
* app/core/gimp.[ch]: added "gboolean no_data" property which
must be passed to gimp_new().
* app/display/gimpdisplay-foreach.[ch]: added gdisplays_set_busy()
and gdisplays_unset_busy().
* app/gui/about-dialog.c: don't include "appenv.h", declare
"double_speed" extern.
* app/gui/brush-select.[ch]
* app/gui/gradient-select.[ch]
* app/gui/palette-select.[ch]
* app/gui/pattern-select.[ch]: made the list of dialogs and the
global selection dialogs private. Added functions which get a
dialog by PDB callback_name. Pass a "Gimp" and the callback_name
to the constructors. Don't include "app_procs.h" for "the_gimp"
and "appenv.h" for "no_data" any more. Use the passed "Gimp"
instead and look at gimp->no_data.
* app/gui/toolbox.[ch]: pass a "Gimp" to the constructor.
* app/gui/gui.[ch]: use the new gdisplays_[un]set_busy() functions,
use the passed "Gimp" all over the place, don't include
"appenv.h" and "app_procs.h". gui_really_quit_dialog() takes
a "quit_func" callback now and calls it instead of calling
app_exit_finish() (which is now private) directly.
* app/gui/convert-dialog.c
* app/gui/dialogs-constructors.c
* app/gui/palette-import-dialog.c
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/pattern_select.pdb: changed accordingly.
* app/pdb/brush_select_cmds.c
* app/pdb/fileops_cmds.c
* app/pdb/gradient_select_cmds.c
* app/pdb/pattern_select_cmds.c: regenerated.
2001-10-24 Sven Neumann <sven@gimp.org>
* plug-ins/perl/examples/glowing_steel: merged Raphaels patch for

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs base core pdb plug-in xcf tools display widgets gui
SUBDIRS = paint-funcs base core xcf file pdb plug-in tools display widgets gui
scriptdata =
@ -45,15 +45,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
gimprc.c \
gimprc.h \
##
## file load/save stuff
##
file-open.c \
file-open.h \
file-save.c \
file-save.h \
file-utils.h \
file-utils.c \
##
## stuff for plug-in/
##
plug_in.c \
@ -128,8 +119,9 @@ gimp_LDADD = @STRIP_BEGIN@ \
widgets/libappwidgets.a \
plug-in/libappplug-in.a \
core/libappcore.a \
pdb/libapppdb.a \
xcf/libappxcf.a \
file/libappfile.a \
pdb/libapppdb.a \
paint-funcs/libapppaint-funcs.a \
base/libappbase.a \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \

View file

@ -30,6 +30,9 @@
#include "core/gimpimage.h"
#include "core/gimpobject.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplay-ops.h"
@ -40,8 +43,6 @@
#include "file-save-dialog.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-save.h"
#include "gimprc.h"
#include "undo.h"

View file

@ -66,22 +66,20 @@
#include "libgimp/gimpintl.h"
/* local prototypes */
static void app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage);
static void app_exit_finish (void);
/* global variables */
Gimp *the_gimp = NULL;
static gboolean is_app_exit_finish_done = FALSE;
static void
app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage)
{
if (! no_interface && ! no_splash)
{
splash_update (text1, text2, percentage);
}
}
/* public functions */
void
app_init (gint gimp_argc,
@ -93,7 +91,7 @@ app_init (gint gimp_argc,
/* Create an instance of the "Gimp" object which is the root of the
* core object system
*/
the_gimp = gimp_new (be_verbose);
the_gimp = gimp_new (be_verbose, no_data);
/* Check if the user's gimp_directory exists
*/
@ -182,7 +180,7 @@ app_init (gint gimp_argc,
/* FIXME: This needs to go in preferences */
message_handler = MESSAGE_BOX;
gui_restore (the_gimp);
gui_restore (the_gimp, restore_session);
}
/* Parse the rest of the command line arguments as images to load
@ -201,6 +199,8 @@ app_init (gint gimp_argc,
{
gui_post_init (the_gimp);
}
gtk_main ();
}
void
@ -208,19 +208,28 @@ app_exit (gboolean kill_it)
{
/* If it's the user's perogative, and there are dirty images */
if (! kill_it && gdisplays_dirty () && ! no_interface)
gui_really_quit_dialog ();
gui_really_quit_dialog (G_CALLBACK (app_exit_finish));
else
app_exit_finish ();
}
void
/* private functions */
static void
app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage)
{
if (! no_interface && ! no_splash)
{
splash_update (text1, text2, percentage);
}
}
static void
app_exit_finish (void)
{
if (app_exit_finish_done ())
return;
is_app_exit_finish_done = TRUE;
message_handler = CONSOLE;
if (! no_interface)
@ -249,9 +258,3 @@ app_exit_finish (void)
*/
gtk_exit (0);
}
gboolean
app_exit_finish_done (void)
{
return is_app_exit_finish_done;
}

View file

@ -26,11 +26,9 @@
extern Gimp *the_gimp;
void app_init (gint gimp_argc,
gchar **gimp_argv);
void app_exit (gboolean kill_it);
void app_exit_finish (void);
gboolean app_exit_finish_done (void);
void app_init (gint gimp_argc,
gchar **gimp_argv);
void app_exit (gboolean kill_it);
#endif /* __APP_PROCS_H__ */

View file

@ -52,7 +52,6 @@ extern gchar **batch_cmds;
/* other global variables */
extern gchar *prog_name;
extern MessageHandlerType message_handler;
extern gboolean double_speed;
#endif /* __APPENV_H__ */

View file

@ -118,6 +118,7 @@ gimp_init (Gimp *gimp)
gimp_core_config_init (gimp);
gimp->be_verbose = FALSE;
gimp->no_data = FALSE;
gimp->create_display_func = NULL;
gimp->gui_set_busy_func = NULL;
@ -300,13 +301,15 @@ gimp_finalize (GObject *object)
}
Gimp *
gimp_new (gboolean be_verbose)
gimp_new (gboolean be_verbose,
gboolean no_data)
{
Gimp *gimp;
gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
gimp->be_verbose = be_verbose ? TRUE : FALSE;
gimp->no_data = no_data ? TRUE : FALSE;
return gimp;
}

View file

@ -45,6 +45,7 @@ struct _Gimp
GimpCoreConfig *config;
gboolean be_verbose;
gboolean no_data;
GimpCreateDisplayFunc create_display_func;
GimpSetBusyFunc gui_set_busy_func;
@ -115,7 +116,8 @@ struct _GimpClass
GType gimp_get_type (void);
Gimp * gimp_new (gboolean be_verbose);
Gimp * gimp_new (gboolean be_verbose,
gboolean no_data);
void gimp_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback);

View file

@ -39,8 +39,6 @@
#include "about-dialog.h"
#include "authors.h"
#include "appenv.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/wilber2.xpm"
@ -70,6 +68,8 @@ static void about_dialog_tool_drop (GtkWidget *widget,
static gboolean about_dialog_timer (gpointer data);
extern gboolean double_speed;
static GtkWidget *about_dialog = NULL;
static GtkWidget *logo_area = NULL;
static GtkWidget *scroll_area = NULL;
@ -95,7 +95,6 @@ static gint cur_scroll_text = 0;
static gint cur_scroll_index = 0;
static gint shuffle_array[G_N_ELEMENTS (authors)];
static gchar *drop_text[] =
{
"We are The GIMP." ,
@ -110,6 +109,7 @@ static gchar *hadja_text[] =
"Tvärtom!"
};
GtkWidget *
about_dialog_create (void)
{

View file

@ -618,13 +618,15 @@ static void
indexed_custom_palette_button_callback (GtkWidget *widget,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
IndexedDialog *dialog = (IndexedDialog *) data;
if (dialog->palette_select == NULL)
{
dialog->palette_select =
palette_select_new (_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name);
palette_select_new (the_gimp,
_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name,
NULL);
g_signal_connect (G_OBJECT (dialog->palette_select->shell), "destroy",
G_CALLBACK (indexed_palette_select_destroy_callback),

View file

@ -161,7 +161,7 @@ GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context)
{
return toolbox_create ();
return toolbox_create (context->gimp);
}
GtkWidget *
@ -182,28 +182,28 @@ GtkWidget *
dialogs_brush_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return brush_dialog_create ();
return brush_dialog_create (context->gimp);
}
GtkWidget *
dialogs_pattern_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return pattern_dialog_create ();
return pattern_dialog_create (context->gimp);
}
GtkWidget *
dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return gradient_dialog_create ();
return gradient_dialog_create (context->gimp);
}
GtkWidget *
dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return palette_dialog_create ();
return palette_dialog_create (context->gimp);
}
GtkWidget *

View file

@ -48,13 +48,14 @@
#include "core/gimpdocuments.h"
#include "core/gimpimage.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-open-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -37,14 +37,15 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "file/file-save.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -97,7 +97,7 @@ palette_import_select_grad_callback (GtkWidget *widget,
gpointer data)
{
/* Popup grad edit box .... */
gradient_dialog_create ();
gradient_dialog_create (the_gimp);
}
static void

View file

@ -355,3 +355,31 @@ gdisplays_reconnect (GimpImage *old,
gdisplay_reconnect (gdisp, new);
}
}
void
gdisplays_set_busy (void)
{
GSList *list;
GimpDisplay *gdisp;
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
}
}
void
gdisplays_unset_busy (void)
{
GSList *list;
GimpDisplay *gdisp;
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = list->data;
gdisplay_remove_override_cursor (gdisp);
}
}

View file

@ -47,6 +47,8 @@ void gdisplays_delete (void);
void gdisplays_flush (void);
void gdisplays_flush_now (void);
void gdisplays_nav_preview_resized (void);
void gdisplays_set_busy (void);
void gdisplays_unset_busy (void);
#endif /* __GIMP_DISPLAY_FOREACH_H__ */

View file

@ -1,210 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#ifdef G_OS_WIN32
#include <io.h>
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWGRP
#define S_IWGRP (_S_IWRITE>>3)
#define S_IWOTH (_S_IWRITE>>6)
#endif
#ifndef S_IRGRP
#define S_IRGRP (_S_IREAD>>3)
#define S_IROTH (_S_IREAD>>6)
#endif
#define uid_t gint
#define gid_t gint
#define geteuid() 0
#define getegid() 0
#endif
#include <glib-object.h>
#include "core/core-types.h"
#include "core/gimpimage.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
GSList *load_procs = NULL;
/* public functions */
GimpImage *
file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,
RunModeType run_mode,
gint *status)
{
ProcRecord *proc;
Argument *args;
Argument *return_vals;
gint gimage_id;
gint i;
struct stat statbuf;
*status = GIMP_PDB_CANCEL; /* inhibits error messages by caller */
if (! file_proc)
file_proc = file_proc_find (load_procs, filename);
if (! file_proc)
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s: Unknown file type."),
open_mode, filename);
return NULL;
}
/* check if we are opening a file */
if (stat (filename, &statbuf) == 0)
{
uid_t euid;
gid_t egid;
if (! (statbuf.st_mode & S_IFREG))
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s is not a regular file."),
open_mode, filename);
return NULL;
}
euid = geteuid ();
egid = getegid ();
if (! ((statbuf.st_mode & S_IRUSR) ||
((statbuf.st_mode & S_IRGRP) &&
(statbuf.st_uid != euid)) ||
((statbuf.st_mode & S_IROTH) &&
(statbuf.st_uid != euid) &&
(statbuf.st_gid != egid))))
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s: Permission denied."),
open_mode, filename);
return NULL;
}
}
proc = &file_proc->db_info;
args = g_new0 (Argument, proc->num_args);
for (i = 0; i < proc->num_args; i++)
args[i].arg_type = proc->args[i].arg_type;
args[0].value.pdb_int = run_mode;
args[1].value.pdb_pointer = (gchar *) filename;
args[2].value.pdb_pointer = (gchar *) raw_filename;
return_vals = procedural_db_execute (gimp, proc->name, args);
*status = return_vals[0].value.pdb_int;
gimage_id = return_vals[1].value.pdb_int;
procedural_db_destroy_args (return_vals, proc->num_values);
g_free (args);
if (*status == GIMP_PDB_SUCCESS && gimage_id != -1)
{
return gimp_image_get_by_ID (gimp, gimage_id);
}
return NULL;
}
gchar *
file_open_absolute_filename (const gchar *name)
{
PlugInProcDef *proc;
GSList *procs;
GSList *prefixes;
gchar *absolute;
gchar *current;
g_return_val_if_fail (name != NULL, NULL);
/* check for prefixes like http or ftp */
for (procs = load_procs; procs; procs = g_slist_next (procs))
{
proc = (PlugInProcDef *)procs->data;
for (prefixes = proc->prefixes_list;
prefixes;
prefixes = g_slist_next (prefixes))
{
if (strncmp (name, prefixes->data, strlen (prefixes->data)) == 0)
return g_strdup (name);
}
}
if (g_path_is_absolute (name))
return g_strdup (name);
current = g_get_current_dir ();
absolute = g_build_filename (current, name, NULL);
g_free (current);
return absolute;
}

View file

@ -1,37 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_OPEN_H__
#define __FILE_OPEN_H__
extern GSList *load_procs;
GimpImage * file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,
RunModeType run_mode,
gint *status);
gchar * file_open_absolute_filename (const gchar *name);
#endif /* __FILE_OPEN_H__ */

View file

@ -1,247 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#ifdef G_OS_WIN32
#include <io.h>
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWGRP
#define S_IWGRP (_S_IWRITE>>3)
#define S_IWOTH (_S_IWRITE>>6)
#endif
#ifndef S_IRGRP
#define S_IRGRP (_S_IREAD>>3)
#define S_IROTH (_S_IREAD>>6)
#endif
#define uid_t gint
#define gid_t gint
#define geteuid() 0
#define getegid() 0
#endif
#include <glib-object.h>
#include <gtk/gtk.h> /* EEK */
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdocuments.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
GSList *save_procs = NULL;
/* public functions */
GimpPDBStatusType
file_save (GimpImage *gimage,
const gchar *filename,
const gchar *raw_filename,
RunModeType run_mode,
gboolean set_filename)
{
PlugInProcDef *file_proc;
ProcRecord *proc;
Argument *args;
Argument *return_vals;
gint status;
gint i;
struct stat statbuf;
if (gimp_image_active_drawable (gimage) == NULL)
return GIMP_PDB_EXECUTION_ERROR;
file_proc = gimp_image_get_save_proc (gimage);
if (!file_proc)
file_proc = file_proc_find (save_procs, raw_filename);
if (!file_proc)
{
g_message (_("Save failed.\n"
"%s: Unknown file type."),
filename);
return GIMP_PDB_CANCEL; /* inhibits error messages by caller */
}
/* check if we are saving to a file */
if (stat (filename, &statbuf) == 0)
{
uid_t euid;
gid_t egid;
if (! (statbuf.st_mode & S_IFREG))
{
g_message (_("Save failed.\n"
"%s is not a regular file."),
filename);
return GIMP_PDB_CANCEL; /* inhibits error messages by caller */
}
euid = geteuid ();
egid = getegid ();
if (! ((statbuf.st_mode & S_IWUSR) ||
((statbuf.st_mode & S_IWGRP) &&
(statbuf.st_uid != euid)) ||
((statbuf.st_mode & S_IWOTH) &&
(statbuf.st_uid != euid) &&
(statbuf.st_gid != egid))))
{
g_message (_("Save failed.\n"
"%s: Permission denied."),
filename);
return GIMP_PDB_CANCEL; /* inhibits error messages by caller */
}
}
/* ref the image, so it can't get deleted during save */
g_object_ref (G_OBJECT (gimage));
proc = &file_proc->db_info;
args = g_new0 (Argument, proc->num_args);
for (i = 0; i < proc->num_args; i++)
args[i].arg_type = proc->args[i].arg_type;
args[0].value.pdb_int = run_mode;
args[1].value.pdb_int = gimp_image_get_ID (gimage);
args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gimage));
args[3].value.pdb_pointer = (gpointer) filename;
args[4].value.pdb_pointer = (gpointer) raw_filename;
return_vals = procedural_db_execute (gimage->gimp, proc->name, args);
status = return_vals[0].value.pdb_int;
if (status == GIMP_PDB_SUCCESS)
{
/* set this image to clean */
gimp_image_clean_all (gimage);
gimp_documents_add (gimage->gimp, filename);
/* use the same plug-in for this image next time */
/* DISABLED - gets stuck on first saved format... needs
attention --Adam */
/* gimage_set_save_proc(gimage, file_proc); */
/* Write a thumbnail for the saved image, where appropriate */
switch (gimage->gimp->config->thumbnail_mode)
{
case 0:
break;
default:
{
TempBuf *tempbuf;
tempbuf = make_thumb_tempbuf (gimage);
file_save_thumbnail (gimage, filename, tempbuf);
}
}
if (set_filename)
{
/* set the image title */
gimp_object_set_name (GIMP_OBJECT (gimage), filename);
}
}
g_free (return_vals);
g_free (args);
g_object_unref (G_OBJECT (gimage));
return status;
}
/* Set "gimage"s save handler to "save_proc", then save the image.
* Hide the dialog if all went well, otherwise make the user knows an
* error happened and leave the dialog up. Make sure it's sensitive.
*/
gboolean
file_save_with_proc (GimpImage *gimage,
const gchar *full_filename,
const gchar *raw_filename,
PlugInProcDef *save_proc,
gboolean set_filename)
{
gint status = GIMP_PDB_EXECUTION_ERROR;
gboolean success = FALSE;
if (gimage != NULL)
{
gimp_image_set_save_proc (gimage, save_proc);
status = file_save (gimage,
full_filename,
raw_filename,
RUN_INTERACTIVE,
set_filename);
if (status == GIMP_PDB_SUCCESS)
success = TRUE;
}
/* If there was an error but file_save() didn't print an error
* message, then we'd better.
*/
if (status != GIMP_PDB_SUCCESS && status != GIMP_PDB_CANCEL)
g_message (_("Save failed.\n%s"), full_filename);
return success;
}

View file

@ -1,39 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_SAVE_H__
#define __FILE_SAVE_H__
extern GSList *save_procs;
GimpPDBStatusType file_save (GimpImage *gimage,
const gchar *filename,
const gchar *raw_filename,
RunModeType run_mode,
gboolean set_filename);
gboolean file_save_with_proc (GimpImage *gimage,
const gchar *full_filename,
const gchar *raw_filename,
PlugInProcDef *save_proc,
gboolean set_filename);
#endif /* __FILE_SAVE_H__ */

View file

@ -1,672 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#ifdef G_OS_WIN32
#include <direct.h> /* For _mkdir() */
#define mkdir(path,mode) _mkdir(path)
#endif
#include <glib-object.h>
#include "libgimpmath/gimpmath.h"
#include "core/core-types.h"
#include "base/temp-buf.h"
#include "core/gimpimage.h"
#include "file-utils.h"
#include "plug_in.h"
static PlugInProcDef *
file_proc_find_by_name (GSList *procs,
const gchar *filename,
gboolean skip_magic)
{
GSList *p;
gchar *ext = strrchr (filename, '.');
if (ext)
ext++;
for (p = procs; p; p = g_slist_next (p))
{
PlugInProcDef *proc = p->data;
GSList *prefixes;
if (skip_magic && proc->magics_list)
continue;
for (prefixes = proc->prefixes_list;
prefixes;
prefixes = g_slist_next (prefixes))
{
if (strncmp (filename, prefixes->data, strlen (prefixes->data)) == 0)
return proc;
}
}
for (p = procs; p; p = g_slist_next (p))
{
PlugInProcDef *proc = p->data;
GSList *extensions;
for (extensions = proc->extensions_list;
ext && extensions;
extensions = g_slist_next (extensions))
{
gchar *p1 = ext;
gchar *p2 = (gchar *) extensions->data;
if (skip_magic && proc->magics_list)
continue;
while (*p1 && *p2)
{
if (tolower (*p1) != tolower (*p2))
break;
p1++;
p2++;
}
if (!(*p1) && !(*p2))
return proc;
}
}
return NULL;
}
PlugInProcDef *
file_proc_find (GSList *procs,
const gchar *filename)
{
PlugInProcDef *file_proc;
PlugInProcDef *size_matched_proc = NULL;
GSList *all_procs = procs;
FILE *ifp = NULL;
gint head_size = -2;
gint size_match_count = 0;
gint match_val;
guchar head[256];
/* First, check magicless prefixes/suffixes */
if ( (file_proc = file_proc_find_by_name (all_procs, filename, TRUE)) != NULL)
return file_proc;
/* Then look for magics */
while (procs)
{
file_proc = procs->data;
procs = procs->next;
if (file_proc->magics_list)
{
if (head_size == -2)
{
head_size = 0;
if ((ifp = fopen (filename, "rb")) != NULL)
head_size = fread ((gchar *) head, 1, sizeof (head), ifp);
}
if (head_size >= 4)
{
match_val = file_check_magic_list (file_proc->magics_list,
head_size, head, ifp);
if (match_val == 2) /* size match ? */
{ /* Use it only if no other magic matches */
size_match_count++;
size_matched_proc = file_proc;
}
else if (match_val)
{
fclose (ifp);
return (file_proc);
}
}
}
}
if (ifp) fclose (ifp);
if (size_match_count == 1)
return (size_matched_proc);
/* As a last ditch, try matching by name */
return file_proc_find_by_name (all_procs, filename, FALSE);
}
static void
file_convert_string (gchar *instr,
gchar *outmem,
gint maxmem,
gint *nmem)
{
/* Convert a string in C-notation to array of char */
guchar *uin = (guchar *) instr;
guchar *uout = (guchar *) outmem;
guchar tmp[5], *tmpptr;
gint k;
while ((*uin != '\0') && ((((char *)uout) - outmem) < maxmem))
{
if (*uin != '\\') /* Not an escaped character ? */
{
*(uout++) = *(uin++);
continue;
}
if (*(++uin) == '\0')
{
*(uout++) = '\\';
break;
}
switch (*uin)
{
case '0': case '1': case '2': case '3': /* octal */
for (tmpptr = tmp; (tmpptr-tmp) <= 3;)
{
*(tmpptr++) = *(uin++);
if ( (*uin == '\0') || (!isdigit (*uin))
|| (*uin == '8') || (*uin == '9'))
break;
}
*tmpptr = '\0';
sscanf ((char *)tmp, "%o", &k);
*(uout++) = k;
break;
case 'a': *(uout++) = '\a'; uin++; break;
case 'b': *(uout++) = '\b'; uin++; break;
case 't': *(uout++) = '\t'; uin++; break;
case 'n': *(uout++) = '\n'; uin++; break;
case 'v': *(uout++) = '\v'; uin++; break;
case 'f': *(uout++) = '\f'; uin++; break;
case 'r': *(uout++) = '\r'; uin++; break;
default : *(uout++) = *(uin++); break;
}
}
*nmem = ((gchar *) uout) - outmem;
}
static gint
file_check_single_magic (gchar *offset,
gchar *type,
gchar *value,
gint headsize,
guchar *file_head,
FILE *ifp)
{
/* Return values are 0: no match, 1: magic match, 2: size match */
glong offs;
gulong num_testval, num_operatorval;
gulong fileval;
gint numbytes, k, c = 0, found = 0;
gchar *num_operator_ptr, num_operator, num_test;
guchar mem_testval[256];
/* Check offset */
if (sscanf (offset, "%ld", &offs) != 1) return (0);
if (offs < 0) return (0);
/* Check type of test */
num_operator_ptr = NULL;
num_operator = '\0';
num_test = '=';
if (strncmp (type, "byte", 4) == 0)
{
numbytes = 1;
num_operator_ptr = type+4;
}
else if (strncmp (type, "short", 5) == 0)
{
numbytes = 2;
num_operator_ptr = type+5;
}
else if (strncmp (type, "long", 4) == 0)
{
numbytes = 4;
num_operator_ptr = type+4;
}
else if (strncmp (type, "size", 4) == 0)
{
numbytes = 5;
}
else if (strcmp (type, "string") == 0)
{
numbytes = 0;
}
else return (0);
/* Check numerical operator value if present */
if (num_operator_ptr && (*num_operator_ptr == '&'))
{
if (isdigit (num_operator_ptr[1]))
{
if (num_operator_ptr[1] != '0') /* decimal */
sscanf (num_operator_ptr+1, "%ld", &num_operatorval);
else if (num_operator_ptr[2] == 'x') /* hexadecimal */
sscanf (num_operator_ptr+3, "%lx", &num_operatorval);
else /* octal */
sscanf (num_operator_ptr+2, "%lo", &num_operatorval);
num_operator = *num_operator_ptr;
}
}
if (numbytes > 0) /* Numerical test ? */
{
/* Check test value */
if ((value[0] == '=') || (value[0] == '>') || (value[0] == '<'))
{
num_test = value[0];
value++;
}
if (!isdigit (value[0])) return (0);
/*
* to anybody reading this: is strtol's parsing behaviour (e.g. "0x" prefix)
* broken on some systems or why do we do the base detection ourselves?
* */
if (value[0] != '0') /* decimal */
num_testval = strtol(value, NULL, 10);
else if (value[1] == 'x') /* hexadecimal */
num_testval = (unsigned long)strtoul(value+2, NULL, 16);
else /* octal */
num_testval = strtol(value+1, NULL, 8);
fileval = 0;
if (numbytes == 5) /* Check for file size ? */
{
struct stat buf;
if (fstat (fileno (ifp), &buf) < 0) return (0);
fileval = buf.st_size;
}
else if (offs + numbytes <= headsize) /* We have it in memory ? */
{
for (k = 0; k < numbytes; k++)
fileval = (fileval << 8) | (long)file_head[offs+k];
}
else /* Read it from file */
{
if (fseek (ifp, offs, SEEK_SET) < 0) return (0);
for (k = 0; k < numbytes; k++)
fileval = (fileval << 8) | (c = getc (ifp));
if (c == EOF) return (0);
}
if (num_operator == '&')
fileval &= num_operatorval;
if (num_test == '<')
found = (fileval < num_testval);
else if (num_test == '>')
found = (fileval > num_testval);
else
found = (fileval == num_testval);
if (found && (numbytes == 5)) found = 2;
}
else if (numbytes == 0) /* String test */
{
file_convert_string ((char *)value, (char *)mem_testval,
sizeof (mem_testval), &numbytes);
if (numbytes <= 0) return (0);
if (offs + numbytes <= headsize) /* We have it in memory ? */
{
found = (memcmp (mem_testval, file_head+offs, numbytes) == 0);
}
else /* Read it from file */
{
if (fseek (ifp, offs, SEEK_SET) < 0) return (0);
found = 1;
for (k = 0; found && (k < numbytes); k++)
{
c = getc (ifp);
found = (c != EOF) && (c == (int)mem_testval[k]);
}
}
}
return found;
}
gint
file_check_magic_list (GSList *magics_list,
gint headsize,
guchar *head,
FILE *ifp)
{
/* Return values are 0: no match, 1: magic match, 2: size match */
gchar *offset;
gchar *type;
gchar *value;
gint and = 0;
gint found = 0;
gint match_val;
while (magics_list)
{
if ((offset = (gchar *)magics_list->data) == NULL) break;
if ((magics_list = magics_list->next) == NULL) break;
if ((type = (gchar *)magics_list->data) == NULL) break;
if ((magics_list = magics_list->next) == NULL) break;
if ((value = (gchar *)magics_list->data) == NULL) break;
magics_list = magics_list->next;
match_val = file_check_single_magic (offset, type, value,
headsize, head, ifp);
if (and)
found = found && match_val;
else
found = match_val;
and = (strchr (offset, '&') != NULL);
if ((!and) && found)
return match_val;
}
return 0;
}
TempBuf *
make_thumb_tempbuf (GimpImage *gimage)
{
gint w, h;
if (gimage->width<=80 && gimage->height<=60)
{
w = gimage->width;
h = gimage->height;
}
else
{
/* Ratio molesting to fit within .xvpic thumbnail size limits */
if (60 * gimage->width < 80 * gimage->height)
{
h = 60;
w = (60 * gimage->width) / gimage->height;
if (w == 0)
w = 1;
}
else
{
w = 80;
h = (80 * gimage->height) / gimage->width;
if (h == 0)
h = 1;
}
}
/*printf("tn: %d x %d -> ", w, h);fflush(stdout);*/
return gimp_viewable_get_preview (GIMP_VIEWABLE (gimage), w, h);
}
/* The readXVThumb function source may be re-used under
the XFree86-style license. <adam@gimp.org> */
guchar *
readXVThumb (const gchar *fnam,
gint *w,
gint *h,
gchar **imginfo /* caller frees if != NULL */)
{
FILE *fp;
const gchar *P7_332 = "P7 332";
gchar P7_buf[7];
gchar linebuf[200];
guchar *buf;
gint twofivefive;
void *ptr;
*w = *h = 0;
*imginfo = NULL;
fp = fopen (fnam, "rb");
if (!fp)
return NULL;
fread (P7_buf, 6, 1, fp);
if (strncmp(P7_buf, P7_332, 6)!=0)
{
g_warning ("Thumbnail doesn't have the 'P7 332' header.");
fclose (fp);
return NULL;
}
/*newline*/
fread (P7_buf, 1, 1, fp);
do
{
ptr = fgets(linebuf, 199, fp);
if ((strncmp(linebuf, "#IMGINFO:", 9) == 0) &&
(linebuf[9] != '\0') &&
(linebuf[9] != '\n'))
{
if (linebuf[strlen(linebuf)-1] == '\n')
linebuf[strlen(linebuf)-1] = '\0';
if (linebuf[9] != '\0')
{
if (*imginfo)
g_free(*imginfo);
*imginfo = g_strdup (&linebuf[9]);
}
}
}
while (ptr && linebuf[0]=='#'); /* keep throwing away comment lines */
if (!ptr)
{
/* g_warning("Thumbnail ended - not an image?"); */
fclose (fp);
return NULL;
}
sscanf(linebuf, "%d %d %d\n", w, h, &twofivefive);
if (twofivefive!=255)
{
g_warning ("Thumbnail is of funky depth.");
fclose (fp);
return NULL;
}
if ((*w)<1 || (*h)<1 || (*w)>80 || (*h)>60)
{
g_warning ("Thumbnail size bad. Corrupted?");
fclose (fp);
return NULL;
}
buf = g_malloc ((*w) * (*h));
fread (buf, (*w) * (*h), 1, fp);
fclose (fp);
return buf;
}
gboolean
file_save_thumbnail (GimpImage *gimage,
const gchar *full_source_filename,
TempBuf *tempbuf)
{
gint i,j;
gint w,h;
guchar *tbd;
gchar *pathname;
gchar *filename;
gchar *xvpathname;
gchar *thumbnailname;
GimpImageBaseType basetype;
FILE *fp;
struct stat statbuf;
if (stat (full_source_filename, &statbuf) != 0)
{
return FALSE;
}
pathname = g_path_get_dirname (full_source_filename);
filename = g_path_get_basename (full_source_filename);
xvpathname = g_build_filename (pathname, ".xvpics", NULL);
thumbnailname = g_build_filename (xvpathname, filename, NULL);
tbd = temp_buf_data (tempbuf);
w = tempbuf->width;
h = tempbuf->height;
/*printf("tn: %d x %d\n", w, h);fflush(stdout);*/
mkdir (xvpathname, 0755);
fp = fopen (thumbnailname, "wb");
g_free (pathname);
g_free (filename);
g_free (xvpathname);
g_free (thumbnailname);
if (fp)
{
basetype = gimp_image_base_type (gimage);
fprintf (fp,
"P7 332\n#IMGINFO:%dx%d %s (%d %s)\n"
"#END_OF_COMMENTS\n%d %d 255\n",
gimage->width, gimage->height,
(basetype == RGB) ? "RGB" :
(basetype == GRAY) ? "Greyscale" :
(basetype == INDEXED) ? "Indexed" :
"(UNKNOWN COLOUR TYPE)",
(int)statbuf.st_size,
(statbuf.st_size == 1) ? "byte" : "bytes",
w, h);
switch (basetype)
{
case INDEXED:
case RGB:
for (i=0; i<h; i++)
{
/* Do a cheap unidirectional error-spread to look better */
gint rerr=0, gerr=0, berr=0, a;
for (j=0; j<w; j++)
{
gint32 r,g,b;
if (128 & *(tbd + 3))
{
r = *(tbd++) + rerr;
g = *(tbd++) + gerr;
b = *(tbd++) + berr;
tbd++;
}
else
{
a = (( (i^j) & 4 ) << 5) | 64; /* cute. */
r = a + rerr;
g = a + gerr;
b = a + berr;
tbd += 4;
}
r = CLAMP0255 (r);
g = CLAMP0255 (g);
b = CLAMP0255 (b);
fputc(((r>>5)<<5) | ((g>>5)<<2) | (b>>6), fp);
rerr = r - ( (r>>5) * 255 ) / 7;
gerr = g - ( (g>>5) * 255 ) / 7;
berr = b - ( (b>>6) * 255 ) / 3;
}
}
break;
case GRAY:
for (i=0; i<h; i++)
{
/* Do a cheap unidirectional error-spread to look better */
gint b3err=0, b2err=0, v, a;
for (j=0; j<w; j++)
{
gint32 b3, b2;
v = *(tbd++);
a = *(tbd++);
if (!(128 & a))
v = (( (i^j) & 4 ) << 5) | 64;
b2 = v + b2err;
b3 = v + b3err;
b2 = CLAMP0255 (b2);
b3 = CLAMP0255 (b3);
fputc(((b3>>5)<<5) | ((b3>>5)<<2) | (b2>>6), fp);
b2err = b2 - ( (b2>>6) * 255 ) / 3;
b3err = b3 - ( (b3>>5) * 255 ) / 7;
}
}
break;
default:
g_warning("UNKNOWN GIMAGE TYPE IN THUMBNAIL SAVE");
break;
}
fclose (fp);
}
else /* Error writing thumbnail */
{
return FALSE;
}
return TRUE;
}

View file

@ -1,46 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_UTILS_H__
#define __FILE_UTILS_H__
#include <stdio.h>
PlugInProcDef * file_proc_find (GSList *procs,
const gchar *filename);
/* Return values are 0: no match, 1: magic match, 2: size match */
gint file_check_magic_list (GSList *magics_list,
gint headsize,
guchar *head,
FILE *ifp);
TempBuf * make_thumb_tempbuf (GimpImage *gimage);
guchar * readXVThumb (const gchar *fnam,
gint *w,
gint *h,
gchar **imginfo /* caller frees if != NULL */);
gboolean file_save_thumbnail (GimpImage *gimage,
const char *full_source_filename,
TempBuf *tempbuf);
#endif /* __FILE_UTILS_H__ */

6
app/file/.cvsignore Normal file
View file

@ -0,0 +1,6 @@
Makefile
Makefile.in
.deps
.libs
*.lo
libappfile.la

32
app/file/Makefile.am Normal file
View file

@ -0,0 +1,32 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libappfile.a
libappfile_a_SOURCES = @STRIP_BEGIN@ \
file-open.c \
file-open.h \
file-save.c \
file-save.h \
file-utils.c \
file-utils.h \
@STRIP_END@
AM_CPPFLAGS = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gimp-File\" \
@GIMP_THREAD_FLAGS@ \
@GIMP_MP_FLAGS@ \
@STRIP_END@
INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir) \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
-I$(includedir) \
@STRIP_END@
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done

View file

@ -65,6 +65,7 @@
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -71,6 +71,7 @@
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -51,6 +51,7 @@
#include "core/gimpimage.h"
#include "file-utils.h"
#include "plug_in.h"

View file

@ -39,8 +39,6 @@
#include "about-dialog.h"
#include "authors.h"
#include "appenv.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/wilber2.xpm"
@ -70,6 +68,8 @@ static void about_dialog_tool_drop (GtkWidget *widget,
static gboolean about_dialog_timer (gpointer data);
extern gboolean double_speed;
static GtkWidget *about_dialog = NULL;
static GtkWidget *logo_area = NULL;
static GtkWidget *scroll_area = NULL;
@ -95,7 +95,6 @@ static gint cur_scroll_text = 0;
static gint cur_scroll_index = 0;
static gint shuffle_array[G_N_ELEMENTS (authors)];
static gchar *drop_text[] =
{
"We are The GIMP." ,
@ -110,6 +109,7 @@ static gchar *hadja_text[] =
"Tvärtom!"
};
GtkWidget *
about_dialog_create (void)
{

View file

@ -42,8 +42,6 @@
#include "brush-select.h"
#include "dialogs-constructors.h"
#include "appenv.h"
#include "app_procs.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -80,20 +78,22 @@ static void brush_select_close_callback (GtkWidget *widget,
/* list of active dialogs */
GSList *brush_active_dialogs = NULL;
static GSList *brush_active_dialogs = NULL;
/* the main brush selection dialog */
BrushSelect *brush_select_dialog = NULL;
static BrushSelect *brush_select_dialog = NULL;
/* public functions */
GtkWidget *
brush_dialog_create (void)
brush_dialog_create (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (! brush_select_dialog)
{
brush_select_dialog = brush_select_new (NULL, NULL, 0.0, 0, 0);
brush_select_dialog = brush_select_new (gimp, NULL, NULL, 0.0, 0, 0, NULL);
}
return brush_select_dialog->shell;
@ -112,14 +112,16 @@ brush_dialog_free (void)
/* If title == NULL then it is the main brush dialog */
BrushSelect *
brush_select_new (gchar *title,
brush_select_new (Gimp *gimp,
const gchar *title,
/* These are the required initial vals
* If init_name == NULL then use current brush
*/
gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode)
const gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode,
const gchar *callback_name)
{
BrushSelect *bsp;
GtkWidget *main_vbox;
@ -131,8 +133,12 @@ brush_select_new (gchar *title,
static gboolean first_call = TRUE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
bsp = g_new0 (BrushSelect, 1);
bsp->callback_name = g_strdup (callback_name);
/* The shell */
bsp->shell = gimp_dialog_new (title ? title : _("Brush Selection"),
"brush_selection",
@ -146,37 +152,36 @@ brush_select_new (gchar *title,
NULL);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox)), 0)));
gtk_dialog_set_has_separator (GTK_DIALOG (bsp->shell), FALSE);
gtk_widget_hide (GTK_DIALOG (bsp->shell)->action_area);
if (title)
{
bsp->context = gimp_create_context (the_gimp, title, NULL);
bsp->context = gimp_create_context (gimp, title, NULL);
}
else
{
bsp->context = gimp_get_user_context (the_gimp);
bsp->context = gimp_get_user_context (gimp);
}
if (no_data && first_call)
gimp_data_factory_data_init (the_gimp->brush_factory, FALSE);
if (gimp->no_data && first_call)
gimp_data_factory_data_init (gimp->brush_factory, FALSE);
first_call = FALSE;
if (title && init_name && strlen (init_name))
{
active = (GimpBrush *)
gimp_container_get_child_by_name (the_gimp->brush_factory->container,
gimp_container_get_child_by_name (gimp->brush_factory->container,
init_name);
}
else
{
active = gimp_context_get_brush (gimp_get_user_context (the_gimp));
active = gimp_context_get_brush (gimp_get_user_context (gimp));
}
if (!active)
active = gimp_context_get_brush (gimp_get_standard_context (the_gimp));
active = gimp_context_get_brush (gimp_get_standard_context (gimp));
if (title)
{
@ -193,7 +198,7 @@ brush_select_new (gchar *title,
/* The Brush Grid */
bsp->view = gimp_brush_factory_view_new (GIMP_VIEW_TYPE_GRID,
the_gimp->brush_factory,
gimp->brush_factory,
dialogs_edit_brush_func,
bsp->context,
title ? FALSE : TRUE,
@ -296,8 +301,9 @@ brush_select_new (gchar *title,
void
brush_select_free (BrushSelect *bsp)
{
if (!bsp)
return;
g_return_if_fail (bsp != NULL);
gtk_widget_destroy (bsp->shell);
/* remove from active list */
brush_active_dialogs = g_slist_remove (brush_active_dialogs, bsp);
@ -392,6 +398,23 @@ brush_select_change_callbacks (BrushSelect *bsp,
busy = FALSE;
}
BrushSelect *
brush_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
BrushSelect *bsp;
for (list = brush_active_dialogs; list; list = g_slist_next (list))
{
bsp = (BrushSelect *) list->data;
if (bsp->callback_name && ! strcmp (callback_name, bsp->callback_name))
return bsp;
}
return NULL;
}
/* Close active dialogs that no longer have PDB registered for them */
void
@ -536,7 +559,6 @@ brush_select_close_callback (GtkWidget *widget,
{
/* Send data back */
brush_select_change_callbacks (bsp, TRUE);
gtk_widget_destroy (bsp->shell);
brush_select_free (bsp);
}
}

View file

@ -40,24 +40,23 @@ struct _BrushSelect
gint spacing_value;
};
/* list of active dialogs */
extern GSList *brush_active_dialogs;
/* the main brush dialog */
extern BrushSelect *brush_select_dialog;
BrushSelect * brush_select_new (Gimp *gimp,
const gchar *title,
/* These are the required
* initial vals
* If init_name == NULL then use
* current brush
*/
const gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode,
const gchar *callback_name);
void brush_select_free (BrushSelect *bsp);
BrushSelect * brush_select_new (gchar *title,
/* These are the required initial vals
* If init_name == NULL then use
* current brush
*/
gchar *init_name,
gdouble init_opacity,
gint init_spacing,
gint init_mode);
void brush_select_free (BrushSelect *bsp);
void brush_select_dialogs_check (void);
BrushSelect * brush_select_get_by_callback (const gchar *callback_name);
void brush_select_dialogs_check (void);
/* show/hide paint options (main brush dialog if bsp == NULL) */
@ -66,8 +65,8 @@ void brush_select_show_paint_options (BrushSelect *bsp,
/* the main brush selection */
GtkWidget * brush_dialog_create (void);
void brush_dialog_free (void);
GtkWidget * brush_dialog_create (Gimp *gimp);
void brush_dialog_free (void);
#endif /* __BRUSH_SELECT_H__ */

View file

@ -618,13 +618,15 @@ static void
indexed_custom_palette_button_callback (GtkWidget *widget,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
IndexedDialog *dialog = (IndexedDialog *) data;
if (dialog->palette_select == NULL)
{
dialog->palette_select =
palette_select_new (_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name);
palette_select_new (the_gimp,
_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name,
NULL);
g_signal_connect (G_OBJECT (dialog->palette_select->shell), "destroy",
G_CALLBACK (indexed_palette_select_destroy_callback),

View file

@ -161,7 +161,7 @@ GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context)
{
return toolbox_create ();
return toolbox_create (context->gimp);
}
GtkWidget *
@ -182,28 +182,28 @@ GtkWidget *
dialogs_brush_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return brush_dialog_create ();
return brush_dialog_create (context->gimp);
}
GtkWidget *
dialogs_pattern_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return pattern_dialog_create ();
return pattern_dialog_create (context->gimp);
}
GtkWidget *
dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return gradient_dialog_create ();
return gradient_dialog_create (context->gimp);
}
GtkWidget *
dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return palette_dialog_create ();
return palette_dialog_create (context->gimp);
}
GtkWidget *

View file

@ -30,6 +30,9 @@
#include "core/gimpimage.h"
#include "core/gimpobject.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplay-ops.h"
@ -40,8 +43,6 @@
#include "file-save-dialog.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-save.h"
#include "gimprc.h"
#include "undo.h"

View file

@ -48,13 +48,14 @@
#include "core/gimpdocuments.h"
#include "core/gimpimage.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-open-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -37,14 +37,15 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "file/file-save.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"

View file

@ -40,9 +40,6 @@
#include "dialogs-constructors.h"
#include "gradient-select.h"
#include "appenv.h"
#include "app_procs.h"
#include "libgimp/gimpintl.h"
@ -56,20 +53,22 @@ static void gradient_select_close_callback (GtkWidget *widget,
/* list of active dialogs */
GSList *gradient_active_dialogs = NULL;
static GSList *gradient_active_dialogs = NULL;
/* the main gradient selection dialog */
GradientSelect *gradient_select_dialog = NULL;
static GradientSelect *gradient_select_dialog = NULL;
/* public functions */
GtkWidget *
gradient_dialog_create (void)
gradient_dialog_create (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (! gradient_select_dialog)
{
gradient_select_dialog = gradient_select_new (NULL, NULL);
gradient_select_dialog = gradient_select_new (gimp, NULL, NULL, NULL, 0);
}
return gradient_select_dialog->shell;
@ -87,8 +86,11 @@ gradient_dialog_free (void)
/* If title == NULL then it is the main gradient select dialog */
GradientSelect *
gradient_select_new (gchar *title,
gchar *initial_gradient)
gradient_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_gradient,
const gchar *callback_name,
gint sample_size)
{
GradientSelect *gsp;
GtkWidget *vbox;
@ -96,7 +98,12 @@ gradient_select_new (gchar *title,
static gboolean first_call = TRUE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gsp = g_new0 (GradientSelect, 1);
gsp->callback_name = g_strdup (callback_name);
gsp->sample_size = sample_size;
/* The shell */
gsp->shell = gimp_dialog_new (title ? title : _("Gradient Selection"),
@ -116,14 +123,14 @@ gradient_select_new (gchar *title,
if (title)
{
gsp->context = gimp_create_context (the_gimp, title, NULL);
gsp->context = gimp_create_context (gimp, title, NULL);
}
else
{
gsp->context = gimp_get_user_context (the_gimp);
gsp->context = gimp_get_user_context (gimp);
}
if (no_data && first_call)
if (gimp->no_data && first_call)
gimp_data_factory_data_init (gsp->context->gimp->gradient_factory, FALSE);
first_call = FALSE;
@ -136,11 +143,11 @@ gradient_select_new (gchar *title,
}
else
{
active = gimp_context_get_gradient (gimp_get_user_context (the_gimp));
active = gimp_context_get_gradient (gimp_get_user_context (gimp));
}
if (!active)
active = gimp_context_get_gradient (gimp_get_standard_context (the_gimp));
active = gimp_context_get_gradient (gimp_get_standard_context (gimp));
if (title)
gimp_context_set_gradient (gsp->context, active);
@ -177,8 +184,9 @@ gradient_select_new (gchar *title,
void
gradient_select_free (GradientSelect *gsp)
{
if (!gsp)
return;
g_return_if_fail (gsp != NULL);
gtk_widget_destroy (gsp->shell);
/* remove from active list */
gradient_active_dialogs = g_slist_remove (gradient_active_dialogs, gsp);
@ -265,6 +273,23 @@ gradient_select_change_callbacks (GradientSelect *gsp,
busy = FALSE;
}
GradientSelect *
gradient_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
GradientSelect *gsp;
for (list = gradient_active_dialogs; list; list = g_slist_next (list))
{
gsp = (GradientSelect *) list->data;
if (gsp->callback_name && ! strcmp (callback_name, gsp->callback_name))
return gsp;
}
return NULL;
}
/* Close active dialogs that no longer have PDB registered for them */
void
@ -324,7 +349,6 @@ gradient_select_close_callback (GtkWidget *widget,
if (gsp != gradient_select_dialog)
{
gradient_select_change_callbacks (gsp, TRUE);
gtk_widget_destroy (gsp->shell);
gradient_select_free (gsp);
}
}

View file

@ -37,26 +37,20 @@ struct _GradientSelect
};
/* list of active dialogs */
extern GSList *gradient_active_dialogs;
GradientSelect * gradient_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_gradient,
const gchar *callback_name,
gint sample_size);
/* the main gradient selection dialog */
extern GradientSelect *gradient_select_dialog;
GradientSelect * gradient_select_new (gchar *title,
gchar *initial_gradient);
void gradient_select_free (GradientSelect *gsp);
void gradient_select_update_all (GimpGradient *gradient);
void gradient_select_dialogs_check (void);
void gradient_select_free (GradientSelect *gsp);
GradientSelect * gradient_select_get_by_callback (const gchar *callback_name);
void gradient_select_dialogs_check (void);
/* the main gradient selection */
GtkWidget * gradient_dialog_create (void);
void gradient_dialog_free (void);
GtkWidget * gradient_dialog_create (Gimp *gimp);
void gradient_dialog_free (void);
#endif /* __GRADIENT_SELECT_H__ */

View file

@ -57,8 +57,6 @@
#include "tool-options-dialog.h"
#include "toolbox.h"
#include "appenv.h"
#include "app_procs.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -107,11 +105,6 @@ static void gui_image_selection_control (GimpImage *gimage,
gpointer data);
/* global variables */
extern GSList *display_list; /* from gdisplay.c */
/* private variables */
static GQuark image_disconnect_handler_id = 0;
@ -132,17 +125,17 @@ static void
gui_themes_dir_foreach_func (const gchar *filename,
gpointer loader_data)
{
GHashTable *hash;
gchar *basename;
Gimp *gimp;
gchar *basename;
hash = (GHashTable *) loader_data;
gimp = (Gimp *) loader_data;
basename = g_path_get_basename (filename);
if (be_verbose)
if (gimp->be_verbose)
g_print (_("adding theme \"%s\" (%s)\n"), basename, filename);
g_hash_table_insert (hash,
g_hash_table_insert (themes_hash,
basename,
g_strdup (filename));
}
@ -169,7 +162,7 @@ gui_libs_init (Gimp *gimp,
gimp_datafiles_read_directories (gimprc.theme_path,
TYPE_DIRECTORY,
gui_themes_dir_foreach_func,
themes_hash);
gimp);
}
if (gimprc.theme)
@ -188,7 +181,7 @@ gui_libs_init (Gimp *gimp,
gtkrc = g_strdup (gimp_gtkrc ());
}
if (be_verbose)
if (gimp->be_verbose)
g_print (_("parsing \"%s\"\n"), gtkrc);
gtk_rc_parse (gtkrc);
@ -199,7 +192,7 @@ gui_libs_init (Gimp *gimp,
gtkrc = gimp_personal_rc_file ("gtkrc");
if (be_verbose)
if (gimp->be_verbose)
g_print (_("parsing \"%s\"\n"), gtkrc);
gtk_rc_parse (gtkrc);
@ -216,9 +209,6 @@ gui_init (Gimp *gimp)
gimp->gui_set_busy_func = gui_set_busy;
gimp->gui_unset_busy_func = gui_unset_busy;
if (gimprc.always_restore_session)
restore_session = TRUE;
image_disconnect_handler_id =
gimp_container_add_handler (gimp->images, "disconnect",
G_CALLBACK (gui_image_disconnect),
@ -289,7 +279,8 @@ gui_init (Gimp *gimp)
}
void
gui_restore (Gimp *gimp)
gui_restore (Gimp *gimp,
gboolean restore_session)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
@ -304,7 +295,7 @@ gui_restore (Gimp *gimp)
devices_restore ();
if (restore_session)
if (gimprc.always_restore_session || restore_session)
session_restore (gimp);
}
@ -348,7 +339,7 @@ gui_exit (Gimp *gimp)
/* handle this in the dialog factory: */
tool_options_dialog_free ();
toolbox_free ();
toolbox_free (gimp);
gimp_help_free ();
@ -378,7 +369,7 @@ gui_exit (Gimp *gimp)
}
void
gui_really_quit_dialog (void)
gui_really_quit_dialog (GCallback quit_func)
{
GtkWidget *dialog;
@ -393,7 +384,7 @@ gui_really_quit_dialog (void)
GTK_STOCK_QUIT, GTK_STOCK_CANCEL,
NULL, NULL,
gui_really_quit_callback,
NULL);
quit_func);
gtk_widget_show (dialog);
}
@ -401,6 +392,8 @@ gui_really_quit_dialog (void)
/* private functions */
gboolean double_speed = FALSE;
static void
gui_display_new (GimpImage *gimage)
{
@ -419,36 +412,14 @@ gui_display_new (GimpImage *gimage)
static void
gui_set_busy (Gimp *gimp)
{
GDisplay *gdisp;
GSList *list;
/* Canvases */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
}
/* Dialogs */
gdisplays_set_busy ();
gimp_dialog_factories_idle ();
gdk_flush ();
}
static void
gui_unset_busy (Gimp *gimp)
{
GDisplay *gdisp;
GSList *list;
/* Canvases */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_remove_override_cursor (gdisp);
}
/* Dialogs */
gdisplays_unset_busy ();
gimp_dialog_factories_unidle ();
}
@ -505,9 +476,13 @@ gui_really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data)
{
GCallback quit_func;
quit_func = G_CALLBACK (data);
if (quit)
{
app_exit_finish ();
(* quit_func) ();
}
else
{

View file

@ -20,18 +20,19 @@
#define __GUI_H__
void gui_libs_init (Gimp *gimp,
gint *argc,
gchar ***argv);
void gui_libs_init (Gimp *gimp,
gint *argc,
gchar ***argv);
void gui_init (Gimp *gimp);
void gui_restore (Gimp *gimp);
void gui_post_init (Gimp *gimp);
void gui_init (Gimp *gimp);
void gui_restore (Gimp *gimp,
gboolean restore_session);
void gui_post_init (Gimp *gimp);
void gui_shutdown (Gimp *gimp);
void gui_exit (Gimp *gimp);
void gui_shutdown (Gimp *gimp);
void gui_exit (Gimp *gimp);
void gui_really_quit_dialog (void);
void gui_really_quit_dialog (GCallback quit_func);
#endif /* __GUI_H__ */

View file

@ -97,7 +97,7 @@ palette_import_select_grad_callback (GtkWidget *widget,
gpointer data)
{
/* Popup grad edit box .... */
gradient_dialog_create ();
gradient_dialog_create (the_gimp);
}
static void

View file

@ -40,9 +40,6 @@
#include "palette-editor.h"
#include "palette-select.h"
#include "appenv.h"
#include "app_procs.h"
#include "libgimp/gimpintl.h"
@ -63,17 +60,19 @@ static void palette_select_close_callback (GtkWidget *widget,
static GSList *palette_active_dialogs = NULL;
/* the main palette selection dialog */
PaletteSelect *palette_select_dialog = NULL;
static PaletteSelect *palette_select_dialog = NULL;
/* public functions */
GtkWidget *
palette_dialog_create (void)
palette_dialog_create (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (! palette_select_dialog)
{
palette_select_dialog = palette_select_new (NULL, NULL);
palette_select_dialog = palette_select_new (gimp, NULL, NULL, NULL);
}
return palette_select_dialog->shell;
@ -90,8 +89,10 @@ palette_dialog_free (void)
}
PaletteSelect *
palette_select_new (const gchar *title,
const gchar *initial_palette)
palette_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_palette,
const gchar *callback_name)
{
PaletteSelect *psp;
GtkWidget *vbox;
@ -99,9 +100,11 @@ palette_select_new (const gchar *title,
static gboolean first_call = TRUE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
psp = g_new0 (PaletteSelect, 1);
psp->callback_name = NULL;
psp->callback_name = g_strdup (callback_name);
/* The shell and main vbox */
psp->shell = gimp_dialog_new (title ? title : _("Palette Selection"),
@ -121,31 +124,31 @@ palette_select_new (const gchar *title,
if (title)
{
psp->context = gimp_create_context (the_gimp, title, NULL);
psp->context = gimp_create_context (gimp, title, NULL);
}
else
{
psp->context = gimp_get_user_context (the_gimp);
psp->context = gimp_get_user_context (gimp);
}
if (no_data && first_call)
gimp_data_factory_data_init (the_gimp->palette_factory, FALSE);
if (gimp->no_data && first_call)
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
first_call = FALSE;
if (title && initial_palette && strlen (initial_palette))
{
active = (GimpPalette *)
gimp_container_get_child_by_name (the_gimp->palette_factory->container,
gimp_container_get_child_by_name (gimp->palette_factory->container,
initial_palette);
}
else
{
active = gimp_context_get_palette (gimp_get_user_context (the_gimp));
active = gimp_context_get_palette (gimp_get_user_context (gimp));
}
if (!active)
active = gimp_context_get_palette (gimp_get_standard_context (the_gimp));
active = gimp_context_get_palette (gimp_get_standard_context (gimp));
if (title)
gimp_context_set_palette (psp->context, active);
@ -157,7 +160,7 @@ palette_select_new (const gchar *title,
/* The Palette List */
psp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
the_gimp->palette_factory,
gimp->palette_factory,
dialogs_edit_palette_func,
psp->context,
32,

View file

@ -37,13 +37,15 @@ struct _PaletteSelect
};
PaletteSelect * palette_select_new (const gchar *title,
const gchar *initial_palette);
PaletteSelect * palette_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_palette,
const gchar *callback_name);
void palette_select_free (PaletteSelect *palette_select);
/* the main palette selection */
GtkWidget * palette_dialog_create (void);
GtkWidget * palette_dialog_create (Gimp *gimp);
void palette_dialog_free (void);

View file

@ -40,9 +40,6 @@
#include "pattern-select.h"
#include "appenv.h"
#include "app_procs.h"
#include "libgimp/gimpintl.h"
@ -64,20 +61,20 @@ static void pattern_select_close_callback (GtkWidget *widget,
/* The main pattern selection dialog */
PatternSelect *pattern_select_dialog = NULL;
/* local variables */
static PatternSelect *pattern_select_dialog = NULL;
/* List of active dialogs */
GSList *pattern_active_dialogs = NULL;
static GSList *pattern_active_dialogs = NULL;
GtkWidget *
pattern_dialog_create (void)
pattern_dialog_create (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (! pattern_select_dialog)
{
pattern_select_dialog = pattern_select_new (NULL, NULL);
pattern_select_dialog = pattern_select_new (gimp, NULL, NULL, NULL);
}
return pattern_select_dialog->shell;
@ -96,8 +93,10 @@ pattern_dialog_free (void)
/* If title == NULL then it is the main pattern dialog */
PatternSelect *
pattern_select_new (gchar *title,
gchar *initial_pattern)
pattern_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_pattern,
const gchar *callback_name)
{
PatternSelect *psp;
GtkWidget *vbox;
@ -106,8 +105,12 @@ pattern_select_new (gchar *title,
static gboolean first_call = TRUE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
psp = g_new0 (PatternSelect, 1);
psp->callback_name = g_strdup (callback_name);
/* The shell */
psp->shell = gimp_dialog_new (title ? title : _("Pattern Selection"),
"pattern_selection",
@ -121,37 +124,36 @@ pattern_select_new (gchar *title,
NULL);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox)), 0)));
gtk_dialog_set_has_separator (GTK_DIALOG (psp->shell), FALSE);
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
if (title)
{
psp->context = gimp_create_context (the_gimp, title, NULL);
psp->context = gimp_create_context (gimp, title, NULL);
}
else
{
psp->context = gimp_get_user_context (the_gimp);
psp->context = gimp_get_user_context (gimp);
}
if (no_data && first_call)
gimp_data_factory_data_init (the_gimp->pattern_factory, FALSE);
if (gimp->no_data && first_call)
gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
first_call = FALSE;
if (title && initial_pattern && strlen (initial_pattern))
{
active = (GimpPattern *)
gimp_container_get_child_by_name (the_gimp->pattern_factory->container,
gimp_container_get_child_by_name (gimp->pattern_factory->container,
initial_pattern);
}
else
{
active = gimp_context_get_pattern (gimp_get_user_context (the_gimp));
active = gimp_context_get_pattern (gimp_get_user_context (gimp));
}
if (!active)
active = gimp_context_get_pattern (gimp_get_standard_context (the_gimp));
active = gimp_context_get_pattern (gimp_get_standard_context (gimp));
if (title)
gimp_context_set_pattern (psp->context, active);
@ -163,7 +165,7 @@ pattern_select_new (gchar *title,
/* The Brush Grid */
psp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
the_gimp->pattern_factory,
gimp->pattern_factory,
NULL,
psp->context,
MIN_CELL_SIZE,
@ -190,8 +192,9 @@ pattern_select_new (gchar *title,
void
pattern_select_free (PatternSelect *psp)
{
if (!psp)
return;
g_return_if_fail (psp != NULL);
gtk_widget_destroy (psp->shell);
/* remove from active list */
pattern_active_dialogs = g_slist_remove (pattern_active_dialogs, psp);
@ -262,6 +265,23 @@ pattern_select_change_callbacks (PatternSelect *psp,
busy = FALSE;
}
PatternSelect *
pattern_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
PatternSelect *psp;
for (list = pattern_active_dialogs; list; list = g_slist_next (list))
{
psp = (PatternSelect *) list->data;
if (psp->callback_name && ! strcmp (callback_name, psp->callback_name))
return psp;
}
return NULL;
}
/* Close active dialogs that no longer have PDB registered for them */
void
@ -326,7 +346,6 @@ pattern_select_close_callback (GtkWidget *widget,
{
/* Send data back */
pattern_select_change_callbacks (psp, TRUE);
gtk_widget_destroy (psp->shell);
pattern_select_free (psp);
}
}

View file

@ -36,21 +36,18 @@ struct _PatternSelect
};
/* list of active dialogs */
extern GSList *pattern_active_dialogs;
PatternSelect * pattern_select_new (Gimp *gimp,
const gchar *title,
const gchar *initial_pattern,
const gchar *callback_name);
void pattern_select_free (PatternSelect *psp);
/* the main pattern dialog */
extern PatternSelect *pattern_select_dialog;
PatternSelect * pattern_select_new (gchar *title,
gchar *initial_pattern);
void pattern_select_free (PatternSelect *psp);
void pattern_select_dialogs_check (void);
PatternSelect * pattern_select_get_by_callback (const gchar *callback_name);
void pattern_select_dialogs_check (void);
/* the main pattern selection */
GtkWidget * pattern_dialog_create (void);
GtkWidget * pattern_dialog_create (Gimp *gimp);
void pattern_dialog_free (void);

View file

@ -69,7 +69,6 @@ static gint toolbox_tool_button_press (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data);
static void toolbox_destroy (void);
static gint toolbox_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
@ -149,12 +148,6 @@ toolbox_delete (GtkWidget *widget,
return TRUE;
}
static void
toolbox_destroy (void)
{
app_exit_finish ();
}
static gint
toolbox_check_device (GtkWidget *widget,
GdkEvent *event,
@ -317,7 +310,7 @@ create_tools (GtkWidget *wbox,
}
GtkWidget *
toolbox_create (void)
toolbox_create (Gimp *gimp)
{
GimpContext *context;
GtkItemFactory *toolbox_factory;
@ -326,7 +319,9 @@ toolbox_create (void)
GtkWidget *wbox;
GList *list;
context = gimp_get_user_context (the_gimp);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
context = gimp_get_user_context (gimp);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
@ -337,10 +332,6 @@ toolbox_create (void)
G_CALLBACK (toolbox_delete),
NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (toolbox_destroy),
NULL);
g_signal_connect (G_OBJECT (window), "style_set",
G_CALLBACK (toolbox_style_set_callback),
NULL);
@ -437,8 +428,10 @@ toolbox_create (void)
}
void
toolbox_free (void)
toolbox_free (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gtk_widget_destroy (toolbox_shell);
}

View file

@ -20,8 +20,8 @@
#define __TOOLBOX_H__
GtkWidget * toolbox_create (void);
void toolbox_free (void);
GtkWidget * toolbox_create (Gimp *gimp);
void toolbox_free (Gimp *gimp);
#endif /* __TOOLBOX_H__ */

View file

@ -75,7 +75,6 @@ gchar **batch_cmds = NULL;
/* other global variables */
gchar *prog_name = NULL; /* our executable name */
MessageHandlerType message_handler = CONSOLE;
gboolean double_speed = FALSE;
/*
@ -344,11 +343,15 @@ main (int argc,
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-Paint-Funcs",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-Core",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-PDB",
g_log_set_handler ("Gimp-File",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
@ -356,6 +359,10 @@ main (int argc,
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-PDB",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-Widgets",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
@ -364,6 +371,10 @@ main (int argc,
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-Display",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
NULL);
g_log_set_handler ("Gimp-GUI",
G_LOG_LEVEL_MESSAGE,
gimp_message_log_func,
@ -408,10 +419,6 @@ main (int argc,
app_init (argc - 1,
argv + 1);
/* Main application loop */
if (! app_exit_finish_done ())
gtk_main ();
return 0;
}

View file

@ -51,23 +51,6 @@ register_brush_select_procs (Gimp *gimp)
procedural_db_register (gimp, &brushes_set_popup_proc);
}
static BrushSelect *
brush_get_brushselect (gchar *name)
{
GSList *list;
BrushSelect *bsp;
for (list = brush_active_dialogs; list; list = g_slist_next (list))
{
bsp = (BrushSelect *) list->data;
if (bsp->callback_name && !strcmp (name, bsp->callback_name))
return bsp;
}
return NULL;
}
static Argument *
brushes_popup_invoker (Gimp *gimp,
Argument *args)
@ -105,16 +88,15 @@ brushes_popup_invoker (Gimp *gimp,
if ((prec = procedural_db_lookup (gimp, name)))
{
if (brush && strlen (brush))
newdialog = brush_select_new (title, brush, opacity, spacing,
paint_mode);
newdialog = brush_select_new (gimp, title, brush, opacity, spacing,
paint_mode, name);
else
newdialog = brush_select_new (title, NULL, 0.0, 0, 0);
/* The callback procedure to run when brush changes */
newdialog->callback_name = g_strdup (name);
newdialog = brush_select_new (gimp, title, NULL, 0.0, 0, 0, name);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&brushes_popup_proc, success);
@ -186,20 +168,14 @@ brushes_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(bsp = brush_get_brushselect (name)))
(bsp = brush_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (bsp->shell))
gtk_widget_hide (bsp->shell);
/* Free memory if poping down dialog which is not the main one */
if (bsp != brush_select_dialog)
{
gtk_widget_destroy (bsp->shell);
brush_select_free (bsp);
}
brush_select_free (bsp);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&brushes_close_popup_proc, success);
@ -262,7 +238,7 @@ brushes_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(bsp = brush_get_brushselect (name)))
(bsp = brush_select_get_by_callback (name)))
{
GimpObject *object =
gimp_container_get_child_by_name (gimp->brush_factory->container,

View file

@ -43,9 +43,9 @@
#include "base/base-config.h"
#include "core/gimpimage.h"
#include "file-open.h"
#include "file-save.h"
#include "file-utils.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "file/file-utils.h"
#include "plug_in.h"
static ProcRecord file_load_proc;

View file

@ -51,23 +51,6 @@ register_gradient_select_procs (Gimp *gimp)
procedural_db_register (gimp, &gradients_get_gradient_data_proc);
}
static GradientSelect *
gradients_get_gradientselect (gchar *name)
{
GSList *list;
GradientSelect *gsp;
for (list = gradient_active_dialogs; list; list = g_slist_next (list))
{
gsp = (GradientSelect *) list->data;
if (gsp->callback_name && !strcmp (name, gsp->callback_name))
return gsp;
}
return NULL;
}
static Argument *
gradients_popup_invoker (Gimp *gimp,
Argument *args)
@ -99,15 +82,16 @@ gradients_popup_invoker (Gimp *gimp,
if ((prec = procedural_db_lookup (gimp, name)))
{
if (initial_gradient && strlen (initial_gradient))
newdialog = gradient_select_new (title, initial_gradient);
newdialog = gradient_select_new (gimp, title, initial_gradient,
name, sample_size);
else
newdialog = gradient_select_new (title, NULL);
newdialog->callback_name = g_strdup (name);
newdialog->sample_size = sample_size;
newdialog = gradient_select_new (gimp, title, NULL,
name, sample_size);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&gradients_popup_proc, success);
@ -169,21 +153,14 @@ gradients_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(gsp = gradients_get_gradientselect (name)))
(gsp = gradient_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (gsp->shell))
gtk_widget_hide (gsp->shell);
/* Free memory if poping down dialog which is not the main one */
if (gsp != gradient_select_dialog)
{
/* Send data back */
gtk_widget_destroy (gsp->shell);
gradient_select_free (gsp);
}
gradient_select_free (gsp);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&gradients_close_popup_proc, success);
@ -235,7 +212,7 @@ gradients_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, pdbname)) &&
(gsp = gradients_get_gradientselect (pdbname)))
(gsp = gradient_select_get_by_callback (pdbname)))
{
GimpGradient *active = NULL;

View file

@ -48,23 +48,6 @@ register_pattern_select_procs (Gimp *gimp)
procedural_db_register (gimp, &patterns_set_popup_proc);
}
static PatternSelect *
pattern_get_patternselect (gchar *name)
{
GSList *list;
PatternSelect *psp;
for (list = pattern_active_dialogs; list; list = g_slist_next (list))
{
psp = (PatternSelect *) list->data;
if (psp->callback_name && !strcmp (name, psp->callback_name))
return psp;
}
return NULL;
}
static Argument *
patterns_popup_invoker (Gimp *gimp,
Argument *args)
@ -91,15 +74,14 @@ patterns_popup_invoker (Gimp *gimp,
if ((prec = procedural_db_lookup (gimp, name)))
{
if (pattern && strlen (pattern))
newdialog = pattern_select_new (title, pattern);
newdialog = pattern_select_new (gimp, title, pattern, name);
else
newdialog = pattern_select_new (title, NULL);
/* The callback procedure to run when pattern changes */
newdialog->callback_name = g_strdup (name);
newdialog = pattern_select_new (gimp, title, NULL, name);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&patterns_popup_proc, success);
@ -156,20 +138,14 @@ patterns_close_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(psp = pattern_get_patternselect (name)))
(psp = pattern_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (psp->shell))
gtk_widget_hide (psp->shell);
/* Free memory if poping down dialog which is not the main one */
if (psp != pattern_select_dialog)
{
gtk_widget_destroy (psp->shell);
pattern_select_free (psp);
}
pattern_select_free (psp);
}
else
success = FALSE;
{
success = FALSE;
}
}
return procedural_db_return_args (&patterns_close_popup_proc, success);
@ -221,7 +197,7 @@ patterns_set_popup_invoker (Gimp *gimp,
if (success)
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(psp = pattern_get_patternselect (name)))
(psp = pattern_select_get_by_callback (name)))
{
GimpPattern *active = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,

View file

@ -69,7 +69,6 @@ static gint toolbox_tool_button_press (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data);
static void toolbox_destroy (void);
static gint toolbox_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
@ -149,12 +148,6 @@ toolbox_delete (GtkWidget *widget,
return TRUE;
}
static void
toolbox_destroy (void)
{
app_exit_finish ();
}
static gint
toolbox_check_device (GtkWidget *widget,
GdkEvent *event,
@ -317,7 +310,7 @@ create_tools (GtkWidget *wbox,
}
GtkWidget *
toolbox_create (void)
toolbox_create (Gimp *gimp)
{
GimpContext *context;
GtkItemFactory *toolbox_factory;
@ -326,7 +319,9 @@ toolbox_create (void)
GtkWidget *wbox;
GList *list;
context = gimp_get_user_context (the_gimp);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
context = gimp_get_user_context (gimp);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
@ -337,10 +332,6 @@ toolbox_create (void)
G_CALLBACK (toolbox_delete),
NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (toolbox_destroy),
NULL);
g_signal_connect (G_OBJECT (window), "style_set",
G_CALLBACK (toolbox_style_set_callback),
NULL);
@ -437,8 +428,10 @@ toolbox_create (void)
}
void
toolbox_free (void)
toolbox_free (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gtk_widget_destroy (toolbox_shell);
}

View file

@ -20,8 +20,8 @@
#define __TOOLBOX_H__
GtkWidget * toolbox_create (void);
void toolbox_free (void);
GtkWidget * toolbox_create (Gimp *gimp);
void toolbox_free (Gimp *gimp);
#endif /* __TOOLBOX_H__ */

View file

@ -1,3 +1,7 @@
2001-10-25 Michael Natterer <mitch@gimp.org>
* POTFILES.in: app/file-*.c -> app/file/file-*.c
2001-10-23 Michael Natterer <mitch@gimp.org>
* POTFILES.in: updated.

View file

@ -3,8 +3,6 @@
app/app_procs.c
app/devices.c
app/file-open.c
app/file-save.c
app/floating_sel.c
app/gdisplay_color_ui.c
app/gimphelp.c
@ -41,6 +39,9 @@ app/display/gimpdisplay-ops.c
app/display/gimpdisplay.c
app/display/gimpdisplayshell.c
app/file/file-open.c
app/file/file-save.c
app/gui/about-dialog.c
app/gui/brush-editor.c
app/gui/brush-select.c

View file

@ -58,16 +58,15 @@ sub brushes_popup {
if ((prec = procedural_db_lookup (gimp, name)))
{
if (brush && strlen (brush))
newdialog = brush_select_new (title, brush, opacity, spacing,
paint_mode);
newdialog = brush_select_new (gimp, title, brush, opacity, spacing,
paint_mode, name);
else
newdialog = brush_select_new (title, NULL, 0.0, 0, 0);
/* The callback procedure to run when brush changes */
newdialog->callback_name = g_strdup (name);
newdialog = brush_select_new (gimp, title, NULL, 0.0, 0, 0, name);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -90,20 +89,14 @@ sub brushes_close_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(bsp = brush_get_brushselect (name)))
(bsp = brush_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (bsp->shell))
gtk_widget_hide (bsp->shell);
/* Free memory if poping down dialog which is not the main one */
if (bsp != brush_select_dialog)
{
gtk_widget_destroy (bsp->shell);
brush_select_free (bsp);
}
brush_select_free (bsp);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -132,7 +125,7 @@ sub brushes_set_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(bsp = brush_get_brushselect (name)))
(bsp = brush_select_get_by_callback (name)))
{
GimpObject *object =
gimp_container_get_child_by_name (gimp->brush_factory->container,
@ -166,25 +159,6 @@ CODE
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h"
"core/gimpdatafactory.h" "gui/brush-select.h");
$extra{app}->{code} = <<'CODE';
static BrushSelect *
brush_get_brushselect (gchar *name)
{
GSList *list;
BrushSelect *bsp;
for (list = brush_active_dialogs; list; list = g_slist_next (list))
{
bsp = (BrushSelect *) list->data;
if (bsp->callback_name && !strcmp (name, bsp->callback_name))
return bsp;
}
return NULL;
}
CODE
@procs = qw(brushes_popup brushes_close_popup brushes_set_popup);
%exports = (app => [@procs], lib => [@procs]);

View file

@ -413,8 +413,8 @@ CODE
);
}
@headers = qw("file-open.h" "file-save.h" "file-utils.h" "plug_in.h"
<sys/types.h> <unistd.h>);
@headers = qw("file/file-open.h" "file/file-save.h" "file/file-utils.h"
"plug_in.h" <sys/types.h> <unistd.h>);
@procs = qw(file_load file_save file_load_thumbnail file_save_thumbnail
temp_name register_magic_load_handler register_load_handler

View file

@ -57,15 +57,16 @@ sub gradients_popup {
if ((prec = procedural_db_lookup (gimp, name)))
{
if (initial_gradient && strlen (initial_gradient))
newdialog = gradient_select_new (title, initial_gradient);
newdialog = gradient_select_new (gimp, title, initial_gradient,
name, sample_size);
else
newdialog = gradient_select_new (title, NULL);
newdialog->callback_name = g_strdup (name);
newdialog->sample_size = sample_size;
newdialog = gradient_select_new (gimp, title, NULL,
name, sample_size);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -88,21 +89,14 @@ sub gradients_close_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(gsp = gradients_get_gradientselect (name)))
(gsp = gradient_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (gsp->shell))
gtk_widget_hide (gsp->shell);
/* Free memory if poping down dialog which is not the main one */
if (gsp != gradient_select_dialog)
{
/* Send data back */
gtk_widget_destroy (gsp->shell);
gradient_select_free (gsp);
}
gradient_select_free (gsp);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -127,7 +121,7 @@ sub gradients_set_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, pdbname)) &&
(gsp = gradients_get_gradientselect (pdbname)))
(gsp = gradient_select_get_by_callback (pdbname)))
{
GimpGradient *active = NULL;
@ -232,25 +226,6 @@ CODE
"core/gimpgradient.h"
"gui/gui-types.h" "gui/gradient-select.h");
$extra{app}->{code} = <<'CODE';
static GradientSelect *
gradients_get_gradientselect (gchar *name)
{
GSList *list;
GradientSelect *gsp;
for (list = gradient_active_dialogs; list; list = g_slist_next (list))
{
gsp = (GradientSelect *) list->data;
if (gsp->callback_name && !strcmp (name, gsp->callback_name))
return gsp;
}
return NULL;
}
CODE
@procs = qw(gradients_popup gradients_close_popup gradients_set_popup
gradients_get_gradient_data);
%exports = (app => [@procs], lib => [@procs]);

View file

@ -47,15 +47,14 @@ sub patterns_popup {
if ((prec = procedural_db_lookup (gimp, name)))
{
if (pattern && strlen (pattern))
newdialog = pattern_select_new (title, pattern);
newdialog = pattern_select_new (gimp, title, pattern, name);
else
newdialog = pattern_select_new (title, NULL);
/* The callback procedure to run when pattern changes */
newdialog->callback_name = g_strdup (name);
newdialog = pattern_select_new (gimp, title, NULL, name);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -78,20 +77,14 @@ sub patterns_close_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(psp = pattern_get_patternselect (name)))
(psp = pattern_select_get_by_callback (name)))
{
if (GTK_WIDGET_VISIBLE (psp->shell))
gtk_widget_hide (psp->shell);
/* Free memory if poping down dialog which is not the main one */
if (psp != pattern_select_dialog)
{
gtk_widget_destroy (psp->shell);
pattern_select_free (psp);
}
pattern_select_free (psp);
}
else
success = FALSE;
{
success = FALSE;
}
}
CODE
);
@ -116,7 +109,7 @@ sub patterns_set_popup {
code => <<'CODE'
{
if ((prec = procedural_db_lookup (gimp, name)) &&
(psp = pattern_get_patternselect (name)))
(psp = pattern_select_get_by_callback (name)))
{
GimpPattern *active = (GimpPattern *)
gimp_container_get_child_by_name (gimp->pattern_factory->container,
@ -141,25 +134,6 @@ CODE
"core/gimpdatafactory.h" "core/gimpcontainer.h"
"gui/gui-types.h" "gui/pattern-select.h");
$extra{app}->{code} = <<'CODE';
static PatternSelect *
pattern_get_patternselect (gchar *name)
{
GSList *list;
PatternSelect *psp;
for (list = pattern_active_dialogs; list; list = g_slist_next (list))
{
psp = (PatternSelect *) list->data;
if (psp->callback_name && !strcmp (name, psp->callback_name))
return psp;
}
return NULL;
}
CODE
@procs = qw(patterns_popup patterns_close_popup patterns_set_popup);
%exports = (app => [@procs], lib => [@procs]);