GNOME Bugzilla – Bug 124394
ScriptFu text should support multiline input
Last modified: 2004-09-23 18:20:00 UTC
As PangoLayout support multiline layout there is no reason for ScriptFu to limit text input to single line. By changing the input box for the ScriptFu Text type entry from a GtkEntry to a GtkTextViewer it is possible to support multi line input. Of course there is a question of what alignment to request from the PangoLayout. Ultimately I would have liked to add an alignment field to each script fu script that has an alignment input, but since this is not possible without breaking the API, I suggest that the alignment is set to center. Once named parameters are introduced, then the alignment should be made into a parameter. Another possibility might be to change ScriptFu text to actually refer to two different inputs, the entry widget and an associated alignment. But that would break just much...
Created attachment 20686 [details] [review] Patch to script-fu-scripts.c to provide multiline input for SF_STRING
I just provided a patch to script-fu-scripts.c to make the input fields for SF_TEXT be GtkTextView instead of GtkEntry. This is enough for providing multiline input for most of the script fu label scripts. But with a few exceptions: - The pango alignment for the text tool is currently set to be PANGO_ALIGN_LEFT. For most labels the most natural is to have the alignment CENTER. Currently there is no API that supports setting the alignment. this should be changed. - Yosh believes that multi-line should be another SF type. Such a type should also provide an alignment object. [I realized yesterday that it might actually be possible to get even more fancy by supporting the full power of PangoMarkup. This would mean creating a widget that supports editing PangoMarkups regarding font sizes etc. Unfortunately PangoMarkup currently lacks paragraph control... Either PangoMarkup may be extended or another method may be specified for that functionality.]
Multiline text in Script-Fu would be so useful that we should IMHO add this feature in 2.2
IMHO we should add a new parameter type to Script-Fu that allows for multiline strings. It could be called SF-TEXT and the implementation could be based on the patch already provided here.
Created attachment 31878 [details] [review] Patch to add multi-line text and SF-TEXT argument type for scripts This patch adds an SF-TEXT argument type for use in Script-Fu scripts. The SF-TEXT type allows for input of multiple-lines of text where the still existing SF-STRING argument type only allows for a single line of input.
Applied. Will do some further modification but wanted to commit the patch first. 2004-09-23 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/script-fu-enums.h * plug-ins/script-fu/script-fu-interface.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/siod-wrapper.c: applied a patch by Kevin Cozens, based on a patch by Dov Grobgeld. Implements multi-line text input in Script-Fu (bug #124394). * plug-ins/script-fu/scripts/test-sphere.scm: test the new SF-TEXT parameter.