mirror of https://github.com/GNOME/gimp.git
added -DGDK_DISABLE_DEPRECATED.
2001-09-02 Michael Natterer <mitch@gimp.org> * configure.in: added -DGDK_DISABLE_DEPRECATED. * app/gui/about-dialog.c * plug-ins/common/wmf.c * plug-ins/ifscompose/ifscompose_utils.c: #undef it here (too lazy...) * app/colormaps.[ch] * app/gdisplay.c * app/module_db.c * app/plug_in.c * app/gui/brush-editor.c * app/gui/color-notebook.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/select-commands.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c: replaced deprecated stuff, g_list_free() the return value of gtk_container_get_children(). * plug-ins/Makefile.am: build gflare again. * plug-ins/gflare/asupsample.[ch]: removed because the same function is already in libgimpcolor. * plug-ins/gflare/gtkmultioptionmenu.[ch]: removed because Gtk+ handles menu_height > screen_height by scrolling now. * plug-ins/gflare/Makefile.am * plug-ins/gflare/gflare.c: changed accordingly, cleanups.
This commit is contained in:
parent
083c7c9116
commit
1ccb029ead
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2001-09-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* configure.in: added -DGDK_DISABLE_DEPRECATED.
|
||||
|
||||
* app/gui/about-dialog.c
|
||||
* plug-ins/common/wmf.c
|
||||
* plug-ins/ifscompose/ifscompose_utils.c: #undef it here (too lazy...)
|
||||
|
||||
* app/colormaps.[ch]
|
||||
* app/gdisplay.c
|
||||
* app/module_db.c
|
||||
* app/plug_in.c
|
||||
* app/gui/brush-editor.c
|
||||
* app/gui/color-notebook.c
|
||||
* app/gui/gradient-select.c
|
||||
* app/gui/palette-select.c
|
||||
* app/gui/paths-dialog.c
|
||||
* app/gui/select-commands.c
|
||||
* app/widgets/gimpdialogfactory.c
|
||||
* app/widgets/gimpdock.c
|
||||
* app/widgets/gimpdockbook.c: replaced deprecated stuff,
|
||||
g_list_free() the return value of gtk_container_get_children().
|
||||
|
||||
* plug-ins/Makefile.am: build gflare again.
|
||||
|
||||
* plug-ins/gflare/asupsample.[ch]: removed because the same function
|
||||
is already in libgimpcolor.
|
||||
|
||||
* plug-ins/gflare/gtkmultioptionmenu.[ch]: removed because Gtk+
|
||||
handles menu_height > screen_height by scrolling now.
|
||||
|
||||
* plug-ins/gflare/Makefile.am
|
||||
* plug-ins/gflare/gflare.c: changed accordingly, cleanups.
|
||||
|
||||
2001-09-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/plug_in.c
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -154,6 +154,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *edge_lock;
|
||||
GtkWidget *shrink_dialog;
|
||||
GDisplay *gdisp;
|
||||
GList *children;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
|
@ -171,11 +172,15 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, gdisp->gimage);
|
||||
|
||||
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
|
||||
|
||||
/* eeek */
|
||||
gtk_box_pack_start (GTK_BOX (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox)), 0)), edge_lock,
|
||||
FALSE, FALSE, 0);
|
||||
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle",
|
||||
edge_lock);
|
||||
children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (children->data), edge_lock, FALSE, FALSE, 0);
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
|
||||
! selection_shrink_edge_lock);
|
||||
gtk_widget_show (edge_lock);
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -58,7 +64,7 @@
|
|||
#define ALL 0xFF
|
||||
|
||||
/* NB: take care when changing these values: make sure the curve[] array in
|
||||
* curves.h is large enough.
|
||||
* gimpcurvestool.h is large enough.
|
||||
*/
|
||||
#define GRAPH_WIDTH 256
|
||||
#define GRAPH_HEIGHT 256
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
@ -38,6 +44,7 @@ gulong g_active_guide_pixel;
|
|||
|
||||
gulong marching_ants_pixels[8];
|
||||
|
||||
|
||||
static void
|
||||
set_app_colors (void)
|
||||
{
|
||||
|
@ -53,9 +60,9 @@ set_app_colors (void)
|
|||
}
|
||||
|
||||
gulong
|
||||
get_color (int red,
|
||||
int green,
|
||||
int blue)
|
||||
get_color (gint red,
|
||||
gint green,
|
||||
gint blue)
|
||||
{
|
||||
return gdk_rgb_xpixel_from_rgb ((red << 16) | (green << 8) | blue);
|
||||
}
|
||||
|
@ -63,10 +70,7 @@ get_color (int red,
|
|||
void
|
||||
get_standard_colormaps (void)
|
||||
{
|
||||
if (gtk_check_version (1, 2, 8))
|
||||
gimprc.min_colors = CLAMP (gimprc.min_colors, 27, 216);
|
||||
else
|
||||
gimprc.min_colors = CLAMP (gimprc.min_colors, 27, 256);
|
||||
gimprc.min_colors = CLAMP (gimprc.min_colors, 27, 256);
|
||||
|
||||
gdk_rgb_set_min_colors (gimprc.min_colors);
|
||||
gdk_rgb_set_install (gimprc.install_cmap);
|
||||
|
|
|
@ -36,10 +36,11 @@ extern gulong g_active_guide_pixel;
|
|||
/* Colormap entries reserved for color cycled marching ants--optional */
|
||||
extern gulong marching_ants_pixels[8];
|
||||
|
||||
gulong get_color (gint red,
|
||||
gint green,
|
||||
gint blue);
|
||||
void get_standard_colormaps (void);
|
||||
|
||||
gulong get_color (gint red,
|
||||
gint green,
|
||||
gint blue);
|
||||
void get_standard_colormaps (void);
|
||||
|
||||
|
||||
#endif /* __COLORMAPS_H__ */
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -857,7 +863,8 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
GtkStyle *style;
|
||||
GdkGC *icongc, *iconmaskgc;
|
||||
GdkColormap *colormap;
|
||||
GdkColor black, white;
|
||||
GdkColor black, white;
|
||||
gboolean success;
|
||||
|
||||
TempBuf *icondata;
|
||||
guchar *data;
|
||||
|
@ -866,7 +873,6 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
|
||||
if (!gdisp->icon)
|
||||
{
|
||||
gdk_rgb_init ();
|
||||
gdisp->icon = gdk_pixmap_new (gdisp->shell->window,
|
||||
gdisp->iconsize,
|
||||
gdisp->iconsize,
|
||||
|
@ -877,12 +883,19 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
1);
|
||||
}
|
||||
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
iconmaskgc = gdk_gc_new (gdisp->iconmask);
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
|
||||
gdk_color_white (colormap, &white);
|
||||
gdk_color_black (colormap, &black);
|
||||
white.red = 255;
|
||||
white.green = 255;
|
||||
white.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &white, 1, FALSE, TRUE, &success);
|
||||
|
||||
black.red = 0;
|
||||
black.green = 0;
|
||||
black.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &black, 1, FALSE, TRUE, &success);
|
||||
|
||||
if (! gdisp->icon_needs_update)
|
||||
return;
|
||||
|
@ -1490,7 +1503,9 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
|
|||
gdisp->cursor_label->allocation.width;
|
||||
|
||||
gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1);
|
||||
if (label_frame_size_difference) /* don't resize if this is a new display */
|
||||
|
||||
/* don't resize if this is a new display */
|
||||
if (label_frame_size_difference)
|
||||
gtk_widget_set_usize (gdisp->cursor_label->parent,
|
||||
cursor_label_width + label_frame_size_difference, -1);
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
|
|
@ -264,8 +264,7 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1046,37 +1046,37 @@ browser_info_add (GimpContainer *container,
|
|||
|
||||
|
||||
static void
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
{
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GimpModuleInfoObj *info;
|
||||
|
||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||
dlist = gtk_container_get_children (GTK_CONTAINER (st->list));
|
||||
free_list = dlist;
|
||||
|
||||
while (dlist)
|
||||
{
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
g_warning ("tried to remove module that wasn't in brower's list");
|
||||
g_list_free(free_list);
|
||||
g_list_free (free_list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -857,7 +863,8 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
GtkStyle *style;
|
||||
GdkGC *icongc, *iconmaskgc;
|
||||
GdkColormap *colormap;
|
||||
GdkColor black, white;
|
||||
GdkColor black, white;
|
||||
gboolean success;
|
||||
|
||||
TempBuf *icondata;
|
||||
guchar *data;
|
||||
|
@ -866,7 +873,6 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
|
||||
if (!gdisp->icon)
|
||||
{
|
||||
gdk_rgb_init ();
|
||||
gdisp->icon = gdk_pixmap_new (gdisp->shell->window,
|
||||
gdisp->iconsize,
|
||||
gdisp->iconsize,
|
||||
|
@ -877,12 +883,19 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
1);
|
||||
}
|
||||
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
iconmaskgc = gdk_gc_new (gdisp->iconmask);
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
|
||||
gdk_color_white (colormap, &white);
|
||||
gdk_color_black (colormap, &black);
|
||||
white.red = 255;
|
||||
white.green = 255;
|
||||
white.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &white, 1, FALSE, TRUE, &success);
|
||||
|
||||
black.red = 0;
|
||||
black.green = 0;
|
||||
black.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &black, 1, FALSE, TRUE, &success);
|
||||
|
||||
if (! gdisp->icon_needs_update)
|
||||
return;
|
||||
|
@ -1490,7 +1503,9 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
|
|||
gdisp->cursor_label->allocation.width;
|
||||
|
||||
gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1);
|
||||
if (label_frame_size_difference) /* don't resize if this is a new display */
|
||||
|
||||
/* don't resize if this is a new display */
|
||||
if (label_frame_size_difference)
|
||||
gtk_widget_set_usize (gdisp->cursor_label->parent,
|
||||
cursor_label_width + label_frame_size_difference, -1);
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -857,7 +863,8 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
GtkStyle *style;
|
||||
GdkGC *icongc, *iconmaskgc;
|
||||
GdkColormap *colormap;
|
||||
GdkColor black, white;
|
||||
GdkColor black, white;
|
||||
gboolean success;
|
||||
|
||||
TempBuf *icondata;
|
||||
guchar *data;
|
||||
|
@ -866,7 +873,6 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
|
||||
if (!gdisp->icon)
|
||||
{
|
||||
gdk_rgb_init ();
|
||||
gdisp->icon = gdk_pixmap_new (gdisp->shell->window,
|
||||
gdisp->iconsize,
|
||||
gdisp->iconsize,
|
||||
|
@ -877,12 +883,19 @@ gdisplay_update_icon (GDisplay *gdisp)
|
|||
1);
|
||||
}
|
||||
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
icongc = gdk_gc_new (gdisp->icon);
|
||||
iconmaskgc = gdk_gc_new (gdisp->iconmask);
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */
|
||||
|
||||
gdk_color_white (colormap, &white);
|
||||
gdk_color_black (colormap, &black);
|
||||
white.red = 255;
|
||||
white.green = 255;
|
||||
white.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &white, 1, FALSE, TRUE, &success);
|
||||
|
||||
black.red = 0;
|
||||
black.green = 0;
|
||||
black.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &black, 1, FALSE, TRUE, &success);
|
||||
|
||||
if (! gdisp->icon_needs_update)
|
||||
return;
|
||||
|
@ -1490,7 +1503,9 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
|
|||
gdisp->cursor_label->allocation.width;
|
||||
|
||||
gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1);
|
||||
if (label_frame_size_difference) /* don't resize if this is a new display */
|
||||
|
||||
/* don't resize if this is a new display */
|
||||
if (label_frame_size_difference)
|
||||
gtk_widget_set_usize (gdisp->cursor_label->parent,
|
||||
cursor_label_width + label_frame_size_difference, -1);
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
|
|
@ -103,8 +103,7 @@ brush_editor_new (Gimp *gimp)
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (brush_editor->shell)->vbox)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (brush_editor->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (brush_editor->shell)->action_area);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
|
|
|
@ -264,8 +264,7 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -111,8 +111,7 @@ gradient_select_new (gchar *title,
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (gsp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (gsp->shell)->action_area);
|
||||
|
||||
if (title)
|
||||
|
|
|
@ -1046,37 +1046,37 @@ browser_info_add (GimpContainer *container,
|
|||
|
||||
|
||||
static void
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
{
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GimpModuleInfoObj *info;
|
||||
|
||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||
dlist = gtk_container_get_children (GTK_CONTAINER (st->list));
|
||||
free_list = dlist;
|
||||
|
||||
while (dlist)
|
||||
{
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
g_warning ("tried to remove module that wasn't in brower's list");
|
||||
g_list_free(free_list);
|
||||
g_list_free (free_list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,8 +116,7 @@ palette_select_new (const 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)
|
||||
|
|
|
@ -374,7 +374,8 @@ static void
|
|||
paths_dialog_realized (GtkWidget *widget)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
gchar dash_list[2]= {3,3};
|
||||
gchar dash_list[2]= { 3, 3 };
|
||||
gboolean success;
|
||||
|
||||
/* Help out small displays */
|
||||
if (gimprc.preview_size < 64)
|
||||
|
@ -383,10 +384,18 @@ paths_dialog_realized (GtkWidget *widget)
|
|||
paths_dialog->gc = gdk_gc_new (widget->window);
|
||||
gdk_gc_set_dashes (paths_dialog->gc, 2, dash_list, 2);
|
||||
colormap = gtk_widget_get_colormap (paths_dialog->paths_list);
|
||||
gdk_color_parse ("black", &paths_dialog->black);
|
||||
gdk_color_alloc (colormap, &paths_dialog->black);
|
||||
gdk_color_parse ("white", &paths_dialog->white);
|
||||
gdk_color_alloc (colormap, &paths_dialog->white);
|
||||
|
||||
paths_dialog->black.red = 0;
|
||||
paths_dialog->black.green = 0;
|
||||
paths_dialog->black.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &paths_dialog->black, 1,
|
||||
FALSE, TRUE, &success);
|
||||
|
||||
paths_dialog->white.red = 255;
|
||||
paths_dialog->white.green = 255;
|
||||
paths_dialog->white.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &paths_dialog->white, 1,
|
||||
FALSE, TRUE, &success);
|
||||
}
|
||||
|
||||
/* Clears out row when list element is deleted/destroyed */
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -154,6 +154,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *edge_lock;
|
||||
GtkWidget *shrink_dialog;
|
||||
GDisplay *gdisp;
|
||||
GList *children;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
|
@ -171,11 +172,15 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, gdisp->gimage);
|
||||
|
||||
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
|
||||
|
||||
/* eeek */
|
||||
gtk_box_pack_start (GTK_BOX (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox)), 0)), edge_lock,
|
||||
FALSE, FALSE, 0);
|
||||
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle",
|
||||
edge_lock);
|
||||
children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (children->data), edge_lock, FALSE, FALSE, 0);
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
|
||||
! selection_shrink_edge_lock);
|
||||
gtk_widget_show (edge_lock);
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -1046,37 +1046,37 @@ browser_info_add (GimpContainer *container,
|
|||
|
||||
|
||||
static void
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
browser_info_remove (GimpContainer *container,
|
||||
GimpModuleInfoObj *mod,
|
||||
BrowserState *st)
|
||||
{
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GList *dlist;
|
||||
GList *free_list;
|
||||
GtkWidget *list_item;
|
||||
GimpModuleInfoObj *info;
|
||||
|
||||
dlist = gtk_container_children (GTK_CONTAINER (st->list));
|
||||
dlist = gtk_container_get_children (GTK_CONTAINER (st->list));
|
||||
free_list = dlist;
|
||||
|
||||
while (dlist)
|
||||
{
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
list_item = dlist->data;
|
||||
|
||||
info = g_object_get_data (G_OBJECT (list_item), "module_info");
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
if (info == mod)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (st->list), list_item);
|
||||
g_list_free (free_list);
|
||||
return;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
dlist = dlist->next;
|
||||
}
|
||||
|
||||
g_warning ("tried to remove module that wasn't in brower's list");
|
||||
g_list_free(free_list);
|
||||
g_list_free (free_list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -779,16 +779,25 @@ blob_pixmap (GdkColormap *colormap,
|
|||
GdkPixmap *pixmap;
|
||||
GdkGC *black_gc, *white_gc;
|
||||
GdkColor tmp_color;
|
||||
gboolean success;
|
||||
Blob *blob;
|
||||
|
||||
pixmap = gdk_pixmap_new (NULL, 22, 21, visual->depth);
|
||||
|
||||
tmp_color.red = 0;
|
||||
tmp_color.green = 0;
|
||||
tmp_color.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &tmp_color, 1, FALSE, TRUE, &success);
|
||||
|
||||
black_gc = gdk_gc_new (pixmap);
|
||||
gdk_color_black (colormap, &tmp_color);
|
||||
gdk_gc_set_foreground (black_gc, &tmp_color);
|
||||
|
||||
tmp_color.red = 255;
|
||||
tmp_color.green = 255;
|
||||
tmp_color.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &tmp_color, 1, FALSE, TRUE, &success);
|
||||
|
||||
white_gc = gdk_gc_new (pixmap);
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
gdk_gc_set_foreground (white_gc, &tmp_color);
|
||||
|
||||
gdk_draw_rectangle (pixmap, white_gc, TRUE, 0, 0, 21, 20);
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
240
app/plug_in.c
240
app/plug_in.c
|
@ -910,7 +910,8 @@ plug_in_destroy (PlugIn *plug_in)
|
|||
{
|
||||
if (plug_in)
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
if (plug_in->open)
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
||||
if (plug_in->args[0])
|
||||
g_free (plug_in->args[0]);
|
||||
|
@ -1126,132 +1127,129 @@ plug_in_close (PlugIn *plug_in,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
if (plug_in && plug_in->open)
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (plug_in->open == TRUE);
|
||||
|
||||
if (! plug_in->open)
|
||||
return;
|
||||
|
||||
plug_in->open = FALSE;
|
||||
|
||||
/* Ask the filter to exit gracefully */
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in->open = FALSE;
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* Ask the filter to exit gracefully
|
||||
*/
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (current_writechannel);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
/* give the plug-in some time (10 ms) */
|
||||
#ifndef G_OS_WIN32
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
||||
select (0, NULL, NULL, NULL, &tv);
|
||||
#else
|
||||
Sleep (10);
|
||||
Sleep (10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
gdk_input_remove (plug_in->input_id);
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
|
||||
/* Set the fields to null values. */
|
||||
plug_in->pid = 0;
|
||||
plug_in->input_id = 0;
|
||||
plug_in->my_read = NULL;
|
||||
plug_in->my_write = NULL;
|
||||
plug_in->his_read = NULL;
|
||||
plug_in->his_write = NULL;
|
||||
|
||||
if (plug_in->recurse)
|
||||
gtk_main_quit ();
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
plug_in->recurse = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
/* If necessary, kill the filter. */
|
||||
#ifndef G_OS_WIN32
|
||||
if (kill_it && plug_in->pid)
|
||||
status = kill (plug_in->pid, SIGKILL);
|
||||
|
||||
/* Wait for the process to exit. This will happen
|
||||
* immediately if it was just killed.
|
||||
*/
|
||||
if (plug_in->pid)
|
||||
waitpid (plug_in->pid, &status, 0);
|
||||
#else
|
||||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
/* Trying to avoid TerminateProcess (does mostly work).
|
||||
* Otherwise some of our needed DLLs may get into an unstable state
|
||||
* (see Win32 API docs).
|
||||
*/
|
||||
DWORD dwExitCode = STILL_ACTIVE;
|
||||
DWORD dwTries = 10;
|
||||
while ((STILL_ACTIVE == dwExitCode)
|
||||
&& GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode)
|
||||
&& (dwTries > 0))
|
||||
{
|
||||
Sleep(10);
|
||||
dwTries--;
|
||||
}
|
||||
if (STILL_ACTIVE == dwExitCode)
|
||||
{
|
||||
g_warning("Terminating %s ...", plug_in->args[0]);
|
||||
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
plug_in->pid = 0;
|
||||
|
||||
/* Remove the input handler. */
|
||||
if (plug_in->input_id)
|
||||
{
|
||||
g_source_remove (plug_in->input_id);
|
||||
plug_in->input_id = 0;
|
||||
}
|
||||
|
||||
/* Close the pipes. */
|
||||
if (plug_in->my_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_read);
|
||||
plug_in->my_read = NULL;
|
||||
}
|
||||
if (plug_in->my_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->my_write);
|
||||
plug_in->my_write = NULL;
|
||||
}
|
||||
if (plug_in->his_read != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_read);
|
||||
plug_in->his_read = NULL;
|
||||
}
|
||||
if (plug_in->his_write != NULL)
|
||||
{
|
||||
g_io_channel_unref (plug_in->his_write);
|
||||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
|
||||
/* Destroy the progress dialog if it exists. */
|
||||
if (plug_in->progress)
|
||||
{
|
||||
progress_end (plug_in->progress);
|
||||
plug_in->progress = NULL;
|
||||
}
|
||||
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
plug_in->recurse = FALSE;
|
||||
}
|
||||
|
||||
plug_in->synchronous = FALSE;
|
||||
|
||||
/* Unregister any temporary procedures. */
|
||||
if (plug_in->temp_proc_defs)
|
||||
{
|
||||
g_slist_foreach (plug_in->temp_proc_defs,
|
||||
(GFunc) plug_in_proc_def_remove,
|
||||
NULL);
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
}
|
||||
|
||||
/* Close any dialogs that this plugin might have opened */
|
||||
brush_select_dialogs_check ();
|
||||
pattern_select_dialogs_check ();
|
||||
gradient_select_dialogs_check ();
|
||||
|
||||
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
|
||||
}
|
||||
|
||||
static Argument *
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -58,7 +64,7 @@
|
|||
#define ALL 0xFF
|
||||
|
||||
/* NB: take care when changing these values: make sure the curve[] array in
|
||||
* curves.h is large enough.
|
||||
* gimpcurvestool.h is large enough.
|
||||
*/
|
||||
#define GRAPH_WIDTH 256
|
||||
#define GRAPH_HEIGHT 256
|
||||
|
|
|
@ -779,16 +779,25 @@ blob_pixmap (GdkColormap *colormap,
|
|||
GdkPixmap *pixmap;
|
||||
GdkGC *black_gc, *white_gc;
|
||||
GdkColor tmp_color;
|
||||
gboolean success;
|
||||
Blob *blob;
|
||||
|
||||
pixmap = gdk_pixmap_new (NULL, 22, 21, visual->depth);
|
||||
|
||||
tmp_color.red = 0;
|
||||
tmp_color.green = 0;
|
||||
tmp_color.blue = 0;
|
||||
gdk_colormap_alloc_colors (colormap, &tmp_color, 1, FALSE, TRUE, &success);
|
||||
|
||||
black_gc = gdk_gc_new (pixmap);
|
||||
gdk_color_black (colormap, &tmp_color);
|
||||
gdk_gc_set_foreground (black_gc, &tmp_color);
|
||||
|
||||
tmp_color.red = 255;
|
||||
tmp_color.green = 255;
|
||||
tmp_color.blue = 255;
|
||||
gdk_colormap_alloc_colors (colormap, &tmp_color, 1, FALSE, TRUE, &success);
|
||||
|
||||
white_gc = gdk_gc_new (pixmap);
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
gdk_gc_set_foreground (white_gc, &tmp_color);
|
||||
|
||||
gdk_draw_rectangle (pixmap, white_gc, TRUE, 0, 0, 21, 20);
|
||||
|
|
|
@ -103,8 +103,7 @@ brush_editor_new (Gimp *gimp)
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (brush_editor->shell)->vbox)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (brush_editor->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (brush_editor->shell)->action_area);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
|
|
|
@ -264,8 +264,7 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -980,15 +980,16 @@ gimp_dialog_factories_save_foreach (gchar *name,
|
|||
for (books = dock->dockbooks; books; books = g_list_next (books))
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
GList *children;
|
||||
GList *pages;
|
||||
|
||||
dockbook = (GimpDockbook *) books->data;
|
||||
|
||||
fprintf (fp, "(");
|
||||
|
||||
for (pages = gtk_container_children (GTK_CONTAINER (dockbook));
|
||||
pages;
|
||||
pages = g_list_next (pages))
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
||||
|
||||
for (pages = children; pages; pages = g_list_next (pages))
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
GimpDialogFactoryEntry *entry;
|
||||
|
@ -1003,6 +1004,8 @@ gimp_dialog_factories_save_foreach (gchar *name,
|
|||
entry->identifier, pages->next ? " ": "");
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
fprintf (fp, ")%s", books->next ? "\n " : "");
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ gimp_dock_remove_book (GimpDock *dock,
|
|||
dockbook->dock = NULL;
|
||||
dock->dockbooks = g_list_remove (dock->dockbooks, dockbook);
|
||||
|
||||
children = gtk_container_children (GTK_CONTAINER (dock->vbox));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dock->vbox));
|
||||
book_index = g_list_index (children, dockbook);
|
||||
|
||||
if (length != 1)
|
||||
|
@ -300,6 +300,8 @@ gimp_dock_remove_book (GimpDock *dock,
|
|||
gtk_container_remove (GTK_CONTAINER (dock->vbox), separator);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (dock->vbox), GTK_WIDGET (dockbook));
|
||||
|
||||
if (length == 1)
|
||||
|
|
|
@ -346,6 +346,8 @@ void
|
|||
gimp_dockbook_remove (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
GList *children;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
|
||||
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
|
||||
|
||||
|
@ -358,10 +360,14 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
|
|||
|
||||
gtk_container_remove (GTK_CONTAINER (dockbook), GTK_WIDGET (dockable));
|
||||
|
||||
if (! g_list_length (gtk_container_children (GTK_CONTAINER (dockbook))))
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dockbook));
|
||||
|
||||
if (! g_list_length (children))
|
||||
{
|
||||
gimp_dock_remove_book (dockbook->dock, dockbook);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -743,7 +743,7 @@ fi
|
|||
|
||||
AM_CONDITIONAL(STATICLIBS, test x$enable_static = xyes)
|
||||
|
||||
CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED -DGDK_DISABLE_COMPAT_H -DGTK_DISABLE_COMPAT_H"
|
||||
CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_DISABLE_COMPAT_H -DGTK_DISABLE_COMPAT_H"
|
||||
|
||||
AC_SUBST(GIMP_MAJOR_VERSION)
|
||||
AC_SUBST(GIMP_MINOR_VERSION)
|
||||
|
|
|
@ -44,7 +44,7 @@ SUBDIRS = \
|
|||
## gap \
|
||||
## gdyntext \
|
||||
## gfig \
|
||||
## gflare \
|
||||
gflare \
|
||||
gfli \
|
||||
## gimpressionist \
|
||||
$(HELPBROWSER) \
|
||||
|
|
|
@ -28,6 +28,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
|
|
@ -7,10 +7,6 @@ libexecdir = $(gimpplugindir)/plug-ins
|
|||
libexec_PROGRAMS = gflare
|
||||
|
||||
gflare_SOURCES = @STRIP_BEGIN@ \
|
||||
asupsample.h \
|
||||
asupsample.c \
|
||||
gtkmultioptionmenu.h \
|
||||
gtkmultioptionmenu.c \
|
||||
gflare.c \
|
||||
@STRIP_END@
|
||||
|
||||
|
|
|
@ -1,335 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* General, non-jittered adaptive supersampling library
|
||||
* Copyright (C) 1997 Federico Mena Quintero
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* This code is *largely* based on the sources for POV-Ray 3.0. I am
|
||||
* grateful to the POV-Team for such a great program and for making
|
||||
* their sources available. All comments / bug reports /
|
||||
* etc. regarding this library should be addressed to me, not to the
|
||||
* POV-Ray team. Any bugs are my responsibility, not theirs.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "asupsample.h"
|
||||
|
||||
|
||||
/***** Types *****/
|
||||
|
||||
typedef struct {
|
||||
char ready;
|
||||
color_t color;
|
||||
} sample_t;
|
||||
|
||||
|
||||
/***** Local functions *****/
|
||||
|
||||
static unsigned long render_sub_pixel(int max_depth, int depth, sample_t **block,
|
||||
int x, int y, int x1, int y1, int x3, int y3,
|
||||
double threshold, int sub_pixel_size, render_func_t render_func,
|
||||
color_t *color, void *render_data);
|
||||
|
||||
static double color_dist(color_t c1, color_t c2);
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
/*****/
|
||||
|
||||
unsigned long
|
||||
adaptive_supersample_area(int x1, int y1, int x2, int y2, int max_depth, double threshold,
|
||||
render_func_t render_func, void *render_data,
|
||||
put_pixel_func_t put_pixel_func, void *put_pixel_data,
|
||||
progress_func_t progress_func, void *progress_data)
|
||||
{
|
||||
int x, y, width; /* Counters, width of region */
|
||||
int xt, xtt, yt; /* Temporary counters */
|
||||
int sub_pixel_size; /* Numbe of samples per pixel (1D) */
|
||||
size_t row_size; /* Memory needed for one row */
|
||||
color_t color; /* Rendered pixel's color */
|
||||
sample_t tmp_sample; /* For swapping samples */
|
||||
sample_t *top_row, *bot_row, *tmp_row; /* Sample rows */
|
||||
sample_t **block; /* Sample block matrix */
|
||||
unsigned long num_samples;
|
||||
|
||||
/* Initialize color */
|
||||
|
||||
color.r = 0.0;
|
||||
color.g = 0.0;
|
||||
color.b = 0.0;
|
||||
color.a = 0.0;
|
||||
|
||||
/* Calculate sub-pixel size */
|
||||
|
||||
sub_pixel_size = 1 << max_depth; /* 2**max_depth */
|
||||
|
||||
/* Create row arrays */
|
||||
|
||||
width = x2 - x1 + 1;
|
||||
|
||||
row_size = (sub_pixel_size * width + 1) * sizeof(sample_t);
|
||||
|
||||
top_row = g_malloc(row_size);
|
||||
bot_row = g_malloc(row_size);
|
||||
|
||||
for (x = 0; x < (sub_pixel_size * width + 1); x++) {
|
||||
top_row[x].ready = 0;
|
||||
|
||||
top_row[x].color.r = 0.0;
|
||||
top_row[x].color.g = 0.0;
|
||||
top_row[x].color.b = 0.0;
|
||||
top_row[x].color.a = 0.0;
|
||||
|
||||
bot_row[x].ready = 0;
|
||||
|
||||
bot_row[x].color.r = 0.0;
|
||||
bot_row[x].color.g = 0.0;
|
||||
bot_row[x].color.b = 0.0;
|
||||
bot_row[x].color.a = 0.0;
|
||||
} /* for */
|
||||
|
||||
/* Allocate block matrix */
|
||||
|
||||
block = g_malloc((sub_pixel_size + 1) * sizeof(sample_t *)); /* Rows */
|
||||
|
||||
for (y = 0; y < (sub_pixel_size + 1); y++)
|
||||
block[y] = g_malloc((sub_pixel_size + 1) * sizeof(sample_t)); /* Columns */
|
||||
|
||||
for (y = 0; y < (sub_pixel_size + 1); y++)
|
||||
for (x = 0; x < (sub_pixel_size + 1); x++) {
|
||||
block[y][x].ready = 0;
|
||||
|
||||
block[y][x].color.r = 0.0;
|
||||
block[y][x].color.g = 0.0;
|
||||
block[y][x].color.b = 0.0;
|
||||
block[y][x].color.a = 0.0;
|
||||
} /* for */
|
||||
|
||||
/* Render region */
|
||||
|
||||
num_samples = 0;
|
||||
|
||||
for (y = y1; y <= y2; y++) {
|
||||
/* Clear the bottom row */
|
||||
|
||||
for (xt = 0; xt < (sub_pixel_size * width + 1); xt++)
|
||||
bot_row[xt].ready = 0;
|
||||
|
||||
/* Clear first column */
|
||||
|
||||
for (yt = 0; yt < (sub_pixel_size + 1); yt++)
|
||||
block[yt][0].ready = 0;
|
||||
|
||||
/* Render row */
|
||||
|
||||
for (x = x1; x <= x2; x++) {
|
||||
/* Initialize block by clearing all but first row/column */
|
||||
|
||||
for (yt = 1; yt < (sub_pixel_size + 1); yt++)
|
||||
for (xt = 1; xt < (sub_pixel_size + 1); xt++)
|
||||
block[yt][xt].ready = 0;
|
||||
|
||||
/* Copy samples from top row to block */
|
||||
|
||||
for (xtt = 0, xt = (x - x1) * sub_pixel_size;
|
||||
xtt < (sub_pixel_size + 1);
|
||||
xtt++, xt++)
|
||||
block[0][xtt] = top_row[xt];
|
||||
|
||||
/* Render pixel on (x, y) */
|
||||
|
||||
num_samples += render_sub_pixel(max_depth, 1, block, x, y, 0, 0,
|
||||
sub_pixel_size, sub_pixel_size,
|
||||
threshold, sub_pixel_size, render_func, &color,
|
||||
render_data);
|
||||
|
||||
if (put_pixel_func)
|
||||
(*put_pixel_func)(x, y, color, put_pixel_data);
|
||||
|
||||
/* Copy block information to rows */
|
||||
|
||||
top_row[((x - x1) + 1) * sub_pixel_size] = block[0][sub_pixel_size];
|
||||
|
||||
for (xtt = 0, xt = (x - x1) * sub_pixel_size;
|
||||
xtt < (sub_pixel_size + 1);
|
||||
xtt++, xt++)
|
||||
bot_row[xt] = block[sub_pixel_size][xtt];
|
||||
|
||||
/* Swap first and last columns */
|
||||
|
||||
for (yt = 0; yt < (sub_pixel_size + 1); yt++) {
|
||||
tmp_sample = block[yt][0];
|
||||
block[yt][0] = block[yt][sub_pixel_size];
|
||||
block[yt][sub_pixel_size] = tmp_sample;
|
||||
} /* for */
|
||||
} /* for */
|
||||
|
||||
/* Swap rows */
|
||||
|
||||
tmp_row = top_row;
|
||||
top_row = bot_row;
|
||||
bot_row = tmp_row;
|
||||
|
||||
/* Call progress display function */
|
||||
|
||||
if (progress_func)
|
||||
(*progress_func)(y1, y2, y, progress_data);
|
||||
} /* for */
|
||||
|
||||
/* Free memory */
|
||||
|
||||
for (y = 0; y < (sub_pixel_size + 1); y++)
|
||||
g_free(block[y]);
|
||||
|
||||
g_free(block);
|
||||
g_free(top_row);
|
||||
g_free(bot_row);
|
||||
|
||||
return num_samples;
|
||||
} /* adaptive_supersample_area */
|
||||
|
||||
|
||||
/*****/
|
||||
|
||||
static unsigned long
|
||||
render_sub_pixel(int max_depth, int depth, sample_t **block,
|
||||
int x, int y, int x1, int y1, int x3, int y3,
|
||||
double threshold, int sub_pixel_size, render_func_t render_func,
|
||||
color_t *color, void *render_data)
|
||||
{
|
||||
int x2, y2; /* Coords of center sample */
|
||||
double dx1, dy1; /* Delta to upper left sample */
|
||||
double dx3, dy3; /* Delta to lower right sample */
|
||||
color_t c1, c2, c3, c4; /* Sample colors */
|
||||
unsigned long num_samples;
|
||||
|
||||
/* Get offsets for corners */
|
||||
|
||||
dx1 = (double) (x1 - sub_pixel_size / 2) / sub_pixel_size;
|
||||
dx3 = (double) (x3 - sub_pixel_size / 2) / sub_pixel_size;
|
||||
|
||||
dy1 = (double) (y1 - sub_pixel_size / 2) / sub_pixel_size;
|
||||
dy3 = (double) (y3 - sub_pixel_size / 2) / sub_pixel_size;
|
||||
|
||||
num_samples = 0;
|
||||
|
||||
/* Render upper left sample */
|
||||
|
||||
if (!block[y1][x1].ready) {
|
||||
num_samples++;
|
||||
(*render_func)(x + dx1, y + dy1, &c1, render_data);
|
||||
|
||||
block[y1][x1].ready = 1;
|
||||
block[y1][x1].color = c1;
|
||||
} else
|
||||
c1 = block[y1][x1].color;
|
||||
|
||||
/* Render upper right sample */
|
||||
|
||||
if (!block[y1][x3].ready) {
|
||||
num_samples++;
|
||||
(*render_func)(x + dx3, y + dy1, &c2, render_data);
|
||||
|
||||
block[y1][x3].ready = 1;
|
||||
block[y1][x3].color = c2;
|
||||
} else
|
||||
c2 = block[y1][x3].color;
|
||||
|
||||
/* Render lower left sample */
|
||||
|
||||
if (!block[y3][x1].ready) {
|
||||
num_samples++;
|
||||
(*render_func)(x + dx1, y + dy3, &c3, render_data);
|
||||
|
||||
block[y3][x1].ready = 1;
|
||||
block[y3][x1].color = c3;
|
||||
} else
|
||||
c3 = block[y3][x1].color;
|
||||
|
||||
/* Render lower right sample */
|
||||
|
||||
if (!block[y3][x3].ready) {
|
||||
num_samples++;
|
||||
(*render_func)(x + dx3, y + dy3, &c4, render_data);
|
||||
|
||||
block[y3][x3].ready = 1;
|
||||
block[y3][x3].color = c4;
|
||||
} else
|
||||
c4 = block[y3][x3].color;
|
||||
|
||||
/* Check for supersampling */
|
||||
|
||||
if (depth <= max_depth) {
|
||||
/* Check whether we have tu supersample */
|
||||
|
||||
if ((color_dist(c1, c2) >= threshold) ||
|
||||
(color_dist(c1, c3) >= threshold) ||
|
||||
(color_dist(c1, c4) >= threshold) ||
|
||||
(color_dist(c2, c3) >= threshold) ||
|
||||
(color_dist(c2, c4) >= threshold) ||
|
||||
(color_dist(c3, c4) >= threshold)) {
|
||||
/* Calc coordinates of center subsample */
|
||||
|
||||
x2 = (x1 + x3) / 2;
|
||||
y2 = (y1 + y3) / 2;
|
||||
|
||||
/* Render sub-blocks */
|
||||
|
||||
num_samples += render_sub_pixel(max_depth, depth + 1, block, x, y, x1, y1, x2, y2,
|
||||
threshold, sub_pixel_size, render_func, &c1,
|
||||
render_data);
|
||||
|
||||
num_samples += render_sub_pixel(max_depth, depth + 1, block, x, y, x2, y1, x3, y2,
|
||||
threshold, sub_pixel_size, render_func, &c2,
|
||||
render_data);
|
||||
|
||||
num_samples += render_sub_pixel(max_depth, depth + 1, block, x, y, x1, y2, x2, y3,
|
||||
threshold, sub_pixel_size, render_func, &c3,
|
||||
render_data);
|
||||
|
||||
num_samples += render_sub_pixel(max_depth, depth + 1, block, x, y, x2, y2, x3, y3,
|
||||
threshold, sub_pixel_size, render_func, &c4,
|
||||
render_data);
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
||||
color->r = 0.25 * (c1.r + c2.r + c3.r + c4.r);
|
||||
color->g = 0.25 * (c1.g + c2.g + c3.g + c4.g);
|
||||
color->b = 0.25 * (c1.b + c2.b + c3.b + c4.b);
|
||||
color->a = 0.25 * (c1.a + c2.a + c3.a + c4.a);
|
||||
|
||||
return num_samples;
|
||||
} /* render_sub_pixel */
|
||||
|
||||
|
||||
/*****/
|
||||
|
||||
static double
|
||||
color_dist(color_t c1, color_t c2)
|
||||
{
|
||||
return fabs(c1.r - c2.r) +
|
||||
fabs(c1.g - c2.g) +
|
||||
fabs(c1.b - c2.b) +
|
||||
fabs(c1.a - c2.a);
|
||||
} /* color_dist */
|
|
@ -1,47 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* General, non-jittered adaptive supersampling library
|
||||
* Copyright (C) 1997 Federico Mena Quintero
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ASUPSAMPLE_H__
|
||||
#define __ASUPSAMPLE_H__
|
||||
|
||||
|
||||
/***** Types *****/
|
||||
|
||||
typedef struct {
|
||||
double r, g, b, a; /* Range is [0, 1] */
|
||||
} color_t;
|
||||
|
||||
typedef void (*render_func_t) (double x, double y, color_t *color, void *render_data);
|
||||
typedef void (*put_pixel_func_t) (int x, int y, color_t color, void *put_pixel_data);
|
||||
typedef void (*progress_func_t) (int y1, int y2, int curr_y, void *progress_data);
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
||||
unsigned long adaptive_supersample_area(int x1, int y1, int x2, int y2, int max_depth, double threshold,
|
||||
render_func_t render_func, void *render_data,
|
||||
put_pixel_func_t put_pixel_func, void *put_pixel_data,
|
||||
progress_func_t progress_func, void *progress_data);
|
||||
|
||||
|
||||
#endif
|
|
@ -31,20 +31,11 @@
|
|||
* federico@nuclecu.unam.mx
|
||||
*/
|
||||
|
||||
/*
|
||||
version 0.27
|
||||
Changed so that it works with GIMP 1.1.x
|
||||
Default problem solved
|
||||
martweb@gmx.net
|
||||
*/
|
||||
|
||||
#ifdef RCSID
|
||||
static char rcsid[] = "$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -69,14 +60,13 @@ static char rcsid[] = "$Id$";
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <libgimpcolor/gimpcolor.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include "asupsample.h"
|
||||
#include "gtkmultioptionmenu.h"
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -107,7 +97,6 @@ static char rcsid[] = "$Id$";
|
|||
|
||||
#define GM_PREVIEW_WIDTH 80
|
||||
#define GM_PREVIEW_HEIGHT 16
|
||||
#define GM_MENU_MAX 20
|
||||
|
||||
#define SCALE_WIDTH 100
|
||||
#define ENTRY_WIDTH 40
|
||||
|
@ -335,10 +324,14 @@ struct _GradientMenu
|
|||
GradientName gradient_name;
|
||||
};
|
||||
|
||||
typedef gint (* PreviewInitFunc) (Preview *preview, gpointer data);
|
||||
typedef void (* PreviewRenderFunc) (Preview *preview, guchar *buffer,
|
||||
gint y, gpointer data);
|
||||
typedef void (* PreviewDeinitFunc) (Preview *preview, gpointer data);
|
||||
typedef gint (* PreviewInitFunc) (Preview *preview,
|
||||
gpointer data);
|
||||
typedef void (* PreviewRenderFunc) (Preview *preview,
|
||||
guchar *buffer,
|
||||
gint y,
|
||||
gpointer data);
|
||||
typedef void (* PreviewDeinitFunc) (Preview *preview,
|
||||
gpointer data);
|
||||
|
||||
struct _Preview
|
||||
{
|
||||
|
@ -399,7 +392,9 @@ typedef struct
|
|||
gint run;
|
||||
} PluginInterface;
|
||||
|
||||
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
|
||||
typedef void (* QueryFunc) (GtkWidget *,
|
||||
gpointer,
|
||||
gpointer);
|
||||
|
||||
/***
|
||||
*** Global Functions Prototypes
|
||||
|
@ -426,7 +421,7 @@ static void gflare_name_copy (gchar *dest,
|
|||
gchar *src);
|
||||
|
||||
static gint gflares_list_insert (GFlare *gflare);
|
||||
static GFlare * gflares_list_lookup (gchar *name);
|
||||
static GFlare * gflares_list_lookup (gchar *name);
|
||||
static gint gflares_list_index (GFlare *gflare);
|
||||
static gint gflares_list_remove (GFlare *gflare);
|
||||
static void gflares_list_load_all (void);
|
||||
|
@ -532,7 +527,7 @@ PluginValues pvals =
|
|||
|
||||
PluginInterface pint =
|
||||
{
|
||||
FALSE /* run */
|
||||
FALSE /* run */
|
||||
};
|
||||
|
||||
GFlare default_gflare =
|
||||
|
@ -636,59 +631,93 @@ static void plugin_do (void);
|
|||
|
||||
static void plugin_do_non_asupsample (void);
|
||||
static void plugin_do_asupsample (void);
|
||||
static void plugin_render_func (double x, double y,
|
||||
color_t *color, gpointer data);
|
||||
static void plugin_put_pixel_func (int ix, int iy, color_t color,
|
||||
gpointer data);
|
||||
static void plugin_progress_func (int y1, int y2, int curr_y,
|
||||
gpointer data);
|
||||
static void plugin_render_func (gdouble x,
|
||||
gdouble y,
|
||||
GimpRGB *color,
|
||||
gpointer data);
|
||||
static void plugin_put_pixel_func (gint ix,
|
||||
gint iy,
|
||||
GimpRGB *color,
|
||||
gpointer data);
|
||||
static void plugin_progress_func (gint y1,
|
||||
gint y2,
|
||||
gint curr_y,
|
||||
gpointer data);
|
||||
|
||||
static TileKeeper *tile_keeper_new (gint shadow);
|
||||
static guchar *tile_keeper_provide (TileKeeper *tk, gint ix, gint iy,
|
||||
gint dirty);
|
||||
static void tile_keeper_free (TileKeeper *tk);
|
||||
static TileKeeper *tile_keeper_new (gint shadow);
|
||||
static guchar *tile_keeper_provide (TileKeeper *tk,
|
||||
gint ix,
|
||||
gint iy,
|
||||
gint dirty);
|
||||
static void tile_keeper_free (TileKeeper *tk);
|
||||
|
||||
static GFlare * gflare_new (void);
|
||||
static void gflare_free (GFlare *gflare);
|
||||
static void gflare_read_int (gint *intvar, GFlareFile *gf);
|
||||
static void gflare_read_double (gdouble *dblvar, GFlareFile *gf);
|
||||
static void gflare_read_gradient_name (gchar *name, GFlareFile *gf);
|
||||
static void gflare_read_shape (GFlareShape *shape, GFlareFile *gf);
|
||||
static void gflare_read_mode (GFlareMode *mode, GFlareFile *gf);
|
||||
static void gflare_write_gradient_name (gchar *name, FILE *fp);
|
||||
static void gflare_free (GFlare *gflare);
|
||||
static void gflare_read_int (gint *intvar,
|
||||
GFlareFile *gf);
|
||||
static void gflare_read_double (gdouble *dblvar,
|
||||
GFlareFile *gf);
|
||||
static void gflare_read_gradient_name (gchar *name,
|
||||
GFlareFile *gf);
|
||||
static void gflare_read_shape (GFlareShape *shape,
|
||||
GFlareFile *gf);
|
||||
static void gflare_read_mode (GFlareMode *mode,
|
||||
GFlareFile *gf);
|
||||
static void gflare_write_gradient_name (gchar *name,
|
||||
FILE *fp);
|
||||
|
||||
static gint calc_sample_one_gradient (void);
|
||||
static void calc_place_sflare (void);
|
||||
static void calc_get_gradient (guchar *pix, guchar *gradient,
|
||||
gdouble pos);
|
||||
static gdouble fmod_positive (gdouble x, gdouble m);
|
||||
static void calc_paint_func (guchar *dest,
|
||||
guchar *src1, guchar *src2,
|
||||
gint opacity, GFlareMode mode);
|
||||
static void calc_combine (guchar *dest,
|
||||
guchar *src1, guchar *src2,
|
||||
gint opacity);
|
||||
static void calc_addition (guchar *dest,
|
||||
guchar *src1, guchar *src2);
|
||||
static void calc_screen (guchar *dest,
|
||||
guchar *src1, guchar *src2);
|
||||
static void calc_overlay (guchar *dest,
|
||||
guchar *src1, guchar *src2);
|
||||
static void calc_get_gradient (guchar *pix,
|
||||
guchar *gradient,
|
||||
gdouble pos);
|
||||
static gdouble fmod_positive (gdouble x,
|
||||
gdouble m);
|
||||
static void calc_paint_func (guchar *dest,
|
||||
guchar *src1,
|
||||
guchar *src2,
|
||||
gint opacity,
|
||||
GFlareMode mode);
|
||||
static void calc_combine (guchar *dest,
|
||||
guchar *src1,
|
||||
guchar *src2,
|
||||
gint opacity);
|
||||
static void calc_addition (guchar *dest,
|
||||
guchar *src1,
|
||||
guchar *src2);
|
||||
static void calc_screen (guchar *dest,
|
||||
guchar *src1,
|
||||
guchar *src2);
|
||||
static void calc_overlay (guchar *dest,
|
||||
guchar *src1,
|
||||
guchar *src2);
|
||||
|
||||
static void dlg_ok_callback (GtkWidget *widget, gpointer data);
|
||||
static void dlg_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void dlg_setup_gflare (void);
|
||||
static void dlg_page_map_callback (GtkWidget *widget, gpointer data);
|
||||
static gint dlg_preview_handle_event (GtkWidget *widget, GdkEvent *event);
|
||||
static gint ed_preview_handle_event (GtkWidget *widget, GdkEvent *event);
|
||||
static void dlg_page_map_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint dlg_preview_handle_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
static gint ed_preview_handle_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
static void dlg_preview_update (void);
|
||||
static gint dlg_preview_init_func (Preview *preview, gpointer data);
|
||||
static void dlg_preview_render_func (Preview *preview,
|
||||
guchar *dest, gint y, gpointer data);
|
||||
static void dlg_preview_deinit_func (Preview *preview, gpointer data);
|
||||
static void dlg_make_page_settings (GFlareDialog *dlg, GtkWidget *notebook);
|
||||
static void dlg_position_entry_callback (GtkWidget *widget, gpointer data);
|
||||
static void dlg_update_preview_callback (GtkWidget *widget, gpointer data);
|
||||
static void dlg_make_page_selector (GFlareDialog *dlg, GtkWidget *notebook);
|
||||
static gint dlg_preview_init_func (Preview *preview,
|
||||
gpointer data);
|
||||
static void dlg_preview_render_func (Preview *preview,
|
||||
guchar *dest,
|
||||
gint y,
|
||||
gpointer data);
|
||||
static void dlg_preview_deinit_func (Preview *preview,
|
||||
gpointer data);
|
||||
static void dlg_make_page_settings (GFlareDialog *dlg,
|
||||
GtkWidget *notebook);
|
||||
static void dlg_position_entry_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void dlg_update_preview_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void dlg_make_page_selector (GFlareDialog *dlg,
|
||||
GtkWidget *notebook);
|
||||
|
||||
static void dlg_selector_setup_listbox (void);
|
||||
static void dlg_selector_insert (GFlare *gflare,
|
||||
|
@ -720,19 +749,30 @@ static void dlg_selector_do_delete_callback (GtkWidget *widget,
|
|||
gboolean delete,
|
||||
gpointer data);
|
||||
|
||||
static void ed_run (GFlare *target_gflare,
|
||||
GFlareEditorCallback callback,
|
||||
gpointer calldata);
|
||||
static void ed_close_callback (GtkWidget *widget, gpointer data);
|
||||
static void ed_ok_callback (GtkWidget *widget, gpointer data);
|
||||
static void ed_rescan_callback (GtkWidget *widget, gpointer data);
|
||||
static void ed_make_page_general (GFlareEditor *ed, GtkWidget *notebook);
|
||||
static void ed_make_page_glow (GFlareEditor *ed, GtkWidget *notebook);
|
||||
static void ed_make_page_rays (GFlareEditor *ed, GtkWidget *notebook);
|
||||
static void ed_make_page_sflare (GFlareEditor *ed, GtkWidget *notebook);
|
||||
static void ed_put_gradient_menu (GtkWidget *table, gint x, gint y,
|
||||
gchar *caption, GradientMenu *gm);
|
||||
static void ed_mode_menu_callback (GtkWidget *widget, gpointer data);
|
||||
static void ed_run (GFlare *target_gflare,
|
||||
GFlareEditorCallback callback,
|
||||
gpointer calldata);
|
||||
static void ed_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void ed_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void ed_rescan_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void ed_make_page_general (GFlareEditor *ed,
|
||||
GtkWidget *notebook);
|
||||
static void ed_make_page_glow (GFlareEditor *ed,
|
||||
GtkWidget *notebook);
|
||||
static void ed_make_page_rays (GFlareEditor *ed,
|
||||
GtkWidget *notebook);
|
||||
static void ed_make_page_sflare (GFlareEditor *ed,
|
||||
GtkWidget *notebook);
|
||||
static void ed_put_gradient_menu (GtkWidget *table,
|
||||
gint x,
|
||||
gint y,
|
||||
gchar *caption,
|
||||
GradientMenu *gm);
|
||||
static void ed_mode_menu_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void ed_gradient_menu_callback (gchar *gradient_name, gpointer data);
|
||||
static void ed_shape_radio_callback (GtkWidget *widget, gpointer data);
|
||||
static void ed_ientry_callback (GtkWidget *widget, gpointer data);
|
||||
|
@ -1127,20 +1167,20 @@ plugin_do_non_asupsample (void)
|
|||
}
|
||||
|
||||
static void
|
||||
plugin_do_asupsample ()
|
||||
plugin_do_asupsample (void)
|
||||
{
|
||||
tk_read = tile_keeper_new (FALSE);
|
||||
tk_write = tile_keeper_new (TRUE);
|
||||
|
||||
adaptive_supersample_area (dinfo.x1, dinfo.y1, dinfo.x2 - 1, dinfo.y2 - 1,
|
||||
pvals.asupsample_max_depth,
|
||||
pvals.asupsample_threshold,
|
||||
(render_func_t) plugin_render_func,
|
||||
NULL,
|
||||
(put_pixel_func_t) plugin_put_pixel_func,
|
||||
NULL,
|
||||
(progress_func_t) plugin_progress_func,
|
||||
NULL);
|
||||
gimp_adaptive_supersample_area (dinfo.x1, dinfo.y1, dinfo.x2 - 1, dinfo.y2 - 1,
|
||||
pvals.asupsample_max_depth,
|
||||
pvals.asupsample_threshold,
|
||||
plugin_render_func,
|
||||
NULL,
|
||||
plugin_put_pixel_func,
|
||||
NULL,
|
||||
plugin_progress_func,
|
||||
NULL);
|
||||
tile_keeper_free (tk_read);
|
||||
tile_keeper_free (tk_write);
|
||||
}
|
||||
|
@ -1153,7 +1193,10 @@ plugin_do_asupsample ()
|
|||
guchar values. */
|
||||
|
||||
static void
|
||||
plugin_render_func (double x, double y, color_t *color, gpointer data)
|
||||
plugin_render_func (gdouble x,
|
||||
gdouble y,
|
||||
GimpRGB *color,
|
||||
gpointer data)
|
||||
{
|
||||
guchar src_pix[4];
|
||||
guchar flare_pix[4];
|
||||
|
@ -1181,7 +1224,10 @@ plugin_render_func (double x, double y, color_t *color, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
plugin_put_pixel_func (int ix, int iy, color_t color, gpointer data)
|
||||
plugin_put_pixel_func (gint ix,
|
||||
gint iy,
|
||||
GimpRGB *color,
|
||||
gpointer data)
|
||||
{
|
||||
guchar *dest;
|
||||
|
||||
|
@ -1189,19 +1235,22 @@ plugin_put_pixel_func (int ix, int iy, color_t color, gpointer data)
|
|||
|
||||
if (dinfo.is_color)
|
||||
{
|
||||
dest[0] = color.r * 255;
|
||||
dest[1] = color.g * 255;
|
||||
dest[2] = color.b * 255;
|
||||
dest[0] = color->r * 255;
|
||||
dest[1] = color->g * 255;
|
||||
dest[2] = color->b * 255;
|
||||
}
|
||||
else
|
||||
dest[0] = INTENSITY (color.r, color.g, color.b) * 255;
|
||||
dest[0] = INTENSITY (color->r, color->g, color->b) * 255;
|
||||
|
||||
if (dinfo.has_alpha)
|
||||
dest[drawable->bpp - 1] = color.a * 255;
|
||||
dest[drawable->bpp - 1] = color->a * 255;
|
||||
}
|
||||
|
||||
static void
|
||||
plugin_progress_func (int y1, int y2, int curr_y, gpointer data)
|
||||
plugin_progress_func (gint y1,
|
||||
gint y2,
|
||||
gint curr_y,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_progress_update ((double) curr_y / (double) (y2 - y1));
|
||||
}
|
||||
|
@ -1459,7 +1508,8 @@ gflare_read_double (gdouble *dblvar, GFlareFile *gf)
|
|||
}
|
||||
|
||||
static void
|
||||
gflare_read_gradient_name (GradientName name, GFlareFile *gf)
|
||||
gflare_read_gradient_name (GradientName name,
|
||||
GFlareFile *gf)
|
||||
{
|
||||
gchar tmp[1024], dec[1024];
|
||||
|
||||
|
@ -1480,7 +1530,8 @@ gflare_read_gradient_name (GradientName name, GFlareFile *gf)
|
|||
}
|
||||
|
||||
static void
|
||||
gflare_read_shape (GFlareShape *shape, GFlareFile *gf)
|
||||
gflare_read_shape (GFlareShape *shape,
|
||||
GFlareFile *gf)
|
||||
{
|
||||
gchar tmp[1024];
|
||||
gint i;
|
||||
|
@ -1501,7 +1552,8 @@ gflare_read_shape (GFlareShape *shape, GFlareFile *gf)
|
|||
}
|
||||
|
||||
static void
|
||||
gflare_read_mode (GFlareMode *mode, GFlareFile *gf)
|
||||
gflare_read_mode (GFlareMode *mode,
|
||||
GFlareFile *gf)
|
||||
{
|
||||
gchar tmp[1024];
|
||||
gint i;
|
||||
|
@ -2533,8 +2585,10 @@ dlg_run (void)
|
|||
* Make sure the selector page is realized
|
||||
* This idea is from app/layers_dialog.c
|
||||
*/
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), 1);
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), 0);
|
||||
#if 0
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialization done
|
||||
|
@ -4082,7 +4136,7 @@ ed_make_page_sflare (GFlareEditor *ed,
|
|||
|
||||
entry = ed->polygon_entry = gtk_entry_new ();
|
||||
gtk_widget_set_usize (entry, ENTRY_WIDTH, 0);
|
||||
sprintf (buf, "%d", gflare->sflare_nverts);
|
||||
g_snprintf (buf, sizeof (buf), "%d", gflare->sflare_nverts);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buf);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) ed_ientry_callback,
|
||||
|
@ -4621,10 +4675,10 @@ gradient_menu_rescan ()
|
|||
{
|
||||
gm = tmp->data;
|
||||
tmp = tmp->next;
|
||||
menu = GTK_MULTI_OPTION_MENU (gm->option_menu)->menu;
|
||||
menu = GTK_OPTION_MENU (gm->option_menu)->menu;
|
||||
if (menu)
|
||||
{
|
||||
gtk_multi_option_menu_remove_menu (GTK_MULTI_OPTION_MENU (gm->option_menu));
|
||||
gtk_option_menu_remove_menu (GTK_OPTION_MENU (gm->option_menu));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4649,21 +4703,22 @@ gradient_menu_rescan ()
|
|||
GTK_WIDGET_VISIBLE)
|
||||
*/
|
||||
parent = gm->option_menu->parent;
|
||||
if (0 && (parent != NULL) && GTK_CHECK_TYPE (parent, gtk_container_get_type ()))
|
||||
if (0 && (parent != NULL) &&
|
||||
GTK_CHECK_TYPE (parent, gtk_container_get_type ()))
|
||||
{
|
||||
/*gtk_container_block_resize (GTK_CONTAINER (parent));*/
|
||||
gtk_multi_option_menu_set_menu (GTK_MULTI_OPTION_MENU (gm->option_menu), menu);
|
||||
/*gtk_container_unblock_resize (GTK_CONTAINER (parent));*/
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (gm->option_menu), menu);
|
||||
}
|
||||
else
|
||||
gtk_multi_option_menu_set_menu (GTK_MULTI_OPTION_MENU (gm->option_menu), menu);
|
||||
{
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (gm->option_menu), menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GradientMenu *
|
||||
gradient_menu_new (GradientMenuCallback callback,
|
||||
gpointer callback_data,
|
||||
gchar *default_gradient_name)
|
||||
gpointer callback_data,
|
||||
gchar *default_gradient_name)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GradientMenu *gm;
|
||||
|
@ -4678,18 +4733,19 @@ gradient_menu_new (GradientMenuCallback callback,
|
|||
GM_PREVIEW_WIDTH,
|
||||
GM_PREVIEW_HEIGHT);
|
||||
|
||||
gm->option_menu = gtk_multi_option_menu_new ();
|
||||
gm->option_menu = gtk_option_menu_new ();
|
||||
|
||||
/* @GRADIENT_NAME */
|
||||
menu = gm_menu_new (gm, default_gradient_name);
|
||||
gtk_multi_option_menu_set_menu (GTK_MULTI_OPTION_MENU (gm->option_menu), menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (gm->option_menu), menu);
|
||||
|
||||
gtk_widget_show (gm->preview);
|
||||
gtk_widget_show (gm->option_menu);
|
||||
|
||||
gradient_menus = g_list_append (gradient_menus, gm);
|
||||
gtk_signal_connect (GTK_OBJECT (gm->option_menu), "destroy",
|
||||
(GtkSignalFunc) &gm_option_menu_destroy_callback, gm);
|
||||
GTK_SIGNAL_FUNC (gm_option_menu_destroy_callback),
|
||||
gm);
|
||||
|
||||
return gm;
|
||||
}
|
||||
|
@ -4777,12 +4833,11 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
gchar **active_name_ptr,
|
||||
gchar *default_gradient_name)
|
||||
{
|
||||
GtkWidget *menu, *sub_menu;
|
||||
gchar *sub_active_name;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
gchar *name;
|
||||
gint active_i = 0;
|
||||
gint i, n;
|
||||
gint i;
|
||||
|
||||
*active_name_ptr = NULL;
|
||||
if (start_n >= num_gradient_names)
|
||||
|
@ -4794,9 +4849,10 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
this menuitem lives */
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
for (i = 0, n = start_n; i < GM_MENU_MAX && n < num_gradient_names; i++, n++)
|
||||
|
||||
for (i = 0; i < num_gradient_names; i++)
|
||||
{
|
||||
name = gradient_names[n];
|
||||
name = gradient_names[i];
|
||||
if (strcmp (name, default_gradient_name) == 0)
|
||||
{
|
||||
active_i = i;
|
||||
|
@ -4804,38 +4860,16 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
}
|
||||
menuitem = gtk_menu_item_new_with_label (name);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), gm);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (gm_menu_item_callback),
|
||||
name);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
} /* for */
|
||||
|
||||
sub_menu = gm_menu_create_sub_menus (gm, n, &sub_active_name,
|
||||
default_gradient_name);
|
||||
if (sub_menu)
|
||||
{
|
||||
active_i += 2;
|
||||
|
||||
/* hline */
|
||||
menuitem = gtk_menu_item_new ();
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_menu_prepend (GTK_MENU (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (_("More..."));
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_menu_prepend (GTK_MENU (menu), menuitem);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), sub_menu);
|
||||
|
||||
if (sub_active_name)
|
||||
{
|
||||
*active_name_ptr = sub_active_name;
|
||||
active_i = 0; /* "More ..." */
|
||||
}
|
||||
}
|
||||
|
||||
gtk_menu_set_active (GTK_MENU (menu), active_i);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
@ -5347,7 +5381,7 @@ gradient_report (void)
|
|||
{
|
||||
double total = (double) get_values_external_clock / CLOCKS_PER_SEC;
|
||||
|
||||
printf("gradient_get_values_external %.2f sec. / %d times (ave %.2f sec.)\n",
|
||||
printf ("gradient_get_values_external %.2f sec. / %d times (ave %.2f sec.)\n",
|
||||
total,
|
||||
get_values_external_count,
|
||||
total / get_values_external_count);
|
||||
|
|
|
@ -1,668 +0,0 @@
|
|||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified 97-06-26 Eiichi Takamori <taka@ma1.seikyou.ne.jp>
|
||||
GtkMultiOptionMenu, taken from GtkOptionMenu, can work with
|
||||
hierarchal menus.
|
||||
*/
|
||||
|
||||
#include "gtk/gtkmenu.h"
|
||||
#include "gtk/gtkmenuitem.h"
|
||||
#include "gtkmultioptionmenu.h"
|
||||
#include "gtk/gtksignal.h"
|
||||
|
||||
|
||||
#define CHILD_LEFT_SPACING 5
|
||||
#define CHILD_RIGHT_SPACING 1
|
||||
#define CHILD_TOP_SPACING 1
|
||||
#define CHILD_BOTTOM_SPACING 1
|
||||
#define MULTI_OPTION_INDICATOR_WIDTH 12
|
||||
#define MULTI_OPTION_INDICATOR_HEIGHT 8
|
||||
#define MULTI_OPTION_INDICATOR_SPACING 2
|
||||
|
||||
|
||||
static void gtk_multi_option_menu_class_init (GtkMultiOptionMenuClass *klass);
|
||||
static void gtk_multi_option_menu_init (GtkMultiOptionMenu *multi_option_menu);
|
||||
static void gtk_multi_option_menu_destroy (GtkObject *object);
|
||||
static void gtk_multi_option_menu_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_multi_option_menu_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_multi_option_menu_paint (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static gint gtk_multi_option_menu_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gint gtk_multi_option_menu_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static void gtk_multi_option_menu_deactivate (GtkMenuShell *menu_shell,
|
||||
GtkMultiOptionMenu *multi_option_menu);
|
||||
static void gtk_multi_option_menu_update_contents (GtkMultiOptionMenu *multi_option_menu);
|
||||
static void gtk_multi_option_menu_remove_contents (GtkMultiOptionMenu *multi_option_menu);
|
||||
static void gtk_multi_option_menu_calc_size (GtkMultiOptionMenu *multi_option_menu);
|
||||
static void gtk_multi_option_menu_calc_size_recursive (GtkMultiOptionMenu *multi_option_menu, GtkWidget *menu);
|
||||
static void gtk_multi_option_menu_position (GtkMenu *menu,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gpointer user_data);
|
||||
static void gtk_multi_option_menu_show_all (GtkWidget *widget);
|
||||
static void gtk_multi_option_menu_hide_all (GtkWidget *widget);
|
||||
|
||||
|
||||
static GtkButtonClass *parent_class = NULL;
|
||||
|
||||
|
||||
guint
|
||||
gtk_multi_option_menu_get_type ()
|
||||
{
|
||||
static guint multi_option_menu_type = 0;
|
||||
|
||||
if (!multi_option_menu_type)
|
||||
{
|
||||
GtkTypeInfo multi_option_menu_info =
|
||||
{
|
||||
"GtkMultiOptionMenu",
|
||||
sizeof (GtkMultiOptionMenu),
|
||||
sizeof (GtkMultiOptionMenuClass),
|
||||
(GtkClassInitFunc) gtk_multi_option_menu_class_init,
|
||||
(GtkObjectInitFunc) gtk_multi_option_menu_init,
|
||||
NULL,
|
||||
NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
multi_option_menu_type = gtk_type_unique (gtk_button_get_type (), &multi_option_menu_info);
|
||||
}
|
||||
|
||||
return multi_option_menu_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_class_init (GtkMultiOptionMenuClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkButtonClass *button_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
button_class = (GtkButtonClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_button_get_type ());
|
||||
|
||||
object_class->destroy = gtk_multi_option_menu_destroy;
|
||||
|
||||
widget_class->size_request = gtk_multi_option_menu_size_request;
|
||||
widget_class->size_allocate = gtk_multi_option_menu_size_allocate;
|
||||
widget_class->expose_event = gtk_multi_option_menu_expose;
|
||||
widget_class->button_press_event = gtk_multi_option_menu_button_press;
|
||||
widget_class->show_all = gtk_multi_option_menu_show_all;
|
||||
widget_class->hide_all = gtk_multi_option_menu_hide_all;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_init (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
GTK_WIDGET_UNSET_FLAGS (multi_option_menu, GTK_CAN_FOCUS);
|
||||
|
||||
multi_option_menu->menu = NULL;
|
||||
multi_option_menu->menu_item = NULL;
|
||||
multi_option_menu->width = 0;
|
||||
multi_option_menu->height = 0;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_multi_option_menu_new ()
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (gtk_multi_option_menu_get_type ()));
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_multi_option_menu_get_menu (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
g_return_val_if_fail (multi_option_menu != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu), NULL);
|
||||
|
||||
return multi_option_menu->menu;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_detacher (GtkWidget *widget,
|
||||
GtkMenu *menu)
|
||||
{
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
|
||||
g_return_if_fail (multi_option_menu->menu == (GtkWidget*) menu);
|
||||
|
||||
gtk_multi_option_menu_remove_contents (multi_option_menu);
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (multi_option_menu->menu),
|
||||
multi_option_menu);
|
||||
|
||||
multi_option_menu->menu = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_multi_option_menu_set_menu (GtkMultiOptionMenu *multi_option_menu,
|
||||
GtkWidget *menu)
|
||||
{
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
g_return_if_fail (menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
if (multi_option_menu->menu != menu)
|
||||
{
|
||||
gtk_multi_option_menu_remove_menu (multi_option_menu);
|
||||
|
||||
multi_option_menu->menu = menu;
|
||||
gtk_menu_attach_to_widget (GTK_MENU (menu),
|
||||
GTK_WIDGET (multi_option_menu),
|
||||
gtk_multi_option_menu_detacher);
|
||||
|
||||
gtk_multi_option_menu_calc_size (multi_option_menu);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (multi_option_menu->menu), "deactivate",
|
||||
(GtkSignalFunc) gtk_multi_option_menu_deactivate,
|
||||
multi_option_menu);
|
||||
|
||||
if (GTK_WIDGET (multi_option_menu)->parent)
|
||||
gtk_widget_queue_resize (GTK_WIDGET (multi_option_menu)->parent);
|
||||
|
||||
gtk_multi_option_menu_update_contents (multi_option_menu);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_multi_option_menu_remove_menu (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
if (multi_option_menu->menu)
|
||||
gtk_menu_detach (GTK_MENU (multi_option_menu->menu));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_multi_option_menu_set_history (GtkMultiOptionMenu *multi_option_menu,
|
||||
gint index)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
if (multi_option_menu->menu)
|
||||
{
|
||||
gtk_menu_set_active (GTK_MENU (multi_option_menu->menu), index);
|
||||
menu_item = gtk_menu_get_active (GTK_MENU (multi_option_menu->menu));
|
||||
|
||||
if (menu_item != multi_option_menu->menu_item)
|
||||
{
|
||||
gtk_multi_option_menu_remove_contents (multi_option_menu);
|
||||
gtk_multi_option_menu_update_contents (multi_option_menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_destroy (GtkObject *object)
|
||||
{
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (object));
|
||||
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (object);
|
||||
|
||||
if (multi_option_menu->menu)
|
||||
gtk_widget_destroy (multi_option_menu->menu);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
gint tmp;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
g_return_if_fail (requisition != NULL);
|
||||
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
|
||||
|
||||
requisition->width = ((GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->xthickness) * 2 +
|
||||
multi_option_menu->width +
|
||||
MULTI_OPTION_INDICATOR_WIDTH +
|
||||
MULTI_OPTION_INDICATOR_SPACING * 5 +
|
||||
CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING);
|
||||
requisition->height = ((GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->ythickness) * 2 +
|
||||
multi_option_menu->height +
|
||||
CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING);
|
||||
|
||||
tmp = (requisition->height - multi_option_menu->height +
|
||||
MULTI_OPTION_INDICATOR_HEIGHT + MULTI_OPTION_INDICATOR_SPACING * 2);
|
||||
requisition->height = MAX (requisition->height, tmp);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GtkAllocation child_allocation;
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
gint tmp;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
g_return_if_fail (allocation != NULL);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
child = GTK_BUTTON (widget)->child;
|
||||
if (child && GTK_WIDGET_VISIBLE (child))
|
||||
{
|
||||
if ((allocation->width <= 1) && (allocation->height <= 1))
|
||||
{
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
|
||||
|
||||
allocation->width = ((GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->xthickness) * 2 +
|
||||
multi_option_menu->width +
|
||||
MULTI_OPTION_INDICATOR_WIDTH +
|
||||
MULTI_OPTION_INDICATOR_SPACING * 5 +
|
||||
CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING);
|
||||
allocation->height = ((GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->ythickness) * 2 +
|
||||
multi_option_menu->height +
|
||||
CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING);
|
||||
|
||||
tmp = (allocation->height - multi_option_menu->height +
|
||||
MULTI_OPTION_INDICATOR_HEIGHT +
|
||||
MULTI_OPTION_INDICATOR_SPACING * 2);
|
||||
allocation->height = MAX (allocation->height, tmp);
|
||||
|
||||
}
|
||||
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->xthickness);
|
||||
child_allocation.y = (GTK_CONTAINER (widget)->border_width +
|
||||
GTK_WIDGET (widget)->style->ythickness);
|
||||
child_allocation.width = (allocation->width - child_allocation.x * 2 -
|
||||
MULTI_OPTION_INDICATOR_WIDTH - MULTI_OPTION_INDICATOR_SPACING * 5 -
|
||||
CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING);
|
||||
child_allocation.height = (allocation->height - child_allocation.y * 2 -
|
||||
CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING);
|
||||
child_allocation.x += CHILD_LEFT_SPACING;
|
||||
child_allocation.y += CHILD_RIGHT_SPACING;
|
||||
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_paint (GtkWidget *widget,
|
||||
GdkRectangle *area)
|
||||
{
|
||||
GdkRectangle restrict_area;
|
||||
GdkRectangle new_area;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
g_return_if_fail (area != NULL);
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
restrict_area.x = GTK_CONTAINER (widget)->border_width;
|
||||
restrict_area.y = GTK_CONTAINER (widget)->border_width;
|
||||
restrict_area.width = widget->allocation.width - restrict_area.x * 2;
|
||||
restrict_area.height = widget->allocation.height - restrict_area.y * 2;
|
||||
|
||||
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
|
||||
{
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
|
||||
gdk_window_clear_area (widget->window,
|
||||
new_area.x, new_area.y,
|
||||
new_area.width, new_area.height);
|
||||
|
||||
gtk_draw_shadow (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
|
||||
restrict_area.x, restrict_area.y,
|
||||
restrict_area.width, restrict_area.height);
|
||||
|
||||
gtk_draw_shadow (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
|
||||
restrict_area.x + restrict_area.width - restrict_area.x -
|
||||
MULTI_OPTION_INDICATOR_WIDTH - MULTI_OPTION_INDICATOR_SPACING * 4,
|
||||
restrict_area.y + (restrict_area.height - MULTI_OPTION_INDICATOR_HEIGHT) / 2,
|
||||
MULTI_OPTION_INDICATOR_WIDTH, MULTI_OPTION_INDICATOR_HEIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_multi_option_menu_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GdkEventExpose child_event;
|
||||
gint remove_child;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_MULTI_OPTION_MENU (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
gtk_multi_option_menu_paint (widget, &event->area);
|
||||
|
||||
remove_child = FALSE;
|
||||
child = GTK_BUTTON (widget)->child;
|
||||
|
||||
if (!child)
|
||||
{
|
||||
if (!GTK_MULTI_OPTION_MENU (widget)->menu)
|
||||
return FALSE;
|
||||
gtk_multi_option_menu_update_contents (GTK_MULTI_OPTION_MENU (widget));
|
||||
child = GTK_BUTTON (widget)->child;
|
||||
remove_child = TRUE;
|
||||
}
|
||||
|
||||
child_event = *event;
|
||||
|
||||
if (GTK_WIDGET_NO_WINDOW (child) &&
|
||||
gtk_widget_intersect (child, &event->area, &child_event.area))
|
||||
gtk_widget_event (child, (GdkEvent*) &child_event);
|
||||
|
||||
if (remove_child)
|
||||
gtk_multi_option_menu_remove_contents (GTK_MULTI_OPTION_MENU (widget));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_multi_option_menu_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_MULTI_OPTION_MENU (widget), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if ((event->type == GDK_BUTTON_PRESS) &&
|
||||
(event->button == 1))
|
||||
{
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
|
||||
gtk_multi_option_menu_remove_contents (multi_option_menu);
|
||||
gtk_menu_popup (GTK_MENU (multi_option_menu->menu), NULL, NULL,
|
||||
gtk_multi_option_menu_position, multi_option_menu,
|
||||
event->button, event->time);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_deactivate (GtkMenuShell *menu_shell,
|
||||
GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
g_return_if_fail (menu_shell != NULL);
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
gtk_multi_option_menu_update_contents (multi_option_menu);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_update_contents (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
if (multi_option_menu->menu)
|
||||
{
|
||||
gtk_multi_option_menu_remove_contents (multi_option_menu);
|
||||
|
||||
menu_item = gtk_menu_get_active (GTK_MENU (multi_option_menu->menu));
|
||||
while (menu_item && GTK_IS_MENU_ITEM (menu_item) && GTK_MENU_ITEM (menu_item)->submenu)
|
||||
{
|
||||
submenu = GTK_MENU_ITEM (menu_item)->submenu;
|
||||
menu_item = gtk_menu_get_active (GTK_MENU (submenu));
|
||||
}
|
||||
multi_option_menu->menu_item = menu_item;
|
||||
|
||||
if (multi_option_menu->menu_item)
|
||||
{
|
||||
gtk_widget_ref (multi_option_menu->menu_item);
|
||||
child = GTK_BIN (multi_option_menu->menu_item)->child;
|
||||
if (child)
|
||||
{
|
||||
/*gtk_container_block_resize (GTK_CONTAINER (multi_option_menu));*/
|
||||
if (GTK_WIDGET (multi_option_menu)->state != child->state)
|
||||
gtk_widget_set_state (child, GTK_WIDGET (multi_option_menu)->state);
|
||||
gtk_widget_reparent (child, GTK_WIDGET (multi_option_menu));
|
||||
/*gtk_container_unblock_resize (GTK_CONTAINER (multi_option_menu));*/
|
||||
}
|
||||
|
||||
gtk_widget_size_request (child, &child->requisition);
|
||||
gtk_widget_size_allocate (GTK_WIDGET (multi_option_menu),
|
||||
&(GTK_WIDGET (multi_option_menu)->allocation));
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (multi_option_menu))
|
||||
gtk_widget_queue_draw (GTK_WIDGET (multi_option_menu));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_remove_contents (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
if (GTK_BUTTON (multi_option_menu)->child)
|
||||
{
|
||||
/*gtk_container_block_resize (GTK_CONTAINER (multi_option_menu));*/
|
||||
if (GTK_WIDGET (multi_option_menu->menu_item)->state != GTK_BUTTON (multi_option_menu)->child->state)
|
||||
gtk_widget_set_state (GTK_BUTTON (multi_option_menu)->child,
|
||||
GTK_WIDGET (multi_option_menu->menu_item)->state);
|
||||
gtk_widget_unrealize (GTK_BUTTON (multi_option_menu)->child);
|
||||
gtk_widget_reparent (GTK_BUTTON (multi_option_menu)->child, multi_option_menu->menu_item);
|
||||
gtk_widget_unref (multi_option_menu->menu_item);
|
||||
multi_option_menu->menu_item = NULL;
|
||||
/*gtk_container_unblock_resize (GTK_CONTAINER (multi_option_menu));*/
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_calc_size (GtkMultiOptionMenu *multi_option_menu)
|
||||
{
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
|
||||
multi_option_menu->width = 0;
|
||||
multi_option_menu->height = 0;
|
||||
|
||||
if (multi_option_menu->menu)
|
||||
{
|
||||
gtk_multi_option_menu_calc_size_recursive (multi_option_menu, multi_option_menu->menu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_calc_size_recursive (GtkMultiOptionMenu *multi_option_menu, GtkWidget *menu)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GList *children;
|
||||
|
||||
g_return_if_fail (multi_option_menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (multi_option_menu));
|
||||
g_return_if_fail (menu != NULL);
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
children = GTK_MENU_SHELL (menu)->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (child))
|
||||
{
|
||||
gtk_widget_size_request (child, &child->requisition);
|
||||
|
||||
multi_option_menu->width = MAX (multi_option_menu->width, child->requisition.width);
|
||||
multi_option_menu->height = MAX (multi_option_menu->height, child->requisition.height);
|
||||
if (GTK_IS_MENU_ITEM (child) && GTK_MENU_ITEM (child)->submenu)
|
||||
gtk_multi_option_menu_calc_size_recursive (multi_option_menu, GTK_MENU_ITEM (child)->submenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_position (GtkMenu *menu,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
GtkWidget *active;
|
||||
GtkWidget *child;
|
||||
GList *children;
|
||||
gint shift_menu;
|
||||
gint screen_width;
|
||||
gint screen_height;
|
||||
gint menu_xpos;
|
||||
gint menu_ypos;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
g_return_if_fail (user_data != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (user_data));
|
||||
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (user_data);
|
||||
|
||||
width = GTK_WIDGET (menu)->allocation.width;
|
||||
height = GTK_WIDGET (menu)->allocation.height;
|
||||
|
||||
active = gtk_menu_get_active (GTK_MENU (multi_option_menu->menu));
|
||||
children = GTK_MENU_SHELL (multi_option_menu->menu)->children;
|
||||
gdk_window_get_origin (GTK_WIDGET (multi_option_menu)->window, &menu_xpos, &menu_ypos);
|
||||
|
||||
menu_ypos += (GTK_WIDGET (multi_option_menu)->allocation.height) / 2 - 2;
|
||||
|
||||
if (active != NULL)
|
||||
menu_ypos -= active->requisition.height / 2;
|
||||
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
if (active == child)
|
||||
break;
|
||||
|
||||
menu_ypos -= child->allocation.height;
|
||||
children = children->next;
|
||||
}
|
||||
|
||||
screen_width = gdk_screen_width ();
|
||||
screen_height = gdk_screen_height ();
|
||||
|
||||
shift_menu = FALSE;
|
||||
if (menu_ypos < 0)
|
||||
{
|
||||
menu_ypos = 0;
|
||||
shift_menu = TRUE;
|
||||
}
|
||||
else if ((menu_ypos + height) > screen_height)
|
||||
{
|
||||
menu_ypos -= ((menu_ypos + height) - screen_height);
|
||||
shift_menu = TRUE;
|
||||
}
|
||||
|
||||
if (shift_menu)
|
||||
{
|
||||
if ((menu_xpos + GTK_WIDGET (multi_option_menu)->allocation.width + width) <= screen_width)
|
||||
menu_xpos += GTK_WIDGET (multi_option_menu)->allocation.width;
|
||||
else
|
||||
menu_xpos -= width;
|
||||
}
|
||||
|
||||
if (menu_xpos < 0)
|
||||
menu_xpos = 0;
|
||||
else if ((menu_xpos + width) > screen_width)
|
||||
menu_xpos -= ((menu_xpos + width) - screen_width);
|
||||
|
||||
*x = menu_xpos;
|
||||
*y = menu_ypos;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_show_all (GtkWidget *widget)
|
||||
{
|
||||
GtkContainer *container;
|
||||
GtkMultiOptionMenu *multi_option_menu;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
container = GTK_CONTAINER (widget);
|
||||
multi_option_menu = GTK_MULTI_OPTION_MENU (widget);
|
||||
|
||||
gtk_widget_show (widget);
|
||||
gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
|
||||
if (multi_option_menu->menu)
|
||||
gtk_widget_show_all (multi_option_menu->menu);
|
||||
if (multi_option_menu->menu_item)
|
||||
gtk_widget_show_all (multi_option_menu->menu_item);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_multi_option_menu_hide_all (GtkWidget *widget)
|
||||
{
|
||||
GtkContainer *container;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MULTI_OPTION_MENU (widget));
|
||||
container = GTK_CONTAINER (widget);
|
||||
|
||||
gtk_widget_hide (widget);
|
||||
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified 97-06-26 Eiichi Takamori <taka@ma1.seikyou.ne.jp>
|
||||
GtkMultiOptionMenu, taken from GtkOptionMenu, can work with
|
||||
hierarchal menus.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_MULTI_OPTION_MENU_H__
|
||||
#define __GTK_MULTI_OPTION_MENU_H__
|
||||
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_MULTI_OPTION_MENU(obj) GTK_CHECK_CAST (obj, gtk_multi_option_menu_get_type (), GtkMultiOptionMenu)
|
||||
#define GTK_MULTI_OPTION_MENU_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_multi_option_menu_get_type (), GtkMultiOptionMenuClass)
|
||||
#define GTK_IS_MULTI_OPTION_MENU(obj) GTK_CHECK_TYPE (obj, gtk_multi_option_menu_get_type ())
|
||||
|
||||
|
||||
typedef struct _GtkMultiOptionMenu GtkMultiOptionMenu;
|
||||
typedef struct _GtkMultiOptionMenuClass GtkMultiOptionMenuClass;
|
||||
|
||||
struct _GtkMultiOptionMenu
|
||||
{
|
||||
GtkButton button;
|
||||
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
guint16 width;
|
||||
guint16 height;
|
||||
};
|
||||
|
||||
struct _GtkMultiOptionMenuClass
|
||||
{
|
||||
GtkButtonClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
guint gtk_multi_option_menu_get_type (void);
|
||||
GtkWidget* gtk_multi_option_menu_new (void);
|
||||
GtkWidget* gtk_multi_option_menu_get_menu (GtkMultiOptionMenu *multi_option_menu);
|
||||
void gtk_multi_option_menu_set_menu (GtkMultiOptionMenu *multi_option_menu,
|
||||
GtkWidget *menu);
|
||||
void gtk_multi_option_menu_remove_menu (GtkMultiOptionMenu *multi_option_menu);
|
||||
void gtk_multi_option_menu_set_history (GtkMultiOptionMenu *multi_option_menu,
|
||||
gint index);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_MULTI_OPTION_MENU_H__ */
|
|
@ -23,26 +23,40 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
||||
#include "ifscompose.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkPoint point;
|
||||
gdouble angle;
|
||||
} SortPoint;
|
||||
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
aff_element_compute_click_boundary(AffElement *elem, int num_elements,
|
||||
gdouble *points_x, gdouble *points_y);
|
||||
static guchar *
|
||||
create_brush(IfsComposeVals *ifsvals, gint *brush_size, gdouble *brush_offset);
|
||||
static void aff_element_compute_click_boundary (AffElement *elem,
|
||||
gint num_elements,
|
||||
gdouble *points_x,
|
||||
gdouble *points_y);
|
||||
static guchar * create_brush (IfsComposeVals *ifsvals,
|
||||
gint *brush_size,
|
||||
gdouble *brush_offset);
|
||||
|
||||
|
||||
void
|
||||
aff2_translate(Aff2 *naff, gdouble x, gdouble y)
|
||||
aff2_translate (Aff2 *naff,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
naff->a11 = 1.0;
|
||||
naff->a12 = 0;
|
||||
|
@ -53,7 +67,8 @@ aff2_translate(Aff2 *naff, gdouble x, gdouble y)
|
|||
}
|
||||
|
||||
void
|
||||
aff2_rotate(Aff2 *naff, gdouble theta)
|
||||
aff2_rotate (Aff2 *naff,
|
||||
gdouble theta)
|
||||
{
|
||||
naff->a11 = cos(theta);
|
||||
naff->a12 = sin(theta);
|
||||
|
@ -64,7 +79,9 @@ aff2_rotate(Aff2 *naff, gdouble theta)
|
|||
}
|
||||
|
||||
void
|
||||
aff2_scale(Aff2 *naff, gdouble s, gint flip)
|
||||
aff2_scale(Aff2 *naff,
|
||||
gdouble s,
|
||||
gint flip)
|
||||
{
|
||||
if (flip)
|
||||
naff->a11 = -s;
|
||||
|
@ -79,7 +96,9 @@ aff2_scale(Aff2 *naff, gdouble s, gint flip)
|
|||
|
||||
/* Create a unitary transform with given x-y asymmetry and shear */
|
||||
void
|
||||
aff2_distort(Aff2 *naff, gdouble asym, gdouble shear)
|
||||
aff2_distort (Aff2 *naff,
|
||||
gdouble asym,
|
||||
gdouble shear)
|
||||
{
|
||||
naff->a11 = asym;
|
||||
naff->a22 = 1/asym;
|
||||
|
@ -91,9 +110,11 @@ aff2_distort(Aff2 *naff, gdouble asym, gdouble shear)
|
|||
|
||||
/* Find a pure stretch in some directon that brings xo,yo to xn,yn */
|
||||
void
|
||||
aff2_compute_stretch(Aff2 *naff,
|
||||
gdouble xo, gdouble yo,
|
||||
gdouble xn, gdouble yn)
|
||||
aff2_compute_stretch (Aff2 *naff,
|
||||
gdouble xo,
|
||||
gdouble yo,
|
||||
gdouble xn,
|
||||
gdouble yn)
|
||||
{
|
||||
gdouble denom = xo*xn + yo*yn;
|
||||
|
||||
|
@ -116,7 +137,9 @@ aff2_compute_stretch(Aff2 *naff,
|
|||
}
|
||||
|
||||
void
|
||||
aff2_compose(Aff2 *naff, Aff2 *aff1, Aff2 *aff2)
|
||||
aff2_compose (Aff2 *naff,
|
||||
Aff2 *aff1,
|
||||
Aff2 *aff2)
|
||||
{
|
||||
naff->a11 = aff1->a11*aff2->a11 + aff1->a12*aff2->a21;
|
||||
naff->a12 = aff1->a11*aff2->a12 + aff1->a12*aff2->a22;
|
||||
|
@ -128,7 +151,8 @@ aff2_compose(Aff2 *naff, Aff2 *aff1, Aff2 *aff2)
|
|||
|
||||
/* Returns the identity matrix if the original matrix was singular */
|
||||
void
|
||||
aff2_invert(Aff2 *naff, Aff2 *aff)
|
||||
aff2_invert (Aff2 *naff,
|
||||
Aff2 *aff)
|
||||
{
|
||||
gdouble det = aff->a11*aff->a22 - aff->a12*aff->a21;
|
||||
|
||||
|
@ -148,8 +172,11 @@ aff2_invert(Aff2 *naff, Aff2 *aff)
|
|||
}
|
||||
|
||||
void
|
||||
aff2_apply(Aff2 *aff, gdouble x, gdouble y,
|
||||
gdouble *xf, gdouble *yf)
|
||||
aff2_apply (Aff2 *aff,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble *xf,
|
||||
gdouble *yf)
|
||||
{
|
||||
gdouble xt = aff->a11*x + aff->a12*y + aff->b1;
|
||||
gdouble yt = aff->a21*x + aff->a22*y + aff->b2;
|
||||
|
@ -161,7 +188,9 @@ aff2_apply(Aff2 *aff, gdouble x, gdouble y,
|
|||
(Will return garbage for pure translations) */
|
||||
|
||||
void
|
||||
aff2_fixed_point(Aff2 *aff, gdouble *xf, gdouble *yf)
|
||||
aff2_fixed_point (Aff2 *aff,
|
||||
gdouble *xf,
|
||||
gdouble *yf)
|
||||
{
|
||||
Aff2 t1,t2;
|
||||
|
||||
|
@ -177,8 +206,13 @@ aff2_fixed_point(Aff2 *aff, gdouble *xf, gdouble *yf)
|
|||
}
|
||||
|
||||
void
|
||||
aff3_apply (Aff3 *t, gdouble x, gdouble y, gdouble z,
|
||||
gdouble *xf, gdouble *yf, gdouble *zf)
|
||||
aff3_apply (Aff3 *t,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble z,
|
||||
gdouble *xf,
|
||||
gdouble *yf,
|
||||
gdouble *zf)
|
||||
{
|
||||
double xt = t->vals[0][0]*x + t->vals[0][1]*y + t->vals[0][2]*z + t->vals[0][3];
|
||||
double yt = t->vals[1][0]*x + t->vals[1][1]*y + t->vals[1][2]*z + t->vals[1][3];
|
||||
|
@ -190,7 +224,8 @@ aff3_apply (Aff3 *t, gdouble x, gdouble y, gdouble z,
|
|||
}
|
||||
|
||||
static int
|
||||
ipolygon_sort_func(const void *a, const void *b)
|
||||
ipolygon_sort_func (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
if (((SortPoint *)a)->angle < ((SortPoint *)b)->angle)
|
||||
return -1;
|
||||
|
@ -210,7 +245,7 @@ ipolygon_sort_func(const void *a, const void *b)
|
|||
*/
|
||||
|
||||
IPolygon *
|
||||
ipolygon_convex_hull(IPolygon *poly)
|
||||
ipolygon_convex_hull (IPolygon *poly)
|
||||
{
|
||||
gint num_new = poly->npoints;
|
||||
GdkPoint *new_points = g_new(GdkPoint,num_new);
|
||||
|
@ -314,7 +349,9 @@ ipolygon_convex_hull(IPolygon *poly)
|
|||
*/
|
||||
|
||||
gint
|
||||
ipolygon_contains(IPolygon *poly, gint xt, gint yt)
|
||||
ipolygon_contains (IPolygon *poly,
|
||||
gint xt,
|
||||
gint yt)
|
||||
{
|
||||
gint xnew, ynew;
|
||||
gint xold, yold;
|
||||
|
@ -357,7 +394,7 @@ ipolygon_contains(IPolygon *poly, gint xt, gint yt)
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_compute_color_trans(AffElement *elem)
|
||||
aff_element_compute_color_trans (AffElement *elem)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
|
@ -465,8 +502,11 @@ aff_element_compute_color_trans(AffElement *elem)
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_compute_trans(AffElement *elem, gdouble width, gdouble height,
|
||||
gdouble center_x, gdouble center_y)
|
||||
aff_element_compute_trans (AffElement *elem,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
gdouble center_x,
|
||||
gdouble center_y)
|
||||
{
|
||||
Aff2 t1, t2, t3;
|
||||
|
||||
|
@ -485,9 +525,12 @@ aff_element_compute_trans(AffElement *elem, gdouble width, gdouble height,
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_decompose_trans(AffElement *elem, Aff2 *aff, gdouble width,
|
||||
gdouble height, gdouble center_x,
|
||||
gdouble center_y)
|
||||
aff_element_decompose_trans (AffElement *elem,
|
||||
Aff2 *aff,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
gdouble center_x,
|
||||
gdouble center_y)
|
||||
{
|
||||
Aff2 t1,t2;
|
||||
gdouble det,scale,sign;
|
||||
|
@ -542,8 +585,10 @@ aff_element_decompose_trans(AffElement *elem, Aff2 *aff, gdouble width,
|
|||
}
|
||||
|
||||
static void
|
||||
aff_element_compute_click_boundary(AffElement *elem, int num_elements,
|
||||
gdouble *points_x, gdouble *points_y)
|
||||
aff_element_compute_click_boundary (AffElement *elem,
|
||||
int num_elements,
|
||||
gdouble *points_x,
|
||||
gdouble *points_y)
|
||||
{
|
||||
gint i;
|
||||
gdouble xtot = 0;
|
||||
|
@ -628,10 +673,11 @@ aff_element_compute_click_boundary(AffElement *elem, int num_elements,
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_compute_boundary(AffElement *elem, gint width,
|
||||
gint height,
|
||||
AffElement **elements,
|
||||
int num_elements)
|
||||
aff_element_compute_boundary (AffElement *elem,
|
||||
gint width,
|
||||
gint height,
|
||||
AffElement **elements,
|
||||
gint num_elements)
|
||||
{
|
||||
int i;
|
||||
IPolygon tmp_poly;
|
||||
|
@ -663,11 +709,14 @@ aff_element_compute_boundary(AffElement *elem, gint width,
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_draw(AffElement *elem, gint selected,
|
||||
gint width, gint height,
|
||||
GdkDrawable *win,
|
||||
GdkGC *normal_gc,GdkGC *selected_gc,
|
||||
GdkFont *font)
|
||||
aff_element_draw (AffElement *elem,
|
||||
gint selected,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkDrawable *win,
|
||||
GdkGC *normal_gc,
|
||||
GdkGC *selected_gc,
|
||||
GdkFont *font)
|
||||
{
|
||||
GdkGC *gc;
|
||||
gint string_width = gdk_string_width (font,elem->name);
|
||||
|
@ -691,7 +740,10 @@ aff_element_draw(AffElement *elem, gint selected,
|
|||
}
|
||||
|
||||
AffElement *
|
||||
aff_element_new (gdouble x, gdouble y, GimpRGB *color, gint count)
|
||||
aff_element_new (gdouble x,
|
||||
gdouble y,
|
||||
GimpRGB *color,
|
||||
gint count)
|
||||
{
|
||||
AffElement *elem = g_new(AffElement, 1);
|
||||
gchar buffer[16];
|
||||
|
@ -729,7 +781,7 @@ aff_element_new (gdouble x, gdouble y, GimpRGB *color, gint count)
|
|||
}
|
||||
|
||||
void
|
||||
aff_element_free(AffElement *elem)
|
||||
aff_element_free (AffElement *elem)
|
||||
{
|
||||
if (elem->click_boundary != elem->draw_boundary)
|
||||
g_free(elem->click_boundary);
|
||||
|
@ -742,7 +794,9 @@ static brush_chars[] = {' ',':','*','@'};
|
|||
#endif
|
||||
|
||||
static guchar *
|
||||
create_brush(IfsComposeVals *ifsvals, gint *brush_size, gdouble *brush_offset)
|
||||
create_brush (IfsComposeVals *ifsvals,
|
||||
gint *brush_size,
|
||||
gdouble *brush_offset)
|
||||
{
|
||||
gint i,j;
|
||||
gint ii,jj;
|
||||
|
@ -793,10 +847,18 @@ create_brush(IfsComposeVals *ifsvals, gint *brush_size, gdouble *brush_offset)
|
|||
}
|
||||
|
||||
void
|
||||
ifs_render(AffElement **elements, gint num_elements,
|
||||
gint width, gint height, gint nsteps,
|
||||
IfsComposeVals *vals, gint band_y, gint band_height,
|
||||
guchar *data, guchar *mask, guchar *nhits, gint preview)
|
||||
ifs_render (AffElement **elements,
|
||||
gint num_elements,
|
||||
gint width,
|
||||
gint height,
|
||||
gint nsteps,
|
||||
IfsComposeVals *vals,
|
||||
gint band_y,
|
||||
gint band_height,
|
||||
guchar *data,
|
||||
guchar *mask,
|
||||
guchar *nhits,
|
||||
gint preview)
|
||||
{
|
||||
gint i,k;
|
||||
gdouble x,y;
|
||||
|
|
Loading…
Reference in New Issue