gimp/libgimp/gimpprocview.c

488 lines
16 KiB
C
Raw Normal View History

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
1997-11-25 06:05:25 +08:00
*
* gimpprocview.c
1997-11-25 06:05:25 +08:00
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* 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
* 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
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
1997-11-25 06:05:25 +08:00
*/
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +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"
#include <string.h>
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gimp.h"
#include "gimpuitypes.h"
#include "gimpprocview.h"
#include "libgimp-intl.h"
1997-11-25 06:05:25 +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.
**/
/* local function prototypes */
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static GtkWidget * gimp_proc_view_create_params (const GimpParamDef *params,
gint n_params,
GtkSizeGroup *name_group,
GtkSizeGroup *type_group,
GtkSizeGroup *desc_group);
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);
/* public functions */
/**
* gimp_proc_view_new:
* @procedure_name: The name of a procedure.
* @menu_path: (nullable): The procedure's menu path, or %NULL.
*
* Returns: (transfer full): a new widget providing a view on a
* GIMP procedure
*
* Since: 2.4
**/
GtkWidget *
gimp_proc_view_new (const gchar *procedure_name,
const gchar *menu_path)
1997-11-25 06:05:25 +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);
gimp_pdb_proc_info (procedure_name,
&blurb,
&help,
&author,
&copyright,
&date,
&type,
&n_params,
&n_return_vals,
&params,
&return_vals);
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 (&copyright, g_free);
if (blurb && help && ! strcmp (blurb, help))
g_clear_pointer (&help, g_free);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
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);
/* show the name */
frame = gimp_frame_new (procedure_name);
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);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
2011-09-30 16:53:32 +08:00
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
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);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
1997-11-25 06:05:25 +08:00
if (menu_path)
{
label = gtk_label_new_with_mnemonic (menu_path);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
1997-11-25 06:05:25 +08:00
if (blurb)
1997-11-25 06:05:25 +08:00
{
label = gtk_label_new (blurb);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
1997-11-25 06:05:25 +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);
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);
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);
}
1997-11-25 06:05:25 +08:00
/* out parameters */
if (n_return_vals)
1997-11-25 06:05:25 +08:00
{
frame = gimp_frame_new (_("Return Values"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
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
}
g_object_unref (name_group);
g_object_unref (type_group);
g_object_unref (desc_group);
if (! help && ! author && ! date && ! copyright)
return main_vbox;
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);
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 */
if (help)
1998-12-14 04:16:01 +08:00
{
label = gtk_label_new (help);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
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 */
if (! author && ! date && ! copyright)
goto out;
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);
row = 0;
if (author)
{
label = gtk_label_new (author);
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);
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);
}
1997-11-25 06:05:25 +08:00
if (date)
{
label = gtk_label_new (date);
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);
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);
}
1997-11-25 06:05:25 +08:00
if (copyright)
{
label = gtk_label_new (copyright);
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);
2018-04-29 08:16:34 +08:00
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
_("Copyright:"), 0.0, 0.0,
label, 3);
}
1997-11-25 06:05:25 +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);
return main_vbox;
}
1998-12-14 04:16:01 +08:00
/* private functions */
1997-11-25 06:05:25 +08:00
static GtkWidget *
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;
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
for (i = 0; i < n_params; i++)
1997-11-25 06:05:25 +08:00
{
GtkWidget *label;
const gchar *type;
gchar *upper;
/* name */
label = gtk_label_new (params[i].name);
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);
2018-04-29 08:16:34 +08:00
gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
gtk_widget_show (label);
/* type */
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);
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);
2018-04-29 08:16:34 +08:00
gtk_grid_attach (GTK_GRID (grid), label, 1, i, 1, 1);
gtk_widget_show (label);
/* description */
label = gtk_label_new (params[i].description);
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);
2018-04-29 08:16:34 +08:00
gtk_grid_attach (GTK_GRID (grid), label, 2, i, 1, 1);
gtk_widget_show (label);
1997-11-25 06:05:25 +08:00
}
2018-04-29 08:16:34 +08:00
return grid;
1997-11-25 06:05:25 +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)
pspec = gimp_pdb_proc_return_value (procedure_name, i);
else
pspec = gimp_pdb_proc_argument (procedure_name, i);
/* 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;
}