app/tools/gimpgegltool.c (gimp_param_spec_duplicate) support multiline

2008-02-06  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpgegltool.c (gimp_param_spec_duplicate)
	* app/widgets/gimppropwidgets.c (gimp_prop_table_new): support
	multiline text and file paths. The multiline support is hacked up
	and needs some proper solution.


svn path=/trunk/; revision=24818
This commit is contained in:
Michael Natterer 2008-02-06 09:09:34 +00:00 committed by Michael Natterer
parent 2e5e958217
commit 84939f1652
3 changed files with 70 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2008-02-06 Michael Natterer <mitch@gimp.org>
* app/tools/gimpgegltool.c (gimp_param_spec_duplicate)
* app/widgets/gimppropwidgets.c (gimp_prop_table_new): support
multiline text and file paths. The multiline support is hacked up
and needs some proper solution.
2008-02-05 Michael Natterer <mitch@gimp.org>
* app/tools/gimpgegltool.c: don't include <gegl-plugin.h> any longer.

View File

@ -21,6 +21,7 @@
#include <string.h>
#include <gegl.h>
#include <gegl-paramspecs.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
@ -307,11 +308,37 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
{
GParamSpecString *spec = G_PARAM_SPEC_STRING (pspec);
return g_param_spec_string (pspec->name,
g_param_spec_get_nick (pspec),
g_param_spec_get_blurb (pspec),
spec->default_value,
pspec->flags);
if (GEGL_IS_PARAM_SPEC_PATH (pspec))
{
return gimp_param_spec_config_path (pspec->name,
g_param_spec_get_nick (pspec),
g_param_spec_get_blurb (pspec),
GIMP_CONFIG_PATH_FILE,
spec->default_value,
pspec->flags);
}
else
{
static GQuark multiline_quark = 0;
GParamSpec *new;
if (! multiline_quark)
multiline_quark = g_quark_from_static_string ("multiline");
new = g_param_spec_string (pspec->name,
g_param_spec_get_nick (pspec),
g_param_spec_get_blurb (pspec),
spec->default_value,
pspec->flags);
if (GEGL_IS_PARAM_SPEC_MULTILINE (pspec))
{
g_param_spec_set_qdata (new, multiline_quark,
GINT_TO_POINTER (TRUE));
}
return new;
}
}
else if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
{

View File

@ -754,7 +754,37 @@ gimp_prop_table_new (GObject *config,
if (G_IS_PARAM_SPEC_STRING (pspec))
{
widget = gimp_prop_entry_new (config, pspec->name, -1);
static GQuark multiline_quark = 0;
if (! multiline_quark)
multiline_quark = g_quark_from_static_string ("multiline");
if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
{
widget = gimp_prop_file_chooser_button_new (config,
pspec->name,
g_param_spec_get_nick (pspec),
GTK_FILE_CHOOSER_ACTION_OPEN);
}
else if (g_param_spec_get_qdata (pspec, multiline_quark))
{
GtkTextBuffer *buffer;
GtkWidget *view;
buffer = gimp_prop_text_buffer_new (config, pspec->name, -1);
view = gtk_text_view_new_with_buffer (buffer);
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (widget), view);
gtk_widget_show (view);
}
else
{
widget = gimp_prop_entry_new (config, pspec->name, -1);
}
label = g_param_spec_get_nick (pspec);
}
else if (G_IS_PARAM_SPEC_BOOLEAN (pspec))