2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-09-22 23:26:58 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2006-05-04 02:05:06 +08:00
|
|
|
* gimpplugin-context.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-09-22 23:26:58 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-09-22 23:26:58 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-09-22 23:26:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2012-03-30 01:19:01 +08:00
|
|
|
#include <gegl.h>
|
2004-09-22 23:26:58 +08:00
|
|
|
|
|
|
|
#include "plug-in-types.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
2010-09-05 04:17:01 +08:00
|
|
|
|
|
|
|
#include "pdb/gimppdbcontext.h"
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
#include "gimpplugin.h"
|
|
|
|
#include "gimpplugin-context.h"
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "gimppluginmanager.h"
|
2004-09-22 23:26:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
gboolean
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_context_push (GimpPlugIn *plug_in)
|
2004-09-22 23:26:58 +08:00
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugInProcFrame *proc_frame;
|
|
|
|
GimpContext *parent;
|
|
|
|
GimpContext *context;
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
proc_frame = gimp_plug_in_get_proc_frame (plug_in);
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2004-09-23 00:22:43 +08:00
|
|
|
if (proc_frame->context_stack)
|
|
|
|
parent = proc_frame->context_stack->data;
|
|
|
|
else
|
|
|
|
parent = proc_frame->main_context;
|
|
|
|
|
2010-09-05 04:17:01 +08:00
|
|
|
context = gimp_pdb_context_new (plug_in->manager->gimp, parent, FALSE);
|
2004-09-23 00:22:43 +08:00
|
|
|
|
|
|
|
proc_frame->context_stack = g_list_prepend (proc_frame->context_stack,
|
|
|
|
context);
|
|
|
|
|
2004-09-22 23:26:58 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_context_pop (GimpPlugIn *plug_in)
|
2004-09-22 23:26:58 +08:00
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugInProcFrame *proc_frame;
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
proc_frame = gimp_plug_in_get_proc_frame (plug_in);
|
2004-09-22 23:26:58 +08:00
|
|
|
|
2004-09-23 00:22:43 +08:00
|
|
|
if (proc_frame->context_stack)
|
|
|
|
{
|
|
|
|
GimpContext *context = proc_frame->context_stack->data;
|
|
|
|
|
|
|
|
proc_frame->context_stack = g_list_remove (proc_frame->context_stack,
|
|
|
|
context);
|
|
|
|
g_object_unref (context);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2004-09-22 23:26:58 +08:00
|
|
|
}
|