tools/pdbgen/Makefile.am new files that will hold context related PDB

2004-09-22  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/Makefile.am
	* tools/pdbgen/pdb/context.pdb: new files that will hold context
	related PDB functions.

	* tools/pdbgen/groups.pl
	* app/pdb/Makefile.am
	* app/pdb/context_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/progress_cmds.c
	* libgimp/gimp_pdb.h
	* libgimp/gimpcontext_pdb.[ch]: (re)generated.

	* app/plug-in/Makefile.am
	* app/plug-in/plug-in-context.[ch]: new files that will hold code
	that implements a context stack in the plug-in's proc-frame.

	* app/plug-in/plug-in.[ch]: new function plug_in_get_proc_frame().

	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-in-progress.c: use the new function instead of
	duplicating it all over the place.
This commit is contained in:
Sven Neumann 2004-09-22 15:26:58 +00:00 committed by Sven Neumann
parent 9ffc00be80
commit 4069dd9d97
23 changed files with 641 additions and 150 deletions

View File

@ -1,3 +1,27 @@
2004-09-22 Sven Neumann <sven@gimp.org>
* tools/pdbgen/Makefile.am
* tools/pdbgen/pdb/context.pdb: new files that will hold context
related PDB functions.
* tools/pdbgen/groups.pl
* app/pdb/Makefile.am
* app/pdb/context_cmds.c
* app/pdb/internal_procs.c
* app/pdb/progress_cmds.c
* libgimp/gimp_pdb.h
* libgimp/gimpcontext_pdb.[ch]: (re)generated.
* app/plug-in/Makefile.am
* app/plug-in/plug-in-context.[ch]: new files that will hold code
that implements a context stack in the plug-in's proc-frame.
* app/plug-in/plug-in.[ch]: new function plug_in_get_proc_frame().
* app/plug-in/plug-in-message.c
* app/plug-in/plug-in-progress.c: use the new function instead of
duplicating it all over the place.
2004-09-22 Michael Natterer <mitch@gimp.org>
* app/plug-in/Makefile.am

View File

@ -11,6 +11,7 @@ libapppdb_a_SOURCES = \
brushes_cmds.c \
channel_cmds.c \
color_cmds.c \
context_cmds.c \
convert_cmds.c \
display_cmds.c \
drawable_cmds.c \
@ -20,7 +21,7 @@ libapppdb_a_SOURCES = \
font_select_cmds.c \
fonts_cmds.c \
gimprc_cmds.c \
gradient_edit_cmds.c \
gradient_edit_cmds.c \
gradient_select_cmds.c \
gradients_cmds.c \
guides_cmds.c \

105
app/pdb/context_cmds.c Normal file
View File

@ -0,0 +1,105 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2003 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.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
#include "config.h"
#include <glib-object.h>
#include "pdb-types.h"
#include "procedural_db.h"
#include "core/gimp.h"
#include "plug-in/plug-in-context.h"
#include "plug-in/plug-in.h"
static ProcRecord context_push_proc;
static ProcRecord context_pop_proc;
void
register_context_procs (Gimp *gimp)
{
procedural_db_register (gimp, &context_push_proc);
procedural_db_register (gimp, &context_pop_proc);
}
static Argument *
context_push_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
plug_in_context_push (gimp->current_plug_in);
}
else
success = FALSE;
return procedural_db_return_args (&context_push_proc, success);
}
static ProcRecord context_push_proc =
{
"gimp_context_push",
"Pushes a context to the top of the plug-in's context stack.",
"This procedure creates a new context by copying the current context. This copy becomes the new current context for the calling plug-in until it is popped again.",
"Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
"Michael Natterer & Sven Neumann",
"2004",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { context_push_invoker } }
};
static Argument *
context_pop_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
plug_in_context_push (gimp->current_plug_in);
}
else
success = FALSE;
return procedural_db_return_args (&context_pop_proc, success);
}
static ProcRecord context_pop_proc =
{
"gimp_context_pop",
"Pops the topmost context from the plug-in's context stack.",
"This procedure creates a new context and makes it the current context for the calling plug-in.",
"Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
"Michael Natterer & Sven Neumann",
"2004",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { context_pop_invoker } }
};

View File

