diff options
author | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-02-02 12:15:57 +0000 |
---|---|---|
committer | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-02-02 12:15:57 +0000 |
commit | 397cd4071a2f313b3b3b40f8b748c9f6103f5002 (patch) | |
tree | f0fd9b381d13640ee6bc1527418eb64db5a38415 /tikzit/src/common/NodeStyle.m | |
parent | 071fea73851125d78a7df3a9b749fa90ab41b0fa (diff) |
Generate definitions for the edge styles in the default preamble
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@407 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'tikzit/src/common/NodeStyle.m')
-rw-r--r-- | tikzit/src/common/NodeStyle.m | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/tikzit/src/common/NodeStyle.m b/tikzit/src/common/NodeStyle.m index a2d22c7..b3d9ab2 100644 --- a/tikzit/src/common/NodeStyle.m +++ b/tikzit/src/common/NodeStyle.m @@ -135,28 +135,25 @@ } - (NSString*)tikz { - NSString *fillName, *strokeName; - - NSMutableString *buf = [NSMutableString string]; - - fillName = [fillColorRGB name]; - strokeName = [strokeColorRGB name]; - + NSString *fillName = [fillColorRGB name]; + NSString *strokeName = [strokeColorRGB name]; + NSString *stroke = @""; + if (strokeThickness != 1) { + stroke = [NSString stringWithFormat:@",line width=%@ pt", + [NSNumber numberWithFloat:(float)strokeThickness * 0.4f]]; + } + // If the colors are unknown, fall back on hexnames. These should be defined as colors // in the Preambles class. if (fillName == nil) fillName = [fillColorRGB hexName]; if (strokeName == nil) strokeName = [strokeColorRGB hexName]; - - [buf appendFormat:@"\\tikzstyle{%@}=[%@,fill=%@,draw=%@%@]\n", + + return [NSString stringWithFormat:@"\\tikzstyle{%@}=[%@,fill=%@,draw=%@%@]", name, shapeName, fillName, strokeName, - (strokeThickness != 1) ? - [NSString stringWithFormat:@",line width=%@ pt", - [NSNumber numberWithFloat:(float)strokeThickness * 0.4f]] : @""]; - - return buf; + stroke]; } - (BOOL)strokeColorIsKnown { |