diff options
Diffstat (limited to 'tikzit/src/osx')
34 files changed, 402 insertions, 87 deletions
diff --git a/tikzit/src/osx/AppDelegate.h b/tikzit/src/osx/AppDelegate.h index 64acc38..0f9d787 100644 --- a/tikzit/src/osx/AppDelegate.h +++ b/tikzit/src/osx/AppDelegate.h @@ -37,13 +37,13 @@ PreambleController *preambleController; PreviewController *previewController; PreferenceController *preferenceController; - ToolPaletteController *toolPaletteController; + ToolPaletteController *__weak toolPaletteController; IBOutlet GraphicsView *graphicsView; NSString *tempDir; } @property IBOutlet StylePaletteController *stylePaletteController; -@property IBOutlet ToolPaletteController *toolPaletteController; +@property (weak) IBOutlet ToolPaletteController *toolPaletteController; - (void)awakeFromNib; + (void)setDefaults; diff --git a/tikzit/src/osx/CustomNodeCellView.h b/tikzit/src/osx/CustomNodeCellView.h index 5b3b1ee..22606d7 100644 --- a/tikzit/src/osx/CustomNodeCellView.h +++ b/tikzit/src/osx/CustomNodeCellView.h @@ -18,6 +18,6 @@ BOOL selected; } -@property (retain) id objectValue; +@property (strong) id objectValue; @end diff --git a/tikzit/src/osx/CustomNodeController.h b/tikzit/src/osx/CustomNodeController.h index 55f0e0b..56cb74c 100644 --- a/tikzit/src/osx/CustomNodeController.h +++ b/tikzit/src/osx/CustomNodeController.h @@ -16,18 +16,18 @@ #import "SupportDir.h" @interface CustomNodeController : NSViewController <NSTableViewDelegate>{ - NSDictionary* nodeStyles; + NSDictionary* __weak nodeStyles; NSMutableArray* customNodeStyles; - NSMutableArray* onodeStyles; + NSMutableArray* __weak onodeStyles; - GraphicsView *graphicsView; - TikzSourceController *tikzSourceController; + GraphicsView *__weak graphicsView; + TikzSourceController *__weak tikzSourceController; } -@property (readonly) NSDictionary *nodeStyles; -@property (readonly) NSMutableArray* onodeStyles; +@property (weak, readonly) NSDictionary *nodeStyles; +@property (weak, readonly) NSMutableArray* onodeStyles; -@property IBOutlet GraphicsView *graphicsView; -@property IBOutlet TikzSourceController *tikzSourceController; +@property (weak) IBOutlet GraphicsView *graphicsView; +@property (weak) IBOutlet TikzSourceController *tikzSourceController; @end diff --git a/tikzit/src/osx/CustomNodes.xib b/tikzit/src/osx/CustomNodes.xib index 8b2587a..1cc8db2 100644 --- a/tikzit/src/osx/CustomNodes.xib +++ b/tikzit/src/osx/CustomNodes.xib @@ -1,15 +1,249 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4450" systemVersion="12D78" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4450"/> + <deployment defaultVersion="1070" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/> </dependencies> <objects> - <customObject id="-2" userLabel="File's Owner"/> + <customObject id="-2" userLabel="File's Owner" customClass="CustomNodeController"> + <connections> + <outlet property="graphicsView" destination="3MT-Yc-Dhv" id="9gg-fS-oBl"/> + <outlet property="tikzSourceController" destination="il5-cQ-3oh" id="Wny-jd-sKZ"/> + <outlet property="view" destination="1" id="sH5-DU-xwB"/> + </connections> + </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-3" userLabel="Application"/> + <arrayController objectClassName="NodeStyle" id="iyU-U5-XAU" userLabel="Node Style Array Controller"> + <declaredKeys> + <string>name</string> + <string>strokeThickness</string> + <string>strokeColor</string> + <string>fillColor</string> + <string>strokeColorIsKnown</string> + <string>fillColorIsKnown</string> + <string>representedObject.name</string> + <string>shapeName</string> + <string>scale</string> + <string>@distinctUnionOfObjects.category</string> + <string>category</string> + </declaredKeys> + <connections> + <binding destination="-2" name="contentArray" keyPath="onodeStyles" id="Yzy-xv-qEa"/> + </connections> + </arrayController> + <customObject id="il5-cQ-3oh" customClass="TikzSourceController"> + <connections> + <outlet property="errorMessage" destination="6rJ-4b-syy" id="cin-Wb-6uD"/> + <outlet property="errorNotification" destination="R3k-mz-hMn" id="jtn-fQ-Amk"/> + <outlet property="graphicsView" destination="3MT-Yc-Dhv" id="hK1-h1-Dsr"/> + <outlet property="sourceView" destination="QXu-0d-uF0" id="SEj-FL-5Ac"/> + <outlet property="status" destination="6rJ-4b-syy" id="lVN-cK-3Cb"/> + </connections> + </customObject> <customView id="1"> <rect key="frame" x="0.0" y="0.0" width="480" height="272"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DO1-FS-fZd"> + <rect key="frame" x="0.0" y="0.0" width="480" height="272"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="32" horizontalPageScroll="10" verticalLineScroll="32" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="Ry0-48-577"> + <rect key="frame" x="0.0" y="0.0" width="117" height="272"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <clipView key="contentView" id="9D3-br-lEi"> + <rect key="frame" x="1" y="1" width="115" height="270"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="30" rowSizeStyle="automatic" viewBased="YES" id="ieg-vU-MzM"> + <rect key="frame" x="0.0" y="0.0" width="115" height="270"/> + <autoresizingMask key="autoresizingMask"/> + <size key="intercellSpacing" width="3" height="2"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> + <tableColumns> + <tableColumn width="112" minWidth="40" maxWidth="1000" id="k91-pc-nbl"> + <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/> + </tableHeaderCell> + <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="ZaR-9P-sAp"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> + <prototypeCellViews> + <tableCellView id="0ce-nA-hcl" customClass="CustomNodeCellView"> + <rect key="frame" x="1" y="1" width="112" height="30"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KUl-Qh-CHH"> + <rect key="frame" x="36" y="3" width="87" height="17"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Table View Cell" id="92K-au-Qpa"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + <connections> + <binding destination="0ce-nA-hcl" name="value" keyPath="objectValue" id="06y-KE-8wP"/> + </connections> + </textFieldCell> + </textField> + </subviews> + <connections> + <outlet property="textField" destination="KUl-Qh-CHH" id="Cze-5m-UmF"/> + </connections> + </tableCellView> + </prototypeCellViews> + </tableColumn> + </tableColumns> + <connections> + <binding destination="-2" name="selectionIndexes" keyPath="selectedNode" id="C4J-62-GDG"/> + <outlet property="delegate" destination="-2" id="M05-fU-pjz"/> + </connections> + </tableView> + </subviews> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </clipView> + <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="QIL-7j-JmC"> + <rect key="frame" x="1" y="256" width="0.0" height="15"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="ElP-ub-Uwa"> + <rect key="frame" x="224" y="17" width="15" height="102"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> + <view fixedFrame="YES" id="F5P-T2-9eB"> + <rect key="frame" x="118" y="0.0" width="362" height="272"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <splitView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KKi-SZ-dS6"> + <rect key="frame" x="0.0" y="0.0" width="362" height="272"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <customView fixedFrame="YES" id="d61-FR-v2c"> + <rect key="frame" x="0.0" y="0.0" width="362" height="156"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <customView wantsLayer="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3MT-Yc-Dhv" customClass="GraphicsView"> + <rect key="frame" x="0.0" y="0.0" width="362" height="155"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + </customView> + <customView wantsLayer="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R3k-mz-hMn" customClass="ParseErrorView"> + <rect key="frame" x="0.0" y="113" width="361" height="42"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <subviews> + <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6rJ-4b-syy"> + <rect key="frame" x="5" y="10" width="354" height="27"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="left" placeholderString="parser information" allowsEditingTextAttributes="YES" id="3y1-Zn-Hv4"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <button wantsLayer="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Et8-Cc-Xac"> + <rect key="frame" x="340" y="21" width="17" height="19"/> + <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="squareTextured" bezelStyle="texturedSquare" image="NSStopProgressFreestandingTemplate" imagePosition="only" alignment="center" state="on" imageScaling="proportionallyDown" id="7vB-Le-tP4"> + <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="closeParseError:" target="il5-cQ-3oh" id="jdZ-7K-cwe"/> + </connections> + </button> + </subviews> + </customView> + </subviews> + </customView> + <customView fixedFrame="YES" id="Fal-9S-dwR"> + <rect key="frame" x="0.0" y="165" width="362" height="107"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yLp-gf-r49"> + <rect key="frame" x="0.0" y="0.0" width="362" height="107"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <clipView key="contentView" ambiguous="YES" misplaced="YES" id="qOT-id-lqk"> + <rect key="frame" x="1" y="1" width="345" height="105"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textView ambiguous="YES" importsGraphics="NO" richText="NO" findStyle="panel" allowsUndo="YES" usesRuler="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="QXu-0d-uF0"> + <rect key="frame" x="0.0" y="0.0" width="345" height="105"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + <size key="minSize" width="345" height="105"/> + <size key="maxSize" width="877" height="10000000"/> + <attributedString key="textStorage"> + <fragment> + <string key="content">\begin{tikzpicture} + +\end{tikzpicture}</string> + <attributes> + <font key="NSFont" metaFont="toolTip"/> + <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural"/> + </attributes> + </fragment> + </attributedString> + <color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> + <size key="minSize" width="345" height="105"/> + <size key="maxSize" width="877" height="10000000"/> + <connections> + <binding destination="il5-cQ-3oh" name="attributedString" keyPath="source" id="15z-o3-4ni"/> + <outlet property="delegate" destination="il5-cQ-3oh" id="9Mr-J3-zvR"/> + </connections> + </textView> + </subviews> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + </clipView> + <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="BYM-Xm-JpT"> + <rect key="frame" x="-100" y="-100" width="87" height="18"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + <scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="0.90909090909090906" horizontal="NO" id="SEU-Jq-fwu"> + <rect key="frame" x="346" y="1" width="15" height="105"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> + </subviews> + </customView> + </subviews> + <holdingPriorities> + <real value="250"/> + <real value="250"/> + </holdingPriorities> + </splitView> + <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="esG-a3-KD7"> + <rect key="frame" x="220" y="-184" width="128" height="14"/> + <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" id="7uu-y8-NcI"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + </view> + </subviews> + <holdingPriorities> + <real value="250"/> + <real value="250"/> + </holdingPriorities> + </splitView> + </subviews> + <constraints> + <constraint firstAttribute="trailing" secondItem="DO1-FS-fZd" secondAttribute="trailing" id="Bow-1P-jx4"/> + <constraint firstAttribute="bottom" secondItem="DO1-FS-fZd" secondAttribute="bottom" id="c94-eC-Rhp"/> + <constraint firstItem="DO1-FS-fZd" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="j1G-Ag-RLs"/> + <constraint firstItem="DO1-FS-fZd" firstAttribute="top" secondItem="1" secondAttribute="top" id="tBr-89-Ipp"/> + </constraints> </customView> </objects> -</document>
\ No newline at end of file + <resources> + <image name="NSStopProgressFreestandingTemplate" width="12" height="12"/> + </resources> +</document> diff --git a/tikzit/src/osx/EdgeControlLayer.m b/tikzit/src/osx/EdgeControlLayer.m index 377cde4..facdd84 100644 --- a/tikzit/src/osx/EdgeControlLayer.m +++ b/tikzit/src/osx/EdgeControlLayer.m @@ -29,7 +29,7 @@ - (id)initWithEdge:(Edge*)e andTransformer:(Transformer*)t { - [super init]; + if (!(self = [super init])) return nil; transformer = t; edge = e; self.opacity = 0.0f; diff --git a/tikzit/src/osx/EdgeStyle+Coder.m b/tikzit/src/osx/EdgeStyle+Coder.m index 208fac0..039344d 100644 --- a/tikzit/src/osx/EdgeStyle+Coder.m +++ b/tikzit/src/osx/EdgeStyle+Coder.m @@ -26,7 +26,7 @@ @implementation EdgeStyle (Coder) - (id)initWithCoder:(NSCoder*)coder { - [super init]; + if (!(self = [super init])) return nil; name = [coder decodeObjectForKey:@"name"]; category = [coder decodeObjectForKey:@"category"]; diff --git a/tikzit/src/osx/GraphicsView.h b/tikzit/src/osx/GraphicsView.h index e963ac7..c3c2add 100644 --- a/tikzit/src/osx/GraphicsView.h +++ b/tikzit/src/osx/GraphicsView.h @@ -92,12 +92,12 @@ typedef enum { NSUndoManager *documentUndoManager; NSPoint startPoint; - TikzSourceController *tikzSourceController; + TikzSourceController *__weak tikzSourceController; } @property BOOL enabled; -@property Graph *graph; -@property IBOutlet TikzSourceController *tikzSourceController; +@property (weak) Graph *graph; +@property (weak) IBOutlet TikzSourceController *tikzSourceController; @property (readonly) Transformer *transformer; @property (readonly) PickSupport *pickSupport; diff --git a/tikzit/src/osx/Grid.m b/tikzit/src/osx/Grid.m index 3e412a3..aa35c1f 100644 --- a/tikzit/src/osx/Grid.m +++ b/tikzit/src/osx/Grid.m @@ -32,7 +32,7 @@ subdivisions:(int)subs transformer:(Transformer*)t { - [super init]; + if (!(self = [super init])) return nil; gridX = spacing; gridY = spacing; subdivisions = subs; diff --git a/tikzit/src/osx/NilToEmptyStringTransformer.m b/tikzit/src/osx/NilToEmptyStringTransformer.m index 97267e3..413f404 100644 --- a/tikzit/src/osx/NilToEmptyStringTransformer.m +++ b/tikzit/src/osx/NilToEmptyStringTransformer.m @@ -26,7 +26,7 @@ @implementation NilToEmptyStringTransformer - (id)init { - [super init]; + if (!(self = [super init])) return nil; return self; } diff --git a/tikzit/src/osx/NodeLayer.h b/tikzit/src/osx/NodeLayer.h index dfe05e8..d2a943b 100644 --- a/tikzit/src/osx/NodeLayer.h +++ b/tikzit/src/osx/NodeLayer.h @@ -30,7 +30,7 @@ #import "NodeSelectionLayer.h" @interface NodeLayer : CALayer { - Node *node; + Node *__weak node; Shape *shape; CGMutablePathRef path; float textwidth; @@ -42,10 +42,10 @@ BOOL dirty; // need to rebuild CGBezierPath of the shape } -@property Node *node; +@property (weak) Node *node; @property (assign) NSPoint center; @property (assign) BOOL rescale; -@property (retain) NodeSelectionLayer *selection; +@property (strong) NodeSelectionLayer *selection; @property (readonly) CGMutablePathRef path; - (id)initWithNode:(Node*)n transformer:(Transformer*)t; diff --git a/tikzit/src/osx/NodeLayer.m b/tikzit/src/osx/NodeLayer.m index 2c37c26..5d15585 100644 --- a/tikzit/src/osx/NodeLayer.m +++ b/tikzit/src/osx/NodeLayer.m @@ -34,7 +34,7 @@ @synthesize node, selection, rescale; - (id)initWithNode:(Node *)n transformer:(Transformer*)t { - [super init]; + if (!(self = [super init])) return nil; node = n; selection = [[NodeSelectionLayer alloc] init]; [selection setNodeLayer:self]; @@ -233,7 +233,6 @@ - (void)dealloc { if (path != NULL) CFRelease(path); - [super dealloc]; } @end diff --git a/tikzit/src/osx/NodeSelectionLayer.h b/tikzit/src/osx/NodeSelectionLayer.h index 99ee75f..68d5beb 100644 --- a/tikzit/src/osx/NodeSelectionLayer.h +++ b/tikzit/src/osx/NodeSelectionLayer.h @@ -31,10 +31,10 @@ BOOL selected; CGMutablePathRef path; NSLock *drawLock; - NodeLayer *nodeLayer; + NodeLayer *__weak nodeLayer; } -@property NodeLayer *nodeLayer; +@property (weak) NodeLayer *nodeLayer; - (id)init; - (void)select; diff --git a/tikzit/src/osx/NodeSelectionLayer.m b/tikzit/src/osx/NodeSelectionLayer.m index 5efcbf7..02b8ac2 100644 --- a/tikzit/src/osx/NodeSelectionLayer.m +++ b/tikzit/src/osx/NodeSelectionLayer.m @@ -30,7 +30,7 @@ @synthesize nodeLayer; - (id)init { - [super init]; + if (!(self = [super init])) return nil; selected = NO; drawLock = [[NSLock alloc] init]; nodeLayer = nil; diff --git a/tikzit/src/osx/NodeStyle+Coder.m b/tikzit/src/osx/NodeStyle+Coder.m index 8da91c1..d3623f5 100644 --- a/tikzit/src/osx/NodeStyle+Coder.m +++ b/tikzit/src/osx/NodeStyle+Coder.m @@ -59,7 +59,7 @@ } - (id)initWithCoder:(NSCoder *)coder { - [super init]; + if (!(self = [super init])) return nil; // decode keys name = [coder decodeObjectForKey:@"name"]; diff --git a/tikzit/src/osx/PreambleController.h b/tikzit/src/osx/PreambleController.h index 3c7a7c3..5b0931d 100644 --- a/tikzit/src/osx/PreambleController.h +++ b/tikzit/src/osx/PreambleController.h @@ -38,8 +38,8 @@ @property (readonly) BOOL useDefaultPreamble; @property (readonly) Preambles *preambles; -@property (retain) NSAttributedString *preambleText; -@property (retain) NSIndexSet *selectionIndexes; +@property (strong) NSAttributedString *preambleText; +@property (strong) NSIndexSet *selectionIndexes; - (id)initWithNibName:(NSString *)nibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg; - (void)savePreambles:(NSString*)plist; diff --git a/tikzit/src/osx/PreambleController.m b/tikzit/src/osx/PreambleController.m index 3e55eaf..206bb30 100644 --- a/tikzit/src/osx/PreambleController.m +++ b/tikzit/src/osx/PreambleController.m @@ -29,7 +29,7 @@ @synthesize preambleText, preambles; - (id)initWithNibName:(NSString *)nibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg { - [super initWithNibName:nibName bundle:Nil]; + if (!(self = [super initWithNibName:nibName bundle:Nil])) return nil; preambles = (Preambles*)[NSKeyedUnarchiver unarchiveObjectWithFile:plist]; [preambles setStyles:sty]; diff --git a/tikzit/src/osx/Preambles+Coder.m b/tikzit/src/osx/Preambles+Coder.m index 6b9768a..5e468b2 100644 --- a/tikzit/src/osx/Preambles+Coder.m +++ b/tikzit/src/osx/Preambles+Coder.m @@ -27,7 +27,7 @@ @implementation Preambles (Coder) - (id)initWithCoder:(NSCoder *)coder { - [super init]; + if (!(self = [super init])) return nil; selectedPreambleName = [coder decodeObjectForKey:@"selectedPreamble"]; preambleDict = [coder decodeObjectForKey:@"preambles"]; return self; diff --git a/tikzit/src/osx/PreferenceController.h b/tikzit/src/osx/PreferenceController.h index 5a14b72..b2b23f3 100644 --- a/tikzit/src/osx/PreferenceController.h +++ b/tikzit/src/osx/PreferenceController.h @@ -25,6 +25,7 @@ #import <Cocoa/Cocoa.h> #import "UpdatePreferenceController.h" #import "PreambleController.h" +#import "CustomNodeController.h" @interface PreferenceController : NSWindowController{ @@ -32,13 +33,17 @@ IBOutlet NSView *generalView; IBOutlet NSView *updateView; IBOutlet NSView *preambleView; + IBOutlet NSView *customNodeView; UpdatePreferenceController *updateController; PreambleController *preambleController; + CustomNodeController *customNodeController; int currentViewTag; } +- (id)initWithWindowNibName:(NSString *)windowNibName preambleController:(PreambleController *)pc; + - (IBAction)switchView:(id)sender; @end diff --git a/tikzit/src/osx/PreferenceController.m b/tikzit/src/osx/PreferenceController.m index ab992ed..099bf48 100644 --- a/tikzit/src/osx/PreferenceController.m +++ b/tikzit/src/osx/PreferenceController.m @@ -30,8 +30,8 @@ @implementation PreferenceController -- (id)initWithWindowNibName:(NSString *)windowNibName preambleController:(PreambleController*)pc{ - [super initWithWindowNibName:windowNibName]; +- (id)initWithWindowNibName:(NSString *)windowNibName preambleController:(PreambleController *)pc{ + if (!(self = [super initWithWindowNibName:windowNibName])) return nil; preambleController = pc; @@ -69,6 +69,9 @@ case 3: view = preambleView; break; + case 4: + view = customNodeView; + break; } return view; @@ -96,6 +99,11 @@ [[[self window] contentView] replaceSubview:preambleView with:[preambleController view]]; preambleView = [preambleController view]; + customNodeController = [[CustomNodeController alloc] initWithNibName:@"CustomNodes" bundle:nil]; + [[customNodeController view] setFrame:[customNodeView frame]]; + [[[self window] contentView] replaceSubview:customNodeView with:[customNodeController view]]; + customNodeView = [customNodeController view]; + [[self window] setContentSize:[preambleView frame].size]; [[[self window] contentView] addSubview:preambleView]; currentViewTag = 3; diff --git a/tikzit/src/osx/Preferences.xib b/tikzit/src/osx/Preferences.xib index 8247c8d..155cf71 100644 --- a/tikzit/src/osx/Preferences.xib +++ b/tikzit/src/osx/Preferences.xib @@ -126,6 +126,28 @@ <bool key="NSToolbarIsUserRemovable">YES</bool> <int key="NSToolbarItemVisibilityPriority">0</int> </object> + <object class="NSToolbarItem" key="CBA2626C-DD4C-4ADD-BD5D-26D21216D9A8" id="845520355"> + <object class="NSMutableString" key="NSToolbarItemIdentifier"> + <characters key="NS.bytes">CBA2626C-DD4C-4ADD-BD5D-26D21216D9A8</characters> + </object> + <string key="NSToolbarItemLabel">Custom Nodes</string> + <string key="NSToolbarItemPaletteLabel">Custom Nodes</string> + <string key="NSToolbarItemToolTip"/> + <nil key="NSToolbarItemView"/> + <object class="NSCustomResource" key="NSToolbarItemImage"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">customshape</string> + </object> + <nil key="NSToolbarItemTarget"/> + <nil key="NSToolbarItemAction"/> + <string key="NSToolbarItemMinSize">{0, 0}</string> + <string key="NSToolbarItemMaxSize">{0, 0}</string> + <bool key="NSToolbarItemEnabled">YES</bool> + <bool key="NSToolbarItemAutovalidates">YES</bool> + <int key="NSToolbarItemTag">4</int> + <bool key="NSToolbarIsUserRemovable">YES</bool> + <int key="NSToolbarItemVisibilityPriority">0</int> + </object> <object class="NSToolbarItem" key="F85FE7C2-9847-4E58-8BF6-BE334E918CA7" id="641338426"> <object class="NSMutableString" key="NSToolbarItemIdentifier"> <characters key="NS.bytes">F85FE7C2-9847-4E58-8BF6-BE334E918CA7</characters> @@ -149,15 +171,17 @@ <int key="NSToolbarItemVisibilityPriority">0</int> </object> </dictionary> - <array key="NSToolbarIBAllowedItems"> + <array class="NSMutableArray" key="NSToolbarIBAllowedItems"> <reference ref="914743654"/> <reference ref="224936444"/> <reference ref="641338426"/> <reference ref="265637031"/> + <reference ref="845520355"/> </array> <array key="NSToolbarIBDefaultItems"> <reference ref="265637031"/> <reference ref="641338426"/> + <reference ref="845520355"/> <reference ref="224936444"/> </array> <array key="NSToolbarIBSelectableItems" id="0"/> @@ -329,6 +353,17 @@ <string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSClassName">NSView</string> </object> + <object class="NSCustomView" id="443314002"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">12</int> + <array class="NSMutableArray" key="NSSubviews"/> + <string key="NSFrameSize">{557, 354}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <string key="NSClassName">NSView</string> + </object> <object class="NSUserDefaultsController" id="706090457"> <bool key="NSSharedInstance">YES</bool> </object> @@ -409,6 +444,22 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> + <string key="label">customNodeView</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="443314002"/> + </object> + <int key="connectionID">123</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">switchView:</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="845520355"/> + </object> + <int key="connectionID">125</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="1005"/> <reference key="destination" ref="1001"/> @@ -496,6 +547,7 @@ <reference ref="914743654"/> <reference ref="224936444"/> <reference ref="265637031"/> + <reference ref="845520355"/> </array> <reference key="parent" ref="1005"/> </object> @@ -744,6 +796,16 @@ <reference key="object" ref="265637031"/> <reference key="parent" ref="338765480"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">122</int> + <reference key="object" ref="443314002"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">124</int> + <reference key="object" ref="845520355"/> + <reference key="parent" ref="338765480"/> + </object> </array> </object> <dictionary class="NSMutableDictionary" key="flattenedProperties"> @@ -758,6 +820,8 @@ <string key="118.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="119.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="12.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="122.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <array key="13.IBNSViewMetadataConstraints"> <reference ref="559306534"/> <reference ref="338893657"/> @@ -794,7 +858,7 @@ <nil key="activeLocalization"/> <dictionary class="NSMutableDictionary" key="localizations"/> <nil key="sourceID"/> - <int key="maxID">121</int> + <int key="maxID">125</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -813,12 +877,17 @@ </object> </object> <dictionary class="NSMutableDictionary" key="outlets"> + <string key="customNodeView">NSView</string> <string key="engineView">NSView</string> <string key="generalView">NSView</string> <string key="preambleView">NSView</string> <string key="updateView">NSView</string> </dictionary> <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> + <object class="IBToOneOutletInfo" key="customNodeView"> + <string key="name">customNodeView</string> + <string key="candidateClassName">NSView</string> + </object> <object class="IBToOneOutletInfo" key="engineView"> <string key="name">engineView</string> <string key="candidateClassName">NSView</string> @@ -859,6 +928,7 @@ <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> <string key="NSPreferencesGeneral">{32, 32}</string> <string key="NSSwitch">{15, 15}</string> + <string key="customshape">{32, 32}</string> <string key="engine">{32, 32}</string> <string key="preamble">{32, 32}</string> <string key="updates">{32, 32}</string> diff --git a/tikzit/src/osx/PreviewController.m b/tikzit/src/osx/PreviewController.m index 310c2ab..cf069b1 100644 --- a/tikzit/src/osx/PreviewController.m +++ b/tikzit/src/osx/PreviewController.m @@ -33,7 +33,7 @@ static PreviewController *preview = nil; - (id)initWithWindowNibName:(NSString*)nib preambleController:(PreambleController*)pc tempDir:(NSString*)dir { - [super initWithWindowNibName:nib]; + if (!(self = [super initWithWindowNibName:nib])) return nil; tempDir = [dir copy]; typesetCount = 0; preambleController = pc; diff --git a/tikzit/src/osx/PropertyInspectorController.h b/tikzit/src/osx/PropertyInspectorController.h index 0625f9b..663ee4a 100644 --- a/tikzit/src/osx/PropertyInspectorController.h +++ b/tikzit/src/osx/PropertyInspectorController.h @@ -52,11 +52,11 @@ //@property (readonly) BOOL enableNodeDataControls; //@property (readonly) BOOL enableEdgeDataControls; -@property (retain) NSMutableArray *selectedNodes; -@property (retain) NSMutableArray *selectedEdges; -@property (retain) NSMutableArray *sourceAnchorNames; -@property (retain) NSMutableArray *targetAnchorNames; -@property (retain) StylePaletteController *stylePaletteController; +@property (strong) NSMutableArray *selectedNodes; +@property (strong) NSMutableArray *selectedEdges; +@property (strong) NSMutableArray *sourceAnchorNames; +@property (strong) NSMutableArray *targetAnchorNames; +@property (strong) StylePaletteController *stylePaletteController; - (id)initWithWindowNibName:(NSString *)windowNibName; - (void)graphSelectionChanged:(NSNotification*)notification; diff --git a/tikzit/src/osx/PropertyInspectorController.m b/tikzit/src/osx/PropertyInspectorController.m index 1411549..981f746 100644 --- a/tikzit/src/osx/PropertyInspectorController.m +++ b/tikzit/src/osx/PropertyInspectorController.m @@ -25,7 +25,7 @@ @synthesize sourceAnchorNames, targetAnchorNames; - (id)initWithWindowNibName:(NSString *)windowNibName { - [super initWithWindowNibName:windowNibName]; + if (!(self = [super initWithWindowNibName:windowNibName])) return nil; noSelection = [[GraphElementData alloc] init]; [noSelection setProperty:@"" forKey:@"No Selection"]; diff --git a/tikzit/src/osx/SelectBoxLayer.m b/tikzit/src/osx/SelectBoxLayer.m index c198ffa..a7abe33 100644 --- a/tikzit/src/osx/SelectBoxLayer.m +++ b/tikzit/src/osx/SelectBoxLayer.m @@ -14,7 +14,7 @@ @synthesize active; - (id)init { - [super init]; + if (!(self = [super init])) return nil; box = CGRectMake(0.0f, 0.0f, 0.0f, 0.0f); active = NO; return self; @@ -42,7 +42,7 @@ } + (SelectBoxLayer*)layer { - return [[[SelectBoxLayer alloc] init] autorelease]; + return [[SelectBoxLayer alloc] init]; } @end diff --git a/tikzit/src/osx/SelectableNodeView.h b/tikzit/src/osx/SelectableNodeView.h index be7d1a1..6b0841d 100644 --- a/tikzit/src/osx/SelectableNodeView.h +++ b/tikzit/src/osx/SelectableNodeView.h @@ -32,7 +32,7 @@ } @property (assign) BOOL selected; -@property (retain) NodeStyle *nodeStyle; +@property (strong) NodeStyle *nodeStyle; @end diff --git a/tikzit/src/osx/SelectableNodeView.m b/tikzit/src/osx/SelectableNodeView.m index 6fdd283..797a137 100644 --- a/tikzit/src/osx/SelectableNodeView.m +++ b/tikzit/src/osx/SelectableNodeView.m @@ -30,7 +30,7 @@ @synthesize selected; - (id)initWithFrame:(NSRect)frameRect { - [super initWithFrame:frameRect]; + if (!(self = [super initWithFrame:frameRect])) return nil; nodeLayer = nil; return self; } diff --git a/tikzit/src/osx/StylePaletteController.h b/tikzit/src/osx/StylePaletteController.h index ed30b58..51404bb 100644 --- a/tikzit/src/osx/StylePaletteController.h +++ b/tikzit/src/osx/StylePaletteController.h @@ -28,8 +28,8 @@ @class SFBInspectorView; @interface StylePaletteController : NSWindowController { - NSMutableArray *nodeStyles; - NSMutableArray *edgeStyles; + NSMutableArray *__weak nodeStyles; + NSMutableArray *__weak edgeStyles; IBOutlet NSArrayController *nodeStyleArrayController; IBOutlet NSArrayController *filteredNodeStyleArrayController; IBOutlet NSArrayController *edgeStyleArrayController; @@ -43,15 +43,15 @@ NSString *displayedEdgeStyleCategory; } -@property (readonly) NSMutableArray *nodeStyles; -@property (readonly) NSMutableArray *edgeStyles; +@property (weak, readonly) NSMutableArray *nodeStyles; +@property (weak, readonly) NSMutableArray *edgeStyles; @property (readonly) BOOL documentActive; -@property (assign) NodeStyle *activeNodeStyle; -@property (assign) EdgeStyle *activeEdgeStyle; +@property (weak) NodeStyle *activeNodeStyle; +@property (weak) EdgeStyle *activeEdgeStyle; @property (copy) NSString *displayedNodeStyleCategory; @property (copy) NSString *displayedEdgeStyleCategory; -@property (readonly) NSPredicate *displayedNodeStylePredicate; -@property (readonly) NSPredicate *displayedEdgeStylePredicate; +@property (weak, readonly) NSPredicate *displayedNodeStylePredicate; +@property (weak, readonly) NSPredicate *displayedEdgeStylePredicate; //@property NSString *nodeLabel; diff --git a/tikzit/src/osx/TikzDocument.h b/tikzit/src/osx/TikzDocument.h index d817b2e..1881994 100644 --- a/tikzit/src/osx/TikzDocument.h +++ b/tikzit/src/osx/TikzDocument.h @@ -32,6 +32,6 @@ } @property (readonly) NSString *tikz; -@property (readonly) GraphicsView *graphicsView; +@property (weak, readonly) GraphicsView *graphicsView; @end diff --git a/tikzit/src/osx/TikzFormatter.m b/tikzit/src/osx/TikzFormatter.m index 8972706..9e45cb6 100644 --- a/tikzit/src/osx/TikzFormatter.m +++ b/tikzit/src/osx/TikzFormatter.m @@ -76,10 +76,6 @@ } } - [cs autorelease]; - [scanner autorelease]; - [strippedString autorelease]; - if([strippedString length] % 2 == 1){ return NO; } diff --git a/tikzit/src/osx/TikzSourceController.h b/tikzit/src/osx/TikzSourceController.h index 3408d9f..84d36da 100644 --- a/tikzit/src/osx/TikzSourceController.h +++ b/tikzit/src/osx/TikzSourceController.h @@ -27,17 +27,17 @@ #import "ParseErrorView.h" @interface TikzSourceController : NSObject { - GraphicsView *graphicsView; - NSTextView *sourceView; + GraphicsView *__weak graphicsView; + NSTextView *__unsafe_unretained sourceView; NSAttributedString *source; - NSTextField *status; + NSTextField *__weak status; NSDictionary *textAttrs; NSColor *successColor; NSColor *failedColor; - NSTextField *errorMessage; - ParseErrorView *errorNotification; + NSTextField *__weak errorMessage; + ParseErrorView *__weak errorNotification; - NSUndoManager *documentUndoManager; + NSUndoManager *__weak documentUndoManager; BOOL tikzChanged; BOOL justUndid; @@ -46,14 +46,14 @@ } @property BOOL tikzChanged; -@property IBOutlet GraphicsView *graphicsView; -@property IBOutlet NSTextView *sourceView; -@property IBOutlet NSTextField *status; -@property NSUndoManager *documentUndoManager; +@property (weak) IBOutlet GraphicsView *graphicsView; +@property (unsafe_unretained) IBOutlet NSTextView *sourceView; +@property (weak) IBOutlet NSTextField *status; +@property (weak) NSUndoManager *documentUndoManager; @property (copy) NSAttributedString *source; @property (copy) NSString *tikz; -@property IBOutlet ParseErrorView *errorNotification; -@property IBOutlet NSTextField *errorMessage; +@property (weak) IBOutlet ParseErrorView *errorNotification; +@property (weak) IBOutlet NSTextField *errorMessage; - (void)updateTikzFromGraph; - (void)graphChanged:(NSNotification*)n; diff --git a/tikzit/src/osx/TikzSourceController.m b/tikzit/src/osx/TikzSourceController.m index 737d771..84eb3a5 100644 --- a/tikzit/src/osx/TikzSourceController.m +++ b/tikzit/src/osx/TikzSourceController.m @@ -142,8 +142,12 @@ } - (BOOL)tryParseTikz { + NSError *thisError; + Graph *g = [TikzGraphAssembler parseTikz:[self tikz] - error:&lastError]; + error:&thisError]; + + lastError = thisError; if (g) { [graphicsView deselectAll:self]; @@ -230,9 +234,8 @@ } } -- (void)finalize { +- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [super finalize]; } @end diff --git a/tikzit/src/osx/TikzWindowController.h b/tikzit/src/osx/TikzWindowController.h index e35b7eb..eab427c 100644 --- a/tikzit/src/osx/TikzWindowController.h +++ b/tikzit/src/osx/TikzWindowController.h @@ -11,13 +11,13 @@ @class TikzDocument, GraphicsView, TikzSourceController; @interface TikzWindowController : NSWindowController { - GraphicsView *graphicsView; - TikzSourceController *tikzSourceController; + GraphicsView *__weak graphicsView; + TikzSourceController *__weak tikzSourceController; TikzDocument *document; } -@property IBOutlet GraphicsView *graphicsView; -@property IBOutlet TikzSourceController *tikzSourceController; +@property (weak) IBOutlet GraphicsView *graphicsView; +@property (weak) IBOutlet TikzSourceController *tikzSourceController; - (id)initWithDocument:(TikzDocument*)doc; diff --git a/tikzit/src/osx/TikzWindowController.m b/tikzit/src/osx/TikzWindowController.m index 2e672d2..bfacbfb 100644 --- a/tikzit/src/osx/TikzWindowController.m +++ b/tikzit/src/osx/TikzWindowController.m @@ -16,7 +16,7 @@ @synthesize graphicsView, tikzSourceController; - (id)initWithDocument:(TikzDocument*)doc { - [super initWithWindowNibName:@"TikzDocument"]; + if (!(self = [super initWithWindowNibName:@"TikzDocument"])) return nil; document = doc; return self; } diff --git a/tikzit/src/osx/ToolPaletteController.h b/tikzit/src/osx/ToolPaletteController.h index e45c08d..6301c6b 100644 --- a/tikzit/src/osx/ToolPaletteController.h +++ b/tikzit/src/osx/ToolPaletteController.h @@ -30,13 +30,13 @@ typedef enum { } TikzTool; @interface ToolPaletteController : NSObject { - NSPanel *toolPalette; - NSMatrix *toolMatrix; + NSPanel *__weak toolPalette; + NSMatrix *__weak toolMatrix; } @property TikzTool selectedTool; -@property IBOutlet NSPanel *toolPalette; -@property IBOutlet NSMatrix *toolMatrix; +@property (weak) IBOutlet NSPanel *toolPalette; +@property (weak) IBOutlet NSMatrix *toolMatrix; @end |