@ -34,6 +34,7 @@ void register_brush_select_procs (Gimp *gimp);
void register_brushes_procs (Gimp *gimp);
void register_channel_procs (Gimp *gimp);
void register_color_procs (Gimp *gimp);
void register_context_procs (Gimp *gimp);
void register_convert_procs (Gimp *gimp);
void register_display_procs (Gimp *gimp);
void register_drawable_procs (Gimp *gimp);
@ -70,7 +71,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 381 procedures registered total */
/* 383 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -91,91 +92,94 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Color"), 0.06);
register_color_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.094);
(* status_callback) (NULL, _("Context"), 0.094);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.099);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.102);
(* status_callback) (NULL, _("Display procedures"), 0.107);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.113);
(* status_callback) (NULL, _("Drawable procedures"), 0.117);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.197);
(* status_callback) (NULL, _("Edit procedures"), 0.201);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.218);
(* status_callback) (NULL, _("File Operations"), 0.222);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.241);
(* status_callback) (NULL, _("Floating selections"), 0.245);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.257);
(* status_callback) (NULL, _("Font UI"), 0.261);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.265);
(* status_callback) (NULL, _("Fonts"), 0.269);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.27);
(* status_callback) (NULL, _("Gimprc procedures"), 0.274);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.286);
(* status_callback) (NULL, _("Gradient"), 0.29);
register_gradient_edit_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.346);
(* status_callback) (NULL, _("Gradient UI"), 0.35);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.354);
(* status_callback) (NULL, _("Gradients"), 0.358);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.383);
(* status_callback) (NULL, _("Guide procedures"), 0.386);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.399);
(* status_callback) (NULL, _("Help procedures"), 0.402);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.402);
(* status_callback) (NULL, _("Image"), 0.405);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.564);
(* status_callback) (NULL, _("Layer"), 0.567);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.633);
(* status_callback) (NULL, _("Message procedures"), 0.634);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.64);
(* status_callback) (NULL, _("Miscellaneous"), 0.642);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.646);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.648);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.685);
(* status_callback) (NULL, _("Palette"), 0.687);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.701);
(* status_callback) (NULL, _("Palette UI"), 0.702);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.709);
(* status_callback) (NULL, _("Palettes"), 0.71);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.722);
(* status_callback) (NULL, _("Parasite procedures"), 0.723);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.753);
(* status_callback) (NULL, _("Paths"), 0.755);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.793);
(* status_callback) (NULL, _("Pattern UI"), 0.794);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.801);
(* status_callback) (NULL, _("Patterns"), 0.802);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.814);
(* status_callback) (NULL, _("Plug-in"), 0.815);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.827);
(* status_callback) (NULL, _("Procedural database"), 0.828);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.85);
(* status_callback) (NULL, _("Progress"), 0.851);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.864);
@ -187,7 +191,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Text procedures"), 0.924);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.934);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.935);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.95);

View File

@ -19,6 +19,8 @@ libappplug_in_a_SOURCES = \
plug-in.h \
plug-ins.c \
plug-ins.h \
plug-in-context.c \
plug-in-context.h \
plug-in-debug.c \
plug-in-debug.h \
plug-in-def.c \

View File

@ -0,0 +1,53 @@
/* 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.
*/
#include "config.h"
#include <glib-object.h>
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in.h"
#include "plug-in-context.h"
gboolean
plug_in_context_push (PlugIn *plug_in)
{
PlugInProcFrame *proc_frame;
g_return_val_if_fail (plug_in != NULL, FALSE);
proc_frame = plug_in_get_proc_frame (plug_in);
return TRUE;
}
gboolean
plug_in_context_pop (PlugIn *plug_in)
{
PlugInProcFrame *proc_frame;
g_return_val_if_fail (plug_in != NULL, FALSE);
proc_frame = plug_in_get_proc_frame (plug_in);
return TRUE;
}

View File

@ -0,0 +1,29 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-context.h
*
* 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 __PLUG_IN_CONTEXT_H__
#define __PLUG_IN_CONTEXT_H__
gboolean plug_in_context_push (PlugIn *plug_in);
gboolean plug_in_context_pop (PlugIn *plug_in);
#endif /* __PLUG_IN_CONTEXT_H__ */

View File

@ -352,10 +352,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
Argument *args;
Argument *return_vals;
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
proc_rec = procedural_db_lookup (plug_in->gimp, proc_run->name);

View File

