1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <string.h>
|
1999-10-27 02:27:27 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "apptypes.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
2001-02-12 11:27:28 +08:00
|
|
|
#include "context_manager.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "dialog_handler.h"
|
2001-02-06 01:48:50 +08:00
|
|
|
#include "gimpcontainer.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "gimpcontext.h"
|
2001-02-19 03:44:28 +08:00
|
|
|
#include "gimpdatafactoryview.h"
|
2001-02-14 03:53:07 +08:00
|
|
|
#include "gimpdatafactory.h"
|
2001-02-05 01:34:30 +08:00
|
|
|
#include "gimppattern.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "pattern_select.h"
|
1998-06-23 01:30:40 +08:00
|
|
|
#include "session.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "temp_buf.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-01-22 05:58:16 +08:00
|
|
|
#include "pdb/procedural_db.h"
|
|
|
|
|
1998-12-16 08:37:09 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1999-04-29 16:50:22 +08:00
|
|
|
#define MIN_CELL_SIZE 32
|
2001-02-13 02:05:12 +08:00
|
|
|
#define STD_PATTERN_COLUMNS 6
|
|
|
|
#define STD_PATTERN_ROWS 5
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
2001-02-13 02:05:12 +08:00
|
|
|
static void pattern_select_change_callbacks (PatternSelect *psp,
|
|
|
|
gboolean closing);
|
|
|
|
|
|
|
|
static void pattern_select_pattern_changed (GimpContext *context,
|
|
|
|
GimpPattern *pattern,
|
|
|
|
PatternSelect *psp);
|
2001-02-05 01:34:30 +08:00
|
|
|
|
|
|
|
static void pattern_select_pattern_dirty_callback (GimpPattern *brush,
|
|
|
|
PatternSelect *psp);
|
2001-02-13 02:05:12 +08:00
|
|
|
|
|
|
|
static void pattern_select_update_active_pattern_field (PatternSelect *psp);
|
|
|
|
|
|
|
|
static void pattern_select_close_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* The main pattern selection dialog */
|
|
|
|
PatternSelect *pattern_select_dialog = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-23 22:47:50 +08:00
|
|
|
/* local variables */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-23 22:47:50 +08:00
|
|
|
/* List of active dialogs */
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-24 04:54:02 +08:00
|
|
|
GSList *pattern_active_dialogs = NULL;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2001-02-13 02:05:12 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
void
|
|
|
|
pattern_dialog_create (void)
|
|
|
|
{
|
|
|
|
if (! pattern_select_dialog)
|
|
|
|
{
|
|
|
|
pattern_select_dialog = pattern_select_new (NULL, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_VISIBLE (pattern_select_dialog->shell))
|
|
|
|
gtk_widget_show (pattern_select_dialog->shell);
|
|
|
|
else
|
|
|
|
gdk_window_raise (pattern_select_dialog->shell->window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-02-05 01:34:30 +08:00
|
|
|
pattern_dialog_free (void)
|
1999-10-27 02:27:27 +08:00
|
|
|
{
|
|
|
|
if (pattern_select_dialog)
|
|
|
|
{
|
1999-10-28 23:05:49 +08:00
|
|
|
session_get_window_info (pattern_select_dialog->shell,
|
|
|
|
&pattern_select_session_info);
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern_select_free (pattern_select_dialog);
|
|
|
|
pattern_select_dialog = NULL;
|
|
|
|
}
|
|
|
|
}
|
1999-04-23 22:47:50 +08:00
|
|
|
|
2001-02-13 02:05:12 +08:00
|
|
|
|
1999-04-23 22:47:50 +08:00
|
|
|
/* If title == NULL then it is the main pattern dialog */
|
1999-10-27 02:27:27 +08:00
|
|
|
PatternSelect *
|
1999-04-23 22:47:50 +08:00
|
|
|
pattern_select_new (gchar *title,
|
|
|
|
gchar *initial_pattern)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
PatternSelect *psp;
|
2001-02-13 02:05:12 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *label_box;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-05 01:34:30 +08:00
|
|
|
GimpPattern *active = NULL;
|
1999-10-27 02:27:27 +08:00
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
static gboolean first_call = TRUE;
|
|
|
|
|
2001-02-13 02:05:12 +08:00
|
|
|
psp = g_new0 (PatternSelect, 1);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* The shell */
|
|
|
|
psp->shell = gimp_dialog_new (title ? title : _("Pattern Selection"),
|
|
|
|
"pattern_selection",
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/pattern_selection.html",
|
2000-01-30 07:06:06 +08:00
|
|
|
title ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_NONE,
|
1999-10-27 02:27:27 +08:00
|
|
|
FALSE, TRUE, FALSE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2001-02-14 22:57:14 +08:00
|
|
|
"_delete_event_", pattern_select_close_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
psp, NULL, NULL, TRUE, TRUE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
NULL);
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2001-02-14 22:57:14 +08:00
|
|
|
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox)), 0)));
|
|
|
|
|
|
|
|
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (title)
|
|
|
|
{
|
|
|
|
psp->context = gimp_context_new (title, NULL);
|
1998-10-02 06:09:01 +08:00
|
|
|
}
|
1999-09-28 01:58:10 +08:00
|
|
|
else
|
|
|
|
{
|
1999-10-28 23:05:49 +08:00
|
|
|
psp->context = gimp_context_get_user ();
|
1999-09-28 01:58:10 +08:00
|
|
|
|
|
|
|
session_set_window_geometry (psp->shell, &pattern_select_session_info,
|
|
|
|
TRUE);
|
1999-10-28 23:05:49 +08:00
|
|
|
dialog_register (psp->shell);
|
1999-10-27 02:27:27 +08:00
|
|
|
}
|
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
if (no_data && first_call)
|
2001-02-14 09:42:12 +08:00
|
|
|
gimp_data_factory_data_init (global_pattern_factory, FALSE);
|
1999-10-27 02:27:27 +08:00
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
first_call = FALSE;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (title && initial_pattern && strlen (initial_pattern))
|
|
|
|
{
|
2001-02-06 01:48:50 +08:00
|
|
|
active = (GimpPattern *)
|
2001-02-14 03:53:07 +08:00
|
|
|
gimp_container_get_child_by_name (global_pattern_factory->container,
|
2001-02-06 01:48:50 +08:00
|
|
|
initial_pattern);
|
1999-10-27 02:27:27 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
active = gimp_context_get_pattern (gimp_context_get_user ());
|
1999-09-28 01:58:10 +08:00
|
|
|
}
|
1998-10-02 06:09:01 +08:00
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
if (!active)
|
2001-02-13 08:12:15 +08:00
|
|
|
active = gimp_context_get_pattern (gimp_context_get_standard ());
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (title)
|
2001-02-13 08:12:15 +08:00
|
|
|
gimp_context_set_pattern (psp->context, active);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-04-29 16:50:22 +08:00
|
|
|
/* The main vbox */
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), vbox);
|
|
|
|
|
|
|
|
/* Options box */
|
|
|
|
psp->options_box = gtk_vbox_new (FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), psp->options_box, FALSE, FALSE, 0);
|
2001-02-13 02:05:12 +08:00
|
|
|
gtk_widget_show (psp->options_box);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the active pattern label */
|
1999-04-29 16:50:22 +08:00
|
|
|
label_box = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (psp->options_box), label_box, FALSE, FALSE, 2);
|
2001-02-13 02:05:12 +08:00
|
|
|
gtk_widget_show (label_box);
|
1999-04-29 16:50:22 +08:00
|
|
|
|
1999-11-14 18:50:19 +08:00
|
|
|
psp->pattern_name = gtk_label_new (_("No Patterns available"));
|
1999-04-29 16:50:22 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (label_box), psp->pattern_name, FALSE, FALSE, 4);
|
1999-04-23 22:47:50 +08:00
|
|
|
psp->pattern_size = gtk_label_new ("(0 X 0)");
|
1999-04-29 16:50:22 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (label_box), psp->pattern_size, FALSE, FALSE, 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (psp->pattern_name);
|
|
|
|
gtk_widget_show (psp->pattern_size);
|
|
|
|
|
2001-02-13 02:05:12 +08:00
|
|
|
/* The Brush Grid */
|
2001-02-14 22:57:14 +08:00
|
|
|
psp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
|
|
|
global_pattern_factory,
|
|
|
|
NULL,
|
|
|
|
psp->context,
|
|
|
|
MIN_CELL_SIZE,
|
|
|
|
STD_PATTERN_COLUMNS,
|
|
|
|
STD_PATTERN_ROWS);
|
2001-02-13 02:05:12 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), psp->view, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (psp->view);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (vbox);
|
2001-02-05 01:34:30 +08:00
|
|
|
|
|
|
|
/* add callbacks to keep the display area current */
|
|
|
|
psp->name_changed_handler_id =
|
2001-02-14 03:53:07 +08:00
|
|
|
gimp_container_add_handler
|
|
|
|
(global_pattern_factory->container, "name_changed",
|
2001-02-05 01:34:30 +08:00
|
|
|
GTK_SIGNAL_FUNC (pattern_select_pattern_dirty_callback),
|
|
|
|
psp);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (psp->shell);
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (psp->context), "pattern_changed",
|
|
|
|
GTK_SIGNAL_FUNC (pattern_select_pattern_changed),
|
|
|
|
psp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (active)
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_update_active_pattern_field (psp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* Add to active pattern dialogs list */
|
|
|
|
pattern_active_dialogs = g_slist_append (pattern_active_dialogs, psp);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return psp;
|
|
|
|
}
|
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
void
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern_select_free (PatternSelect *psp)
|
|
|
|
{
|
|
|
|
if (!psp)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* remove from active list */
|
|
|
|
pattern_active_dialogs = g_slist_remove (pattern_active_dialogs, psp);
|
|
|
|
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (psp->context), psp);
|
|
|
|
|
|
|
|
if (psp->callback_name)
|
|
|
|
{
|
|
|
|
g_free (psp->callback_name);
|
|
|
|
gtk_object_unref (GTK_OBJECT (psp->context));
|
|
|
|
}
|
|
|
|
|
2001-02-14 03:53:07 +08:00
|
|
|
gimp_container_remove_handler (global_pattern_factory->container,
|
2001-02-05 01:34:30 +08:00
|
|
|
psp->name_changed_handler_id);
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
g_free (psp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call this dialog's PDB callback */
|
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
static void
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_change_callbacks (PatternSelect *psp,
|
|
|
|
gboolean closing)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2001-02-05 01:34:30 +08:00
|
|
|
gchar *name;
|
|
|
|
ProcRecord *prec = NULL;
|
|
|
|
GimpPattern *pattern;
|
|
|
|
gint nreturn_vals;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
static gboolean busy = FALSE;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
/* Any procs registered to callback? */
|
|
|
|
Argument *return_vals;
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
if (!psp || !psp->callback_name || busy)
|
1998-10-02 06:09:01 +08:00
|
|
|
return;
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
busy = TRUE;
|
2001-02-13 02:05:12 +08:00
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
name = psp->callback_name;
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern = gimp_context_get_pattern (psp->context);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
/* If its still registered run it */
|
1999-10-27 02:27:27 +08:00
|
|
|
prec = procedural_db_lookup (name);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (prec && pattern)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
return_vals =
|
|
|
|
procedural_db_run_proc (name,
|
|
|
|
&nreturn_vals,
|
2001-02-05 01:34:30 +08:00
|
|
|
PDB_STRING, GIMP_OBJECT (pattern)->name,
|
1999-10-28 23:05:49 +08:00
|
|
|
PDB_INT32, pattern->mask->width,
|
|
|
|
PDB_INT32, pattern->mask->height,
|
|
|
|
PDB_INT32, pattern->mask->bytes,
|
2001-02-13 02:05:12 +08:00
|
|
|
PDB_INT32, (pattern->mask->bytes *
|
|
|
|
pattern->mask->height *
|
|
|
|
pattern->mask->width),
|
1999-10-27 02:27:27 +08:00
|
|
|
PDB_INT8ARRAY, temp_buf_data (pattern->mask),
|
1999-10-28 23:05:49 +08:00
|
|
|
PDB_INT32, (gint) closing,
|
1999-10-27 02:27:27 +08:00
|
|
|
PDB_END);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
|
1999-06-06 07:41:45 +08:00
|
|
|
g_warning ("failed to run pattern callback function");
|
2001-02-13 02:05:12 +08:00
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
procedural_db_destroy_args (return_vals, nreturn_vals);
|
|
|
|
}
|
2001-02-13 02:05:12 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
busy = FALSE;
|
1998-10-02 06:09:01 +08:00
|
|
|
}
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* Close active dialogs that no longer have PDB registered for them */
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_dialogs_check (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
PatternSelect *psp;
|
2001-02-05 01:34:30 +08:00
|
|
|
GSList *list;
|
|
|
|
gchar *name;
|
|
|
|
ProcRecord *prec = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
list = pattern_active_dialogs;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
while (list)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
psp = (PatternSelect *) list->data;
|
1999-10-28 23:05:49 +08:00
|
|
|
list = g_slist_next (list);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
name = psp->callback_name;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (name)
|
|
|
|
{
|
|
|
|
prec = procedural_db_lookup (name);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (!prec)
|
|
|
|
{
|
|
|
|
/* Can alter pattern_active_dialogs list */
|
|
|
|
pattern_select_close_callback (NULL, psp);
|
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
1999-05-02 05:37:34 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
static void
|
|
|
|
pattern_select_pattern_changed (GimpContext *context,
|
2001-02-05 01:34:30 +08:00
|
|
|
GimpPattern *pattern,
|
1999-10-27 02:27:27 +08:00
|
|
|
PatternSelect *psp)
|
|
|
|
{
|
|
|
|
if (pattern)
|
1999-10-29 22:15:55 +08:00
|
|
|
{
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_update_active_pattern_field (psp);
|
1999-10-29 22:15:55 +08:00
|
|
|
|
|
|
|
if (psp->callback_name)
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_change_callbacks (psp, FALSE);
|
1999-10-29 22:15:55 +08:00
|
|
|
}
|
1999-10-27 02:27:27 +08:00
|
|
|
}
|
|
|
|
|
2001-02-05 01:34:30 +08:00
|
|
|
static void
|
|
|
|
pattern_select_pattern_dirty_callback (GimpPattern *pattern,
|
|
|
|
PatternSelect *psp)
|
|
|
|
{
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_update_active_pattern_field (psp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_update_active_pattern_field (PatternSelect *psp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-05 01:34:30 +08:00
|
|
|
GimpPattern *pattern;
|
|
|
|
gchar buf[32];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern = gimp_context_get_pattern (psp->context);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!pattern)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Set pattern name */
|
2001-02-05 01:34:30 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (psp->pattern_name),
|
|
|
|
GIMP_OBJECT (pattern)->name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Set pattern size */
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_snprintf (buf, sizeof (buf), "(%d X %d)",
|
|
|
|
pattern->mask->width, pattern->mask->height);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (psp->pattern_size), buf);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
static void
|
|
|
|
pattern_select_close_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
PatternSelect *psp;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
psp = (PatternSelect *) data;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (GTK_WIDGET_VISIBLE (psp->shell))
|
|
|
|
gtk_widget_hide (psp->shell);
|
|
|
|
|
|
|
|
/* Free memory if poping down dialog which is not the main one */
|
|
|
|
if (psp != pattern_select_dialog)
|
|
|
|
{
|
|
|
|
/* Send data back */
|
2001-02-13 02:05:12 +08:00
|
|
|
pattern_select_change_callbacks (psp, TRUE);
|
1999-10-27 02:27:27 +08:00
|
|
|
gtk_widget_destroy (psp->shell);
|
|
|
|
pattern_select_free (psp);
|
|
|
|
}
|
|
|
|
}
|