diff options
author | Johan Paulsson <gonz@users.sourceforge.net> | 2013-01-24 18:21:59 +0000 |
---|---|---|
committer | Johan Paulsson <gonz@users.sourceforge.net> | 2013-01-24 18:21:59 +0000 |
commit | 46d894569372dea8c3e3f698b361f68d6bbebde6 (patch) | |
tree | 895dc3157d94bd38cc6e880c1c7aea76d8cb509d /tikzit/src/common | |
parent | 702a3875c5c7c5c937e55d50039ccb0c7bced754 (diff) |
Default preamble will include edges in osx. Added checks for null colour as coloured edges is not an option in osx.
Diffstat (limited to 'tikzit/src/common')
-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 |
3 files changed, 21 insertions, 5 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]]; |