diff options
Diffstat (limited to 'tikzit/src')
-rw-r--r-- | tikzit/src/common/EdgeStyle.m | 8 | ||||
-rw-r--r-- | tikzit/src/common/Preambles.h | 2 | ||||
-rw-r--r-- | tikzit/src/common/Preambles.m | 16 | ||||
-rw-r--r-- | tikzit/src/osx/AppDelegate.m | 4 | ||||
-rw-r--r-- | tikzit/src/osx/PreambleController.h | 2 | ||||
-rw-r--r-- | tikzit/src/osx/PreambleController.m | 3 |
6 files changed, 27 insertions, 8 deletions
diff --git a/tikzit/src/common/EdgeStyle.m b/tikzit/src/common/EdgeStyle.m index 88b1f54..7a638c9 100644 --- a/tikzit/src/common/EdgeStyle.m +++ b/tikzit/src/common/EdgeStyle.m @@ -169,9 +169,11 @@ else if (headStyle == AH_Latex) [buf appendString:@"latex"]; - [buf appendString:@",draw="]; - [buf appendString:colorName]; - + if(colorName != nil){ + [buf appendString:@",draw="]; + [buf appendString:colorName]; + } + if (decorationStyle != ED_None) { [buf appendString:@",postaction={decorate},decoration={markings,mark="]; if (decorationStyle == ED_Arrow) diff --git a/tikzit/src/common/Preambles.h b/tikzit/src/common/Preambles.h index d507ad9..95081c4 100644 --- a/tikzit/src/common/Preambles.h +++ b/tikzit/src/common/Preambles.h @@ -29,6 +29,7 @@ NSMutableDictionary *preambleDict; NSString *selectedPreambleName; NSArray *styles; + NSArray *edges; StyleManager *styleManager; } @@ -40,6 +41,7 @@ + (Preambles*)preambles; - (id)init; - (void)setStyles:(NSArray*)sty; +- (void)setEdges:(NSArray*)edg; - (NSString*)preambleForName:(NSString*)name; - (BOOL)setPreamble:(NSString*)content forName:(NSString*)name; diff --git a/tikzit/src/common/Preambles.m b/tikzit/src/common/Preambles.m index af3bbc4..5343127 100644 --- a/tikzit/src/common/Preambles.m +++ b/tikzit/src/common/Preambles.m @@ -64,6 +64,7 @@ static NSString *POSTAMBLE = preambleDict = [[NSMutableDictionary alloc] initWithCapacity:1]; [preambleDict setObject:[self defaultPreamble] forKey:@"custom"]; styles = nil; + edges = nil; styleManager = nil; return self; } @@ -96,6 +97,12 @@ static NSString *POSTAMBLE = styles = sty; } +- (void)setEdges:(NSArray*)edg { + [edg retain]; + [edges release]; + edges = edg; +} + - (NSString*)styleDefinitions { if (styleManager != nil) { [self setStyles:[styleManager nodeStyles]]; @@ -120,11 +127,16 @@ static NSString *POSTAMBLE = [stroke hexName], [stroke redFloat], [stroke greenFloat], [stroke blueFloat]]; } } + + if (styleManager != nil) { + [self setEdges:[styleManager edgeStyles]]; + } + [buf appendString:@"\n"]; - for (EdgeStyle *st in [styleManager edgeStyles]) { + for (EdgeStyle *st in edges) { [buf appendFormat:@"%@\n", [st tikz]]; ColorRGB *color = [st colorRGB]; - if ([color name] == nil && ![colors containsObject:color]) { + if (color != nil && [color name] == nil && ![colors containsObject:color]) { [colors addObject:color]; [colbuf appendFormat:@"\\definecolor{%@}{rgb}{%.3f,%.3f,%.3f}\n", [color hexName], [color redFloat], [color greenFloat], [color blueFloat]]; diff --git a/tikzit/src/osx/AppDelegate.m b/tikzit/src/osx/AppDelegate.m index edfaf19..bb1b5d6 100644 --- a/tikzit/src/osx/AppDelegate.m +++ b/tikzit/src/osx/AppDelegate.m @@ -51,7 +51,9 @@ preambleController = [[PreambleController alloc] initWithWindowNibName:@"Preamble" plist:preamblePlist - styles:[stylePaletteController nodeStyles]]; + styles:[stylePaletteController nodeStyles] + edges:[stylePaletteController edgeStyles]]; + char template[] = "/tmp/tikzit_tmp_XXXXXXX"; char *dir = mkdtemp(template); diff --git a/tikzit/src/osx/PreambleController.h b/tikzit/src/osx/PreambleController.h index 4f7fb33..2d5a8ab 100644 --- a/tikzit/src/osx/PreambleController.h +++ b/tikzit/src/osx/PreambleController.h @@ -44,7 +44,7 @@ @property (retain) NSAttributedString *preambleText; @property (retain) NSIndexSet *selectionIndexes; -- (id)initWithWindowNibName:(NSString *)windowNibName plist:(NSString*)plist styles:(NSArray*)sty; +- (id)initWithWindowNibName:(NSString *)windowNibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg; - (void)savePreambles:(NSString*)plist; - (NSString*)currentPreamble; - (NSString*)currentPostamble; diff --git a/tikzit/src/osx/PreambleController.m b/tikzit/src/osx/PreambleController.m index e09a3fc..e424e7b 100644 --- a/tikzit/src/osx/PreambleController.m +++ b/tikzit/src/osx/PreambleController.m @@ -28,11 +28,12 @@ @synthesize preambleText, preambles; -- (id)initWithWindowNibName:(NSString *)windowNibName plist:(NSString*)plist styles:(NSArray*)sty { +- (id)initWithWindowNibName:(NSString *)windowNibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg { [super initWithWindowNibName:windowNibName]; preambles = (Preambles*)[NSKeyedUnarchiver unarchiveObjectWithFile:plist]; [preambles setStyles:sty]; + [preambles setEdges:edg]; if (preambles == nil) preambles = [[Preambles alloc] init]; preambleText = nil; |