summaryrefslogtreecommitdiff
path: root/tikzit/src/common/TikzGraphAssembler.m
diff options
context:
space:
mode:
authorJohan Paulsson <gonz@users.sourceforge.net>2013-01-24 16:30:02 +0000
committerJohan Paulsson <gonz@users.sourceforge.net>2013-01-24 16:30:02 +0000
commit702a3875c5c7c5c937e55d50039ccb0c7bced754 (patch)
treeee41f8802ec6b7904de7921fb97fa7f262e129aa /tikzit/src/common/TikzGraphAssembler.m
parent310d4379dd0f439e9a988c3202add12021384690 (diff)
Anchor support for the parser and osx gui
Diffstat (limited to 'tikzit/src/common/TikzGraphAssembler.m')
-rw-r--r--tikzit/src/common/TikzGraphAssembler.m25
1 files changed, 15 insertions, 10 deletions
diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m
index 5e60b05..7d8d0e7 100644
--- a/tikzit/src/common/TikzGraphAssembler.m
+++ b/tikzit/src/common/TikzGraphAssembler.m
@@ -37,9 +37,9 @@ static id currentAssembler = nil;
void yyerror(const char *str) {
NSLog(@"Parse error: %s", str);
if (currentAssembler != nil) {
- NSError *error = [NSError
- errorWithMessage:[NSString stringWithCString:str]
- code:TZ_ERR_PARSE];
+ NSError *error = [NSError errorWithDomain:@"net.sourceforge.tikzit"
+ code:TZ_ERR_PARSE
+ userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithCString:str] forKey: NSLocalizedDescriptionKey]];
[currentAssembler invalidateWithError:error];
}
}
@@ -137,14 +137,19 @@ int yywrap() {
currentEdge = nil;
}
-- (void)setEdgeSource:(NSString*)src target:(NSString*)targ {
- if (![targ isEqualToString:@""]) {
- [currentEdge setSource:[nodeMap objectForKey:src]];
- [currentEdge setTarget:[nodeMap objectForKey:targ]];
+- (void)setEdgeSource:(NSString*)edge anchor:(NSString*)anch {
+ Node *s = [nodeMap objectForKey:edge];
+ [currentEdge setSource:s];
+ [currentEdge setSourceAnchor:anch];
+}
+
+- (void)setEdgeTarget:(NSString*)edge anchor:(NSString*)anch {
+ if (![edge isEqualToString:@""]) {
+ [currentEdge setTarget:[nodeMap objectForKey:edge]];
+ [currentEdge setTargetAnchor:anch];
} else {
- Node *s = [nodeMap objectForKey:src];
- [currentEdge setSource:s];
- [currentEdge setTarget:s];
+ [currentEdge setTargetAnchor:anch];
+ [currentEdge setTarget:[currentEdge source]];
}
}