PIKApp/app/plug-in/pikaplugin.h

124 lines
5.2 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* pikaplugin.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 3 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef __PIKA_PLUG_IN_H__
#define __PIKA_PLUG_IN_H__
#include "core/pikaobject.h"
#include "pikapluginprocframe.h"
#define WRITE_BUFFER_SIZE 512
#define PIKA_TYPE_PLUG_IN (pika_plug_in_get_type ())
#define PIKA_PLUG_IN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_PLUG_IN, PikaPlugIn))
#define PIKA_PLUG_IN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_PLUG_IN, PikaPlugInClass))
#define PIKA_IS_PLUG_IN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_PLUG_IN))
#define PIKA_IS_PLUG_IN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_PLUG_IN))
typedef struct _PikaPlugInClass PikaPlugInClass;
struct _PikaPlugIn
{
PikaObject parent_instance;
PikaPlugInManager *manager;
GFile *file; /* Plug-in's full path name */
PikaPlugInCallMode call_mode; /* QUERY, INIT or RUN */
guint open : 1; /* Is the plug-in open? */
guint hup : 1; /* Did we receive a G_IO_HUP */
GPid pid; /* Plug-in's process id */
GIOChannel *my_read; /* App's read and write channels */
GIOChannel *my_write;
GIOChannel *his_read; /* Plug-in's read and write channels */
GIOChannel *his_write;
guint input_id; /* Id of input proc */
gchar write_buffer[WRITE_BUFFER_SIZE]; /* Buffer for writing */
gint write_buffer_index; /* Buffer index */
GSList *temp_procedures; /* Temporary procedures */
GMainLoop *ext_main_loop; /* for waiting for extension_ack */
PikaPlugInProcFrame main_proc_frame;
GList *temp_proc_frames;
PikaPlugInDef *plug_in_def; /* Valid during query() and init() */
};
struct _PikaPlugInClass
{
PikaObjectClass parent_class;
};
GType pika_plug_in_get_type (void) G_GNUC_CONST;
PikaPlugIn * pika_plug_in_new (PikaPlugInManager *manager,
PikaContext *context,
PikaProgress *progress,
PikaPlugInProcedure *procedure,
GFile *file);
gboolean pika_plug_in_open (PikaPlugIn *plug_in,
PikaPlugInCallMode call_mode,
gboolean synchronous);
void pika_plug_in_close (PikaPlugIn *plug_in,
gboolean kill_it);
PikaPlugInProcFrame *
pika_plug_in_get_proc_frame (PikaPlugIn *plug_in);
PikaPlugInProcFrame *
pika_plug_in_proc_frame_push (PikaPlugIn *plug_in,
PikaContext *context,
PikaProgress *progress,
PikaTemporaryProcedure *procedure);
void pika_plug_in_proc_frame_pop (PikaPlugIn *plug_in);
void pika_plug_in_main_loop (PikaPlugIn *plug_in);
void pika_plug_in_main_loop_quit (PikaPlugIn *plug_in);
const gchar * pika_plug_in_get_undo_desc (PikaPlugIn *plug_in);
void pika_plug_in_add_temp_proc (PikaPlugIn *plug_in,
PikaTemporaryProcedure *procedure);
void pika_plug_in_remove_temp_proc (PikaPlugIn *plug_in,
PikaTemporaryProcedure *procedure);
void pika_plug_in_set_error_handler (PikaPlugIn *plug_in,
PikaPDBErrorHandler handler);
PikaPDBErrorHandler
pika_plug_in_get_error_handler (PikaPlugIn *plug_in);
#endif /* __PIKA_PLUG_IN_H__ */