diff options
Diffstat (limited to 'tikzit/src')
-rw-r--r-- | tikzit/src/Makefile.am | 6 | ||||
-rw-r--r-- | tikzit/src/linux/MainWindow.m | 9 | ||||
-rw-r--r-- | tikzit/src/linux/Menu.m | 20 |
3 files changed, 22 insertions, 13 deletions
diff --git a/tikzit/src/Makefile.am b/tikzit/src/Makefile.am index f75e525..c018dc2 100644 --- a/tikzit/src/Makefile.am +++ b/tikzit/src/Makefile.am @@ -42,8 +42,6 @@ tikzit_SOURCES = linux/CairoRenderContext.m \ linux/NSError+Glib.m \ linux/NSFileManager+Glib.m \ linux/NSString+Glib.m \ - linux/PreambleEditor.m \ - linux/Preambles+Storage.m \ linux/PropertyPane.m \ linux/PropertyListEditor.m \ linux/RecentManager.m \ @@ -72,7 +70,6 @@ tikzit_SOURCES = linux/CairoRenderContext.m \ common/NSFileManager+Utils.m \ common/NSString+LatexConstants.m \ common/PickSupport.m \ - common/Preambles.m \ common/PropertyHolder.m \ common/GraphElementProperty.m \ common/RColor.m \ @@ -90,6 +87,9 @@ tikzit_SOURCES = linux/CairoRenderContext.m \ if HAVE_POPPLER tikzit_SOURCES += \ + common/Preambles.m \ + linux/PreambleEditor.m \ + linux/Preambles+Storage.m \ linux/PreviewRenderer.m \ linux/PreviewWindow.m endif diff --git a/tikzit/src/linux/MainWindow.m b/tikzit/src/linux/MainWindow.m index ecaf1fa..eceb7f9 100644 --- a/tikzit/src/linux/MainWindow.m +++ b/tikzit/src/linux/MainWindow.m @@ -27,9 +27,9 @@ #import "GraphRenderer.h" #import "Menu.h" #import "PreambleEditor.h" +#ifdef HAVE_POPPLER #import "Preambles.h" #import "Preambles+Storage.h" -#ifdef HAVE_POPPLER #import "PreviewWindow.h" #endif #import "PropertyPane.h" @@ -122,6 +122,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc if (self) { document = nil; + preambles = nil; preambleWindow = nil; previewWindow = nil; suppressTikzUpdates = NO; @@ -339,11 +340,13 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc } - (void) editPreambles { +#ifdef HAVE_POPPLER if (preambleWindow == nil) { preambleWindow = [[PreambleEditor alloc] initWithPreambles:preambles]; [preambleWindow setParentWindow:mainWindow]; } [preambleWindow show]; +#endif } - (void) showPreview { @@ -440,6 +443,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc - (void) saveConfiguration { NSError *error = nil; +#ifdef HAVE_POPPLER if (preambles != nil) { NSString *preamblesDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"preambles"]; // NSFileManager is slightly dodgy on Windows @@ -447,6 +451,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc [preambles storeToDirectory:preamblesDir]; [configFile setStringEntry:@"selectedPreamble" inGroup:@"Preambles" value:[preambles selectedPreambleName]]; } +#endif [styleManager saveStylesUsingConfigurationName:@"styles"]; [propertyPane saveUiStateToConfig:configFile group:@"PropertyPane"]; @@ -553,6 +558,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc // must happen after _loadStyles - (void) _loadPreambles { +#ifdef HAVE_POPPLER NSString *preamblesDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"preambles"]; preambles = [[Preambles alloc] initFromDirectory:preamblesDir]; [preambles setStyleManager:styleManager]; @@ -560,6 +566,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc if (selectedPreamble != nil) { [preambles setSelectedPreambleName:selectedPreamble]; } +#endif } - (void) _loadUi { diff --git a/tikzit/src/linux/Menu.m b/tikzit/src/linux/Menu.m index c7eb16d..660f9e2 100644 --- a/tikzit/src/linux/Menu.m +++ b/tikzit/src/linux/Menu.m @@ -224,12 +224,20 @@ static void flip_vert_cb (GtkAction *action, MainWindow *window) { [pool drain]; } +#ifdef HAVE_POPPLER static void show_preamble_cb (GtkAction *action, MainWindow *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [window editPreambles]; [pool drain]; } +static void show_preview_cb (GtkAction *action, MainWindow *window) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [window showPreview]; + [pool drain]; +} +#endif + static void zoom_in_cb (GtkAction *action, MainWindow *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [window zoomIn]; @@ -248,14 +256,6 @@ static void zoom_reset_cb (GtkAction *action, MainWindow *window) { [pool drain]; } -#ifdef HAVE_POPPLER -static void show_preview_cb (GtkAction *action, MainWindow *window) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [window showPreview]; - [pool drain]; -} -#endif - static void input_mode_change_cb (GtkRadioAction *action, GtkRadioAction *current, MainWindow *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [[window graphInputHandler] setMode:(InputMode)gtk_radio_action_get_current_value (action)]; @@ -357,8 +357,8 @@ static const gchar ui_info[] = " <menuitem action='ToolbarVisible'/>" " <menuitem action='StatusbarVisible'/>" */ -" <menuitem action='ShowPreamble'/>" #ifdef HAVE_POPPLER +" <menuitem action='ShowPreamble'/>" " <menuitem action='ShowPreview'/>" #endif " <menu action='Zoom'>" @@ -439,8 +439,10 @@ static GtkActionEntry static_entries[] = { /* ViewMenu */ { "ToolbarStyle", NULL, N_("_Toolbar style") }, +#ifdef HAVE_POPPLER { "ShowPreamble", NULL, N_("_Edit Preambles..."), NULL, N_("Edit the preambles used to generate the preview"), G_CALLBACK (show_preamble_cb) }, +#endif { "Zoom", NULL, N_("_Zoom") }, |