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-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>
|
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
|
|
|
/* configuration */
|
|
|
|
|
|
|
|
#define DBL_LIST_WIDTH 220
|
|
|
|
#define DBL_WIDTH DBL_LIST_WIDTH+400
|
|
|
|
#define DBL_HEIGHT 250
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* end of configuration */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *label;
|
|
|
|
gchar *func;
|
|
|
|
} ListEntry_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GtkWidget *dlg;
|
|
|
|
|
|
|
|
GtkWidget *search_entry;
|
|
|
|
GtkWidget *name_button;
|
|
|
|
GtkWidget *blurb_button;
|
|
|
|
|
|
|
|
GtkWidget *descr_scroll;
|
|
|
|
GtkWidget *descr_table;
|
|
|
|
|
|
|
|
GtkWidget *clist;
|
|
|
|
GtkWidget *scrolled_win;
|
|
|
|
|
|
|
|
/* the currently selected procedure */
|
2000-06-02 01:34:56 +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;
|
|
|
|
GimpParamDef *selected_return_vals;
|
|
|
|
|
|
|
|
void (* apply_callback) (gchar *proc_name,
|
|
|
|
gchar *scheme_proc_name,
|
|
|
|
gchar *proc_blurb,
|
|
|
|
gchar *proc_help,
|
|
|
|
gchar *proc_author,
|
|
|
|
gchar *proc_copyright,
|
|
|
|
gchar *proc_date,
|
|
|
|
GimpPDBProcType proc_type,
|
|
|
|
gint nparams,
|
|
|
|
gint nreturn_vals,
|
|
|
|
GimpParamDef *params,
|
|
|
|
GimpParamDef *return_vals);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
} dbbrowser_t;
|
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
|
|
|
|
static void dialog_apply_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static gint procedure_select_callback (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data);
|
|
|
|
static void dialog_search_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void dialog_select (dbbrowser_t *dbbrowser,
|
|
|
|
gchar *proc_name);
|
|
|
|
static void dialog_close_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void convert_string (gchar *str);
|
|
|
|
static gchar * GParamType2char (GParamType t);
|
|
|
|
|
|
|
|
GList * proc_table = NULL;
|
|
|
|
|
|
|
|
/* create the dialog box
|
|
|
|
* console_entry != NULL => called from the script-fu-console
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
2000-06-02 01:34:56 +08:00
|
|
|
gimp_db_browser (void (* apply_callback) (gchar *proc_name,
|
|
|
|
gchar *scheme_proc_name,
|
|
|
|
gchar *proc_blurb,
|
|
|
|
gchar *proc_help,
|
|
|
|
gchar *proc_author,
|
|
|
|
gchar *proc_copyright,
|
|
|
|
gchar *proc_date,
|
|
|
|
GimpPDBProcType proc_type,
|
|
|
|
gint nparams,
|
|
|
|
gint nreturn_vals,
|
|
|
|
GimpParamDef *params,
|
|
|
|
GimpParamDef *return_vals))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
dbbrowser_t* dbbrowser;
|
|
|
|
|
2000-03-26 02:49:05 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *searchhbox;
|
|
|
|
GtkWidget *vbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *label;
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
dbbrowser = g_new (dbbrowser_t, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
dbbrowser->apply_callback = apply_callback;
|
|
|
|
|
|
|
|
/* the dialog box */
|
1998-03-14 01:46:40 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (apply_callback)
|
|
|
|
{
|
|
|
|
dbbrowser->dlg =
|
|
|
|
gimp_dialog_new (_("DB Browser (init...)"), "dbbrowser",
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/dbbrowser.html",
|
2000-02-28 08:45:58 +08:00
|
|
|
GTK_WIN_POS_MOUSE,
|
|
|
|
FALSE, TRUE, FALSE,
|
|
|
|
|
|
|
|
_("Search by Name"), dialog_search_callback,
|
|
|
|
dbbrowser, NULL, &dbbrowser->name_button, TRUE, FALSE,
|
|
|
|
_("Search by Blurb"), dialog_search_callback,
|
|
|
|
dbbrowser, NULL, &dbbrowser->blurb_button, FALSE, FALSE,
|
|
|
|
_("Apply"), dialog_apply_callback,
|
|
|
|
dbbrowser, NULL, NULL, FALSE, FALSE,
|
|
|
|
_("Close"), dialog_close_callback,
|
|
|
|
dbbrowser, NULL, NULL, FALSE, TRUE,
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dbbrowser->dlg =
|
|
|
|
gimp_dialog_new (_("DB Browser (init...)"), "dbbrowser",
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/dbbrowser.html",
|
2000-02-28 08:45:58 +08:00
|
|
|
GTK_WIN_POS_MOUSE,
|
|
|
|
FALSE, TRUE, FALSE,
|
|
|
|
|
|
|
|
_("Search by Name"), dialog_search_callback,
|
|
|
|
dbbrowser, NULL, &dbbrowser->name_button, TRUE, FALSE,
|
|
|
|
_("Search by Blurb"), dialog_search_callback,
|
|
|
|
dbbrowser, NULL, &dbbrowser->blurb_button, FALSE, FALSE,
|
|
|
|
_("Close"), dialog_close_callback,
|
|
|
|
dbbrowser, NULL, NULL, FALSE, TRUE,
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (dbbrowser->dlg), "destroy",
|
2000-02-28 08:45:58 +08:00
|
|
|
GTK_SIGNAL_FUNC (dialog_close_callback),
|
1997-11-25 06:05:25 +08:00
|
|
|
dbbrowser);
|
|
|
|
|
|
|
|
/* hbox : left=list ; right=description */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dbbrowser->dlg)->vbox),
|
|
|
|
hbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* left = vbox : the list and the search entry */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
|
|
|
vbox, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show(vbox);
|
|
|
|
|
|
|
|
/* list : list in a scrolled_win */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
dbbrowser->clist = gtk_clist_new (1);
|
1998-11-06 08:51:39 +08:00
|
|
|
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
|
|
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
1998-03-22 18:03:12 +08:00
|
|
|
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
|
|
|
GTK_SELECTION_BROWSE);
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_set_usize (dbbrowser->clist, DBL_LIST_WIDTH, DBL_HEIGHT);
|
1998-03-22 18:03:12 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
|
|
|
(GtkSignalFunc) procedure_select_callback,
|
|
|
|
dbbrowser);
|
1998-11-06 08:51:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (dbbrowser->clist);
|
|
|
|
gtk_widget_show (dbbrowser->scrolled_win);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* search entry */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
searchhbox = gtk_hbox_new (FALSE, 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
searchhbox, FALSE, TRUE, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (searchhbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Search:"));
|
|
|
|
gtk_misc_set_alignment( GTK_MISC (label), 0.0, 0.5);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (searchhbox),
|
|
|
|
label, TRUE, TRUE, 0);
|
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 ();
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (searchhbox),
|
|
|
|
dbbrowser->search_entry, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(dbbrowser->search_entry);
|
|
|
|
|
|
|
|
/* right = description */
|
|
|
|
|
|
|
|
dbbrowser->descr_scroll = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll),
|
|
|
|
GTK_POLICY_ALWAYS,
|
2000-02-28 08:45:58 +08:00
|
|
|
GTK_POLICY_ALWAYS);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
|
|
|
dbbrowser->descr_scroll, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_set_usize (dbbrowser->descr_scroll, DBL_WIDTH - DBL_LIST_WIDTH, 0);
|
|
|
|
gtk_widget_show (dbbrowser->descr_scroll);
|
|
|
|
|
|
|
|
/* now build the list */
|
|
|
|
|
1998-03-22 18:03:12 +08:00
|
|
|
gtk_widget_show (dbbrowser->clist);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (dbbrowser->dlg);
|
|
|
|
|
|
|
|
/* initialize the "return" value (for "apply") */
|
|
|
|
|
|
|
|
dbbrowser->descr_table = NULL;
|
|
|
|
dbbrowser->selected_proc_name = NULL;
|
|
|
|
dbbrowser->selected_scheme_proc_name = NULL;
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* first search (all procedures) */
|
2000-02-28 08:45:58 +08:00
|
|
|
dialog_search_callback (NULL, (gpointer) dbbrowser);
|
1998-03-14 01:46:40 +08:00
|
|
|
|
|
|
|
return dbbrowser->dlg;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-02-28 08:45:58 +08:00
|
|
|
procedure_select_callback (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
dbbrowser_t *dbbrowser = data;
|
1998-03-23 07:36:35 +08:00
|
|
|
gchar *func;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
1998-03-27 21:20:10 +08:00
|
|
|
/* g_return_val_if_fail (bevent != NULL, FALSE); */
|
1997-11-25 06:05:25 +08:00
|
|
|
g_return_val_if_fail (dbbrowser != NULL, FALSE);
|
1998-03-22 18:03:12 +08:00
|
|
|
|
1998-03-23 07:36:35 +08:00
|
|
|
if ((func = (gchar *) (gtk_clist_get_row_data (GTK_CLIST (widget), row))))
|
2000-02-28 08:45:58 +08:00
|
|
|
dialog_select (dbbrowser, func);
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* update the description box (right) */
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
dialog_select (dbbrowser_t *dbbrowser,
|
|
|
|
gchar *proc_name)
|
|
|
|
{
|
1998-12-14 04:16:01 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *old_table;
|
|
|
|
GtkWidget *help;
|
|
|
|
GtkWidget *text = NULL;
|
|
|
|
GtkWidget *vscrollbar;
|
2000-02-28 08:45:58 +08:00
|
|
|
gint i, row = 0;
|
|
|
|
|
|
|
|
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
|
|
|
|
2000-08-08 05:30:35 +08:00
|
|
|
gimp_procedural_db_proc_info (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));
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* save the "old" table */
|
|
|
|
old_table = dbbrowser->descr_table;
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
dbbrowser->descr_table = gtk_table_new
|
|
|
|
(10 + dbbrowser->selected_nparams + dbbrowser->selected_nreturn_vals,
|
|
|
|
5, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (dbbrowser->descr_table), 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* show the name */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Name:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1, GTK_FILL, GTK_FILL, 3, 6);
|
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
|
|
|
label = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (label), dbbrowser->selected_scheme_proc_name);
|
|
|
|
gtk_entry_set_editable (GTK_ENTRY (label), FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
1, 4, 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
|
|
|
row++;
|
|
|
|
|
|
|
|
/* show the description */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Blurb:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1, GTK_FILL, GTK_FILL, 3, 0);
|
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
|
|
|
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);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
1, 4, 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
|
|
|
row++;
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_hseparator_new (); /* ok, not really a label ... :) */
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 4, row, row+1, GTK_FILL, GTK_FILL, 3, 6);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
row++;
|
|
|
|
|
|
|
|
/* in parameters */
|
|
|
|
if (dbbrowser->selected_nparams)
|
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("In:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
2000-02-28 08:45:58 +08:00
|
|
|
0, 1, row, row+(dbbrowser->selected_nparams),
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
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);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
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 */
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (GParamType2char ((dbbrowser->selected_params[i]).type));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
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);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
3, 4, 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
|
|
|
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
}
|
2000-02-28 08:45:58 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if ((dbbrowser->selected_nparams) &&
|
2000-02-28 08:45:58 +08:00
|
|
|
(dbbrowser->selected_nreturn_vals))
|
|
|
|
{
|
|
|
|
label = gtk_hseparator_new (); /* ok, not really a label ... :) */
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 4, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 6);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
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:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+(dbbrowser->selected_nreturn_vals),
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
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);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
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 */
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (GParamType2char((dbbrowser->selected_return_vals[i]).type));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
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_return_vals[i]).description);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
3, 4, 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
|
|
|
row++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((dbbrowser->selected_nparams) ||
|
2000-02-28 08:45:58 +08:00
|
|
|
(dbbrowser->selected_nreturn_vals))
|
|
|
|
{
|
|
|
|
label = gtk_hseparator_new (); /* ok, not really a label ... :) */
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 4, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 6);
|
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
row++;
|
|
|
|
}
|
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
/* show the help */
|
2000-02-28 08:45:58 +08:00
|
|
|
if ((dbbrowser->selected_proc_help) &&
|
|
|
|
(strlen (dbbrowser->selected_proc_help) > 1))
|
1998-12-14 04:16:01 +08:00
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Help:"));
|
1998-12-14 04:16:01 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
help = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (help), 0, 2);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (help), 0, 2);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), help,
|
|
|
|
1, 4, row, row+1, GTK_FILL, GTK_FILL, 3, 0);
|
|
|
|
gtk_widget_show (help);
|
|
|
|
row++;
|
|
|
|
|
|
|
|
text = gtk_text_new (NULL, NULL);
|
|
|
|
gtk_text_set_editable (GTK_TEXT (text), FALSE);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_text_set_word_wrap (GTK_TEXT (text), TRUE);
|
1998-12-14 04:16:01 +08:00
|
|
|
gtk_widget_set_usize (text, -1, 60);
|
|
|
|
gtk_table_attach (GTK_TABLE (help), text, 0, 1, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (text);
|
|
|
|
|
|
|
|
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
|
|
|
|
gtk_table_attach (GTK_TABLE (help), vscrollbar, 1, 2, 0, 1,
|
|
|
|
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (vscrollbar);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
label = gtk_hseparator_new (); /* ok, not really a label ... :) */
|
1998-12-14 04:16:01 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 4, row, row+1, GTK_FILL, GTK_FILL, 3, 6);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
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 (_("Author:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
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
|
|
|
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);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
1, 4, 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
|
|
|
row++;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
|
|
|
label = gtk_label_new (_("Date:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
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
|
|
|
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);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
1, 4, 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
|
|
|
row++;
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
label = gtk_label_new (_("Copyright:"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
0, 1, row, row+1,
|
|
|
|
GTK_FILL, GTK_FILL, 3, 0);
|
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
|
|
|
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);
|
|
|
|
gtk_table_attach (GTK_TABLE (dbbrowser->descr_table), label,
|
|
|
|
1, 4, 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
|
|
|
row++;
|
|
|
|
|
1998-11-28 14:44:59 +08:00
|
|
|
if (old_table)
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_destroy (old_table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-11-28 14:44:59 +08:00
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll),
|
|
|
|
dbbrowser->descr_table);
|
1998-12-14 04:16:01 +08:00
|
|
|
|
|
|
|
/* now after the table is added to a window add the text */
|
|
|
|
if (text != NULL)
|
|
|
|
{
|
|
|
|
gtk_widget_realize (text);
|
|
|
|
gtk_text_freeze (GTK_TEXT (text));
|
|
|
|
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL,
|
|
|
|
dbbrowser->selected_proc_help, -1);
|
|
|
|
gtk_text_thaw (GTK_TEXT (text));
|
|
|
|
}
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (dbbrowser->descr_table);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* end of the dialog */
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
dialog_close_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
dbbrowser_t* dbbrowser = data;
|
1998-03-22 18:03:12 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (dbbrowser->apply_callback)
|
|
|
|
{
|
|
|
|
/* we are called by another application : just kill the dialog box */
|
|
|
|
gtk_widget_hide (dbbrowser->dlg);
|
|
|
|
gtk_widget_destroy (dbbrowser->dlg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* we are in the plug_in : kill the gtk application */
|
|
|
|
gtk_widget_destroy (dbbrowser->dlg);
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
1998-02-22 18:06:01 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* end of the dialog */
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
dialog_apply_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
dbbrowser_t* dbbrowser = data;
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
(dbbrowser->apply_callback) (dbbrowser->selected_proc_name,
|
1997-11-25 06:05:25 +08:00
|
|
|
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,
|
2000-02-28 08:45:58 +08:00
|
|
|
dbbrowser->selected_return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
/* search in the whole db */
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
dialog_search_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
gchar **proc_list;
|
|
|
|
gint num_procs;
|
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
dbbrowser_t* dbbrowser = data;
|
1998-07-14 14:15:10 +08:00
|
|
|
gchar *func_name, *label, *query_text;
|
|
|
|
GString *query;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_clist_freeze (GTK_CLIST (dbbrowser->clist));
|
|
|
|
gtk_clist_clear (GTK_CLIST (dbbrowser->clist));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* search */
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (widget == (dbbrowser->name_button))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
|
2000-01-01 23:38:59 +08:00
|
|
|
_("DB Browser (by name - please wait)"));
|
1998-07-14 14:15:10 +08:00
|
|
|
|
|
|
|
query = g_string_new ("");
|
2000-02-28 08:45:58 +08:00
|
|
|
query_text = gtk_entry_get_text (GTK_ENTRY (dbbrowser->search_entry));
|
1998-07-14 14:15:10 +08:00
|
|
|
|
|
|
|
while (*query_text)
|
|
|
|
{
|
|
|
|
if ((*query_text == '_') || (*query_text == '-'))
|
|
|
|
g_string_append (query, "[-_]");
|
|
|
|
else
|
|
|
|
g_string_append_c (query, *query_text);
|
|
|
|
|
|
|
|
query_text++;
|
|
|
|
}
|
|
|
|
|
2000-08-22 07:11:47 +08:00
|
|
|
gimp_procedural_db_query (query->str,
|
|
|
|
".*", ".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
1998-07-14 14:15:10 +08:00
|
|
|
|
|
|
|
g_string_free (query, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-02-28 08:45:58 +08:00
|
|
|
else if (widget == (dbbrowser->blurb_button))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
|
2000-01-01 23:38:59 +08:00
|
|
|
_("DB Browser (by blurb - please wait)"));
|
2000-08-22 07:11:47 +08:00
|
|
|
gimp_procedural_db_query (".*",
|
|
|
|
gtk_entry_get_text(
|
|
|
|
GTK_ENTRY(dbbrowser->search_entry) ),
|
|
|
|
".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-02-28 08:45:58 +08:00
|
|
|
else
|
|
|
|
{
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
|
2000-01-01 23:38:59 +08:00
|
|
|
_("DB Browser (please wait)"));
|
2000-08-22 07:11:47 +08:00
|
|
|
gimp_procedural_db_query (".*", ".*", ".*", ".*", ".*", ".*", ".*",
|
|
|
|
&num_procs, &proc_list);
|
2000-02-28 08:45:58 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
for (i = 0; i < num_procs; i++)
|
|
|
|
{
|
|
|
|
j = 0;
|
|
|
|
while ((j < i) &&
|
|
|
|
(strcmp (gtk_clist_get_row_data (GTK_CLIST (dbbrowser->clist), j),
|
|
|
|
proc_list[i]) < 0))
|
|
|
|
j++;
|
|
|
|
|
|
|
|
label = g_strdup (proc_list[i]);
|
|
|
|
convert_string (label);
|
|
|
|
gtk_clist_insert (GTK_CLIST (GTK_CLIST(dbbrowser->clist)), j,
|
|
|
|
&label);
|
|
|
|
func_name = g_strdup (proc_list[i]);
|
|
|
|
|
|
|
|
gtk_clist_set_row_data_full (GTK_CLIST (dbbrowser->clist), j,
|
|
|
|
func_name, g_free);
|
|
|
|
}
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (num_procs > 0)
|
|
|
|
{
|
|
|
|
dialog_select (dbbrowser,
|
|
|
|
gtk_clist_get_row_data (GTK_CLIST (dbbrowser->clist), 0));
|
|
|
|
gtk_clist_select_row (GTK_CLIST (dbbrowser->clist), 0, 0);
|
|
|
|
}
|
1998-03-23 07:36:35 +08:00
|
|
|
|
|
|
|
/*
|
1997-11-25 06:05:25 +08:00
|
|
|
if (num_procs != 0) {
|
|
|
|
gchar *insert_name, *label_name;
|
|
|
|
int i,j,savej;
|
|
|
|
|
|
|
|
for (i = 0; i < num_procs ; i++) {
|
|
|
|
|
|
|
|
insert_name=g_strdup(proc_list[0]); savej=0;
|
|
|
|
for (j = 0; j < num_procs ; j++) {
|
|
|
|
if (strcmp(proc_list[j],insert_name)<0) {
|
|
|
|
g_free(insert_name);
|
|
|
|
insert_name=g_strdup(proc_list[j]);
|
|
|
|
savej=j;
|
|
|
|
}
|
|
|
|
}
|
1998-03-23 07:36:35 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
proc_list[savej][0]='\255';
|
|
|
|
|
|
|
|
label_name = g_strdup( insert_name );
|
|
|
|
convert_string( label_name );
|
1998-03-22 18:03:12 +08:00
|
|
|
gtk_clist_append (GTK_CLIST (dbbrowser->clist), &label_name);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (i==0) dialog_select( dbbrowser , insert_name );
|
|
|
|
|
|
|
|
g_free(label_name);
|
|
|
|
}
|
|
|
|
}
|
1998-03-23 07:36:35 +08:00
|
|
|
*/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
if (dbbrowser->clist)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
g_free (proc_list);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-01 23:38:59 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg), _("DB Browser"));
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_clist_thaw (GTK_CLIST (dbbrowser->clist));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* utils ... */
|
|
|
|
|
|
|
|
static void
|
2000-02-28 08:45:58 +08:00
|
|
|
convert_string (gchar *str)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
while (*str)
|
|
|
|
{
|
|
|
|
if (*str == '_') *str = '-';
|
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
static gchar *
|
|
|
|
GParamType2char (GParamType t)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-28 08:45:58 +08:00
|
|
|
switch (t)
|
|
|
|
{
|
|
|
|
case PARAM_INT32: return "INT32";
|
|
|
|
case PARAM_INT16: return "INT16";
|
|
|
|
case PARAM_INT8: return "INT8";
|
|
|
|
case PARAM_FLOAT: return "FLOAT";
|
|
|
|
case PARAM_STRING: return "STRING";
|
|
|
|
case PARAM_INT32ARRAY: return "INT32ARRAY";
|
|
|
|
case PARAM_INT16ARRAY: return "INT16ARRAY";
|
|
|
|
case PARAM_INT8ARRAY: return "INT8ARRAY";
|
|
|
|
case PARAM_FLOATARRAY: return "FLOATARRAY";
|
|
|
|
case PARAM_STRINGARRAY: return "STRINGARRAY";
|
|
|
|
case PARAM_COLOR: return "COLOR";
|
|
|
|
case PARAM_REGION: return "REGION";
|
|
|
|
case PARAM_DISPLAY: return "DISPLAY";
|
|
|
|
case PARAM_IMAGE: return "IMAGE";
|
|
|
|
case PARAM_LAYER: return "LAYER";
|
|
|
|
case PARAM_CHANNEL: return "CHANNEL";
|
|
|
|
case PARAM_DRAWABLE: return "DRAWABLE";
|
|
|
|
case PARAM_SELECTION: return "SELECTION";
|
|
|
|
case PARAM_BOUNDARY: return "BOUNDARY";
|
|
|
|
case PARAM_PATH: return "PATH";
|
|
|
|
case PARAM_PARASITE: return "PARASITE";
|
|
|
|
case PARAM_STATUS: return "STATUS";
|
|
|
|
case PARAM_END: return "END";
|
|
|
|
default: return "UNKNOWN?";
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|