diff options
author | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-03-10 16:16:25 +0000 |
---|---|---|
committer | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-03-10 16:16:25 +0000 |
commit | 84d4bc6f0f38e237f2a40faaf75e921211ab0ac6 (patch) | |
tree | d3a644fed47ea2b24cf6c9a50480bd766f036bc9 /tikzit/src/gtk/MainWindow.m | |
parent | 4f15081a2cdf33c1ec6ba8c3c90ae81a7d4b42e8 (diff) |
Better parse error reporting
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@424 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'tikzit/src/gtk/MainWindow.m')
-rw-r--r-- | tikzit/src/gtk/MainWindow.m | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tikzit/src/gtk/MainWindow.m b/tikzit/src/gtk/MainWindow.m index 6506125..0043137 100644 --- a/tikzit/src/gtk/MainWindow.m +++ b/tikzit/src/gtk/MainWindow.m @@ -521,7 +521,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc gtk_text_buffer_get_bounds (tikzBuffer, &start, &end); gchar *text = gtk_text_buffer_get_text (tikzBuffer, &start, &end, FALSE); - BOOL success = [document setTikz:[NSString stringWithUTF8String:text]]; + BOOL success = [document updateTikz:[NSString stringWithUTF8String:text] error:NULL]; [self _setHasParseError:!success]; g_free (text); @@ -766,12 +766,18 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) _forceLoadDocumentFromFile:(NSString*)path { NSError *error = nil; - TikzDocument *d = [TikzDocument documentFromFile:path styleManager:styleManager error:&error]; + TikzDocument *d = [TikzDocument documentFromFile:path + styleManager:styleManager + error:&error]; if (d != nil) { [self _setActiveDocument:d]; [[RecentManager defaultManager] addRecentFile:path]; } else { - [self presentError:error withMessage:@"Could not open file"]; + if ([error code] == TZ_ERR_PARSE) { + [self presentError:error withMessage:@"Invalid file"]; + } else { + [self presentError:error withMessage:@"Could not open file"]; + } [[RecentManager defaultManager] removeRecentFile:path]; } } |