Commit ec030082 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

reverted changes to handling of string arrays to stay backward compatible

2005-10-05  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/siod-wrapper.c: reverted changes to handling
	of string arrays to stay backward compatible (see bug #168290 and
	bug #317634).

	* plug-ins/script-fu/scripts/font-map.scm: reverted change that
	was done to adapt to above changes (see bug #308681).
parent 6cdf44d6
2005-10-05 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/siod-wrapper.c: reverted changes to handling
of string arrays to stay backward compatible (see bug #168290 and
bug #317634).
* plug-ins/script-fu/scripts/font-map.scm: reverted change that
was done to adapt to above changes (see bug #308681).
2005-10-04 Michael Natterer <mitch@gimp.org>
* app/paint/gimpbrushcore.c (gimp_brush_core_start): set
......
......@@ -735,13 +735,13 @@ marshall_proc_db_call (LISP a)
if ((n_elements < 0) || (n_elements > nlength (list)))
{
g_snprintf (error_str, sizeof (error_str),
"STRING array (argument %d) for function %s has "
"String array (argument %d) for function %s has "
"incorrect length (got %ld, expected %d)",
i + 1, proc_name, nlength (list), n_elements);
return my_err (error_str, NIL);
}
args[i].type = GIMP_PDB_STRINGARRAY;
args[i].type = GIMP_PDB_STRINGARRAY;
args[i].data.d_stringarray = list->storage_as.string_array.data;
}
break;
......@@ -1047,16 +1047,25 @@ marshall_proc_db_call (LISP a)
case GIMP_PDB_STRINGARRAY:
{
LISP array;
LISP array = NIL;
gint j;
array = arcons (tc_string_array, values[i].data.d_int32, 0);
for (j = 0; j < values[i].data.d_int32; j++)
{
array->storage_as.string_array.data[j] =
g_strdup (values[i + 1].data.d_stringarray[j]);
string = (values[i + 1].data.d_stringarray)[j];
if (string)
{
string_len = strlen (string);
array = cons (strcons (string_len, string), array);
}
else
{
array = cons (strcons (0, ""), array);
}
}
return_val = cons (array, return_val);
return_val = cons (nreverse (array), return_val);
}
break;
......
......@@ -2,15 +2,14 @@
;; Spencer Kimball
(define (max-font-width text use-name font-list font-size)
(let* ((list (cadr font-list))
(list-cnt (car font-list))
(count 0)
(let* ((list font-list)
(width 0)
(maxwidth 0)
(font "")
(extents '()))
(while (< count list-cnt)
(set! font (aref list count))
(while list
(set! font (car list))
(set! list (cdr list))
(if (= use-name TRUE)
(set! text font))
(set! extents (gimp-text-get-extents-fontname text
......@@ -18,21 +17,19 @@
font))
(set! width (nth 0 extents))
(if (> width maxwidth)
(set! maxwidth width))
(set! count (+ count 1)))
(set! maxwidth width)))
maxwidth))
(define (max-font-height text use-name font-list font-size)
(let* ((list (cadr font-list))
(list-cnt (car font-list))
(count 0)
(let* ((list font-list)
(height 0)
(maxheight 0)
(font "")
(extents '()))
(while (< count list-cnt)
(set! font (aref list count))
(while list
(set! font (car list))
(set! list (cdr list))
(if (= use-name TRUE)
(set! text font))
(set! extents (gimp-text-get-extents-fontname text
......@@ -40,8 +37,7 @@
font))
(set! height (nth 1 extents))
(if (> height maxheight)
(set! maxheight height))
(set! count (+ count 1)))
(set! maxheight height)))
maxheight))
......@@ -52,10 +48,10 @@
font-size
border
colors)
(let* ((font "")
(count 0)
(font-list (gimp-fonts-get-list font-filter))
(num-fonts (car font-list))
(let* ((font "")
(count 0)
(font-list (cadr (gimp-fonts-get-list font-filter)))
(num-fonts (length font-list))
(label-size (/ font-size 2))
(border (+ border (* labels (/ label-size 2))))
(y border)
......@@ -74,8 +70,6 @@
(gimp-image-undo-disable img)
(set! font-list (cadr font-list))
(if (= colors 0)
(begin
(gimp-context-set-background '(255 255 255))
......@@ -93,8 +87,9 @@
(gimp-image-add-layer img drawable -1)))
(gimp-edit-clear drawable)
(while (< count num-fonts)
(set! font (aref font-list count))
(while font-list
(set! font (car font-list))
(set! font-list (cdr font-list))
(if (= use-name TRUE)
(set! text font))
......@@ -121,6 +116,7 @@
"Sans")))
(set! y (+ y label-size))))
(set! count (+ count 1)))
(gimp-image-set-active-layer img drawable)
......
......@@ -735,13 +735,13 @@ marshall_proc_db_call (LISP a)
if ((n_elements < 0) || (n_elements > nlength (list)))
{
g_snprintf (error_str, sizeof (error_str),
"STRING array (argument %d) for function %s has "
"String array (argument %d) for function %s has "
"incorrect length (got %ld, expected %d)",
i + 1, proc_name, nlength (list), n_elements);
return my_err (error_str, NIL);
}
args[i].type = GIMP_PDB_STRINGARRAY;
args[i].type = GIMP_PDB_STRINGARRAY;
args[i].data.d_stringarray = list->storage_as.string_array.data;
}
break;
......@@ -1047,16 +1047,25 @@ marshall_proc_db_call (LISP a)
case GIMP_PDB_STRINGARRAY:
{
LISP array;
LISP array = NIL;
gint j;
array = arcons (tc_string_array, values[i].data.d_int32, 0);
for (j = 0; j < values[i].data.d_int32; j++)
{
array->storage_as.string_array.data[j] =
g_strdup (values[i + 1].data.d_stringarray[j]);
string = (values[i + 1].data.d_stringarray)[j];
if (string)
{
string_len = strlen (string);
array = cons (strcons (string_len, string), array);
}
else
{
array = cons (strcons (0, ""), array);
}
}
return_val = cons (array, return_val);
return_val = cons (nreverse (array), return_val);
}
break;
......
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