@ -51,10 +51,7 @@ plug_in_progress_start (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (! message)
message = plug_in->prog;
@ -99,10 +96,7 @@ plug_in_progress_update (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (! proc_frame->progress ||
! gimp_progress_is_active (proc_frame->progress) ||
@ -122,10 +116,7 @@ plug_in_progress_end (PlugIn *plug_in)
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
{
@ -171,10 +162,7 @@ plug_in_progress_install (PlugIn *plug_in,
return FALSE;
}
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
{
@ -204,10 +192,7 @@ plug_in_progress_uninstall (PlugIn *plug_in,
g_return_val_if_fail (plug_in != NULL, FALSE);
g_return_val_if_fail (progress_callback != NULL, FALSE);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (GIMP_IS_PDB_PROGRESS (proc_frame->progress))
{

View File

@ -849,6 +849,17 @@ plug_in_pop (Gimp *gimp)
gimp->current_plug_in = NULL;
}
PlugInProcFrame *
plug_in_get_proc_frame (PlugIn *plug_in)
{
g_return_val_if_fail (plug_in != NULL, NULL);
if (plug_in->temp_proc_frames)
return plug_in->temp_proc_frames->data;
else
return &plug_in->main_proc_frame;
}
void
plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
@ -918,8 +929,6 @@ plug_in_main_loop_quit (PlugIn *plug_in)
g_return_if_fail (proc_frame->main_loop != NULL);
proc_frame = (PlugInProcFrame *) plug_in->temp_proc_frames->data;
g_main_loop_quit (proc_frame->main_loop);
}
@ -932,10 +941,7 @@ plug_in_get_undo_desc (PlugIn *plug_in)
g_return_val_if_fail (plug_in != NULL, NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame)
proc_def = plug_ins_proc_def_find (plug_in->gimp, proc_frame->proc_rec);

View File

@ -68,43 +68,45 @@ struct _PlugIn
};
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
PlugIn * plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec,
const gchar *prog);
PlugIn * plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec,
const gchar *prog);
void plug_in_ref (PlugIn *plug_in);
void plug_in_unref (PlugIn *plug_in);
void plug_in_ref (PlugIn *plug_in);
void plug_in_unref (PlugIn *plug_in);
gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec);
void plug_in_proc_frame_pop (PlugIn *plug_in);
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);
void plug_in_main_loop (PlugIn *plug_in);
void plug_in_main_loop_quit (PlugIn *plug_in);
void plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec);
void plug_in_proc_frame_pop (PlugIn *plug_in);
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
void plug_in_main_loop (PlugIn *plug_in);
void plug_in_main_loop_quit (PlugIn *plug_in);
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
#endif /* __PLUG_IN_H__ */

View File

@ -0,0 +1,53 @@
/* 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.
*/
#include "config.h"
#include <glib-object.h>
#include "plug-in-types.h"
#include "core/gimp.h"
#include "plug-in.h"
#include "plug-in-context.h"
gboolean
plug_in_context_push (PlugIn *plug_in)
{
PlugInProcFrame *proc_frame;
g_return_val_if_fail (plug_in != NULL, FALSE);
proc_frame = plug_in_get_proc_frame (plug_in);
return TRUE;
}
gboolean
plug_in_context_pop (PlugIn *plug_in)
{
PlugInProcFrame *proc_frame;
g_return_val_if_fail (plug_in != NULL, FALSE);
proc_frame = plug_in_get_proc_frame (plug_in);
return TRUE;
}

View File

@ -0,0 +1,29 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* plug-in-context.h
*
* 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 __PLUG_IN_CONTEXT_H__
#define __PLUG_IN_CONTEXT_H__
gboolean plug_in_context_push (PlugIn *plug_in);
gboolean plug_in_context_pop (PlugIn *plug_in);
#endif /* __PLUG_IN_CONTEXT_H__ */

View File

@ -352,10 +352,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
Argument *args;
Argument *return_vals;
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
proc_rec = procedural_db_lookup (plug_in->gimp, proc_run->name);

View File

