Commit a6c827b8 authored by Scott Lembcke's avatar Scott Lembcke Committed by Scott Lembcke

Changed spacing, padding and alignment of the widgets. Also fixed some

2006-07-21  Scott Lembcke <lemb0029@gnome.org>

        * ext/rbgimpdialog.c: Changed spacing, padding and alignment of the
          widgets. Also fixed some memory leaks where the dialog was not
          destroyed, and collect_results() was not getting called to free
          parameter data.

        * plug-ins/test.rb: Filled in parameter descriptions for dialog
          functions.
parent 14b3d80c
2006-07-21 Scott Lembcke <lemb0029@gnome.org>
* ext/rbgimpdialog.c: Changed spacing, padding and alignment of the
widgets. Also fixed some memory leaks where the dialog was not
destroyed, and collect_results() was not getting called to free
parameter data.
* plug-ins/test.rb: Filled in parameter descriptions for dialog
functions.
2006-07-20 Scott Lembcke <lemb0029@gnome.org>
* ext/rbgimpdialog.c: Even more parameter types added.
......
......@@ -512,6 +512,9 @@ make_table (VALUE params,
Result *results_arr = g_new(Result, num);
GtkWidget *table = gtk_table_new(num+1, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 12);
gtk_table_set_col_spacings(GTK_TABLE(table), 6);
gtk_table_set_row_spacings(GTK_TABLE(table), 6);
int i;
for (i=0; i<num; i++)
......@@ -520,10 +523,11 @@ make_table (VALUE params,
if (!rb_obj_is_kind_of(param, sGimpParamDef))
rb_raise(rb_eArgError, "Parameters must be of type Gimp::ParamDef");
VALUE name = rb_struct_aref(param, ID2SYM(id_name));
GtkWidget *label = gtk_label_new(StringValuePtr(name));
VALUE dscr = rb_struct_aref(param, ID2SYM(id_dscr));
GtkWidget *label = gtk_label_new(StringValuePtr(dscr));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), label, 0, 1, i, i+1,
GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
GTK_FILL, GTK_FILL, 0, 0);
GtkWidget *widget = make_widget(param, &results_arr[i]);
gtk_table_attach(GTK_TABLE(table), widget, 1, 2, i, i+1,
......@@ -580,13 +584,15 @@ show_dialog (VALUE self,
NULL);
gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 12);
table = make_table(params, &num_results, &results);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0);
if (gimp_dialog_run(GIMP_DIALOG(dialog)) == GTK_RESPONSE_OK)
return collect_results(num_results, results);
gint response = gimp_dialog_run(GIMP_DIALOG(dialog));
volatile VALUE rbresults = collect_results(num_results, results);
if (response == GTK_RESPONSE_OK)
return rbresults;
return Qnil;
}
......
......@@ -278,15 +278,15 @@ RubyFu.register(
'<Toolbox>/Xtns/Languages/Ruby-Fu/Test/dialog', #menupath
nil, #image types
[
RubyFu::ParamDef.INT32('INT32', '', 32),
RubyFu::ParamDef.TOGGLE('TOGGLE', '', 1),
RubyFu::ParamDef.INT16('INT16', '', 16),
RubyFu::ParamDef.INT8('INT8', '', 8),
RubyFu::ParamDef.FLOAT('FLOAT', '', 123.4),
RubyFu::ParamDef.SPINNER('SPINNER', '', 6, (1.5..9.1), 0.01),
RubyFu::ParamDef.SLIDER('SLIDER', '', 6, (1.5..9.1), 0.01),
RubyFu::ParamDef.STRING('STRING', '', 'string'),
RubyFu::ParamDef.COLOR('COLOR', '', Gimp::Rgb.new(1.0, 0.0, 0.0, 0.0)),
RubyFu::ParamDef.INT32('int32', 'INT32', 32),
RubyFu::ParamDef.TOGGLE('toggle', 'TOGGLE', 1),
RubyFu::ParamDef.INT16('int16', 'INT16', 16),
RubyFu::ParamDef.INT8('int8', 'INT8', 8),
RubyFu::ParamDef.FLOAT('float', 'FLOAT', 123.4),
RubyFu::ParamDef.SPINNER('spinner', 'SPINNER', 6, (1.5..9.1), 0.01),
RubyFu::ParamDef.SLIDER('slider', 'SLIDER', 6, (1.5..9.1), 0.01),
RubyFu::ParamDef.STRING('string', 'STRING', 'string'),
RubyFu::ParamDef.COLOR('color', 'COLOR', Gimp::Rgb.new(1.0, 0.0, 0.0, 0.0)),
], #params
[] #results
) do|run_mode, *params|
......@@ -306,17 +306,17 @@ RubyFu.register(
'<Toolbox>/Xtns/Languages/Ruby-Fu/Test/more dialog', #menupath
nil, #image types
[
RubyFu::ParamDef.IMAGE('IMAGE', ''),
RubyFu::ParamDef.DRAWABLE('DRAWABLE', ''),
RubyFu::ParamDef.CHANNEL('CHANNEL', ''),
RubyFu::ParamDef.LAYER('LAYER', ''),
RubyFu::ParamDef.FONT('FONT', '', 'Monaco'),
RubyFu::ParamDef.FILE('FILE', '', '/usr/share/dict/words'),
RubyFu::ParamDef.DIR('DIR', '', '/usr/share/dict/'),
RubyFu::ParamDef.PALETTE('PALETTE', '', 'Lights'),
RubyFu::ParamDef.GRADIENT('GRADIENT', '', 'CD'),
RubyFu::ParamDef.PATTERN('PATTERN', '', 'Pine'),
RubyFu::ParamDef.BRUSH('BRUSH', '', 'Circle (11)'),
RubyFu::ParamDef.IMAGE('image', 'IMAGE'),
RubyFu::ParamDef.DRAWABLE('drawable', 'DRAWABLE'),
RubyFu::ParamDef.CHANNEL('channel', 'CHANNEL'),
RubyFu::ParamDef.LAYER('layer', 'LAYER'),
RubyFu::ParamDef.FONT('font', 'FONT', 'Monaco'),
RubyFu::ParamDef.FILE('file', 'FILE', '/usr/share/dict/words'),
RubyFu::ParamDef.DIR('dir', 'DIR', '/usr/share/dict/'),
RubyFu::ParamDef.PALETTE('palette','PALETTE', 'Lights'),
RubyFu::ParamDef.GRADIENT('gradient', 'GRADIENT', 'CD'),
RubyFu::ParamDef.PATTERN('pattern', 'PATTERN', 'Pine'),
RubyFu::ParamDef.BRUSH('brush', 'BRUSH', 'Circle (11)'),
], #params
[] #results
) do|run_mode, *params|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment