2005-08-03 01:06:49 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2005-08-03 01:06:49 +08:00
|
|
|
* gimpprocview.c
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2005-08-03 01:06:49 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2005-08-03 01:06:49 +08:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
1997-11-25 06:05:25 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2005-08-03 01:06:49 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
2005-08-03 01:06:49 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
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
|
|
|
|
2013-11-02 05:29:46 +08:00
|
|
|
#include <gegl.h>
|
2000-02-28 08:45:58 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2005-08-03 00:49:42 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2005-08-03 00:49:42 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
#include "gimpuitypes.h"
|
2004-09-30 08:33:34 +08:00
|
|
|
#include "gimpprocview.h"
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2005-08-03 00:49:42 +08:00
|
|
|
#include "libgimp-intl.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2010-07-07 17:48:10 +08:00
|
|
|
/**
|
|
|
|
* SECTION: gimpprocview
|
|
|
|
* @title: GimpProcView
|
|
|
|
* @short_description: A widget showing information about a PDB procedure.
|
|
|
|
*
|
|
|
|
* A widget showing information about a PDB procedure, mainly for the
|
|
|
|
* procedure and plug-in browsers.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* local function prototypes */
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2008-09-04 20:23:36 +08:00
|
|
|
static GtkWidget * gimp_proc_view_create_params (const GimpParamDef *params,
|
|
|
|
gint n_params,
|
|
|
|
GtkSizeGroup *name_group,
|
|
|
|
GtkSizeGroup *type_group,
|
|
|
|
GtkSizeGroup *desc_group);
|
2019-08-05 20:17:18 +08:00
|
|
|
static GtkWidget * gimp_proc_view_create_args (const gchar *procedure_name,
|
|
|
|
gint n_args,
|
|
|
|
gboolean return_values,
|
|
|
|
GtkSizeGroup *name_group,
|
|
|
|
GtkSizeGroup *type_group,
|
|
|
|
GtkSizeGroup *desc_group);
|
1998-03-23 07:36:35 +08:00
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2008-11-01 03:47:31 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_proc_view_new:
|
2019-08-05 20:17:18 +08:00
|
|
|
* @procedure_name: The name of a procedure.
|
|
|
|
* @menu_path: (nullable): The procedure's menu path, or %NULL.
|
2008-11-01 03:47:31 +08:00
|
|
|
*
|
2019-08-03 06:10:14 +08:00
|
|
|
* Returns: (transfer full): a new widget providing a view on a
|
2019-08-05 20:17:18 +08:00
|
|
|
* GIMP procedure
|
2008-11-01 03:47:31 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2008-11-01 03:47:31 +08:00
|
|
|
**/
|
2000-02-28 08:45:58 +08:00
|
|
|
GtkWidget *
|
2019-08-05 20:17:18 +08:00
|
|
|
gimp_proc_view_new (const gchar *procedure_name,
|
|
|
|
const gchar *menu_path)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-08-05 20:17:18 +08:00
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *grid;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkSizeGroup *name_group;
|
|
|
|
GtkSizeGroup *type_group;
|
|
|
|
GtkSizeGroup *desc_group;
|
|
|
|
gchar *blurb;
|
|
|
|
gchar *help;
|
|
|
|
gchar *author;
|
|
|
|
gchar *copyright;
|
|
|
|
gchar *date;
|
|
|
|
GimpPDBProcType type;
|
|
|
|
gint n_params;
|
|
|
|
gint n_return_vals;
|
|
|
|
GimpParamDef *params;
|
|
|
|
GimpParamDef *return_vals;
|
|
|
|
const gchar *type_str;
|
|
|
|
gint row;
|
|
|
|
|
|
|
|
g_return_val_if_fail (procedure_name != NULL, NULL);
|
|
|
|
|
2019-08-06 18:50:08 +08:00
|
|
|
gimp_pdb_proc_info (procedure_name,
|
|
|
|
&blurb,
|
|
|
|
&help,
|
|
|
|
&author,
|
|
|
|
©right,
|
|
|
|
&date,
|
|
|
|
&type,
|
|
|
|
&n_params,
|
|
|
|
&n_return_vals,
|
|
|
|
¶ms,
|
|
|
|
&return_vals);
|
2019-08-05 20:17:18 +08:00
|
|
|
|
|
|
|
if (blurb && strlen (blurb) < 2) g_clear_pointer (&blurb, g_free);
|
|
|
|
if (help && strlen (help) < 2) g_clear_pointer (&help, g_free);
|
|
|
|
if (author && strlen (author) < 2) g_clear_pointer (&author, g_free);
|
|
|
|
if (date && strlen (date) < 2) g_clear_pointer (&date, g_free);
|
|
|
|
if (copyright && strlen (copyright) < 2) g_clear_pointer (©right, g_free);
|
2004-09-30 20:02:44 +08:00
|
|
|
|
|
|
|
if (blurb && help && ! strcmp (blurb, help))
|
2019-08-05 20:17:18 +08:00
|
|
|
g_clear_pointer (&help, g_free);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2011-09-30 16:53:32 +08:00
|
|
|
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* show the name */
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2019-08-05 20:17:18 +08:00
|
|
|
frame = gimp_frame_new (procedure_name);
|
2004-09-30 08:33:34 +08:00
|
|
|
label = gtk_frame_get_label_widget (GTK_FRAME (frame));
|
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2011-09-30 16:53:32 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2001-07-30 08:46:09 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2005-05-14 23:10:47 +08:00
|
|
|
if (! gimp_enum_get_value (GIMP_TYPE_PDB_PROC_TYPE, type,
|
|
|
|
NULL, NULL, &type_str, NULL))
|
|
|
|
type_str = "UNKNOWN";
|
|
|
|
|
|
|
|
label = gtk_label_new (type_str);
|
2004-09-30 08:33:34 +08:00
|
|
|
gimp_label_set_attributes (GTK_LABEL (label),
|
|
|
|
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
|
|
|
-1);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (menu_path)
|
2002-01-13 07:05:45 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (menu_path);
|
2005-04-05 22:49:03 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2002-01-13 07:05:45 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (blurb)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
label = gtk_label_new (blurb);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 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
|
|
|
|
2019-08-05 20:17:18 +08:00
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), notebook, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
|
|
|
gtk_label_new (_("GValue-based API")));
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
name_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
type_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
desc_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
|
|
|
|
/* in parameters */
|
|
|
|
if (n_params)
|
|
|
|
{
|
|
|
|
frame = gimp_frame_new (_("Parameters"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
grid = gimp_proc_view_create_args (procedure_name, n_params, FALSE,
|
|
|
|
name_group, type_group, desc_group);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* out parameters */
|
|
|
|
if (n_return_vals)
|
|
|
|
{
|
|
|
|
frame = gimp_frame_new (_("Return Values"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
grid = gimp_proc_view_create_args (procedure_name, n_return_vals, TRUE,
|
|
|
|
name_group, type_group, desc_group);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (name_group);
|
|
|
|
g_object_unref (type_group);
|
|
|
|
g_object_unref (desc_group);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
|
|
|
gtk_label_new (_("Legacy API")));
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
name_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
type_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
desc_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
|
|
|
|
/* in parameters */
|
|
|
|
if (n_params)
|
2000-02-28 08:45:58 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
frame = gimp_frame_new (_("Parameters"));
|
2019-08-05 20:17:18 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
grid = gimp_proc_view_create_params (params, n_params,
|
|
|
|
name_group, type_group, desc_group);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
2000-02-28 08:45:58 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* out parameters */
|
2004-09-30 08:33:34 +08:00
|
|
|
if (n_return_vals)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
frame = gimp_frame_new (_("Return Values"));
|
2019-08-05 20:17:18 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
grid = gimp_proc_view_create_params (return_vals, n_return_vals,
|
|
|
|
name_group, type_group, desc_group);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
gtk_widget_show (grid);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2019-08-05 20:17:18 +08:00
|
|
|
g_object_unref (name_group);
|
|
|
|
g_object_unref (type_group);
|
|
|
|
g_object_unref (desc_group);
|
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (! help && ! author && ! date && ! copyright)
|
|
|
|
return main_vbox;
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
frame = gimp_frame_new (_("Additional Information"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2011-09-30 16:53:32 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
/* show the help */
|
2004-09-30 20:02:44 +08:00
|
|
|
if (help)
|
1998-12-14 04:16:01 +08:00
|
|
|
{
|
2004-09-30 08:33:34 +08:00
|
|
|
label = gtk_label_new (help);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2002-01-13 07:05:45 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
1998-12-14 04:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* show the author & the copyright */
|
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (! author && ! date && ! copyright)
|
2019-08-05 20:17:18 +08:00
|
|
|
goto out;
|
2004-09-30 20:02:44 +08:00
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (grid);
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
row = 0;
|
2000-02-28 08:45:58 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (author)
|
|
|
|
{
|
|
|
|
label = gtk_label_new (author);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 20:02:44 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Author:"), 0.0, 0.0,
|
|
|
|
label, 3);
|
2004-09-30 20:02:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (date)
|
|
|
|
{
|
|
|
|
label = gtk_label_new (date);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 20:02:44 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Date:"), 0.0, 0.0,
|
|
|
|
label, 3);
|
2004-09-30 20:02:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 20:02:44 +08:00
|
|
|
if (copyright)
|
|
|
|
{
|
|
|
|
label = gtk_label_new (copyright);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 20:02:44 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
_("Copyright:"), 0.0, 0.0,
|
|
|
|
label, 3);
|
2004-09-30 20:02:44 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2019-08-05 20:17:18 +08:00
|
|
|
out:
|
|
|
|
|
|
|
|
g_free (blurb);
|
|
|
|
g_free (help);
|
|
|
|
g_free (author);
|
|
|
|
g_free (copyright);
|
|
|
|
g_free (date);
|
|
|
|
|
|
|
|
while (n_params--)
|
|
|
|
{
|
|
|
|
g_free (params[n_params].name);
|
|
|
|
g_free (params[n_params].description);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (params);
|
|
|
|
|
|
|
|
while (n_return_vals--)
|
|
|
|
{
|
|
|
|
g_free (return_vals[n_return_vals].name);
|
|
|
|
g_free (return_vals[n_return_vals].description);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (return_vals);
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
return main_vbox;
|
2002-06-14 07:40:55 +08:00
|
|
|
}
|
|
|
|
|
1998-12-14 04:16:01 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* private functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
static GtkWidget *
|
2008-09-04 20:23:36 +08:00
|
|
|
gimp_proc_view_create_params (const GimpParamDef *params,
|
|
|
|
gint n_params,
|
|
|
|
GtkSizeGroup *name_group,
|
|
|
|
GtkSizeGroup *type_group,
|
|
|
|
GtkSizeGroup *desc_group)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2018-04-29 08:16:34 +08:00
|
|
|
GtkWidget *grid;
|
2005-05-14 23:10:47 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
for (i = 0; i < n_params; i++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-05-14 23:10:47 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
const gchar *type;
|
|
|
|
gchar *upper;
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* name */
|
|
|
|
label = gtk_label_new (params[i].name);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_size_group_add_widget (name_group, label);
|
2018-04-29 08:16:34 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (label);
|
2002-01-13 07:05:45 +08:00
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
/* type */
|
2005-05-14 23:10:47 +08:00
|
|
|
if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, params[i].type,
|
|
|
|
NULL, &type, NULL, NULL))
|
|
|
|
upper = g_strdup ("UNKNOWN");
|
|
|
|
else
|
|
|
|
upper = g_ascii_strup (type, -1);
|
|
|
|
|
|
|
|
label = gtk_label_new (upper);
|
|
|
|
g_free (upper);
|
|
|
|
|
2004-09-30 08:33:34 +08:00
|
|
|
gimp_label_set_attributes (GTK_LABEL (label),
|
2004-09-30 20:02:44 +08:00
|
|
|
PANGO_ATTR_FAMILY, "monospace",
|
|
|
|
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
2004-09-30 08:33:34 +08:00
|
|
|
-1);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_size_group_add_widget (type_group, label);
|
2018-04-29 08:16:34 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 1, i, 1, 1);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* description */
|
|
|
|
label = gtk_label_new (params[i].description);
|
2005-04-21 18:23:29 +08:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2016-09-09 01:11:20 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_size_group_add_widget (desc_group, label);
|
2018-04-29 08:16:34 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 2, i, 1, 1);
|
2004-09-30 08:33:34 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2004-09-30 08:33:34 +08:00
|
|
|
|
2018-04-29 08:16:34 +08:00
|
|
|
return grid;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2019-08-05 20:17:18 +08:00
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
gimp_proc_view_create_args (const gchar *procedure_name,
|
|
|
|
gint n_args,
|
|
|
|
gboolean return_values,
|
|
|
|
GtkSizeGroup *name_group,
|
|
|
|
GtkSizeGroup *type_group,
|
|
|
|
GtkSizeGroup *desc_group)
|
|
|
|
{
|
|
|
|
GtkWidget *grid;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
|
|
|
|
|
|
|
|
for (i = 0; i < n_args; i++)
|
|
|
|
{
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
if (return_values)
|
2019-08-06 18:50:08 +08:00
|
|
|
pspec = gimp_pdb_proc_return_value (procedure_name, i);
|
2019-08-05 20:17:18 +08:00
|
|
|
else
|
2019-08-06 18:50:08 +08:00
|
|
|
pspec = gimp_pdb_proc_argument (procedure_name, i);
|
2019-08-05 20:17:18 +08:00
|
|
|
|
|
|
|
/* name */
|
|
|
|
label = gtk_label_new (g_param_spec_get_name (pspec));
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_size_group_add_widget (name_group, label);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* type */
|
|
|
|
label = gtk_label_new (g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (label),
|
|
|
|
PANGO_ATTR_FAMILY, "monospace",
|
|
|
|
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
|
|
|
-1);
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_size_group_add_widget (type_group, label);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 1, i, 1, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* description */
|
|
|
|
label = gtk_label_new (g_param_spec_get_blurb (pspec));
|
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_yalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_size_group_add_widget (desc_group, label);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 2, i, 1, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
g_param_spec_unref (pspec);
|
|
|
|
}
|
|
|
|
|
|
|
|
return grid;
|
|
|
|
}
|