summaryrefslogtreecommitdiff
path: root/tikzit/src/common/Preambles.m
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2013-02-04 11:55:17 +0000
committerAlex Merry <alex.merry@cs.ox.ac.uk>2013-02-04 11:55:17 +0000
commit5349460f6ba630d92ab61f4cbe1c04210e7684cc (patch)
treeffca8efdeb7e51477d6f90e93512f75432600c48 /tikzit/src/common/Preambles.m
parentf9bdbf93887313a79528696607d96140f33cbd84 (diff)
parent5afd392bb6ddde79f0518ffd913bd8c365bf39e6 (diff)
Merge branch 'master' into multi-docs
Diffstat (limited to 'tikzit/src/common/Preambles.m')
-rw-r--r--tikzit/src/common/Preambles.m16
1 files changed, 14 insertions, 2 deletions
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]];