implemented new argument type SF_OPTION which allows the user

to choose from a list of options using a GtkOptionMenu.


--Sven
This commit is contained in:
Sven Neumann 2000-04-28 00:02:11 +00:00
parent c73b233f8a
commit a2831aa21b
11 changed files with 422 additions and 203 deletions

View File

@ -1,3 +1,16 @@
2000-04-28 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-enums.h
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/script-fu.c: implemented new argument type
SF_OPTION which allows the user to choose from a list of options
using a GtkOptionMenu.
* plug-ins/script-fu/scripts/alien-glow-arrow.scm
* plug-ins/script-fu/scripts/beveled-pattern-arrow.scm
* plug-ins/script-fu/scripts/erase-rows.scm
* plug-ins/script-fu/scripts/test-sphere.scm: use SF_OPTION
2000-04-26 Michael Natterer <mitch@gimp.org>
* app/color_select.c

View File

@ -36,7 +36,8 @@ typedef enum
SF_PATTERN,
SF_BRUSH,
SF_GRADIENT,
SF_FILENAME
SF_FILENAME,
SF_OPTION
} SFArgType;
typedef enum

View File

@ -100,12 +100,18 @@ typedef struct
typedef struct
{
gchar *name;
gchar *name;
gdouble opacity;
gint spacing;
gint paint_mode;
} SFBrush;
typedef struct
{
GSList *list;
guint history;
} SFOption;
typedef union
{
gint32 sfa_image;
@ -121,6 +127,7 @@ typedef union
gchar *sfa_pattern;
gchar *sfa_gradient;
SFBrush sfa_brush;
SFOption sfa_option;
} SFArgValue;
typedef struct
@ -211,7 +218,7 @@ static void script_fu_gradient_preview (gchar *name,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
static void script_fu_brush_preview (gchar *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
@ -233,14 +240,14 @@ static SFInterface sf_interface =
NULL /* active script */
};
static struct stat filestat;
static gint current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
static struct stat filestat;
static gboolean current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
extern char siod_err_msg[];
extern gchar siod_err_msg[];
/*
* Function definitions
@ -385,13 +392,15 @@ script_fu_add_script (LISP a)
{
SFScript *script;
GParamDef *args;
char *val;
int i;
gchar *val;
gint i;
guchar color[3];
LISP color_list;
LISP adj_list;
LISP brush_list;
gchar *s, *menu_path = NULL;
LISP option_list;
gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */
if (nlength (a) < 7)
@ -692,6 +701,23 @@ script_fu_add_script (LISP a)
args[i + 1].description = script->arg_labels[i];
break;
case SF_OPTION:
if (!TYPEP (car (a), tc_cons))
return my_err ("script-fu-register: option defaults must be a list", NIL);
for (option_list = car (a); option_list; option_list = cdr (option_list))
{
script->arg_defaults[i].sfa_option.list =
g_slist_append (script->arg_defaults[i].sfa_option.list,
g_strdup (get_c_string (car (option_list))));
}
script->arg_defaults[i].sfa_option.history = 0;
script->arg_values[i].sfa_option.history = 0;
args[i + 1].type = PARAM_INT32;
args[i + 1].name = "option";
args[i + 1].description = script->arg_labels[i];
break;
default:
break;
}
@ -728,7 +754,7 @@ script_fu_report_cc (gchar *command)
{
if (last_command && strcmp (last_command, command) == 0)
{
char *new_command;
gchar *new_command;
new_command = g_new (gchar, strlen (command) + 10);
sprintf (new_command, "%s <%d>", command, ++consec_command_count);
@ -755,18 +781,18 @@ script_fu_report_cc (gchar *command)
}
static void
script_fu_script_proc (char *name,
int nparams,
script_fu_script_proc (gchar *name,
gint nparams,
GParam *params,
int *nreturn_vals,
gint *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
GStatusType status = STATUS_SUCCESS;
GRunModeType run_mode;
SFScript *script;
int min_args;
char *escaped;
gint min_args;
gchar *escaped;
run_mode = params[0].data.d_int32;
@ -784,7 +810,7 @@ script_fu_script_proc (char *name,
/* Determine whether the script is image based (runs on an image) */
if (strncmp (script->description, "<Image>", 7) == 0)
{
script->arg_values[0].sfa_image = params[1].data.d_image;
script->arg_values[0].sfa_image = params[1].data.d_image;
script->arg_values[1].sfa_drawable = params[2].data.d_drawable;
script->image_based = TRUE;
}
@ -806,12 +832,13 @@ script_fu_script_proc (char *name,
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
gint err_msg;
char *text = NULL;
char *command, *c;
char buffer[MAX_STRING_LENGTH];
int length;
int i;
gchar *text = NULL;
gchar *command;
gchar *c;
gchar buffer[MAX_STRING_LENGTH];
gint err_msg;
gint length;
gint i;
length = strlen (script->script_name) + 3;
@ -843,22 +870,19 @@ script_fu_script_proc (char *name,
length += strlen (params[i + 1].data.d_string) + 1;
break;
case SF_FONT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_PATTERN:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_GRADIENT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_BRUSH:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_OPTION:
length += strlen (params[i + 1].data.d_string) + 1;
break;
default:
break;
}
c = command = g_new (char, length);
c = command = g_new (gchar, length);
if (script->num_args)
{
@ -901,21 +925,15 @@ script_fu_script_proc (char *name,
text = params[i + 1].data.d_string;
break;
case SF_FONT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_PATTERN:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_OPTION:
text = params[i + 1].data.d_string;
break;
default:
break;
}
@ -971,7 +989,7 @@ script_fu_find_script (gchar *pdb_name)
static void
script_fu_free_script (SFScript *script)
{
int i;
gint i;
/* Uninstall the temporary procedure for this script */
gimp_uninstall_temp_proc (script->script_name);
@ -1025,6 +1043,12 @@ script_fu_free_script (SFScript *script)
g_free (script->arg_defaults[i].sfa_brush.name);
g_free (script->arg_values[i].sfa_brush.name);
break;
case SF_OPTION:
g_slist_foreach (script->arg_defaults[i].sfa_option.list,
(GFunc)g_free, NULL);
if (script->arg_defaults[i].sfa_option.list)
g_slist_free (script->arg_defaults[i].sfa_option.list);
break;
default:
break;
}
@ -1048,10 +1072,7 @@ static void
script_fu_disable_cc (gint err_msg)
{
if (err_msg)
g_message ("Script-Fu Error\n%s\n"
"If this happens while running a logo script,\n"
"you might not have the font it wants installed on your system",
siod_err_msg);
g_message (_("Script-Fu Error\n%s"), siod_err_msg);
current_command_enabled = FALSE;
@ -1075,10 +1096,13 @@ script_fu_interface (SFScript *script)
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *bbox;
GtkWidget *menu_item;
GSList *list;
gchar *title;
gchar *buf;
gint start_args;
gint i;
guint j;
guchar *color_cube;
static gboolean gtk_initted = FALSE;
@ -1150,8 +1174,8 @@ script_fu_interface (SFScript *script)
/* The argument table */
table = gtk_table_new (script->num_args + 1, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
@ -1161,9 +1185,10 @@ script_fu_interface (SFScript *script)
for (i = start_args; i < script->num_args; i++)
{
gchar *label_text = gettext (script->arg_labels[i]);
gfloat label_yalign = 0.5;
gboolean widget_leftalign = TRUE;
/* we add a colon after the label; some languages want an extra space here */
gchar *label_text = g_strdup_printf (_("%s:"), gettext (script->arg_labels[i]));
gfloat label_yalign = 0.5;
gboolean widget_leftalign = TRUE;
switch (script->arg_types[i])
{
@ -1209,7 +1234,8 @@ script_fu_interface (SFScript *script)
break;
case SF_TOGGLE:
label_text = _("Script Toggle");
g_free (label_text);
label_text = NULL;
script->args_widgets[i] =
gtk_check_button_new_with_label (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (script->args_widgets[i]),
@ -1240,6 +1266,7 @@ script_fu_interface (SFScript *script)
{
case SF_SLIDER:
label_yalign = 1.0;
widget_leftalign = FALSE;
script->args_widgets[i] =
gtk_hscale_new (script->arg_values[i].sfa_adjustment.adj);
@ -1327,6 +1354,23 @@ script_fu_interface (SFScript *script)
&script->arg_values[i].sfa_brush);
break;
case SF_OPTION:
script->args_widgets[i] = gtk_option_menu_new ();
menu = gtk_menu_new ();
for (list = script->arg_defaults[i].sfa_option.list, j = 0;
list;
list = g_slist_next (list), j++)
{
menu_item = gtk_menu_item_new_with_label (gettext ((gchar *)list->data));
gtk_object_set_user_data (GTK_OBJECT (menu_item), GUINT_TO_POINTER (j));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_widget_show (menu_item);
}
gtk_option_menu_set_menu (GTK_OPTION_MENU (script->args_widgets[i]), menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (script->args_widgets[i]),
script->arg_values[i].sfa_option.history);
break;
default:
break;
}
@ -1334,6 +1378,7 @@ script_fu_interface (SFScript *script)
gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
label_text, 1.0, label_yalign,
script->args_widgets[i], 1, widget_leftalign);
g_free (label_text);
}
gtk_widget_show (table);
@ -1519,10 +1564,6 @@ script_fu_cleanup_widgets (SFScript *script)
for (i = 0; i < script->num_args; i++)
switch (script->arg_types[i])
{
case SF_COLOR:
break;
case SF_FILENAME:
break;
case SF_FONT:
if (script->arg_values[i].sfa_font.dialog != NULL)
{
@ -1548,15 +1589,17 @@ static void
script_fu_ok_callback (GtkWidget *widget,
gpointer data)
{
SFScript *script;
SFScript *script;
GdkFont *font;
GtkWidget *menu_item;
gchar *escaped;
gchar *text = NULL;
gchar *command;
gchar *c;
gchar buffer[MAX_STRING_LENGTH];
gint err_msg;
char *text = NULL;
char *command, *c;
char buffer[MAX_STRING_LENGTH];
int length;
int i;
GdkFont *font;
char *escaped;
gint length;
gint i;
if ((script = sf_interface.script) == NULL)
return;
@ -1568,7 +1611,8 @@ script_fu_ok_callback (GtkWidget *widget,
font = gdk_font_load (script->arg_values[i].sfa_font.fontname);
if (font == NULL)
{
g_message (_("At least one font you've choosen is invalid.\nPlease check your settings.\n"));
g_message (_("At least one font you've choosen is invalid.\n"
"Please check your settings.\n"));
return;
}
else
@ -1621,11 +1665,14 @@ script_fu_ok_callback (GtkWidget *widget,
length += strlen (script->arg_values[i].sfa_brush.name) + 3;
length += 36; /* Maximum size of three ints for opacity, spacing,mode*/
break;
case SF_OPTION:
length += 12; /* Maximum size of integer value will not exceed this many characters */
break;
default:
break;
}
c = command = g_new (char, length);
c = command = g_new (gchar, length);
sprintf (command, "(%s ", script->script_name);
c += strlen (script->script_name) + 2;
@ -1712,6 +1759,14 @@ script_fu_ok_callback (GtkWidget *widget,
script->arg_values[i].sfa_brush.paint_mode);
text = buffer;
break;
case SF_OPTION:
menu_item =
gtk_menu_get_active (GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (script->args_widgets[i]))));
script->arg_values[i].sfa_option.history =
GPOINTER_TO_UINT (gtk_object_get_user_data (GTK_OBJECT (menu_item)));
g_snprintf (buffer, sizeof (buffer), "%d", script->arg_values[i].sfa_option.history);
text = buffer;
break;
default:
break;
}
@ -1889,7 +1944,7 @@ script_fu_reset_callback (GtkWidget *widget,
gpointer data)
{
SFScript *script;
int i,j;
gint i, j;
if ((script = sf_interface.script) == NULL)
return;
@ -1966,14 +2021,18 @@ script_fu_reset_callback (GtkWidget *widget,
script->arg_defaults[i].sfa_brush.spacing,
script->arg_defaults[i].sfa_brush.paint_mode);
break;
case SF_OPTION:
script->arg_values[i].sfa_option.history = script->arg_defaults[i].sfa_option.history;
gtk_option_menu_set_history (GTK_OPTION_MENU (script->args_widgets[i]),
script->arg_values[i].sfa_option.history);
default:
break;
}
}
static void
script_fu_menu_callback (gint32 id,
gpointer data)
script_fu_menu_callback (gint32 id,
gpointer data)
{
*((gint32 *) data) = id;
}

View File

@ -100,12 +100,18 @@ typedef struct
typedef struct
{
gchar *name;
gchar *name;
gdouble opacity;
gint spacing;
gint paint_mode;
} SFBrush;
typedef struct
{
GSList *list;
guint history;
} SFOption;
typedef union
{
gint32 sfa_image;
@ -121,6 +127,7 @@ typedef union
gchar *sfa_pattern;
gchar *sfa_gradient;
SFBrush sfa_brush;
SFOption sfa_option;
} SFArgValue;
typedef struct
@ -211,7 +218,7 @@ static void script_fu_gradient_preview (gchar *name,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
static void script_fu_brush_preview (gchar *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
@ -233,14 +240,14 @@ static SFInterface sf_interface =
NULL /* active script */
};
static struct stat filestat;
static gint current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
static struct stat filestat;
static gboolean current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
extern char siod_err_msg[];
extern gchar siod_err_msg[];
/*
* Function definitions
@ -385,13 +392,15 @@ script_fu_add_script (LISP a)
{
SFScript *script;
GParamDef *args;
char *val;
int i;
gchar *val;
gint i;
guchar color[3];
LISP color_list;
LISP adj_list;
LISP brush_list;
gchar *s, *menu_path = NULL;
LISP option_list;
gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */
if (nlength (a) < 7)
@ -692,6 +701,23 @@ script_fu_add_script (LISP a)
args[i + 1].description = script->arg_labels[i];
break;
case SF_OPTION:
if (!TYPEP (car (a), tc_cons))
return my_err ("script-fu-register: option defaults must be a list", NIL);
for (option_list = car (a); option_list; option_list = cdr (option_list))
{
script->arg_defaults[i].sfa_option.list =
g_slist_append (script->arg_defaults[i].sfa_option.list,
g_strdup (get_c_string (car (option_list))));
}
script->arg_defaults[i].sfa_option.history = 0;
script->arg_values[i].sfa_option.history = 0;
args[i + 1].type = PARAM_INT32;
args[i + 1].name = "option";
args[i + 1].description = script->arg_labels[i];
break;
default:
break;
}
@ -728,7 +754,7 @@ script_fu_report_cc (gchar *command)
{
if (last_command && strcmp (last_command, command) == 0)
{
char *new_command;
gchar *new_command;
new_command = g_new (gchar, strlen (command) + 10);
sprintf (new_command, "%s <%d>", command, ++consec_command_count);
@ -755,18 +781,18 @@ script_fu_report_cc (gchar *command)
}
static void
script_fu_script_proc (char *name,
int nparams,
script_fu_script_proc (gchar *name,
gint nparams,
GParam *params,
int *nreturn_vals,
gint *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
GStatusType status = STATUS_SUCCESS;
GRunModeType run_mode;
SFScript *script;
int min_args;
char *escaped;
gint min_args;
gchar *escaped;
run_mode = params[0].data.d_int32;
@ -784,7 +810,7 @@ script_fu_script_proc (char *name,
/* Determine whether the script is image based (runs on an image) */
if (strncmp (script->description, "<Image>", 7) == 0)
{
script->arg_values[0].sfa_image = params[1].data.d_image;
script->arg_values[0].sfa_image = params[1].data.d_image;
script->arg_values[1].sfa_drawable = params[2].data.d_drawable;
script->image_based = TRUE;
}
@ -806,12 +832,13 @@ script_fu_script_proc (char *name,
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
gint err_msg;
char *text = NULL;
char *command, *c;
char buffer[MAX_STRING_LENGTH];
int length;
int i;
gchar *text = NULL;
gchar *command;
gchar *c;
gchar buffer[MAX_STRING_LENGTH];
gint err_msg;
gint length;
gint i;
length = strlen (script->script_name) + 3;
@ -843,22 +870,19 @@ script_fu_script_proc (char *name,
length += strlen (params[i + 1].data.d_string) + 1;
break;
case SF_FONT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_PATTERN:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_GRADIENT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_BRUSH:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_OPTION:
length += strlen (params[i + 1].data.d_string) + 1;
break;
default:
break;
}
c = command = g_new (char, length);
c = command = g_new (gchar, length);
if (script->num_args)
{
@ -901,21 +925,15 @@ script_fu_script_proc (char *name,
text = params[i + 1].data.d_string;
break;
case SF_FONT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_PATTERN:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_OPTION:
text = params[i + 1].data.d_string;
break;
default:
break;
}
@ -971,7 +989,7 @@ script_fu_find_script (gchar *pdb_name)
static void
script_fu_free_script (SFScript *script)
{
int i;
gint i;
/* Uninstall the temporary procedure for this script */
gimp_uninstall_temp_proc (script->script_name);
@ -1025,6 +1043,12 @@ script_fu_free_script (SFScript *script)
g_free (script->arg_defaults[i].sfa_brush.name);
g_free (script->arg_values[i].sfa_brush.name);
break;
case SF_OPTION:
g_slist_foreach (script->arg_defaults[i].sfa_option.list,
(GFunc)g_free, NULL);
if (script->arg_defaults[i].sfa_option.list)
g_slist_free (script->arg_defaults[i].sfa_option.list);
break;
default:
break;
}
@ -1048,10 +1072,7 @@ static void
script_fu_disable_cc (gint err_msg)
{
if (err_msg)
g_message ("Script-Fu Error\n%s\n"
"If this happens while running a logo script,\n"
"you might not have the font it wants installed on your system",
siod_err_msg);
g_message (_("Script-Fu Error\n%s"), siod_err_msg);
current_command_enabled = FALSE;
@ -1075,10 +1096,13 @@ script_fu_interface (SFScript *script)
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *bbox;
GtkWidget *menu_item;
GSList *list;
gchar *title;
gchar *buf;
gint start_args;
gint i;
guint j;
guchar *color_cube;
static gboolean gtk_initted = FALSE;
@ -1150,8 +1174,8 @@ script_fu_interface (SFScript *script)
/* The argument table */
table = gtk_table_new (script->num_args + 1, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
@ -1161,9 +1185,10 @@ script_fu_interface (SFScript *script)
for (i = start_args; i < script->num_args; i++)
{
gchar *label_text = gettext (script->arg_labels[i]);
gfloat label_yalign = 0.5;
gboolean widget_leftalign = TRUE;
/* we add a colon after the label; some languages want an extra space here */
gchar *label_text = g_strdup_printf (_("%s:"), gettext (script->arg_labels[i]));
gfloat label_yalign = 0.5;
gboolean widget_leftalign = TRUE;
switch (script->arg_types[i])
{
@ -1209,7 +1234,8 @@ script_fu_interface (SFScript *script)
break;
case SF_TOGGLE:
label_text = _("Script Toggle");
g_free (label_text);
label_text = NULL;
script->args_widgets[i] =
gtk_check_button_new_with_label (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (script->args_widgets[i]),
@ -1240,6 +1266,7 @@ script_fu_interface (SFScript *script)
{
case SF_SLIDER:
label_yalign = 1.0;
widget_leftalign = FALSE;
script->args_widgets[i] =
gtk_hscale_new (script->arg_values[i].sfa_adjustment.adj);
@ -1327,6 +1354,23 @@ script_fu_interface (SFScript *script)
&script->arg_values[i].sfa_brush);
break;
case SF_OPTION:
script->args_widgets[i] = gtk_option_menu_new ();
menu = gtk_menu_new ();
for (list = script->arg_defaults[i].sfa_option.list, j = 0;
list;
list = g_slist_next (list), j++)
{
menu_item = gtk_menu_item_new_with_label (gettext ((gchar *)list->data));
gtk_object_set_user_data (GTK_OBJECT (menu_item), GUINT_TO_POINTER (j));
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_widget_show (menu_item);
}
gtk_option_menu_set_menu (GTK_OPTION_MENU (script->args_widgets[i]), menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (script->args_widgets[i]),
script->arg_values[i].sfa_option.history);
break;
default:
break;
}
@ -1334,6 +1378,7 @@ script_fu_interface (SFScript *script)
gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
label_text, 1.0, label_yalign,
script->args_widgets[i], 1, widget_leftalign);
g_free (label_text);
}
gtk_widget_show (table);
@ -1519,10 +1564,6 @@ script_fu_cleanup_widgets (SFScript *script)
for (i = 0; i < script->num_args; i++)
switch (script->arg_types[i])
{
case SF_COLOR:
break;
case SF_FILENAME:
break;
case SF_FONT:
if (script->arg_values[i].sfa_font.dialog != NULL)
{
@ -1548,15 +1589,17 @@ static void
script_fu_ok_callback (GtkWidget *widget,
gpointer data)
{
SFScript *script;
SFScript *script;
GdkFont *font;
GtkWidget *menu_item;
gchar *escaped;
gchar *text = NULL;
gchar *command;
gchar *c;
gchar buffer[MAX_STRING_LENGTH];
gint err_msg;
char *text = NULL;
char *command, *c;
char buffer[MAX_STRING_LENGTH];
int length;
int i;
GdkFont *font;
char *escaped;
gint length;
gint i;
if ((script = sf_interface.script) == NULL)
return;
@ -1568,7 +1611,8 @@ script_fu_ok_callback (GtkWidget *widget,
font = gdk_font_load (script->arg_values[i].sfa_font.fontname);
if (font == NULL)
{
g_message (_("At least one font you've choosen is invalid.\nPlease check your settings.\n"));
g_message (_("At least one font you've choosen is invalid.\n"
"Please check your settings.\n"));
return;
}
else
@ -1621,11 +1665,14 @@ script_fu_ok_callback (GtkWidget *widget,
length += strlen (script->arg_values[i].sfa_brush.name) + 3;
length += 36; /* Maximum size of three ints for opacity, spacing,mode*/
break;
case SF_OPTION:
length += 12; /* Maximum size of integer value will not exceed this many characters */
break;
default:
break;
}
c = command = g_new (char, length);
c = command = g_new (gchar, length);
sprintf (command, "(%s ", script->script_name);
c += strlen (script->script_name) + 2;
@ -1712,6 +1759,14 @@ script_fu_ok_callback (GtkWidget *widget,
script->arg_values[i].sfa_brush.paint_mode);
text = buffer;
break;
case SF_OPTION:
menu_item =
gtk_menu_get_active (GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (script->args_widgets[i]))));
script->arg_values[i].sfa_option.history =
GPOINTER_TO_UINT (gtk_object_get_user_data (GTK_OBJECT (menu_item)));
g_snprintf (buffer, sizeof (buffer), "%d", script->arg_values[i].sfa_option.history);
text = buffer;
break;
default:
break;
}
@ -1889,7 +1944,7 @@ script_fu_reset_callback (GtkWidget *widget,
gpointer data)
{
SFScript *script;
int i,j;
gint i, j;
if ((script = sf_interface.script) == NULL)
return;
@ -1966,14 +2021,18 @@ script_fu_reset_callback (GtkWidget *widget,
script->arg_defaults[i].sfa_brush.spacing,
script->arg_defaults[i].sfa_brush.paint_mode);
break;
case SF_OPTION:
script->arg_values[i].sfa_option.history = script->arg_defaults[i].sfa_option.history;
gtk_option_menu_set_history (GTK_OPTION_MENU (script->args_widgets[i]),
script->arg_values[i].sfa_option.history);
default:
break;
}
}
static void
script_fu_menu_callback (gint32 id,
gpointer data)
script_fu_menu_callback (gint32 id,
gpointer data)
{
*((gint32 *) data) = id;
}

View File

@ -446,6 +446,7 @@ init_constants (void)
setvar (cintern ("SF-PATTERN"), flocons (SF_PATTERN), NIL);
setvar (cintern ("SF-BRUSH"), flocons (SF_BRUSH), NIL);
setvar (cintern ("SF-GRADIENT"), flocons (SF_GRADIENT), NIL);
setvar (cintern ("SF-OPTION"), flocons (SF_OPTION), NIL);
/* for SF_ADJUSTMENT */
setvar (cintern ("SF-SLIDER"), flocons (SF_SLIDER), NIL);

View File

@ -64,11 +64,11 @@
(let* ((p (car points))
(px (point-x p))
(py (point-y p)))
(cons (cond ((eq? orientation 'right) (make-point px py))
((eq? orientation 'left) (make-point (- size px) py))
((eq? orientation 'up) (make-point py (- size px)))
((eq? orientation 'down) (make-point py px)))
(rotate-points (cdr points) size orientation)))))
(cons (cond (= orientation 0) (make-point px py)) ; right
(= orientation 1) (make-point (- size px) py)) ; left
(= orientation 2) (make-point py (- size px))) ; up
(= orientation 3) (make-point py px)) ; down
(rotate-points (cdr points) size orientation))
(define (script-fu-alien-glow-right-arrow size orientation glow-color bg-color flatten)
@ -127,8 +127,11 @@
"Adrian Likins"
"1997"
""
SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1)
SF-VALUE _"Orientation" "'right"
SF-COLOR _"Glow Color" '(63 252 0)
SF-COLOR _"Background Color" '(0 0 0)
SF-TOGGLE _"Flatten Image" TRUE)
SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1)
SF-OPTION _"Orientation" '(_"Right"
_"Left"
_"Up"
_"Down")
SF-COLOR _"Glow Color" '(63 252 0)
SF-COLOR _"Background Color" '(0 0 0)
SF-TOGGLE _"Flatten Image" TRUE)

View File

@ -56,10 +56,10 @@
(map (lambda (p)
(let ((px (point-x p))
(py (point-y p)))
(cond ((eq? orientation 'right) (make-point px py))
((eq? orientation 'left) (make-point (- size px) py))
((eq? orientation 'up) (make-point py (- size px)))
((eq? orientation 'down) (make-point py px)))))
(cond ((= orientation 0) (make-point px py)) ; right
((= orientation 1) (make-point (- size px) py)) ; left
((= orientation 2) (make-point py (- size px))) ; up
((= orientation 3) (make-point py px))))) ; down
points))
(define (make-arrow size offset)
@ -141,5 +141,8 @@
"July 1997"
""
SF-ADJUSTMENT _"Size" '(32 5 150 1 10 0 1)
SF-VALUE _"Orientation" "'right"
SF-PATTERN _"Pattern" "Wood")
SF-OPTION _"Orientation" '(_"Right"
_"Left"
_"Up"
_"Down")
SF-PATTERN _"Pattern" "Wood")

View File

@ -5,15 +5,15 @@
(letrec ((loop (lambda (i max)
(if (< i max)
(begin
(if (eq? orientation 'rows)
(if (= orientation 0)
(gimp-rect-select img 0 i width 1 REPLACE FALSE 0)
(gimp-rect-select img i 0 1 height REPLACE FALSE 0))
(gimp-edit-fill drawable BG-IMAGE-FILL)
(loop (+ i 2) max))))))
(loop (if (eq? which 'even)
(loop (if (= which 0)
0
1)
(if (eq? orientation 'rows)
(if (= orientation 0)
height
width)))
(gimp-selection-none img)
@ -29,5 +29,6 @@
"RGB* GRAY* INDEXED*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-VALUE _"Rows/Cols" "'rows"
SF-VALUE _"Even/Odd" "'even")
SF-OPTION _"Rows/Cols" '(_"Rows" _"Columns")
SF-OPTION _"Even/Odd" '(_"Even" _"Odd"))

View File

@ -59,7 +59,7 @@
; Usage:-
; SF-PATTERN "Pattern" "Maple Leaves"
;
; The vaule returned when the script is invoked is a string containing the
; The value returned when the script is invoked is a string containing the
; pattern name. If the above selection was not altered the string would
; contain "Maple Leaves"
; ----------------------------------------------------------------------
@ -73,7 +73,7 @@
; Usage:-
; SF-GRADIENT "Gradient" "Deep_Sea"
;
; The vaule returned when the script is invoked is a string containing the
; The value returned when the script is invoked is a string containing the
; gradient name. If the above selection was not altered the string would
; contain "Deep_Sea"
;
@ -85,14 +85,40 @@
; If the button is pressed a file selection dialog will popup.
;
; Usage:-
; SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"
; SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
;
; The vaule returned when the script is invoked is a string containing the
; The value returned when the script is invoked is a string containing the
; filename.
; ----------------------------------------------------------------------
;
; SF-OPTION
; Only useful in interactive mode. It will create a widget in the control
; dialog. The widget is an option_menu showing the options that are passed
; as a list. The first option is the default choice.
;
; Usage:-
; SF-OPTION "Orientation" '("Horzontal" "Vertical")
;
; The value returned when the script is invoked is the number of the
; choosen option, where the option first is counted as 0.
; ----------------------------------------------------------------------
;
;
(define (script-fu-test-sphere radius light shadow bg-color sphere-color brush text pattern gradient font size filename)
(define (script-fu-test-sphere radius
light
shadow
bg-color
sphere-color
brush
text
pattern
gradient
font
size
filename
orientation)
(let* ((width (* radius 3.75))
(height (* radius 2.5))
(img (car (gimp-image-new width height RGB)))
@ -175,6 +201,7 @@
SF-GRADIENT "Gradient" "Deep_Sea"
SF-FONT "Font" "-freefont-agate-normal-r-normal-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font Size (pixels)" '(50 1 1000 1 10 0 1)
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
SF-OPTION "Orientation" '("Horzontal" "Vertical"))

View File

@ -1,3 +1,7 @@
2000-04-28 Sven Neumann <sven@gimp.org>
* de.po: updated german translation
2000-04-26 Sven Neumann <sven@gimp.org>
* de.po: updates from Felix Natter <fnatter@gmx.net>

View File

@ -6,9 +6,9 @@
msgid ""
msgstr ""
"Project-Id-Version: GIMP 1.1.20\n"
"POT-Creation-Date: 2000-04-18 14:21+0200\n"
"PO-Revision-Date: 2000-04-26 01:19+02:00\n"
"Last-Translator: Felix Natter <fnatter@gmx.net>\n"
"POT-Creation-Date: 2000-04-28 01:56+0200\n"
"PO-Revision-Date: 2000-04-28 01:58+02:00\n"
"Last-Translator: Sven Neumann <sven@gimp.org>\n"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
@ -24,7 +24,7 @@ msgstr "Skript-Fu Konsole"
#. Action area
#: plug-ins/script-fu/script-fu-console.c:207
#: plug-ins/script-fu/script-fu-scripts.c:1867
#: plug-ins/script-fu/script-fu-scripts.c:1922
msgid "Close"
msgstr "Schließen"
@ -55,70 +55,81 @@ msgstr "Kann mit dem SIOD-Ausgabe-pipe keinen Stream erstellen"
msgid "Script-Fu evaluate mode allows only noninteractive invocation"
msgstr "Der Skript-Fu Auswerte-Modus ermöglicht nur nicht-interaktive Aufrufe"
#: plug-ins/script-fu/script-fu-scripts.c:1075
#, c-format
msgid ""
"Script-Fu Error\n"
"%s"
msgstr ""
"Skript-Fu Fehler\n"
"%s"
#. strip the first part of the menupath if it contains _("/Script-Fu/")
#: plug-ins/script-fu/script-fu-scripts.c:1113
#: plug-ins/script-fu/script-fu-scripts.c:1115
#: plug-ins/script-fu/script-fu-scripts.c:1137
#: plug-ins/script-fu/script-fu-scripts.c:1139
msgid "/Script-Fu/"
msgstr "/Skript-Fu/"
#: plug-ins/script-fu/script-fu-scripts.c:1115
#: plug-ins/script-fu/script-fu-scripts.c:1117
#: plug-ins/script-fu/script-fu-scripts.c:1139
#: plug-ins/script-fu/script-fu-scripts.c:1141
#, c-format
msgid "Script-Fu: %s"
msgstr "Skript-Fu: %s"
#. the script arguments frame
#: plug-ins/script-fu/script-fu-scripts.c:1142
#: plug-ins/script-fu/script-fu-scripts.c:1166
msgid "Script Arguments"
msgstr "Skript-Argumente"
#: plug-ins/script-fu/script-fu-scripts.c:1206
#. we add a colon after the label; some languages want an extra space here
#: plug-ins/script-fu/script-fu-scripts.c:1189
#, c-format
msgid "%s:"
msgstr "%s:"
#: plug-ins/script-fu/script-fu-scripts.c:1231
msgid "Script-Fu Color Selection"
msgstr "Skript-Fu Farbauswahl"
#: plug-ins/script-fu/script-fu-scripts.c:1212
msgid "Script Toggle"
msgstr "Skript Schalter"
#: plug-ins/script-fu/script-fu-scripts.c:1274
#: plug-ins/script-fu/script-fu-scripts.c:1301
msgid "Script-Fu File Selection"
msgstr "Skript-Fu Dateiauswahl"
#: plug-ins/script-fu/script-fu-scripts.c:1306
#: plug-ins/script-fu/script-fu-scripts.c:1333
msgid "Script-fu Pattern Selection"
msgstr "Skript-Fu Musterauswahl"
#: plug-ins/script-fu/script-fu-scripts.c:1313
#: plug-ins/script-fu/script-fu-scripts.c:1340
msgid "Script-Fu Gradient Selection"
msgstr "Skript-Fu Farbverlaufsauswahl"
#: plug-ins/script-fu/script-fu-scripts.c:1321
#: plug-ins/script-fu/script-fu-scripts.c:1348
msgid "Script-Fu Brush Selection"
msgstr "Skript-Fu Pinselauswahl"
#: plug-ins/script-fu/script-fu-scripts.c:1346
#: plug-ins/script-fu/script-fu-scripts.c:1391
msgid "Reset to Defaults"
msgstr "Auf Standardwerte zurücksetzen"
#: plug-ins/script-fu/script-fu-scripts.c:1372
#: plug-ins/script-fu/script-fu-scripts.c:1417
msgid "About"
msgstr "Über"
#: plug-ins/script-fu/script-fu-scripts.c:1386
#: plug-ins/script-fu/script-fu-scripts.c:1431
#: plug-ins/script-fu/script-fu-server.c:552
msgid "OK"
msgstr "OK"
#: plug-ins/script-fu/script-fu-scripts.c:1395
#: plug-ins/script-fu/script-fu-scripts.c:1440
#: plug-ins/script-fu/script-fu-server.c:554
msgid "Cancel"
msgstr "Abbrechen"
#: plug-ins/script-fu/script-fu-scripts.c:1500
#: plug-ins/script-fu/script-fu-scripts.c:1545
msgid "NOT SET"
msgstr "NICHT EINGESTELLT"
#: plug-ins/script-fu/script-fu-scripts.c:1571
#: plug-ins/script-fu/script-fu-scripts.c:1614
msgid ""
"At least one font you've choosen is invalid.\n"
"Please check your settings.\n"
@ -126,23 +137,23 @@ msgstr ""
"Mindestens eine Schriftart, die Sie ausgewählt haben, ist ungültig.\n"
"Bitte überprüfen Sie Ihre Einstellungen.\n"
#: plug-ins/script-fu/script-fu-scripts.c:1838
#: plug-ins/script-fu/script-fu-scripts.c:1893
msgid "Author:"
msgstr "Autor:"
#: plug-ins/script-fu/script-fu-scripts.c:1844
#: plug-ins/script-fu/script-fu-scripts.c:1899
msgid "Copyright:"
msgstr "Copyright:"
#: plug-ins/script-fu/script-fu-scripts.c:1850
#: plug-ins/script-fu/script-fu-scripts.c:1905
msgid "Date:"
msgstr "Datum:"
#: plug-ins/script-fu/script-fu-scripts.c:1858
#: plug-ins/script-fu/script-fu-scripts.c:1913
msgid "Image Types:"
msgstr "Bildtypen:"
#: plug-ins/script-fu/script-fu-scripts.c:2007
#: plug-ins/script-fu/script-fu-scripts.c:2066
msgid "Script-Fu Font Selection"
msgstr "Skript-Fu Schriftartauswahl"
@ -166,11 +177,11 @@ msgstr "<Toolbox>/Xtns/Skript-Fu/Konsole..."
msgid "<Toolbox>/Xtns/Script-Fu/Server..."
msgstr "<Toolbox>/Xtns/Skript-Fu/Server..."
#: plug-ins/script-fu/script-fu.c:1007 plug-ins/script-fu/script-fu.c:1008
#: plug-ins/script-fu/script-fu.c:1008 plug-ins/script-fu/script-fu.c:1009
msgid "Re-read all available scripts"
msgstr "Alle Skripte neu einlesen"
#: plug-ins/script-fu/script-fu.c:1012
#: plug-ins/script-fu/script-fu.c:1013
msgid "<Toolbox>/Xtns/Script-Fu/Refresh"
msgstr "<Toolbox>/Xtns/Skript-Fu/Auffrischen"
@ -921,6 +932,10 @@ msgstr "Farbe 3"
msgid "Color"
msgstr "Farbe"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Columns"
msgstr "Spalten"
#: plug-ins/script-fu/scripts/image-structure.scm:0
msgid "Create New Image"
msgstr "Neues Bild erzeugen"
@ -978,6 +993,11 @@ msgstr "Detailreichtum"
msgid "Diameter"
msgstr "Durchmesser"
#: plug-ins/script-fu/scripts/alien-glow-arrow.scm:0
#: plug-ins/script-fu/scripts/beveled-pattern-arrow.scm:0
msgid "Down"
msgstr "Runter"
#: plug-ins/script-fu/scripts/xach-effect.scm:0
msgid "Drop Shadow Blur Radius"
msgstr "Schatten weichzeichnen (Radius)"
@ -1050,6 +1070,10 @@ msgstr "Environment Map"
msgid "Erase before Draw"
msgstr "Vor dem Zeichnen radieren"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Even"
msgstr "Gerade"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Even/Odd"
msgstr "Gerade/Ungerade"
@ -1143,6 +1167,7 @@ msgid "Font Size (pixels)"
msgstr "Schriftgröße (Pixel)"
#: plug-ins/script-fu/scripts/3d-outline.scm:0
#: plug-ins/script-fu/scripts/alien-glow-button.scm:0
#: plug-ins/script-fu/scripts/alien-glow-logo.scm:0
#: plug-ins/script-fu/scripts/alien-neon-logo.scm:0
#: plug-ins/script-fu/scripts/asc2img.scm:0
@ -1355,6 +1380,11 @@ msgstr "Auswahl erhalten"
msgid "Land Height"
msgstr "Land Höhe"
#: plug-ins/script-fu/scripts/alien-glow-arrow.scm:0
#: plug-ins/script-fu/scripts/beveled-pattern-arrow.scm:0
msgid "Left"
msgstr "Links"
#: plug-ins/script-fu/scripts/sphere.scm:0
msgid "Lighting (degrees)"
msgstr "Beleuchtung (Grad)"
@ -1455,6 +1485,10 @@ msgstr "Anzahl der Kacheln in Y-Richtung"
msgid "Number"
msgstr "Nummer"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Odd"
msgstr "Ungerade"
#: plug-ins/script-fu/scripts/line-nova.scm:0
msgid "Offset Radius"
msgstr "Versatz Radius"
@ -1485,8 +1519,8 @@ msgid "Orientation"
msgstr "Orientierung"
#: plug-ins/script-fu/scripts/image-structure.scm:0
msgid "Outer Border (>= 0)"
msgstr "Aüßerer Rand (>= 0)"
msgid "Outer Border"
msgstr "Äußerer Rand"
#: plug-ins/script-fu/scripts/3d-outline.scm:0
msgid "Outline Blur Radius"
@ -1506,8 +1540,8 @@ msgid "Pad Color"
msgstr "Auffüll-Farbe"
#: plug-ins/script-fu/scripts/image-structure.scm:0
msgid "Pad Opacity [0:100]"
msgstr "Auffüll-Deckkraft"
msgid "Pad Opacity"
msgstr "Deckkraft Füllung"
#: plug-ins/script-fu/scripts/carved-logo.scm:0
msgid "Padding Around Text"
@ -1618,6 +1652,11 @@ msgstr "Abstand der B
msgid "Ribbon Width"
msgstr "Breite der Bänder"
#: plug-ins/script-fu/scripts/alien-glow-arrow.scm:0
#: plug-ins/script-fu/scripts/beveled-pattern-arrow.scm:0
msgid "Right"
msgstr "Rechts"
#: plug-ins/script-fu/scripts/ripply-anim.scm:0
msgid "Rippling Strength"
msgstr "Flatter-Intensität"
@ -1631,6 +1670,10 @@ msgstr "Grobheit"
msgid "Round Ratio"
msgstr "Rundungs-Rate"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Rows"
msgstr "Zeilen"
#: plug-ins/script-fu/scripts/erase-rows.scm:0
msgid "Rows/Cols"
msgstr "Zeilen/Spalten"
@ -1708,8 +1751,8 @@ msgid "Sharpness (degrees)"
msgstr "Schärfe (Grad)"
#: plug-ins/script-fu/scripts/image-structure.scm:0
msgid "Shear Length (> 0)"
msgstr "Scherlänge (> 0)"
msgid "Shear Length"
msgstr "Scherlänge"
#: plug-ins/script-fu/scripts/alien-glow-arrow.scm:0
#: plug-ins/script-fu/scripts/beveled-pattern-arrow.scm:0
@ -1877,6 +1920,11 @@ msgstr "Transparenter Hintergrund"
msgid "Turn from Left to Right"
msgstr "Von links nach rechts drehen"
#: plug-ins/script-fu/scripts/alien-glow-arrow.scm:0
#: plug-ins/script-fu/scripts/beveled-pattern-arrow.scm:0
msgid "Up"
msgstr "Rauf"
#: plug-ins/script-fu/scripts/pupi-button.scm:0
msgid "Upper Color (Active)"
msgstr "Farbe oben (aktiv)"