summaryrefslogtreecommitdiff
path: root/tikzit
diff options
context:
space:
mode:
authorJohan Paulsson <gonz@badcode.net>2015-02-25 12:36:17 -0800
committerJohan Paulsson <gonz@badcode.net>2015-02-25 12:36:17 -0800
commitffa99ec96899716ce1084177810303d336f51ff6 (patch)
treef427df60958a456351c73fddd7536bcfa81bc480 /tikzit
parent8233df2ddd3133618be536c5423cdc6a40b4a20c (diff)
Conversion of common files to ifdef for ARC
Diffstat (limited to 'tikzit')
-rw-r--r--tikzit/TikZiT.xcodeproj/project.pbxproj56
-rw-r--r--tikzit/TikZiT.xcodeproj/project.xcworkspace/xcshareddata/TikZiT.xccheckout12
-rw-r--r--tikzit/src/common/ColorRGB.m26
-rw-r--r--tikzit/src/common/Edge.m44
-rw-r--r--tikzit/src/common/EdgeStyle.m20
-rw-r--r--tikzit/src/common/Graph.m112
-rw-r--r--tikzit/src/common/GraphChange.m201
-rw-r--r--tikzit/src/common/GraphElementData.m59
-rw-r--r--tikzit/src/common/GraphElementProperty.m23
-rw-r--r--tikzit/src/common/NSString+LatexConstants.m4
-rw-r--r--tikzit/src/common/NSString+Tikz.m11
-rw-r--r--tikzit/src/common/Node.m34
-rw-r--r--tikzit/src/common/NodeStyle.m24
-rw-r--r--tikzit/src/common/PickSupport.m19
-rw-r--r--tikzit/src/common/Preambles.m28
-rw-r--r--tikzit/src/common/PropertyHolder.m2
-rw-r--r--tikzit/src/common/Shape.m16
-rw-r--r--tikzit/src/common/StyleManager.m47
-rw-r--r--tikzit/src/common/TikzGraphAssembler.m30
-rw-r--r--tikzit/src/common/TikzShape.m4
-rw-r--r--tikzit/src/common/Transformer.m12
-rw-r--r--tikzit/src/common/tikzparserdefs.h9
22 files changed, 641 insertions, 152 deletions
diff --git a/tikzit/TikZiT.xcodeproj/project.pbxproj b/tikzit/TikZiT.xcodeproj/project.pbxproj
index 8e3e7c9..feba845 100644
--- a/tikzit/TikZiT.xcodeproj/project.pbxproj
+++ b/tikzit/TikZiT.xcodeproj/project.pbxproj
@@ -21,9 +21,9 @@
55391AF813D3250F007DBE71 /* Preamble.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55391AF713D3250F007DBE71 /* Preamble.xib */; };
55391B0213D32608007DBE71 /* PropertyInspector.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55391B0013D32608007DBE71 /* PropertyInspector.xib */; };
55391B0A13D32765007DBE71 /* PropertyInspectorController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55391B0913D32765007DBE71 /* PropertyInspectorController.m */; };
- 55397C7914498C22006942FB /* EdgeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7814498C22006942FB /* EdgeStyle.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55397C7914498C22006942FB /* EdgeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7814498C22006942FB /* EdgeStyle.m */; };
55397C7C144990EA006942FB /* EdgeStyle+Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7B144990EA006942FB /* EdgeStyle+Coder.m */; };
- 55397C7F144999C4006942FB /* PropertyHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7E144999C4006942FB /* PropertyHolder.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55397C7F144999C4006942FB /* PropertyHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7E144999C4006942FB /* PropertyHolder.m */; };
55397C811449A877006942FB /* ED_arrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 55397C801449A877006942FB /* ED_arrow.png */; };
55397C831449A8F1006942FB /* ED_tick.png in Resources */ = {isa = PBXBuildFile; fileRef = 55397C821449A8F1006942FB /* ED_tick.png */; };
55397C851449A9BF006942FB /* ED_none.png in Resources */ = {isa = PBXBuildFile; fileRef = 55397C841449A9BF006942FB /* ED_none.png */; };
@@ -33,17 +33,17 @@
55397C901449AC7C006942FB /* AH_latex_head.png in Resources */ = {isa = PBXBuildFile; fileRef = 55397C8E1449AC7C006942FB /* AH_latex_head.png */; };
55397C911449AC7C006942FB /* AH_plain_head.png in Resources */ = {isa = PBXBuildFile; fileRef = 55397C8F1449AC7C006942FB /* AH_plain_head.png */; };
553A4C5A144ED3D500AA6FAC /* NilToEmptyStringTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 553A4C59144ED3D500AA6FAC /* NilToEmptyStringTransformer.m */; };
- 55432E061444BF2D00401BB3 /* GraphElementProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 55432E051444BF2D00401BB3 /* GraphElementProperty.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55598E351635372E0023450A /* DiamondShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55598E341635372E0023450A /* DiamondShape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55432E061444BF2D00401BB3 /* GraphElementProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 55432E051444BF2D00401BB3 /* GraphElementProperty.m */; };
+ 55598E351635372E0023450A /* DiamondShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55598E341635372E0023450A /* DiamondShape.m */; };
555B30F911D8BE3300CAECF5 /* emblem-important.png in Resources */ = {isa = PBXBuildFile; fileRef = 555B30F811D8BE3300CAECF5 /* emblem-important.png */; };
555B313511D8C6DA00CAECF5 /* color.m in Sources */ = {isa = PBXBuildFile; fileRef = 555B313411D8C6DA00CAECF5 /* color.m */; };
555ECE9B1378A3AA0052DB71 /* CALayer+DrawLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 555ECE9A1378A3AA0052DB71 /* CALayer+DrawLabel.m */; };
- 55652DF913E1F2030023F4C6 /* SupportDir.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652DF813E1F2030023F4C6 /* SupportDir.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55652E3B13E1FAEE0023F4C6 /* CircleShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3413E1FAED0023F4C6 /* CircleShape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55652E3C13E1FAEE0023F4C6 /* RectangleShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3613E1FAED0023F4C6 /* RectangleShape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55652E3D13E1FAEE0023F4C6 /* RegularPolyShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3813E1FAED0023F4C6 /* RegularPolyShape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55652E3E13E1FAEE0023F4C6 /* TikzShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3A13E1FAEE0023F4C6 /* TikzShape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55652E4113E1FB0A0023F4C6 /* Shape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E4013E1FB0A0023F4C6 /* Shape.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55652DF913E1F2030023F4C6 /* SupportDir.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652DF813E1F2030023F4C6 /* SupportDir.m */; };
+ 55652E3B13E1FAEE0023F4C6 /* CircleShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3413E1FAED0023F4C6 /* CircleShape.m */; };
+ 55652E3C13E1FAEE0023F4C6 /* RectangleShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3613E1FAED0023F4C6 /* RectangleShape.m */; };
+ 55652E3D13E1FAEE0023F4C6 /* RegularPolyShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3813E1FAED0023F4C6 /* RegularPolyShape.m */; };
+ 55652E3E13E1FAEE0023F4C6 /* TikzShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E3A13E1FAEE0023F4C6 /* TikzShape.m */; };
+ 55652E4113E1FB0A0023F4C6 /* Shape.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652E4013E1FB0A0023F4C6 /* Shape.m */; };
55652E5613E1FC660023F4C6 /* cap.tikz in Copy Shapes */ = {isa = PBXBuildFile; fileRef = 55652E5113E1FC660023F4C6 /* cap.tikz */; };
55652E5713E1FC660023F4C6 /* copants.tikz in Copy Shapes */ = {isa = PBXBuildFile; fileRef = 55652E5213E1FC660023F4C6 /* copants.tikz */; };
55652E5813E1FC660023F4C6 /* cup.tikz in Copy Shapes */ = {isa = PBXBuildFile; fileRef = 55652E5313E1FC660023F4C6 /* cup.tikz */; };
@@ -55,11 +55,11 @@
5573B90F11DA231A00B5DC5D /* PreambleController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5573B90E11DA231A00B5DC5D /* PreambleController.m */; };
5573B92111DA259C00B5DC5D /* text-x-generic.png in Resources */ = {isa = PBXBuildFile; fileRef = 5573B92011DA259C00B5DC5D /* text-x-generic.png */; };
5573B92511DA273400B5DC5D /* format-indent-less.png in Resources */ = {isa = PBXBuildFile; fileRef = 5573B92411DA273400B5DC5D /* format-indent-less.png */; };
- 5573B92911DA292F00B5DC5D /* Preambles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5573B92811DA292F00B5DC5D /* Preambles.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 5573B92911DA292F00B5DC5D /* Preambles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5573B92811DA292F00B5DC5D /* Preambles.m */; };
5573B98811DA377C00B5DC5D /* text-x-script.png in Resources */ = {isa = PBXBuildFile; fileRef = 5573B98711DA377C00B5DC5D /* text-x-script.png */; };
5573BDCB11DB4D2600B5DC5D /* Preambles+Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 5573BDCA11DB4D2600B5DC5D /* Preambles+Coder.m */; };
5585E5C2117F681800124513 /* NodeStyle+Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 5585E5C1117F681800124513 /* NodeStyle+Coder.m */; };
- 5589A9FF11C51E780064D310 /* TikzGraphAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = 5589A9FE11C51E780064D310 /* TikzGraphAssembler.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 5589A9FF11C51E780064D310 /* TikzGraphAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = 5589A9FE11C51E780064D310 /* TikzGraphAssembler.m */; };
5589AA6C11C542D30064D310 /* TikzGraphAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = 5589A9FE11C51E780064D310 /* TikzGraphAssembler.m */; };
5589AA6D11C542D30064D310 /* tikzlexer.lm in Sources */ = {isa = PBXBuildFile; fileRef = 5589A9AA11C500060064D310 /* tikzlexer.lm */; };
5589AA6E11C542D30064D310 /* tikzparser.ym in Sources */ = {isa = PBXBuildFile; fileRef = 5589A9AB11C500060064D310 /* tikzparser.ym */; };
@@ -71,14 +71,14 @@
5589AA8011C542E60064D310 /* NodeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C4117B031C009863B2 /* NodeStyle.m */; };
5589AA8511C543500064D310 /* util.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18CD117B03DD009863B2 /* util.m */; };
5589AD4411C633EE0064D310 /* SelectBoxLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5589AD4311C633EE0064D310 /* SelectBoxLayer.m */; };
- 558F18C5117B031C009863B2 /* Edge.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BA117B031C009863B2 /* Edge.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 558F18C6117B031C009863B2 /* Graph.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BC117B031C009863B2 /* Graph.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 558F18C7117B031C009863B2 /* GraphChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BE117B031C009863B2 /* GraphChange.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 558F18C8117B031C009863B2 /* GraphElementData.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C0117B031C009863B2 /* GraphElementData.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 558F18C9117B031C009863B2 /* Node.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C2117B031C009863B2 /* Node.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 558F18CA117B031C009863B2 /* NodeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C4117B031C009863B2 /* NodeStyle.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 558F18C5117B031C009863B2 /* Edge.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BA117B031C009863B2 /* Edge.m */; };
+ 558F18C6117B031C009863B2 /* Graph.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BC117B031C009863B2 /* Graph.m */; };
+ 558F18C7117B031C009863B2 /* GraphChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18BE117B031C009863B2 /* GraphChange.m */; };
+ 558F18C8117B031C009863B2 /* GraphElementData.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C0117B031C009863B2 /* GraphElementData.m */; };
+ 558F18C9117B031C009863B2 /* Node.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C2117B031C009863B2 /* Node.m */; };
+ 558F18CA117B031C009863B2 /* NodeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18C4117B031C009863B2 /* NodeStyle.m */; };
558F18CE117B03DD009863B2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18CB117B03DD009863B2 /* main.m */; };
- 558F18CF117B03DD009863B2 /* util.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18CD117B03DD009863B2 /* util.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 558F18CF117B03DD009863B2 /* util.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18CD117B03DD009863B2 /* util.m */; };
558F18F7117B043C009863B2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18DA117B043B009863B2 /* AppDelegate.m */; };
558F18F9117B043C009863B2 /* EdgeControlLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18DE117B043B009863B2 /* EdgeControlLayer.m */; };
558F18FA117B043C009863B2 /* GraphicsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 558F18E0117B043B009863B2 /* GraphicsView.m */; };
@@ -97,12 +97,12 @@
559EFA4811C7D49800D020F4 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 559EFA4711C7D49800D020F4 /* Sparkle.framework */; };
559EFA4E11C7D4BD00D020F4 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 559EFA4711C7D49800D020F4 /* Sparkle.framework */; };
559EFA5711C7D95F00D020F4 /* tikzit_dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 559EFA5611C7D95F00D020F4 /* tikzit_dsa_pub.pem */; };
- 559EFB6811CB88E300D020F4 /* ColorRGB.m in Sources */ = {isa = PBXBuildFile; fileRef = 559EFB6711CB88E300D020F4 /* ColorRGB.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 559EFB6811CB88E300D020F4 /* ColorRGB.m in Sources */ = {isa = PBXBuildFile; fileRef = 559EFB6711CB88E300D020F4 /* ColorRGB.m */; };
55CA98D512EF8FCE008F0368 /* SFBInspectors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55CA98D412EF8FCE008F0368 /* SFBInspectors.framework */; };
55CA98DA12EF9098008F0368 /* SFBInspectors.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 55CA98D412EF8FCE008F0368 /* SFBInspectors.framework */; };
55CA98DD12EF910F008F0368 /* SFBInspectors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55CA98D412EF8FCE008F0368 /* SFBInspectors.framework */; };
55CA997212F08281008F0368 /* TikzWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA997112F08281008F0368 /* TikzWindowController.m */; };
- 55CA9AC912F831E5008F0368 /* RColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA9AC812F831E5008F0368 /* RColor.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55CA9AC912F831E5008F0368 /* RColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA9AC812F831E5008F0368 /* RColor.m */; };
55CA9ACA12F831E5008F0368 /* RColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CA9AC812F831E5008F0368 /* RColor.m */; };
55D2E0B21186ED950060B4EC /* Graph+Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 55D2E0B11186ED950060B4EC /* Graph+Coder.m */; };
55D945721165904F0044178C /* tikzitdoc.icns in Resources */ = {isa = PBXBuildFile; fileRef = 55D945701165904F0044178C /* tikzitdoc.icns */; };
@@ -111,9 +111,9 @@
55D949151165D8870044178C /* draw-path.png in Resources */ = {isa = PBXBuildFile; fileRef = 55D949121165D8870044178C /* draw-path.png */; };
55D949161165D8870044178C /* select-rectangular.png in Resources */ = {isa = PBXBuildFile; fileRef = 55D949131165D8870044178C /* select-rectangular.png */; };
55E5E99E1215C8E300256F69 /* transform-crop-and-resize.png in Resources */ = {isa = PBXBuildFile; fileRef = 55E5E99D1215C8E300256F69 /* transform-crop-and-resize.png */; };
- 55F9585C1181B09600F99434 /* PickSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F958591181B09600F99434 /* PickSupport.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55F9585D1181B09600F99434 /* Transformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F9585B1181B09600F99434 /* Transformer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 55F9E04511FF54F000F5659E /* NSString+LatexConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F9E04411FF54F000F5659E /* NSString+LatexConstants.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 55F9585C1181B09600F99434 /* PickSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F958591181B09600F99434 /* PickSupport.m */; };
+ 55F9585D1181B09600F99434 /* Transformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F9585B1181B09600F99434 /* Transformer.m */; };
+ 55F9E04511FF54F000F5659E /* NSString+LatexConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 55F9E04411FF54F000F5659E /* NSString+LatexConstants.m */; };
7F18A321184C577000BC3081 /* UpdatePreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F18A320184C577000BC3081 /* UpdatePreferenceController.m */; };
7F18A323184C599100BC3081 /* UpdatePreferencePanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7F18A322184C599100BC3081 /* UpdatePreferencePanel.xib */; };
7F6E2C7D16B007F000BFE20D /* EdgeStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 55397C7814498C22006942FB /* EdgeStyle.m */; };
@@ -131,11 +131,11 @@
7F6E2C8C16B00ABA00BFE20D /* SFBInspectors.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 55CA98D412EF8FCE008F0368 /* SFBInspectors.framework */; };
7F73438A184AC559002897D0 /* DraggablePDFView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F734389184AC559002897D0 /* DraggablePDFView.m */; };
7F781C1A16B5DE1400239826 /* ParseErrorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F781C1916B5DE1400239826 /* ParseErrorView.m */; };
- 7F7B6DED18DE0C9E004F6CA8 /* tikzlexer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DEA18DE0C9E004F6CA8 /* tikzlexer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- 7F7B6DEE18DE0C9E004F6CA8 /* tikzparser.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DEC18DE0C9E004F6CA8 /* tikzparser.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 7F7B6DED18DE0C9E004F6CA8 /* tikzlexer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DEA18DE0C9E004F6CA8 /* tikzlexer.m */; };
+ 7F7B6DEE18DE0C9E004F6CA8 /* tikzparser.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DEC18DE0C9E004F6CA8 /* tikzparser.m */; };
7F7B6DF418DE0D7A004F6CA8 /* CustomNodeCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DF118DE0D7A004F6CA8 /* CustomNodeCellView.m */; };
7F7B6DF518DE0D7A004F6CA8 /* CustomNodeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7B6DF318DE0D7A004F6CA8 /* CustomNodeController.m */; };
- 7F90E88616DD29600069EBCD /* NSString+Tikz.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F90E88516DD29600069EBCD /* NSString+Tikz.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 7F90E88616DD29600069EBCD /* NSString+Tikz.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F90E88516DD29600069EBCD /* NSString+Tikz.m */; };
7F90E88D16DD47540069EBCD /* PreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F90E88B16DD47540069EBCD /* PreferenceController.m */; };
7F90E88E16DD47540069EBCD /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7F90E88C16DD47540069EBCD /* Preferences.xib */; };
7F90E89116DD54440069EBCD /* UserDefaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7F90E88F16DD54440069EBCD /* UserDefaults.plist */; };
@@ -145,7 +145,7 @@
7FB9BFEE16B57C2E00773146 /* TikzFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FB9BFED16B57C2E00773146 /* TikzFormatter.m */; };
7FD5D44B18E1CB5300E2A930 /* CustomNodes.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7FD5D44918E1CB5300E2A930 /* CustomNodes.xib */; };
7FD5D44D18E1CC0B00E2A930 /* customshape.png in Resources */ = {isa = PBXBuildFile; fileRef = 7FD5D44C18E1CC0B00E2A930 /* customshape.png */; };
- 7FEED45716B1A7C500B056CB /* StyleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FEED45616B1A7C500B056CB /* StyleManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ 7FEED45716B1A7C500B056CB /* StyleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FEED45616B1A7C500B056CB /* StyleManager.m */; };
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
diff --git a/tikzit/TikZiT.xcodeproj/project.xcworkspace/xcshareddata/TikZiT.xccheckout b/tikzit/TikZiT.xcodeproj/project.xcworkspace/xcshareddata/TikZiT.xccheckout
index 2cc312b..c3ec4fe 100644
--- a/tikzit/TikZiT.xcodeproj/project.xcworkspace/xcshareddata/TikZiT.xccheckout
+++ b/tikzit/TikZiT.xcodeproj/project.xcworkspace/xcshareddata/TikZiT.xccheckout
@@ -6,22 +6,18 @@
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>26857C1F-E0FE-4FFB-BDAC-44158C649772</string>
- <key>IDESourceControlProjectName</key>
- <string>TikZiT</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>F6FA2C351D428A0F1026539971510A626DEEFF59</key>
- <string>https://git.code.sf.net/p/tikzit/code</string>
+ <string>https://github.com/tikzit/tikzit.git</string>
</dict>
- <key>IDESourceControlProjectPath</key>
- <string>tikzit/TikZiT.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>F6FA2C351D428A0F1026539971510A626DEEFF59</key>
- <string>../../..</string>
+ <string>TikZiT/</string>
</dict>
<key>IDESourceControlProjectURL</key>
- <string>https://git.code.sf.net/p/tikzit/code</string>
+ <string>https://github.com/tikzit/tikzit.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
@@ -34,7 +30,7 @@
<key>IDESourceControlWCCIdentifierKey</key>
<string>F6FA2C351D428A0F1026539971510A626DEEFF59</string>
<key>IDESourceControlWCCName</key>
- <string>tikzit-code</string>
+ <string>TikZiT</string>
</dict>
</array>
</dict>
diff --git a/tikzit/src/common/ColorRGB.m b/tikzit/src/common/ColorRGB.m
index c108cfe..840d716 100644
--- a/tikzit/src/common/ColorRGB.m
+++ b/tikzit/src/common/ColorRGB.m
@@ -25,7 +25,11 @@
#import "util.h"
typedef struct {
- NSString *name;
+#if __has_feature(objc_arc)
+ __unsafe_unretained NSString *name;
+#else
+ NSString *name;
+#endif
unsigned short r, g, b;
} ColorRGBEntry;
@@ -278,17 +282,29 @@ static NSMapTable *colorHash = nil;
+ (ColorRGB*)colorWithRed:(unsigned short)r green:(unsigned short)g blue:(unsigned short)b {
ColorRGB *col = [[ColorRGB alloc] initWithRed:r green:g blue:b];
- return [col autorelease];
+#if __has_feature(objc_arc)
+ return col;
+#else
+ return [col autorelease];
+#endif
}
+ (ColorRGB*)colorWithFloatRed:(float)r green:(float)g blue:(float)b {
ColorRGB *col = [[ColorRGB alloc] initWithFloatRed:r green:g blue:b];
- return [col autorelease];
+#if __has_feature(objc_arc)
+ return col;
+#else
+ return [col autorelease];
+#endif
}
+ (ColorRGB*) colorWithRColor:(RColor)color {
+#if __has_feature(objc_arc)
+ return [[self alloc] initWithRColor:color];
+#else
return [[[self alloc] initWithRColor:color] autorelease];
+#endif
}
+ (void)makeColorHash {
@@ -300,13 +316,17 @@ static NSMapTable *colorHash = nil;
blue:kColors[i].b];
[h setObject:kColors[i].name forKey:col];
//NSLog(@"adding color %@ (%d)", kColors[i].name, [col hash]);
+#if ! __has_feature(objc_arc)
[col release];
+#endif
}
colorHash = h;
}
+ (void)releaseColorHash {
+#if ! __has_feature(objc_arc)
[colorHash release];
+#endif
}
- (void)setToClosestHashed {
diff --git a/tikzit/src/common/Edge.m b/tikzit/src/common/Edge.m
index ba80aef..ee0f03d 100644
--- a/tikzit/src/common/Edge.m
+++ b/tikzit/src/common/Edge.m
@@ -72,7 +72,11 @@
}
// if we didn't find a style, fill in a default one
+#if __has_feature(objc_arc)
+ style = [EdgeStyle defaultEdgeStyleWithName:style_name];
+#else
style = [[EdgeStyle defaultEdgeStyleWithName:style_name] retain];
+#endif
return NO;
}
@@ -318,8 +322,12 @@
- (EdgeStyle*)style {return style;}
- (void)setStyle:(EdgeStyle*)s {
if (style != s) {
+#if __has_feature(objc_arc)
+ style = s;
+#else
[style release];
style = [s retain];
+#endif
}
}
@@ -335,9 +343,13 @@
[self setSourceAnchor:@""];
}
+#if __has_feature(objc_arc)
+ source = s;
+#else
[source release];
source = [s retain];
-
+#endif
+
if (source==target) {
bendMode = EdgeBendModeInOut;
weight = 1.0f;
@@ -365,9 +377,13 @@
[self setTargetAnchor:@""];
}
+#if __has_feature(objc_arc)
+ target = t;
+#else
[target release];
target = [t retain];
-
+#endif
+
if (source==target) {
bendMode = EdgeBendModeInOut;
weight = 1.0f;
@@ -422,8 +438,12 @@
[self willChangeValueForKey:@"hasEdgeNode"];
if (edgeNode != n) {
hasEdgeNode = (n != nil);
+#if __has_feature(objc_arc)
+ edgeNode = n;
+#else
[edgeNode release];
edgeNode = [n retain];
+#endif
// don't set dirty bit, because control points don't need update
}
[self didChangeValueForKey:@"edgeNode"];
@@ -450,7 +470,9 @@
}else{
sourceAnchor = @"";
}
+#if ! __has_feature(objc_arc)
[oldSourceAnchor release];
+#endif
}
- (NSString*) targetAnchor { return targetAnchor; }
@@ -461,7 +483,9 @@
}else{
targetAnchor = @"";
}
+#if ! __has_feature(objc_arc)
[oldTargetAnchor release];
+#endif
}
@synthesize data;
@@ -558,11 +582,15 @@
- (void)setPropertiesFromEdge:(Edge*)e {
Node *en = [[e edgeNode] copy];
[self setEdgeNode:en];
+#if ! __has_feature(objc_arc)
[en release];
+#endif
GraphElementData *d = [[e data] copy];
[self setData:d];
+#if ! __has_feature(objc_arc)
[d release];
+#endif
[self setStyle:[e style]];
[self setBend:[e bend]];
@@ -683,12 +711,14 @@
forKeyPath:@"style"];
[target removeObserver:self
forKeyPath:@"style"];
+#if ! __has_feature(objc_arc)
[source release];
[target release];
[data release];
[sourceAnchor release];
[targetAnchor release];
[super dealloc];
+#endif
}
- (id)copyWithZone:(NSZone*)zone {
@@ -702,11 +732,19 @@
}
+ (Edge*)edge {
+#if __has_feature(objc_arc)
+ return [[Edge alloc] init];
+#else
return [[[Edge alloc] init] autorelease];
+#endif
}
+ (Edge*)edgeWithSource:(Node*)s andTarget:(Node*)t {
- return [[[Edge alloc] initWithSource:s andTarget:t] autorelease];
+#if __has_feature(objc_arc)
+ return [[Edge alloc] initWithSource:s andTarget:t];
+#else
+ return [[[Edge alloc] initWithSource:s andTarget:t] autorelease];
+#endif
}
@end
diff --git a/tikzit/src/common/EdgeStyle.m b/tikzit/src/common/EdgeStyle.m
index 39810fa..c61e94a 100644
--- a/tikzit/src/common/EdgeStyle.m
+++ b/tikzit/src/common/EdgeStyle.m
@@ -77,10 +77,12 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[name release];
[category release];
[colorRGB release];
[super dealloc];
+#endif
}
- (NSString*) description {
@@ -98,7 +100,11 @@
}
+ (EdgeStyle*)defaultEdgeStyleWithName:(NSString*)nm {
+#if __has_feature(objc_arc)
+ return [[EdgeStyle alloc] initWithName:nm];
+#else
return [[[EdgeStyle alloc] initWithName:nm] autorelease];
+#endif
}
- (NSString*)name { return name; }
@@ -107,7 +113,9 @@
NSString *oldValue = name;
name = [s copy];
[self postPropertyChanged:@"name" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
+#endif
}
}
@@ -147,8 +155,10 @@
NSString *oldValue = category;
category = [s copy];
[self postPropertyChanged:@"category" oldValue:oldValue];
- [oldValue release];
- }
+#if ! __has_feature(objc_arc)
+ [oldValue release];
+#endif
+ }
}
- (ColorRGB*)colorRGB {
@@ -160,8 +170,10 @@
ColorRGB *oldValue = colorRGB;
colorRGB = [c copy];
[self postPropertyChanged:@"colorRGB" oldValue:oldValue];
- [oldValue release];
- }
+#if ! __has_feature(objc_arc)
+ [oldValue release];
+#endif
+ }
}
- (NSString*)tikz {
diff --git a/tikzit/src/common/Graph.m b/tikzit/src/common/Graph.m
index 2d07ccc..cf09a69 100644
--- a/tikzit/src/common/Graph.m
+++ b/tikzit/src/common/Graph.m
@@ -51,8 +51,12 @@
}
- (id)initFromTikz:(NSString*)tikz error:(NSError**)e {
- [self release];
- return [[TikzGraphAssembler parseTikz:tikz error:e] retain];
+#if __has_feature(objc_arc)
+ return [TikzGraphAssembler parseTikz:tikz error:e];
+#else
+ [self release];
+ return [[TikzGraphAssembler parseTikz:tikz error:e] retain];
+#endif
}
- (id)initFromTikz:(NSString*)tikz {
@@ -69,7 +73,8 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
[graphLock lock];
- [inEdges release];
+#if ! __has_feature(objc_arc)
+ [inEdges release];
[outEdges release];
[edges release];
[nodes release];
@@ -78,18 +83,23 @@
[graphLock release];
[super dealloc];
+#endif
}
- (void)sync {
[graphLock lock];
if (dirty) {
- [inEdges release];
- [outEdges release];
+#if ! __has_feature(objc_arc)
+ [inEdges release];
+ [outEdges release];
+#endif
inEdges = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:10];
outEdges = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:10];
+#if ! __has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+#endif
+
for (Edge *e in edges) {
NSMutableSet *ie = [inEdges objectForKey:[e target]];
NSMutableSet *oe = [outEdges objectForKey:[e source]];
@@ -108,8 +118,9 @@
[oe addObject:e];
}
+#if ! __has_feature(objc_arc)
[pool drain];
-
+#endif
dirty = NO;
}
@@ -150,12 +161,20 @@
- (NSSet*)inEdgesForNode:(Node*)nd {
[self sync];
- return [[[inEdges objectForKey:nd] retain] autorelease];
+#if __has_feature(objc_arc)
+ return [inEdges objectForKey:nd];
+#else
+ return [[[inEdges objectForKey:nd] retain] autorelease];
+#endif
}
- (NSSet*)outEdgesForNode:(Node*)nd {
[self sync];
- return [[[outEdges objectForKey:nd] retain] autorelease];
+#if __has_feature(objc_arc)
+ return [outEdges objectForKey:nd];
+#else
+ return [[[outEdges objectForKey:nd] retain] autorelease];
+#endif
}
- (NSSet*)incidentEdgesForNodes:(NSSet*)nds {
@@ -347,7 +366,10 @@
}
GraphChange *change = [GraphChange nodeOrderChangeFrom:oldOrder to:nodes moved:nodeSet];
[graphLock unlock];
- [oldOrder release];
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
return change;
}
@@ -365,8 +387,11 @@
}
}
GraphChange *change = [GraphChange nodeOrderChangeFrom:oldOrder to:nodes moved:nodeSet];
- [oldOrder release];
-
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
+
return change;
}
@@ -383,7 +408,10 @@
}
GraphChange *change = [GraphChange edgeOrderChangeFrom:oldOrder to:edges moved:edgeSet];
[graphLock unlock];
- [oldOrder release];
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
return change;
}
@@ -401,8 +429,11 @@
}
}
GraphChange *change = [GraphChange edgeOrderChangeFrom:oldOrder to:edges moved:edgeSet];
- [oldOrder release];
-
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
+
return change;
}
@@ -419,7 +450,10 @@
}
GraphChange *change = [GraphChange nodeOrderChangeFrom:oldOrder to:nodes moved:nodeSet];
[graphLock unlock];
- [oldOrder release];
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
return change;
}
@@ -437,7 +471,10 @@
}
GraphChange *change = [GraphChange edgeOrderChangeFrom:oldOrder to:edges moved:edgeSet];
[graphLock unlock];
- [oldOrder release];
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
return change;
}
@@ -455,8 +492,11 @@
}
}
GraphChange *change = [GraphChange nodeOrderChangeFrom:oldOrder to:nodes moved:nodeSet];
- [oldOrder release];
-
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
+
return change;
}
@@ -473,8 +513,11 @@
}
}
GraphChange *change = [GraphChange edgeOrderChangeFrom:oldOrder to:edges moved:edgeSet];
- [oldOrder release];
-
+
+#if ! __has_feature(objc_arc)
+ [oldOrder release];
+#endif
+
return change;
}
@@ -571,7 +614,9 @@
[e1 setSource:[newNds objectForKey:[e source]]];
[e1 setTarget:[newNds objectForKey:[e target]]];
[newGraph addEdge:e1];
- [e1 release]; // e1 belongs to newGraph
+#if ! __has_feature(objc_arc)
+ [e1 release]; // e1 belongs to newGraph
+#endif
}
}
@@ -584,8 +629,9 @@
[self sync];
NSMutableSet *cover = [NSMutableSet set];
+#if ! __has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+#endif
NSMutableSet *remainingEdges = [NSMutableSet setWithArray:edges];
while ([remainingEdges count] != 0) {
@@ -610,10 +656,14 @@
}
[cover addObject:path];
+#if ! __has_feature(objc_arc)
[path release];
+#endif
}
-
+
+#if ! __has_feature(objc_arc)
[pool drain];
+#endif
return cover;
}
@@ -780,7 +830,11 @@
}
+ (Graph*)graph {
+#if __has_feature(objc_arc)
+ return [[self alloc] init];
+#else
return [[[self alloc] init] autorelease];
+#endif
}
+ (Graph*)graphFromTikz:(NSString*)tikz error:(NSError**)e {
@@ -803,9 +857,15 @@
for (Node *n in nds) {
Node *ncopy = [n copyWithZone:zone];
[tab setObject:ncopy forKey:n];
+#if ! __has_feature(objc_arc)
[ncopy release]; // tab should still retain ncopy.
+#endif
}
- return [tab autorelease];
+#if __has_feature(objc_arc)
+ return tab;
+#else
+ return [tab autorelease];
+#endif
}
+ (NSMapTable*)edgeTableForEdges:(NSSet*)es {
@@ -820,7 +880,9 @@
for (Edge *e in es) {
Edge *ecopy = [e copyWithZone:zone];
[tab setObject:ecopy forKey:e];
+#if ! __has_feature(objc_arc)
[ecopy release]; // tab should still retain ecopy.
+#endif
}
return tab;
}
diff --git a/tikzit/src/common/GraphChange.m b/tikzit/src/common/GraphChange.m
index 239ae23..29a3939 100644
--- a/tikzit/src/common/GraphChange.m
+++ b/tikzit/src/common/GraphChange.m
@@ -36,6 +36,7 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[affectedNodes release];
[affectedEdges release];
[nodeRef release];
@@ -56,6 +57,7 @@
[nwEdgeOrder release];
[super dealloc];
+#endif
}
@synthesize changeType;
@@ -77,65 +79,128 @@
switch ([self changeType]) {
case GraphAddition:
[inverse setChangeType:GraphDeletion];
- inverse->affectedNodes = [affectedNodes retain];
- inverse->affectedEdges = [affectedEdges retain];
+#if __has_feature(objc_arc)
+ inverse->affectedNodes = affectedNodes;
+ inverse->affectedEdges = affectedEdges;
+#else
+ inverse->affectedNodes = [affectedNodes retain];
+ inverse->affectedEdges = [affectedEdges retain];
+#endif
break;
case GraphDeletion:
[inverse setChangeType:GraphAddition];
- inverse->affectedNodes = [affectedNodes retain];
- inverse->affectedEdges = [affectedEdges retain];
+#if __has_feature(objc_arc)
+ inverse->affectedNodes = affectedNodes;
+ inverse->affectedEdges = affectedEdges;
+#else
+ inverse->affectedNodes = [affectedNodes retain];
+ inverse->affectedEdges = [affectedEdges retain];
+#endif
break;
case NodePropertyChange:
- inverse->nodeRef = [nodeRef retain];
- inverse->oldNode = [nwNode retain];
- inverse->nwNode = [oldNode retain];
+#if __has_feature(objc_arc)
+ inverse->nodeRef = nodeRef;
+ inverse->oldNode = nwNode;
+ inverse->nwNode = oldNode;
+#else
+ inverse->nodeRef = [nodeRef retain];
+ inverse->oldNode = [nwNode retain];
+ inverse->nwNode = [oldNode retain];
+#endif
break;
case NodesPropertyChange:
- inverse->oldNodeTable = [nwNodeTable retain];
- inverse->nwNodeTable = [oldNodeTable retain];
+#if __has_feature(objc_arc)
+
+#else
+ inverse->oldNodeTable = [nwNodeTable retain];
+ inverse->nwNodeTable = [oldNodeTable retain];
+#endif
break;
case EdgePropertyChange:
- inverse->edgeRef = [edgeRef retain];
- inverse->oldEdge = [nwEdge retain];
- inverse->nwEdge = [oldEdge retain];
+#if __has_feature(objc_arc)
+ inverse->edgeRef = edgeRef;
+ inverse->oldEdge = nwEdge;
+ inverse->nwEdge = oldEdge;
+#else
+ inverse->edgeRef = [edgeRef retain];
+ inverse->oldEdge = [nwEdge retain];
+ inverse->nwEdge = [oldEdge retain];
+#endif
break;
case EdgesPropertyChange:
- inverse->oldEdgeTable = [nwEdgeTable retain];
- inverse->nwEdgeTable = [oldEdgeTable retain];
+#if __has_feature(objc_arc)
+ inverse->oldEdgeTable = nwEdgeTable;
+ inverse->nwEdgeTable = oldEdgeTable;
+#else
+ inverse->oldEdgeTable = [nwEdgeTable retain];
+ inverse->nwEdgeTable = [oldEdgeTable retain];
+#endif
break;
case NodesShift:
- inverse->affectedNodes = [affectedNodes retain];
- [inverse setShiftPoint:NSMakePoint(-[self shiftPoint].x,
- -[self shiftPoint].y)];
+#if __has_feature(objc_arc)
+ inverse->affectedNodes = affectedNodes;
+#else
+ inverse->affectedNodes = [affectedNodes retain];
+#endif
+ [inverse setShiftPoint:NSMakePoint(-[self shiftPoint].x,
+ -[self shiftPoint].y)];
break;
case NodesFlip:
- inverse->affectedNodes = [affectedNodes retain];
- [inverse setHorizontal:[self horizontal]];
+#if __has_feature(objc_arc)
+ inverse->affectedNodes = affectedNodes;
+#else
+ inverse->affectedNodes = [affectedNodes retain];
+#endif
+ [inverse setHorizontal:[self horizontal]];
break;
case EdgesReverse:
- inverse->affectedEdges = [affectedEdges retain];
+#if __has_feature(objc_arc)
+ inverse->affectedEdges = affectedEdges;
+#else
+ inverse->affectedEdges = [affectedEdges retain];
+#endif
break;
case BoundingBoxChange:
inverse->oldBoundingBox = nwBoundingBox;
inverse->nwBoundingBox = oldBoundingBox;
break;
case GraphPropertyChange:
- inverse->oldGraphData = [nwGraphData retain];
- inverse->nwGraphData = [oldGraphData retain];
+#if __has_feature(objc_arc)
+ inverse->oldGraphData = nwGraphData;
+ inverse->nwGraphData = oldGraphData;
+#else
+ inverse->oldGraphData = [nwGraphData retain];
+ inverse->nwGraphData = [oldGraphData retain];
+#endif
break;
case NodeOrderChange:
- inverse->affectedNodes = [affectedNodes retain];
- inverse->oldNodeOrder = [nwNodeOrder retain];
- inverse->nwNodeOrder = [oldNodeOrder retain];
+#if __has_feature(objc_arc)
+ inverse->affectedNodes = affectedNodes;
+ inverse->oldNodeOrder = nwNodeOrder;
+ inverse->nwNodeOrder = oldNodeOrder;
+#else
+ inverse->affectedNodes = [affectedNodes retain];
+ inverse->oldNodeOrder = [nwNodeOrder retain];
+ inverse->nwNodeOrder = [oldNodeOrder retain];
+#endif
break;
case EdgeOrderChange:
- inverse->affectedEdges = [affectedEdges retain];
- inverse->oldEdgeOrder = [nwEdgeOrder retain];
- inverse->nwEdgeOrder = [oldEdgeOrder retain];
+#if __has_feature(objc_arc)
+ inverse->affectedEdges = affectedEdges;
+ inverse->oldEdgeOrder = nwEdgeOrder;
+ inverse->nwEdgeOrder = oldEdgeOrder;
+#else
+ inverse->affectedEdges = [affectedEdges retain];
+ inverse->oldEdgeOrder = [nwEdgeOrder retain];
+ inverse->nwEdgeOrder = [oldEdgeOrder retain];
+#endif
break;
}
-
+#if __has_feature(objc_arc)
+ return inverse;
+#else
return [inverse autorelease];
+#endif
}
+ (GraphChange*)graphAdditionWithNodes:(NSSet *)ns edges:(NSSet *)es {
@@ -143,7 +208,11 @@
[gc setChangeType:GraphAddition];
[gc setAffectedNodes:ns];
[gc setAffectedEdges:es];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)graphDeletionWithNodes:(NSSet *)ns edges:(NSSet *)es {
@@ -151,7 +220,11 @@
[gc setChangeType:GraphDeletion];
[gc setAffectedNodes:ns];
[gc setAffectedEdges:es];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)propertyChangeOfNode:(Node*)nd fromOld:(Node*)old toNew:(Node*)nw {
@@ -160,7 +233,11 @@
[gc setNodeRef:nd];
[gc setOldNode:old];
[gc setNwNode:nw];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)propertyChangeOfNodesFromOldCopies:(NSMapTable*)oldC
@@ -169,7 +246,11 @@
[gc setChangeType:NodesPropertyChange];
[gc setOldNodeTable:oldC];
[gc setNwNodeTable:newC];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)propertyChangeOfEdge:(Edge*)e fromOld:(Edge *)old toNew:(Edge *)nw {
@@ -178,7 +259,11 @@
[gc setEdgeRef:e];
[gc setOldEdge:old];
[gc setNwEdge:nw];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)propertyChangeOfEdgesFromOldCopies:(NSMapTable*)oldC
@@ -187,7 +272,11 @@
[gc setChangeType:EdgesPropertyChange];
[gc setOldEdgeTable:oldC];
[gc setNwEdgeTable:newC];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)shiftNodes:(NSSet*)ns byPoint:(NSPoint)p {
@@ -195,7 +284,11 @@
[gc setChangeType:NodesShift];
[gc setAffectedNodes:ns];
[gc setShiftPoint:p];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)flipNodes:(NSSet*)ns horizontal:(BOOL)b {
@@ -203,14 +296,22 @@
[gc setChangeType:NodesFlip];
[gc setAffectedNodes:ns];
[gc setHorizontal:b];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)reverseEdges:(NSSet*)es {
GraphChange *gc = [[GraphChange alloc] init];
[gc setChangeType:EdgesReverse];
[gc setAffectedEdges:es];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)changeBoundingBoxFrom:(NSRect)oldBB to:(NSRect)newBB {
@@ -218,7 +319,11 @@
[gc setChangeType:BoundingBoxChange];
[gc setOldBoundingBox:oldBB];
[gc setNwBoundingBox:newBB];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)propertyChangeOfGraphFrom:(GraphElementData*)oldData to:(GraphElementData*)newData {
@@ -226,7 +331,11 @@
[gc setChangeType:GraphPropertyChange];
[gc setOldGraphData:oldData];
[gc setNwGraphData:newData];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)nodeOrderChangeFrom:(NSArray*)old to:(NSArray*)new moved:(NSSet*)affected {
@@ -235,7 +344,11 @@
[gc setAffectedNodes:affected];
[gc setOldNodeOrder:old];
[gc setNwNodeOrder:new];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
+ (GraphChange*)edgeOrderChangeFrom:(NSArray*)old to:(NSArray*)new moved:(NSSet*)affected {
@@ -244,7 +357,11 @@
[gc setAffectedEdges:affected];
[gc setOldEdgeOrder:old];
[gc setNwEdgeOrder:new];
- return [gc autorelease];
+#if __has_feature(objc_arc)
+ return gc;
+#else
+ return [gc autorelease];
+#endif
}
@end
diff --git a/tikzit/src/common/GraphElementData.m b/tikzit/src/common/GraphElementData.m
index 0750296..41dc9aa 100644
--- a/tikzit/src/common/GraphElementData.m
+++ b/tikzit/src/common/GraphElementData.m
@@ -28,7 +28,11 @@
@implementation GraphElementData
+ (id)data {
+#if __has_feature(objc_arc)
+ return [[self alloc] init];
+#else
return [[[self alloc] init] autorelease];
+#endif
}
- (id)init {
@@ -48,9 +52,15 @@
- (NSArray*)objectsAtIndexes:(NSIndexSet*)indexes {
return [properties objectsAtIndexes:indexes];
}
+
+#if __has_feature(objc_arc)
+- (void) getObjects:(__unsafe_unretained id*)buffer range:(NSRange)range {
+#else
- (void) getObjects:(id*)buffer range:(NSRange)range {
+#endif
[properties getObjects:buffer range:range];
}
+
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index {
[properties insertObject:anObject atIndex:index];
}
@@ -66,22 +76,33 @@
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject {
[properties replaceObjectAtIndex:index withObject:anObject];
}
+
+#if __has_feature(objc_arc)
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state
+ objects:(__unsafe_unretained id [])stackbuf
+ count:(NSUInteger)len {
+#else
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf
count:(NSUInteger)len {
- return [properties countByEnumeratingWithState:state objects:stackbuf count:len];
+#endif
+ return [properties countByEnumeratingWithState:state objects:stackbuf count:len];
}
- (void)setProperty:(NSString*)val forKey:(NSString*)key {
GraphElementProperty *m = [[GraphElementProperty alloc] initWithKeyMatching:key];
NSInteger idx = [properties indexOfObject:m];
- [m release];
+#if !__has_feature(objc_arc)
+ [m release];
+#endif
GraphElementProperty *p;
if (idx == NSNotFound) {
p = [[GraphElementProperty alloc] initWithPropertyValue:val forKey:key];
[properties addObject:p];
- [p release];
+#if !__has_feature(objc_arc)
+ [p release];
+#endif
} else {
p = [properties objectAtIndex:idx];
[p setValue:val];
@@ -91,13 +112,19 @@
- (void)unsetProperty:(NSString*)key {
GraphElementProperty *m = [[GraphElementProperty alloc] initWithKeyMatching:key];
[properties removeObject:m];
- [m release];
+#if !__has_feature(objc_arc)
+ [m release];
+#endif
+
}
- (NSString*)propertyForKey:(NSString*)key {
GraphElementProperty *m = [[GraphElementProperty alloc] initWithKeyMatching:key];
NSInteger idx = [properties indexOfObject:m];
- [m release];
+#if !__has_feature(objc_arc)
+ [m release];
+#endif
+
if (idx == NSNotFound) {
return nil;
@@ -110,19 +137,25 @@
- (void)setAtom:(NSString*)atom {
GraphElementProperty *a = [[GraphElementProperty alloc] initWithAtomName:atom];
if (![properties containsObject:a]) [properties addObject:a];
- [a release];
+#if !__has_feature(objc_arc)
+ [a release];
+#endif
}
- (void)unsetAtom:(NSString*)atom {
GraphElementProperty *a = [[GraphElementProperty alloc] initWithAtomName:atom];
[properties removeObject:a];
- [a release];
+#if !__has_feature(objc_arc)
+ [a release];
+#endif
}
- (BOOL)isAtomSet:(NSString*)atom {
GraphElementProperty *a = [[GraphElementProperty alloc] initWithAtomName:atom];
BOOL set = [properties containsObject:a];
- [a release];
+#if !__has_feature(objc_arc)
+ [a release];
+#endif
return set;
}
@@ -136,14 +169,18 @@
for (GraphElementProperty *p in properties) {
GraphElementProperty *p2 = [p copy];
[cp addObject:p2];
- [p2 release];
+#if !__has_feature(objc_arc)
+ [p2 release];
+#endif
}
return cp;
}
- (void)dealloc {
- [properties release];
- [super dealloc];
+#if !__has_feature(objc_arc)
+ [properties release];
+ [super dealloc];
+#endif
}
@end
diff --git a/tikzit/src/common/GraphElementProperty.m b/tikzit/src/common/GraphElementProperty.m
index 1acdc09..25e1b15 100644
--- a/tikzit/src/common/GraphElementProperty.m
+++ b/tikzit/src/common/GraphElementProperty.m
@@ -28,13 +28,25 @@
@implementation GraphElementProperty
+ (id)atom:(NSString*)n {
- return [[[self alloc] initWithAtomName:n] autorelease];
+#if __has_feature(objc_arc)
+ return [[self alloc] initWithAtomName:n];
+#else
+ return [[[self alloc] initWithAtomName:n] autorelease];
+#endif
}
+ (id)property:(NSString*)k withValue:(NSString*)v {
+#if __has_feature(objc_arc)
+ return [[self alloc] initWithPropertyValue:v forKey:k];
+#else
return [[[self alloc] initWithPropertyValue:v forKey:k] autorelease];
+#endif
}
+ (id)keyMatching:(NSString*)k {
+#if __has_feature(objc_arc)
+ return [[self alloc] initWithKeyMatching:k];
+#else
return [[[self alloc] initWithKeyMatching:k] autorelease];
+#endif
}
- (id)initWithAtomName:(NSString*)n {
@@ -65,15 +77,18 @@
}
- (void) dealloc {
+#if ! __has_feature(objc_arc)
[key release];
-// the below line causes a exc_bad_access. Uncommenting it gains a memory leak but at least no crashing.
-// [value release];
+ [value release];
[super dealloc];
+#endif
}
- (void)setValue:(NSString *)v {
if (value != v) {
+#if ! __has_feature(objc_arc)
[value release];
+#endif
value = [v copy];
}
}
@@ -89,7 +104,9 @@
- (void)setKey:(NSString *)k {
if (key != k) {
+#if ! __has_feature(objc_arc)
[key release];
+#endif
key = [k copy];
}
if (key == nil)
diff --git a/tikzit/src/common/NSString+LatexConstants.m b/tikzit/src/common/NSString+LatexConstants.m
index bd598b7..634c189 100644
--- a/tikzit/src/common/NSString+LatexConstants.m
+++ b/tikzit/src/common/NSString+LatexConstants.m
@@ -197,10 +197,14 @@ static NSSet *texModifiers = nil;
}
NSString *ret = [buf copy];
+#if __has_feature(objc_arc)
+ return ret;
+#else
[buf release];
[wordBuf release];
return [ret autorelease];
+#endif
}
@end
diff --git a/tikzit/src/common/NSString+Tikz.m b/tikzit/src/common/NSString+Tikz.m
index 520ffd3..1e3073b 100644
--- a/tikzit/src/common/NSString+Tikz.m
+++ b/tikzit/src/common/NSString+Tikz.m
@@ -23,12 +23,21 @@
- (NSString*) tikzEscapedString {
static NSCharacterSet *avoid = nil;
if (avoid == nil)
- avoid = [[[NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>-'0123456789. "] invertedSet] retain];
+#if __has_feature(objc_arc)
+ avoid = [[NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>-'0123456789. "] invertedSet];
+#else
+ avoid = [[[NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>-'0123456789. "] invertedSet] retain];
+#endif
+
if ([self rangeOfCharacterFromSet:avoid].length > 0) {
return [NSString stringWithFormat:@"{%@}", self];
} else {
+#if __has_feature(objc_arc)
+ return self;
+#else
return [[self retain] autorelease];
+#endif
}
}
diff --git a/tikzit/src/common/Node.m b/tikzit/src/common/Node.m
index 8c64b6b..c5b11d1 100644
--- a/tikzit/src/common/Node.m
+++ b/tikzit/src/common/Node.m
@@ -50,11 +50,13 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[name release];
[style release];
[data release];
[label release];
[super dealloc];
+#endif
}
- (Shape*) shape {
@@ -67,7 +69,11 @@
- (Transformer*) shapeTransformerFromTransformer:(Transformer*)t {
// we take a copy to keep the reflection attributes
+#if ! __has_feature(objc_arc)
Transformer *transformer = [[t copy] autorelease];
+#else
+ Transformer *transformer = [t copy];
+#endif
NSPoint screenPos = [t toScreen:point];
[transformer setOrigin:screenPos];
float scale = [t scale];
@@ -101,7 +107,11 @@
}
- (BOOL)attachStyleFromTable:(NSArray*)styles {
- NSString *style_name = [[[data propertyForKey:@"style"] retain] autorelease];
+#if __has_feature(objc_arc)
+ NSString *style_name = [data propertyForKey:@"style"];
+#else
+ NSString *style_name = [[[data propertyForKey:@"style"] retain] autorelease];
+#endif
[self setStyle:nil];
@@ -137,11 +147,19 @@
}
+ (Node*)nodeWithPoint:(NSPoint)p {
- return [[[Node alloc] initWithPoint:p] autorelease];
+#if __has_feature(objc_arc)
+ return [[Node alloc] initWithPoint:p];
+#else
+ return [[[Node alloc] initWithPoint:p] autorelease];
+#endif
}
+ (Node*)node {
- return [[[Node alloc] init] autorelease];
+#if __has_feature(objc_arc)
+ return [[Node alloc] init];
+#else
+ return [[[Node alloc] init] autorelease];
+#endif
}
@@ -180,9 +198,13 @@
- (void)setStyle:(NodeStyle *)st {
if (style != st) {
- NodeStyle *oldStyle = style;
- style = [st retain];
- [oldStyle release];
+#if __has_feature(objc_arc)
+ style = st;
+#else
+ NodeStyle *oldStyle = style;
+ style = [st retain];
+ [oldStyle release];
+#endif
}
[self updateData];
}
diff --git a/tikzit/src/common/NodeStyle.m b/tikzit/src/common/NodeStyle.m
index 26ab793..193d44d 100644
--- a/tikzit/src/common/NodeStyle.m
+++ b/tikzit/src/common/NodeStyle.m
@@ -87,12 +87,14 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[name release];
[category release];
[shapeName release];
[strokeColorRGB release];
[fillColorRGB release];
[super dealloc];
+#endif
}
- (NSString*) description {
@@ -110,7 +112,11 @@
}
+ (NodeStyle*)defaultNodeStyleWithName:(NSString*)nm {
- return [[[NodeStyle alloc] initWithName:nm] autorelease];
+#if __has_feature(objc_arc)
+ return [[NodeStyle alloc] initWithName:nm];
+#else
+ return [[[NodeStyle alloc] initWithName:nm] autorelease];
+#endif
}
- (NSString*)name {
@@ -122,7 +128,9 @@
NSString *oldValue = name;
name = [s copy];
[self postPropertyChanged:@"name" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
+#endif
}
}
@@ -135,7 +143,9 @@
NSString *oldValue = shapeName;
shapeName = [s copy];
[self postPropertyChanged:@"shapeName" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
+#endif
}
}
@@ -148,8 +158,10 @@
NSString *oldValue = category;
category = [s copy];
[self postPropertyChanged:@"category" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
- }
+#endif
+ }
}
- (int)strokeThickness { return strokeThickness; }
@@ -175,8 +187,10 @@
ColorRGB *oldValue = strokeColorRGB;
strokeColorRGB = [c copy];
[self postPropertyChanged:@"strokeColorRGB" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
- }
+#endif
+ }
}
- (ColorRGB*)fillColorRGB {
@@ -188,8 +202,10 @@
ColorRGB *oldValue = fillColorRGB;
fillColorRGB = [c copy];
[self postPropertyChanged:@"fillColorRGB" oldValue:oldValue];
+#if ! __has_feature(objc_arc)
[oldValue release];
- }
+#endif
+ }
}
- (NSString*)tikz {
diff --git a/tikzit/src/common/PickSupport.m b/tikzit/src/common/PickSupport.m
index 6470214..560fc2c 100644
--- a/tikzit/src/common/PickSupport.m
+++ b/tikzit/src/common/PickSupport.m
@@ -42,15 +42,24 @@
self = [super init];
if (self) {
- selectedNodes = [[NSMutableSet set] retain];
- selectedEdges = [[NSMutableSet set] retain];
+#if __has_feature(objc_arc)
+ selectedNodes = [NSMutableSet set];
+ selectedEdges = [NSMutableSet set];
+#else
+ selectedNodes = [[NSMutableSet set] retain];
+ selectedEdges = [[NSMutableSet set] retain];
+#endif
}
return self;
}
+ (PickSupport*)pickSupport {
- return [[[PickSupport alloc] init] autorelease];
+#if __has_feature(objc_arc)
+ return [[PickSupport alloc] init];
+#else
+ return [[[PickSupport alloc] init] autorelease];
+#endif
}
@synthesize selectedNodes;
@@ -176,7 +185,9 @@
}
if (replace) {
+#if ! __has_feature(objc_arc)
[selectedNodes release];
+#endif
selectedNodes = [nodes mutableCopy];
} else {
[selectedNodes unionSet:nodes];
@@ -208,10 +219,12 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[selectedNodes release];
[selectedEdges release];
[super dealloc];
+#endif
}
@end
diff --git a/tikzit/src/common/Preambles.m b/tikzit/src/common/Preambles.m
index 651bbcd..922fc30 100644
--- a/tikzit/src/common/Preambles.m
+++ b/tikzit/src/common/Preambles.m
@@ -55,7 +55,11 @@ static NSString *POSTAMBLE =
@implementation Preambles
+ (Preambles*)preambles {
+#if __has_feature(objc_arc)
+ return [[self alloc] init];
+#else
return [[[self alloc] init] autorelease];
+#endif
}
- (id)init {
@@ -72,10 +76,12 @@ static NSString *POSTAMBLE =
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[selectedPreambleName release];
[styles release];
[styleManager release];
[super dealloc];
+#endif
}
- (NSString*)preambleForName:(NSString*)name {
@@ -101,14 +107,18 @@ static NSString *POSTAMBLE =
}
- (void)setStyles:(NSArray*)sty {
+#if ! __has_feature(objc_arc)
[sty retain];
[styles release];
+#endif
styles = sty;
}
- (void)setEdges:(NSArray*)edg {
+#if ! __has_feature(objc_arc)
[edg retain];
[edges release];
+#endif
edges = edg;
}
@@ -116,7 +126,9 @@ static NSString *POSTAMBLE =
if (styleManager != nil) {
[self setStyles:[styleManager nodeStyles]];
}
+#if ! __has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+#endif
NSMutableString *buf = [NSMutableString string];
NSMutableString *colbuf = [NSMutableString string];
NSMutableSet *colors = [NSMutableSet setWithCapacity:2*[styles count]];
@@ -154,8 +166,12 @@ static NSString *POSTAMBLE =
NSString *defs = [[NSString alloc] initWithFormat:@"%@\n%@", colbuf, buf];
+#if __has_feature(objc_arc)
+ return defs;
+#else
[pool drain];
return [defs autorelease];
+#endif
}
- (NSString*)defaultPreamble {
@@ -170,7 +186,9 @@ static NSString *POSTAMBLE =
- (NSString*)selectedPreambleName { return selectedPreambleName; }
- (void)setSelectedPreambleName:(NSString *)sel {
if (sel != selectedPreambleName) {
+#if ! __has_feature(objc_arc)
[selectedPreambleName release];
+#endif
selectedPreambleName = [sel copy];
}
}
@@ -190,8 +208,10 @@ static NSString *POSTAMBLE =
}
- (void)setStyleManager:(StyleManager *)manager {
+#if ! __has_feature(objc_arc)
[manager retain];
[styleManager release];
+#endif
styleManager = manager;
}
@@ -240,10 +260,14 @@ static NSString *POSTAMBLE =
isSelected = YES;
}
NSString *preamble = [preambleDict objectForKey:old];
+#if ! __has_feature(objc_arc)
[preamble retain];
+#endif
[preambleDict removeObjectForKey:old];
[preambleDict setObject:preamble forKey:new];
+#if ! __has_feature(objc_arc)
[preamble release];
+#endif
if (isSelected) {
[self setSelectedPreambleName:new];
}
@@ -254,11 +278,15 @@ static NSString *POSTAMBLE =
if ([name isEqualToString:@"default"])
return NO;
// "name" may be held only by being the selected preamble...
+#if ! __has_feature(objc_arc)
[name retain];
+#endif
if ([name isEqualToString:selectedPreambleName])
[self setSelectedPreambleName:nil];
[preambleDict removeObjectForKey:name];
+#if ! __has_feature(objc_arc)
[name release];
+#endif
return YES;
}
diff --git a/tikzit/src/common/PropertyHolder.m b/tikzit/src/common/PropertyHolder.m
index 2b3442f..6aaf125 100644
--- a/tikzit/src/common/PropertyHolder.m
+++ b/tikzit/src/common/PropertyHolder.m
@@ -63,8 +63,10 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[notificationName release];
[super dealloc];
+#endif
}
@end
diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m
index 5dc25e3..e887688 100644
--- a/tikzit/src/common/Shape.m
+++ b/tikzit/src/common/Shape.m
@@ -61,8 +61,12 @@
- (NSSet*)paths {return paths;}
- (void)setPaths:(NSSet *)p {
if (paths != p) {
+#if __has_feature(objc_arc)
+ paths = p;
+#else
[paths release];
paths = [p retain];
+#endif
[self calcBoundingRect];
}
}
@@ -79,9 +83,11 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[paths release];
[styleTikz release];
[super dealloc];
+#endif
}
NSDictionary *shapeDictionary = nil;
@@ -101,7 +107,9 @@ NSDictionary *shapeDictionary = nil;
[shapeDir stringByAppendingPathComponent:f]];
if (sh != nil) {
[shapeDict setObject:sh forKey:nm];
+#if ! __has_feature(objc_arc)
[sh release];
+#endif
}
}
}
@@ -122,7 +130,9 @@ NSDictionary *shapeDictionary = nil;
shapes[3], SHAPE_UP_TRIANGLE,
shapes[4], SHAPE_DOWN_TRIANGLE,
nil];
+#if ! __has_feature(objc_arc)
for (int i = 0; i<5; ++i) [shapes[i] release];
+#endif
NSString *systemShapeDir = [[SupportDir systemSupportDir] stringByAppendingPathComponent:@"shapes"];
NSString *userShapeDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"shapes"];
@@ -137,7 +147,9 @@ NSDictionary *shapeDictionary = nil;
postNotificationName:@"ShapeDictionaryReplaced"
object:self];
+#if ! __has_feature(objc_arc)
[oldShapeDictionary release];
+#endif
}
+ (NSDictionary*)shapeDictionary {
@@ -147,7 +159,11 @@ NSDictionary *shapeDictionary = nil;
+ (Shape*)shapeForName:(NSString*)shapeName {
Shape *s = [[[self shapeDictionary] objectForKey:shapeName] copy];
+#if __has_feature(objc_arc)
+ return s;
+#else
return [s autorelease];
+#endif
}
@end
diff --git a/tikzit/src/common/StyleManager.m b/tikzit/src/common/StyleManager.m
index ae0d488..05c6c86 100644
--- a/tikzit/src/common/StyleManager.m
+++ b/tikzit/src/common/StyleManager.m
@@ -90,7 +90,11 @@
}
+ (StyleManager*) manager {
+#if __has_feature(objc_arc)
+ return [[self alloc] init];
+#else
return [[[self alloc] init] autorelease];
+#endif
}
- (id) init {
@@ -107,15 +111,18 @@
- (void) dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
-
+#if ! __has_feature(objc_arc)
[nodeStyles release];
[edgeStyles release];
[super dealloc];
+#endif
}
- (void) loadDefaultEdgeStyles {
+#if ! __has_feature(objc_arc)
[edgeStyles release];
+#endif
edgeStyles = [[NSMutableArray alloc] initWithCapacity:3];
EdgeStyle *simple = [EdgeStyle defaultEdgeStyleWithName:@"simple"];
@@ -138,7 +145,9 @@
}
- (void) loadDefaultNodeStyles {
+#if ! __has_feature(objc_arc)
[nodeStyles release];
+#endif
nodeStyles = [[NSMutableArray alloc] initWithCapacity:3];
NodeStyle *rn = [NodeStyle defaultNodeStyleWithName:@"rn"];
@@ -212,8 +221,10 @@
- (void) _setNodeStyles:(NSMutableArray*)styles {
[self ignoreAllNodeStyles];
+#if ! __has_feature(objc_arc)
[nodeStyles release];
[styles retain];
+#endif
nodeStyles = styles;
for (NodeStyle *style in styles) {
[self listenToNodeStyle:style];
@@ -223,8 +234,10 @@
- (void) _setEdgeStyles:(NSMutableArray*)styles {
[self ignoreAllEdgeStyles];
+#if ! __has_feature(objc_arc)
[edgeStyles release];
[styles retain];
+#endif
edgeStyles = styles;
for (EdgeStyle *style in styles) {
[self listenToEdgeStyle:style];
@@ -257,10 +270,14 @@
}
[self ignoreNodeStyle:style];
+#if ! __has_feature(objc_arc)
[style retain];
+#endif
[nodeStyles removeObject:style];
[self postNodeStyleRemoved:style];
+#if ! __has_feature(objc_arc)
[style release];
+#endif
}
- (EdgeStyle*) edgeStyleForName:(NSString*)name {
@@ -288,10 +305,14 @@
}
[self ignoreEdgeStyle:style];
+#if ! __has_feature(objc_arc)
[style retain];
+#endif
[edgeStyles removeObject:style];
[self postEdgeStyleRemoved:style];
+#if ! __has_feature(objc_arc)
[style release];
+#endif
}
- (void) updateFromManager:(StyleManager*)m {
@@ -302,7 +323,11 @@
[currentStyle updateFromStyle:style];
[ns addObject:currentStyle];
} else {
+#if __has_feature(objc_arc)
+ [ns addObject:[style copy]];
+#else
[ns addObject:[[style copy] autorelease]];
+#endif
}
}
NSMutableArray *es = [NSMutableArray arrayWithCapacity:[[m edgeStyles] count]];
@@ -312,8 +337,12 @@
[currentStyle updateFromStyle:style];
[es addObject:currentStyle];
} else {
- [es addObject:[[style copy] autorelease]];
- }
+#if __has_feature(objc_arc)
+ [es addObject:[style copy]];
+#else
+ [es addObject:[[style copy] autorelease]];
+#endif
+ }
}
[self _setNodeStyles:ns];
[self _setEdgeStyles:es];
@@ -324,11 +353,19 @@
NSMutableArray *ns = [NSMutableArray arrayWithCapacity:[nodeStyles count]];
for (NodeStyle *style in nodeStyles) {
- [ns addObject:[[style copyWithZone:zone] autorelease]];
+#if __has_feature(objc_arc)
+ [ns addObject:[style copyWithZone:zone]];
+#else
+ [ns addObject:[[style copyWithZone:zone] autorelease]];
+#endif
}
NSMutableArray *es = [NSMutableArray arrayWithCapacity:[edgeStyles count]];
for (EdgeStyle *style in edgeStyles) {
- [es addObject:[[style copyWithZone:zone] autorelease]];
+#if __has_feature(objc_arc)
+ [es addObject:[style copyWithZone:zone]];
+#else
+ [es addObject:[[style copyWithZone:zone] autorelease]];
+#endif
}
[m _setNodeStyles:ns];
[m _setEdgeStyles:es];
diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m
index 380b71c..c5d2811 100644
--- a/tikzit/src/common/TikzGraphAssembler.m
+++ b/tikzit/src/common/TikzGraphAssembler.m
@@ -31,14 +31,20 @@
@implementation TikzGraphAssembler
- (id)init {
+#if ! __has_feature(objc_arc)
[self release];
+#endif
return nil;
}
- (id)initWithGraph:(Graph*)g {
self = [super init];
if (self) {
+#if __has_feature(objc_arc)
+ graph = g;
+#else
graph = [g retain];
+#endif
nodeMap = [[NSMutableDictionary alloc] init];
yylex_init (&scanner);
yyset_extra(self, scanner);
@@ -47,29 +53,39 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[graph release];
[nodeMap release];
[lastError release];
yylex_destroy (scanner);
[super dealloc];
+#endif
}
- (BOOL) parseTikz:(NSString*)t error:(NSError**)error {
+#if ! __has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+#endif
tikzStr = [t UTF8String];
yy_scan_string(tikzStr, scanner);
int result = yyparse(scanner);
tikzStr = NULL;
+#if ! __has_feature(objc_arc)
[pool drain];
+#endif
if (result == 0) {
return YES;
} else {
if (error) {
if (lastError) {
+#if __has_feature(objc_arc)
+ *error = lastError;
+#else
*error = [[lastError retain] autorelease];
+#endif
} else if (result == 1) {
*error = [NSError errorWithMessage:@"Syntax error"
code:TZ_ERR_PARSE];
@@ -91,10 +107,16 @@
+ (Graph*) parseTikz:(NSString*)tikz error:(NSError**)e {
Graph *gr = [[Graph alloc] init];
if ([self parseTikz:tikz forGraph:gr error:e]) {
+#if __has_feature(objc_arc)
+ return gr;
+#else
return [gr autorelease];
+#endif
} else {
+#if ! __has_feature(objc_arc)
[gr release];
- return nil;
+#endif
+ return nil;
}
}
+ (Graph*) parseTikz:(NSString*)tikz {
@@ -109,8 +131,10 @@
TikzGraphAssembler *assembler = [[self alloc] initWithGraph:gr];
BOOL success = [assembler parseTikz:tikz error:error];
+#if ! __has_feature(objc_arc)
[assembler release];
- return success;
+#endif
+ return success;
}
+ (BOOL)validateTikzPropertyNameOrValue:(NSString*)tikz {
@@ -171,8 +195,10 @@
}
- (void) setLastError:(NSError*)error {
+#if ! __has_feature(objc_arc)
[error retain];
[lastError release];
+#endif
lastError = error;
}
diff --git a/tikzit/src/common/TikzShape.m b/tikzit/src/common/TikzShape.m
index c07c61e..555a7df 100644
--- a/tikzit/src/common/TikzShape.m
+++ b/tikzit/src/common/TikzShape.m
@@ -55,7 +55,11 @@
-NSMidY(bds));
[t setOrigin:shift];
[graph applyTransformer:t];
+#if __has_feature(objc_arc)
+ paths = [graph pathCover];
+#else
paths = [[graph pathCover] retain];
+#endif
}
return self;
}
diff --git a/tikzit/src/common/Transformer.m b/tikzit/src/common/Transformer.m
index 403ae87..2b56813 100644
--- a/tikzit/src/common/Transformer.m
+++ b/tikzit/src/common/Transformer.m
@@ -28,11 +28,19 @@ float const PIXELS_PER_UNIT = 50;
@implementation Transformer
+ (Transformer*)transformer {
- return [[[Transformer alloc] init] autorelease];
+#if __has_feature(objc_arc)
+ return [[Transformer alloc] init];
+#else
+ return [[[Transformer alloc] init] autorelease];
+#endif
}
+ (Transformer*)transformerWithTransformer:(Transformer*)t {
- return [[t copy] autorelease];
+#if __has_feature(objc_arc)
+ return [t copy];
+#else
+ return [[t copy] autorelease];
+#endif
}
+ (Transformer*)transformerWithOrigin:(NSPoint)o andScale:(float)scale {
diff --git a/tikzit/src/common/tikzparserdefs.h b/tikzit/src/common/tikzparserdefs.h
index 587bcd6..cde3345 100644
--- a/tikzit/src/common/tikzparserdefs.h
+++ b/tikzit/src/common/tikzparserdefs.h
@@ -37,8 +37,13 @@
@class Node;
struct noderef {
- Node *node;
- NSString *anchor;
+#if __has_feature(objc_arc)
+ __unsafe_unretained Node *node;
+ __unsafe_unretained NSString *anchor;
+#else
+ Node *node;
+ NSString *anchor;
+#endif
};
// vi:ft=objc:noet:ts=4:sts=4:sw=4