@ -51,10 +51,7 @@ plug_in_progress_start (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (! message)
message = plug_in->prog;
@ -99,10 +96,7 @@ plug_in_progress_update (PlugIn *plug_in,
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (! proc_frame->progress ||
! gimp_progress_is_active (proc_frame->progress) ||
@ -122,10 +116,7 @@ plug_in_progress_end (PlugIn *plug_in)
g_return_if_fail (plug_in != NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
{
@ -171,10 +162,7 @@ plug_in_progress_install (PlugIn *plug_in,
return FALSE;
}
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
{
@ -204,10 +192,7 @@ plug_in_progress_uninstall (PlugIn *plug_in,
g_return_val_if_fail (plug_in != NULL, FALSE);
g_return_val_if_fail (progress_callback != NULL, FALSE);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (GIMP_IS_PDB_PROGRESS (proc_frame->progress))
{

View File

@ -849,6 +849,17 @@ plug_in_pop (Gimp *gimp)
gimp->current_plug_in = NULL;
}
PlugInProcFrame *
plug_in_get_proc_frame (PlugIn *plug_in)
{
g_return_val_if_fail (plug_in != NULL, NULL);
if (plug_in->temp_proc_frames)
return plug_in->temp_proc_frames->data;
else
return &plug_in->main_proc_frame;
}
void
plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
@ -918,8 +929,6 @@ plug_in_main_loop_quit (PlugIn *plug_in)
g_return_if_fail (proc_frame->main_loop != NULL);
proc_frame = (PlugInProcFrame *) plug_in->temp_proc_frames->data;
g_main_loop_quit (proc_frame->main_loop);
}
@ -932,10 +941,7 @@ plug_in_get_undo_desc (PlugIn *plug_in)
g_return_val_if_fail (plug_in != NULL, NULL);
if (plug_in->temp_proc_frames)
proc_frame = plug_in->temp_proc_frames->data;
else
proc_frame = &plug_in->main_proc_frame;
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame)
proc_def = plug_ins_proc_def_find (plug_in->gimp, proc_frame->proc_rec);

View File

@ -68,43 +68,45 @@ struct _PlugIn
};
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_init (Gimp *gimp);
void plug_in_exit (Gimp *gimp);
void plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_query (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
void plug_in_call_init (Gimp *gimp,
GimpContext *context,
PlugInDef *plug_in_def);
PlugIn * plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec,
const gchar *prog);
PlugIn * plug_in_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec,
const gchar *prog);
void plug_in_ref (PlugIn *plug_in);
void plug_in_unref (PlugIn *plug_in);
void plug_in_ref (PlugIn *plug_in);
void plug_in_unref (PlugIn *plug_in);
gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
gboolean plug_in_open (PlugIn *plug_in);
void plug_in_close (PlugIn *plug_in,
gboolean kill_it);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_push (Gimp *gimp,
PlugIn *plug_in);
void plug_in_pop (Gimp *gimp);
void plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec);
void plug_in_proc_frame_pop (PlugIn *plug_in);
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);
void plug_in_main_loop (PlugIn *plug_in);
void plug_in_main_loop_quit (PlugIn *plug_in);
void plug_in_proc_frame_push (PlugIn *plug_in,
GimpContext *context,
GimpProgress *progress,
ProcRecord *proc_rec);
void plug_in_proc_frame_pop (PlugIn *plug_in);
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
void plug_in_main_loop (PlugIn *plug_in);
void plug_in_main_loop_quit (PlugIn *plug_in);
gchar * plug_in_get_undo_desc (PlugIn *plug_in);
#endif /* __PLUG_IN_H__ */

View File

@ -28,6 +28,7 @@
#include <libgimp/gimpbrushselect_pdb.h>
#include <libgimp/gimpchannel_pdb.h>
#include <libgimp/gimpcolor_pdb.h>
#include <libgimp/gimpcontext_pdb.h>
#include <libgimp/gimpconvert_pdb.h>
#include <libgimp/gimpdisplay_pdb.h>
#include <libgimp/gimpdrawable_pdb.h>

87
libgimp/gimpcontext_pdb.c Normal file
View File

@ -0,0 +1,87 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpcontext_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* gimp_context_push:
*
* Pushes a context to the top of the plug-in's context stack.
*
* This procedure creates a new context by copying the current context.
* This copy becomes the new current context for the calling plug-in
* until it is popped again.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_context_push (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_context_push",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_context_pop:
*
* Pops the topmost context from the plug-in's context stack.
*
* This procedure creates a new context and makes it the current
* context for the calling plug-in.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_context_pop (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_context_pop",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

38
libgimp/gimpcontext_pdb.h Normal file
View File

@ -0,0 +1,38 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpcontext_pdb.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
#ifndef __GIMP_CONTEXT_PDB_H__
#define __GIMP_CONTEXT_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_context_push (void);
gboolean gimp_context_pop (void);
G_END_DECLS
#endif /* __GIMP_CONTEXT_PDB_H__ */

View File

@ -6,6 +6,7 @@ pdb_sources = \
pdb/brushes.pdb \
pdb/channel.pdb \
pdb/color.pdb \
pdb/context.pdb \
pdb/convert.pdb \
pdb/display.pdb \
pdb/drawable.pdb \

View File

@ -4,6 +4,7 @@
brushes
channel
color
context
convert
display
drawable

View File

@ -0,0 +1,83 @@
# 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.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub pdb_misc {
$author = 'Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>';
$copyright = 'Michael Natterer & Sven Neumann';
$date = '2004';
$since = '2.2';
}
sub context_push {
$blurb = 'Pushes a context to the top of the plug-in\'s context stack.';
$help = <<'HELP';
This procedure creates a new context by copying the current context. This
copy becomes the new current context for the calling plug-in until it is
popped again.
HELP
&pdb_misc;
%invoke = (
code => <<'CODE'
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
plug_in_context_push (gimp->current_plug_in);
}
else
success = FALSE;
}
CODE
);
}
sub context_pop {
$blurb = 'Pops the topmost context from the plug-in\'s context stack.';
$help = <<'HELP';
This procedure creates a new context and makes it the current context for the
calling plug-in.
HELP
&pdb_misc;
%invoke = (
code => <<'CODE'
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
plug_in_context_push (gimp->current_plug_in);
}
else
success = FALSE;
}
CODE
);
}
@headers = qw("core/gimp.h" "plug-in/plug-in.h" "plug-in/plug-in-context.h");
@procs = qw(context_push context_pop);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Context';
1;