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
|
|
|
*/
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
/*
|
2000-02-28 08:45:58 +08:00
|
|
|
* dbbrowser_utils.c
|
|
|
|
* 0.08 26th sept 97 by Thomas NOEL <thomas@minet.net>
|
|
|
|
*
|
|
|
|
* 98/12/13 Sven Neumann <sven@gimp.org> : added help display
|
|
|
|
*/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-01 23:38:59 +08:00
|
|
|
#include "config.h"
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2000-08-22 07:11:47 +08:00
|
|
|
#include <string.h>
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "dbbrowser_utils.h"
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2000-01-01 23:38:59 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
#define RESPONSE_SEARCH 1
|
|
|
|
#define RESPONSE_SEARCH_NAME 2
|
|
|
|
#define RESPONSE_SEARCH_BLURB 3
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
#define DBL_LIST_WIDTH 220
|
2002-01-13 07:05:45 +08:00
|
|
|
#define DBL_WIDTH (DBL_LIST_WIDTH + 400)
|
2001-12-29 21:26:29 +08:00
|
|
|
#define DBL_HEIGHT 250
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2002-06-14 07:40:55 +08:00
|
|
|
GtkWidget *dialog;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
GtkWidget *search_entry;
|
|
|
|
GtkWidget *descr_vbox;
|
2002-06-14 07:40:55 +08:00
|
|
|
GtkWidget *description;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
GtkListStore *store;
|
|
|
|
GtkWidget *tv;
|
|
|
|
GtkTreeSelection *sel;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
/* the currently selected procedure */
|
2002-01-13 07:05:45 +08:00
|
|
|
gchar *selected_proc_name;
|
|
|
|
gchar *selected_scheme_proc_name;
|
|
|
|
gchar *selected_proc_blurb;
|
|
|
|
gchar *selected_proc_help;
|
|
|
|
gchar *selected_proc_author;
|
|
|
|
gchar *selected_proc_copyright;
|
|
|
|
gchar *selected_proc_date;
|
|
|
|
GimpPDBProcType selected_proc_type;
|
|
|
|
gint selected_nparams;
|
|
|
|
gint selected_nreturn_vals;
|
|
|
|
GimpParamDef *selected_params;
|
2003-11-06 23:27:05 +08:00
|
|
|
GimpParamDef *selected_return_vals;
|
2000-06-02 01:34:56 +08:00
|
|
|
|
2003-06-16 19:40:11 +08:00
|
|
|
GimpDBBrowserApplyCallback apply_callback;
|
2000-02-28 08:45:58 +08:00
|
|
|
} dbbrowser_t;
|
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
static void dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
2003-03-22 09:12:48 +08:00
|
|
|
dbbrowser_t *dbbrowser);
|
2003-09-01 01:23:01 +08:00
|
|
|
static void procedure_select_callback (GtkTreeSelection *sel,
|
2003-03-22 09:12:48 +08:00
|
|
|
dbbrowser_t *dbbrowser);
|
|
|
|
static void procedure_activated_callback (GtkTreeView *treeview,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
dbbrowser_t *dbbrowser);
|
2003-11-06 23:27:05 +08:00
|
|
|
static void dialog_select (dbbrowser_t *dbbrowser,
|
2003-03-22 09:12:48 +08:00
|
|
|
gchar *proc_name);
|
|
|
|
static void convert_string (gchar *str);
|
|
|
|
static const gchar *GParamType2char (GimpPDBArgType t);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* create the dialog box
|
|
|
|
* console_entry != NULL => called from the script-fu-console
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
2001-07-30 08:46:09 +08:00
|
|
|
gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-09-01 01:23:01 +08:00
|
|
|
dbbrowser_t *dbbrowser;
|
|
|
|
GtkWidget *hpaned;
|
|
|
|
GtkWidget *searchhbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
GtkCellRenderer *renderer;
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser = g_new0 (dbbrowser_t, 1);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
dbbrowser->apply_callback = apply_callback;
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* the dialog box */
|
1998-03-14 01:46:40 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (apply_callback)
|
|
|
|
{
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->dialog =
|
|
|
|
gimp_dialog_new (_("DB Browser"), "dbbrowser",
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/dbbrowser.html",
|
2003-11-06 23:27:05 +08:00
|
|
|
|
|
|
|
_("Search by _Name"), RESPONSE_SEARCH_NAME,
|
|
|
|
_("Search by _Blurb"), RESPONSE_SEARCH_BLURB,
|
|
|
|
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
|
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
|
|
|
|
|
|
|
NULL);
|
2000-02-28 08:45:58 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->dialog =
|
|
|
|
gimp_dialog_new (_("DB Browser"), "dbbrowser",
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL, 0,
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/dbbrowser.html",
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
_("Search by _Name"), RESPONSE_SEARCH_NAME,
|
|
|
|
_("Search by _Blurb"), RESPONSE_SEARCH_BLURB,
|
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
NULL);
|
2000-02-28 08:45:58 +08:00
|
|
|
}
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (dbbrowser->dialog),
|
|
|
|
RESPONSE_SEARCH_NAME);
|
|
|
|
|
|
|
|
g_signal_connect (dbbrowser->dialog, "response",
|
|
|
|
G_CALLBACK (dialog_response),
|
|
|
|
dbbrowser);
|
|
|
|
|
2002-05-06 13:09:15 +08:00
|
|
|
/* hpaned : left=list ; right=description */
|
2001-07-30 08:46:09 +08:00
|
|
|
|
2002-05-06 13:09:15 +08:00
|
|
|
hpaned = gtk_hpaned_new ();
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dbbrowser->dialog)->vbox),
|
2002-05-06 13:09:15 +08:00
|
|
|
hpaned, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (hpaned);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* left = vbox : the list and the search entry */
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2001-07-30 08:46:09 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
2002-05-06 13:09:15 +08:00
|
|
|
gtk_paned_pack1 (GTK_PANED (hpaned), vbox, FALSE, TRUE);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* list : list in a scrolled_win */
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
2002-01-14 15:41:07 +08:00
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
GTK_SHADOW_IN);
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2001-07-30 08:46:09 +08:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
GTK_POLICY_ALWAYS);
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (scrolled_window);
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->tv = gtk_tree_view_new ();
|
2002-01-13 07:05:45 +08:00
|
|
|
|
2003-09-01 01:23:01 +08:00
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
|
|
|
gtk_cell_renderer_text_set_fixed_height_from_font
|
|
|
|
(GTK_CELL_RENDERER_TEXT (renderer), 1);
|
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (dbbrowser->tv),
|
|
|
|
-1, NULL,
|
2003-09-01 01:23:01 +08:00
|
|
|
renderer,
|
|
|
|
"text", 0,
|
|
|
|
NULL);
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
|
|
|
|
2003-03-22 09:12:48 +08:00
|
|
|
if (apply_callback)
|
|
|
|
g_signal_connect (dbbrowser->tv, "row_activated",
|
|
|
|
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
|
|
|
gtk_widget_show (dbbrowser->tv);
|
|
|
|
|
|
|
|
dbbrowser->sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (dbbrowser->tv));
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (dbbrowser->sel, "changed",
|
2002-01-13 07:05:45 +08:00
|
|
|
G_CALLBACK (procedure_select_callback), dbbrowser);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* search entry */
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
searchhbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), searchhbox, FALSE, FALSE, 2);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (searchhbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (_("_Search:"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (searchhbox), label, FALSE, FALSE, 2);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
dbbrowser->search_entry = gtk_entry_new ();
|
2003-01-31 11:08:29 +08:00
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (dbbrowser->search_entry), TRUE);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (searchhbox), dbbrowser->search_entry,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (dbbrowser->search_entry);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dbbrowser->search_entry);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* right = description */
|
|
|
|
|
2001-07-30 08:46:09 +08:00
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_widget_set_size_request (scrolled_window, DBL_WIDTH - DBL_LIST_WIDTH, -1);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2003-11-06 23:27:05 +08:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
2000-02-28 08:45:58 +08:00
|
|
|
GTK_POLICY_ALWAYS);
|
2002-05-06 13:09:15 +08:00
|
|
|
gtk_paned_pack2 (GTK_PANED (hpaned), scrolled_window, TRUE, TRUE);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (scrolled_window);
|
|
|
|
|
|
|
|
dbbrowser->descr_vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (dbbrowser->descr_vbox), 4);
|
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
dbbrowser->descr_vbox);
|
|
|
|
gtk_widget_show (dbbrowser->descr_vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* now build the list */
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_widget_show (dbbrowser->dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* initialize the "return" value (for "apply") */
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->description = NULL;
|
2001-07-30 08:46:09 +08:00
|
|
|
dbbrowser->selected_proc_name = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
dbbrowser->selected_scheme_proc_name = NULL;
|
2001-07-30 08:46:09 +08:00
|
|
|
dbbrowser->selected_proc_blurb = NULL;
|
|
|
|
dbbrowser->selected_proc_help = NULL;
|
|
|
|
dbbrowser->selected_proc_author = NULL;
|
|
|
|
dbbrowser->selected_proc_copyright = NULL;
|
|
|
|
dbbrowser->selected_proc_date = NULL;
|
|
|
|
dbbrowser->selected_proc_type = 0;
|
|
|
|
dbbrowser->selected_nparams = 0;
|
|
|
|
dbbrowser->selected_nreturn_vals = 0;
|
|
|
|
dbbrowser->selected_params = NULL;
|
|
|
|
dbbrowser->selected_return_vals = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* first search (all procedures) */
|
2003-11-06 23:27:05 +08:00
|
|
|
dialog_response (dbbrowser->dialog, RESPONSE_SEARCH, dbbrowser);
|
1998-03-14 01:46:40 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
return dbbrowser->dialog;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-03-22 09:12:48 +08:00
|
|
|
static void
|
|
|
|
procedure_activated_callback (GtkTreeView *treeview,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeViewColumn *column,
|
|
|
|
dbbrowser_t *dbbrowser)
|
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
dialog_response (dbbrowser->dialog, GTK_RESPONSE_APPLY, dbbrowser);
|
2003-03-22 09:12:48 +08:00
|
|
|
}
|
|
|
|
|
2003-09-01 01:23:01 +08:00
|
|
|
static void
|
2002-01-13 07:05:45 +08:00
|
|
|
procedure_select_callback (GtkTreeSelection *sel,
|
|
|
|
dbbrowser_t *dbbrowser)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-01-13 07:05:45 +08:00
|
|
|
GtkTreeIter iter;
|
2001-07-30 08:46:09 +08:00
|
|
|
gchar *func;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-09-01 01:23:01 +08:00
|
|
|
g_return_if_fail (sel != NULL);
|
|
|
|
g_return_if_fail (dbbrowser != NULL);
|
1998-03-22 18:03:12 +08:00
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
if (gtk_tree_selection_get_selected (sel, NULL, &iter))
|
|
|
|
{
|
2002-01-30 16:31:00 +08:00
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (dbbrowser->store), &iter,
|
|
|
|
1, &func,
|
|
|
|
-1);
|
2002-01-13 07:05:45 +08:00
|
|
|
dialog_select (dbbrowser, func);
|
|
|
|
g_free (func);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* update the description box (right) */
|
2003-11-06 23:27:05 +08:00
|
|
|
static void
|
|
|
|
dialog_select (dbbrowser_t *dbbrowser,
|
1997-11-25 06:05:25 +08:00
|
|
|
gchar *proc_name)
|
|
|
|
{
|
2002-06-14 07:40:55 +08:00
|
|
|
GtkWidget *old_description;
|
2002-01-13 07:05:45 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *sep;
|
|
|
|
gint i;
|
|
|
|
gint row = 0;
|
|
|
|
const gchar *type;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
g_free (dbbrowser->selected_proc_name);
|
|
|
|
dbbrowser->selected_proc_name = g_strdup (proc_name);
|
|
|
|
|
|
|
|
g_free (dbbrowser->selected_scheme_proc_name);
|
|
|
|
dbbrowser->selected_scheme_proc_name = g_strdup (proc_name);
|
|
|
|
convert_string (dbbrowser->selected_scheme_proc_name);
|
|
|
|
|
|
|
|
g_free (dbbrowser->selected_proc_blurb);
|
|
|
|
g_free (dbbrowser->selected_proc_help);
|
|
|
|
g_free (dbbrowser->selected_proc_author);
|
|
|
|
g_free (dbbrowser->selected_proc_copyright);
|
|
|
|
g_free (dbbrowser->selected_proc_date);
|
|
|
|
g_free (dbbrowser->selected_params);
|
|
|
|
g_free (dbbrowser->selected_return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
gimp_procedural_db_proc_info (proc_name,
|
2003-06-16 19:40:11 +08:00
|
|
|
&dbbrowser->selected_proc_blurb,
|
|
|
|
&dbbrowser->selected_proc_help,
|
|
|
|
&dbbrowser->selected_proc_author,
|
|
|
|
&dbbrowser->selected_proc_copyright,
|
|
|
|
&dbbrowser->selected_proc_date,
|
|
|
|
&dbbrowser->selected_proc_type,
|
|
|
|
&dbbrowser->selected_nparams,
|
|
|
|
&dbbrowser->selected_nreturn_vals,
|
|
|
|
&dbbrowser->selected_params,
|
|
|
|
&dbbrowser->selected_return_vals);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* save the "old" table */
|
2002-06-14 07:40:55 +08:00
|
|
|
old_description = dbbrowser->description;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->description = gtk_table_new (10 +
|
2001-07-30 08:46:09 +08:00
|
|
|
dbbrowser->selected_nparams +
|
|
|
|
dbbrowser->selected_nreturn_vals,
|
|
|
|
5, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (dbbrowser->description), 6);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (dbbrowser->description), 0, 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* show the name */
|
|
|
|
|
2002-01-13 07:05:45 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_scheme_proc_name);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Name:"), 1.0, 0.5,
|
2002-01-13 07:05:45 +08:00
|
|
|
label, 3, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* show the description */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_proc_blurb);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Blurb:"), 1.0, 0.5,
|
|
|
|
label, 3, FALSE);
|
|
|
|
|
|
|
|
sep = gtk_hseparator_new ();
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), sep,
|
2002-01-13 07:05:45 +08:00
|
|
|
0, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 6);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (sep);
|
1997-11-25 06:05:25 +08:00
|
|
|
row++;
|
|
|
|
|
|
|
|
/* in parameters */
|
2003-11-06 23:27:05 +08:00
|
|
|
if (dbbrowser->selected_nparams)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("In:"));
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2003-11-06 23:27:05 +08:00
|
|
|
0, 1, row, row + (dbbrowser->selected_nparams),
|
2001-07-30 08:46:09 +08:00
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
for (i = 0; i < dbbrowser->selected_nparams; i++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* name */
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new ((dbbrowser->selected_params[i]).name);
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* type */
|
2002-01-13 07:05:45 +08:00
|
|
|
type = GParamType2char ((dbbrowser->selected_params[i]).type);
|
|
|
|
label = gtk_label_new (type);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
2, 3, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* description */
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new ((dbbrowser->selected_params[i]).description);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
3, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
row++;
|
|
|
|
}
|
|
|
|
}
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
if ((dbbrowser->selected_nparams) &&
|
2000-02-28 08:45:58 +08:00
|
|
|
(dbbrowser->selected_nreturn_vals))
|
|
|
|
{
|
2001-07-30 08:46:09 +08:00
|
|
|
sep = gtk_hseparator_new ();
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), sep,
|
2002-01-13 07:05:45 +08:00
|
|
|
0, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 6);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (sep);
|
2000-02-28 08:45:58 +08:00
|
|
|
row++;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* out parameters */
|
|
|
|
if (dbbrowser->selected_nreturn_vals)
|
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Out:"));
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2003-11-06 23:27:05 +08:00
|
|
|
0, 1, row, row + (dbbrowser->selected_nreturn_vals),
|
2001-07-30 08:46:09 +08:00
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
for (i = 0; i < dbbrowser->selected_nreturn_vals; i++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* name */
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new ((dbbrowser->selected_return_vals[i]).name);
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* type */
|
2002-01-13 07:05:45 +08:00
|
|
|
type = GParamType2char (dbbrowser->selected_return_vals[i].type);
|
|
|
|
label = gtk_label_new (type);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
2, 3, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* description */
|
2001-07-30 08:46:09 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_return_vals[i].description);
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), label,
|
2002-01-13 07:05:45 +08:00
|
|
|
3, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
row++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
if (dbbrowser->selected_nparams ||
|
2001-07-30 08:46:09 +08:00
|
|
|
dbbrowser->selected_nreturn_vals)
|
2000-02-28 08:45:58 +08:00
|
|
|
{
|
2001-07-30 08:46:09 +08:00
|
|
|
sep = gtk_hseparator_new ();
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), sep,
|
2002-01-13 07:05:45 +08:00
|
|
|
0, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 6);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (sep);
|
|
|
|
row++;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
/* show the help */
|
2001-07-30 08:46:09 +08:00
|
|
|
if (dbbrowser->selected_proc_help &&
|
2000-02-28 08:45:58 +08:00
|
|
|
(strlen (dbbrowser->selected_proc_help) > 1))
|
1998-12-14 04:16:01 +08:00
|
|
|
{
|
2002-01-13 07:05:45 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_proc_help);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Help:"), 1.0, 0.5,
|
2002-01-13 07:05:45 +08:00
|
|
|
label, 3, FALSE);
|
2001-07-30 08:46:09 +08:00
|
|
|
|
|
|
|
sep = gtk_hseparator_new ();
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->description), sep,
|
2002-01-13 07:05:45 +08:00
|
|
|
0, 4, row, row + 1, GTK_FILL, GTK_FILL, 0, 6);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (sep);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
row++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* show the author & the copyright */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_proc_author);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (dbbrowser->description), row, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Author:"), 1.0, 0.5,
|
|
|
|
label, 3, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_proc_date);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (dbbrowser->description), row, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Date:"), 1.0, 0.5,
|
|
|
|
label, 3, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (dbbrowser->selected_proc_copyright);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (dbbrowser->description), row, 2);
|
|
|
|
gimp_table_attach_aligned (GTK_TABLE (dbbrowser->description), 0, row++,
|
2001-07-30 08:46:09 +08:00
|
|
|
_("Copyright:"), 1.0, 0.5,
|
|
|
|
label, 3, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
if (old_description)
|
|
|
|
gtk_container_remove (GTK_CONTAINER (dbbrowser->descr_vbox),
|
|
|
|
old_description);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (dbbrowser->descr_vbox),
|
|
|
|
dbbrowser->description, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (dbbrowser->description);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialog_show_message (dbbrowser_t *dbbrowser,
|
|
|
|
const gchar *message)
|
|
|
|
{
|
|
|
|
if (dbbrowser->description && GTK_IS_LABEL (dbbrowser->description))
|
|
|
|
{
|
|
|
|
gtk_label_set_text (GTK_LABEL (dbbrowser->description), message);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dbbrowser->description)
|
|
|
|
gtk_container_remove (GTK_CONTAINER (dbbrowser->descr_vbox),
|
|
|
|
dbbrowser->description);
|
2003-06-16 19:40:11 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
dbbrowser->description = gtk_label_new (message);
|
|
|
|
gtk_box_pack_start (GTK_BOX (dbbrowser->descr_vbox),
|
|
|
|
dbbrowser->description, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (dbbrowser->description);
|
|
|
|
}
|
1998-12-14 04:16:01 +08:00
|
|
|
|
2002-06-14 07:40:55 +08:00
|
|
|
while (gtk_events_pending ())
|
|
|
|
gtk_main_iteration ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-06 23:27:05 +08:00
|
|
|
dialog_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
dbbrowser_t *dbbrowser)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
switch (response_id)
|
2000-02-28 08:45:58 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
case GTK_RESPONSE_APPLY:
|
|
|
|
(dbbrowser->apply_callback) (dbbrowser->selected_proc_name,
|
|
|
|
dbbrowser->selected_scheme_proc_name,
|
|
|
|
dbbrowser->selected_proc_blurb,
|
|
|
|
dbbrowser->selected_proc_help,
|
|
|
|
dbbrowser->selected_proc_author,
|
|
|
|
dbbrowser->selected_proc_copyright,
|
|
|
|
dbbrowser->selected_proc_date,
|
|
|
|
dbbrowser->selected_proc_type,
|
|
|
|
dbbrowser->selected_nparams,
|
|
|
|
dbbrowser->selected_nreturn_vals,
|
|
|
|
dbbrowser->selected_params,
|
|
|
|
dbbrowser->selected_return_vals);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESPONSE_SEARCH:
|
|
|
|
case RESPONSE_SEARCH_NAME:
|
|
|
|
case RESPONSE_SEARCH_BLURB:
|
|
|
|
{
|
|
|
|
gchar **proc_list;
|
|
|
|
gint num_procs;
|
|
|
|
gint i;
|
|
|
|
gchar *label;
|
|
|
|
const gchar *query_text;
|
|
|
|
GString *query;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
|
|
|
|
|
|
|
/* search */
|
|
|
|
|
|
|
|
if (response_id == RESPONSE_SEARCH_NAME)
|
|
|
|
{
|
|
|
|
dialog_show_message (dbbrowser,
|
|
|
|
_("Searching by name - please wait"));
|
|
|
|
|
|
|
|
query = g_string_new ("");
|
|
|
|
query_text = gtk_entry_get_text (GTK_ENTRY (dbbrowser->search_entry));
|
|
|
|
|
|
|
|
while (*query_text)
|
|
|
|
{
|
|
|
|
if ((*query_text == '_') || (*query_text == '-'))
|
|
|
|
g_string_append (query, "[-_]");
|
|
|
|
else
|
|
|
|
g_string_append_c (query, *query_text);
|
|
|
|
|
|
|
|
query_text++;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_procedural_db_query (query->str,
|
|
|
|
".*", ".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
|
|
|
|
|
|
|
g_string_free (query, TRUE);
|
|
|
|
}
|
|
|
|
else if (response_id == RESPONSE_SEARCH_BLURB)
|
|
|
|
{
|
|
|
|
dialog_show_message (dbbrowser,
|
|
|
|
_("Searching by blurb - please wait"));
|
|
|
|
|
|
|
|
gimp_procedural_db_query (".*",
|
|
|
|
(gchar *) gtk_entry_get_text
|
|
|
|
(GTK_ENTRY (dbbrowser->search_entry)),
|
|
|
|
".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dialog_show_message (dbbrowser, _("Searching - please wait"));
|
|
|
|
|
|
|
|
gimp_procedural_db_query (".*", ".*", ".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
|
|
|
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
|
|
|
GTK_TREE_MODEL (dbbrowser->store));
|
|
|
|
g_object_unref (dbbrowser->store);
|
|
|
|
|
|
|
|
for (i = 0; i < num_procs; i++)
|
|
|
|
{
|
|
|
|
label = g_strdup (proc_list[i]);
|
|
|
|
convert_string (label);
|
|
|
|
gtk_list_store_append (dbbrowser->store, &iter);
|
|
|
|
gtk_list_store_set (dbbrowser->store, &iter,
|
|
|
|
0, label,
|
|
|
|
1, proc_list[i],
|
|
|
|
-1);
|
|
|
|
g_free (label);
|
|
|
|
g_free (proc_list[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (proc_list);
|
|
|
|
|
|
|
|
/* now sort the store */
|
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dbbrowser->store),
|
|
|
|
0, GTK_SORT_ASCENDING);
|
|
|
|
|
|
|
|
if (num_procs > 0)
|
|
|
|
{
|
|
|
|
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (dbbrowser->store), &iter);
|
|
|
|
gtk_tree_selection_select_iter (dbbrowser->sel, &iter);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dialog_show_message (dbbrowser, _("No matches"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (dbbrowser->apply_callback)
|
|
|
|
{
|
|
|
|
/* we are called by another application : just destroy the dialog box */
|
|
|
|
gtk_widget_destroy (dbbrowser->dialog);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* we are in the plug_in : kill the gtk application */
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
break;
|
2002-06-14 07:40:55 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* utils ... */
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
static void
|
2000-02-28 08:45:58 +08:00
|
|
|
convert_string (gchar *str)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
2002-01-13 07:05:45 +08:00
|
|
|
if (*str == '_')
|
|
|
|
*str = '-';
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
static const gchar *
|
2000-08-22 08:13:56 +08:00
|
|
|
GParamType2char (GimpPDBArgType t)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
switch (t)
|
|
|
|
{
|
2002-01-13 07:05:45 +08:00
|
|
|
case GIMP_PDB_INT32: return "INT32";
|
|
|
|
case GIMP_PDB_INT16: return "INT16";
|
|
|
|
case GIMP_PDB_INT8: return "INT8";
|
|
|
|
case GIMP_PDB_FLOAT: return "FLOAT";
|
|
|
|
case GIMP_PDB_STRING: return "STRING";
|
|
|
|
case GIMP_PDB_INT32ARRAY: return "INT32ARRAY";
|
|
|
|
case GIMP_PDB_INT16ARRAY: return "INT16ARRAY";
|
|
|
|
case GIMP_PDB_INT8ARRAY: return "INT8ARRAY";
|
|
|
|
case GIMP_PDB_FLOATARRAY: return "FLOATARRAY";
|
2000-08-22 08:13:56 +08:00
|
|
|
case GIMP_PDB_STRINGARRAY: return "STRINGARRAY";
|
2002-01-13 07:05:45 +08:00
|
|
|
case GIMP_PDB_COLOR: return "COLOR";
|
|
|
|
case GIMP_PDB_REGION: return "REGION";
|
|
|
|
case GIMP_PDB_DISPLAY: return "DISPLAY";
|
|
|
|
case GIMP_PDB_IMAGE: return "IMAGE";
|
|
|
|
case GIMP_PDB_LAYER: return "LAYER";
|
|
|
|
case GIMP_PDB_CHANNEL: return "CHANNEL";
|
|
|
|
case GIMP_PDB_DRAWABLE: return "DRAWABLE";
|
|
|
|
case GIMP_PDB_SELECTION: return "SELECTION";
|
|
|
|
case GIMP_PDB_BOUNDARY: return "BOUNDARY";
|
|
|
|
case GIMP_PDB_PATH: return "PATH";
|
|
|
|
case GIMP_PDB_PARASITE: return "PARASITE";
|
|
|
|
case GIMP_PDB_STATUS: return "STATUS";
|
|
|
|
case GIMP_PDB_END: return "END";
|
|
|
|
default: return "UNKNOWN?";
|
2000-02-28 08:45:58 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|