diff options
author | Alex Merry <alex.merry@cs.ox.ac.uk> | 2013-02-04 18:08:38 +0000 |
---|---|---|
committer | Alex Merry <alex.merry@cs.ox.ac.uk> | 2013-02-04 18:08:38 +0000 |
commit | dc720cc5d5e3f5b2f3d8119947a9dd8c69f4b2df (patch) | |
tree | 7b3eeeaca920b37f45d3c762ea6dc6c625760780 /tikzit/src/gtk/Window.m | |
parent | 0f2452356ae718b73e9467e388092c8af6752a8f (diff) |
GTK: prevent the user from creating invalid tikz
The free-form entry fields (graph element properties and node labels)
are a potential source of invalid tikz code. Since we quote any
dodgy-looking text with { and }, we just need to make sure there are no
unmatched curly braces entered in those fields.
This will turn the entry widgets red when there are unmatched braces,
and refuse to make use of any such values.
Diffstat (limited to 'tikzit/src/gtk/Window.m')
-rw-r--r-- | tikzit/src/gtk/Window.m | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tikzit/src/gtk/Window.m b/tikzit/src/gtk/Window.m index 15049ea..66ffc27 100644 --- a/tikzit/src/gtk/Window.m +++ b/tikzit/src/gtk/Window.m @@ -685,11 +685,10 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) _setHasParseError:(BOOL)hasError { if (hasError && !hasParseError) { gtk_statusbar_push (statusBar, 1, "Parse error"); - GdkColor color = {0, 65535, 61184, 61184}; - gtk_widget_modify_base (tikzPane, GTK_STATE_NORMAL, &color); + widget_set_error (tikzPane); } else if (!hasError && hasParseError) { gtk_statusbar_pop (statusBar, 1); - gtk_widget_modify_base (tikzPane, GTK_STATE_NORMAL, NULL); + widget_clear_error (tikzPane); } hasParseError = hasError; } |