diff options
Diffstat (limited to 'tikzit/src')
41 files changed, 888 insertions, 109 deletions
diff --git a/tikzit/src/common/GraphElementProperty.m b/tikzit/src/common/GraphElementProperty.m index 3cf6632..1acdc09 100644 --- a/tikzit/src/common/GraphElementProperty.m +++ b/tikzit/src/common/GraphElementProperty.m @@ -66,7 +66,8 @@ - (void) dealloc { [key release]; - [value release]; +// the below line causes a exc_bad_access. Uncommenting it gains a memory leak but at least no crashing. +// [value release]; [super dealloc]; } diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m index eb466e2..5dc25e3 100644 --- a/tikzit/src/common/Shape.m +++ b/tikzit/src/common/Shape.m @@ -88,7 +88,8 @@ NSDictionary *shapeDictionary = nil; + (void)addShapesInDir:(NSString*)shapeDir to:(NSMutableDictionary*)shapeDict { NSFileManager *fileManager = [NSFileManager defaultManager]; - NSArray *files = [fileManager directoryContentsAtPath:shapeDir]; + NSError *err = nil; + NSArray *files = [fileManager contentsOfDirectoryAtPath:shapeDir error:&err]; if (files != nil) { NSString *nm; diff --git a/tikzit/src/common/TikzShape.h b/tikzit/src/common/TikzShape.h index 1ccf658..6a91f91 100644 --- a/tikzit/src/common/TikzShape.h +++ b/tikzit/src/common/TikzShape.h @@ -25,8 +25,11 @@ #import "Shape.h" @interface TikzShape : Shape { + NSString *tikzSrc; } +@property (copy) NSString *tikzSrc; + - (id)initWithTikzFile:(NSString*)file; @end diff --git a/tikzit/src/common/TikzShape.m b/tikzit/src/common/TikzShape.m index 9735371..c07c61e 100644 --- a/tikzit/src/common/TikzShape.m +++ b/tikzit/src/common/TikzShape.m @@ -26,6 +26,8 @@ @implementation TikzShape +@synthesize tikzSrc; + - (id)initWithTikzFile:(NSString*)file { self = [super init]; if (self) { @@ -33,6 +35,8 @@ encoding:NSUTF8StringEncoding error:NULL]; if (tikz == nil) return nil; + + tikzSrc = [tikz copy]; Graph *graph = [Graph graphFromTikz:tikz]; if (graph == nil) return nil; diff --git a/tikzit/src/osx/AppDelegate.h b/tikzit/src/osx/AppDelegate.h index 64acc38..92d9add 100644 --- a/tikzit/src/osx/AppDelegate.h +++ b/tikzit/src/osx/AppDelegate.h @@ -28,7 +28,7 @@ #import "PreambleController.h" #import "PreviewController.h" #import "GraphicsView.h" -#import "PreferenceController.h"; +#import "PreferenceController.h" @interface AppDelegate : NSObject { NSMapTable *table; @@ -43,7 +43,7 @@ } @property IBOutlet StylePaletteController *stylePaletteController; -@property IBOutlet ToolPaletteController *toolPaletteController; +@property (strong) IBOutlet ToolPaletteController *toolPaletteController; - (void)awakeFromNib; + (void)setDefaults; diff --git a/tikzit/src/osx/AppDelegate.m b/tikzit/src/osx/AppDelegate.m index 35484b7..94f5507 100644 --- a/tikzit/src/osx/AppDelegate.m +++ b/tikzit/src/osx/AppDelegate.m @@ -110,7 +110,7 @@ } - (IBAction)togglePreamble:(id)sender { - [self toggleController:preambleController]; + [self toggleController:(NSWindowController *) preambleController]; } - (IBAction)togglePreferences:(id)sender { diff --git a/tikzit/src/osx/CustomNodeCellView.h b/tikzit/src/osx/CustomNodeCellView.h new file mode 100644 index 0000000..22606d7 --- /dev/null +++ b/tikzit/src/osx/CustomNodeCellView.h @@ -0,0 +1,23 @@ +// +// CustomNodeCellView.h +// TikZiT +// +// Created by Johan Paulsson on 12/12/13. +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +#import "NodeLayer.h" +#import "NodeStyle.h" +#import "NodeStyle+Coder.h" + +@interface CustomNodeCellView : NSTableCellView{ + NodeLayer *nodeLayer; + NodeStyle *nodeStyle; + BOOL selected; +} + +@property (strong) id objectValue; + +@end diff --git a/tikzit/src/osx/CustomNodeCellView.m b/tikzit/src/osx/CustomNodeCellView.m new file mode 100644 index 0000000..612394b --- /dev/null +++ b/tikzit/src/osx/CustomNodeCellView.m @@ -0,0 +1,83 @@ +// +// CustomNodeCellView.m +// TikZiT +// +// Created by Johan Paulsson on 12/12/13. +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// + +#import "CustomNodeCellView.h" + +@implementation CustomNodeCellView + +- (id)initWithFrame:(NSRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // Initialization code here. + } + return self; +} + +- (void)drawRect:(NSRect)dirtyRect +{ + [super drawRect:dirtyRect]; + + // Drawing code here. +} + +- (id) objectValue{ + return [super objectValue]; +} + +-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { + if (nodeLayer!=nil) { + if (![[[self layer] sublayers] containsObject:nodeLayer]) { + [[self layer] addSublayer:nodeLayer]; + NSPoint c = NSMakePoint((CGRectGetMinX([[self layer] frame])+CGRectGetWidth([nodeLayer bounds])/2), + CGRectGetMidY([[self layer] frame])); + //c = NSMakePoint(-16.5,-16.5); + [nodeLayer setCenter:c andAnimateWhen:NO]; + [[self textField] setFrame:NSMakeRect(CGRectGetWidth([nodeLayer bounds]), CGRectGetMidY([[self layer] frame]), CGRectGetWidth([[self textField] frame]), CGRectGetHeight([[self textField] frame]))]; + } + + if (selected){ + [nodeStyle setStrokeColor:[NSColor whiteColor]]; + [[nodeLayer node] setStyle:nodeStyle]; + }else{ + [nodeStyle setStrokeColor:[NSColor blackColor]]; + [[nodeLayer node] setStyle:nodeStyle]; + } + + [nodeLayer updateFrame]; + } +} + +- (void) setObjectValue:(id)objectValue{ + if(objectValue == nil) + return; + + nodeStyle = (NodeStyle *)objectValue; + [[self textField] setStringValue:[nodeStyle shapeName]]; + + if (nodeLayer == nil) { + nodeLayer = [[NodeLayer alloc] initWithNode:[Node node] + transformer:[Transformer defaultTransformer]]; + [nodeLayer setRescale:NO]; + } + [nodeStyle setName:[nodeStyle shapeName]]; + + [[nodeLayer node] setStyle:nodeStyle]; + [nodeLayer updateFrame]; + + NSLog(@"asd"); +} + +- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle { + [super setBackgroundStyle:backgroundStyle]; + + selected = (backgroundStyle == NSBackgroundStyleDark); + [self setNeedsDisplay:YES]; +} + +@end diff --git a/tikzit/src/osx/CustomNodeController.h b/tikzit/src/osx/CustomNodeController.h new file mode 100644 index 0000000..67adf0b --- /dev/null +++ b/tikzit/src/osx/CustomNodeController.h @@ -0,0 +1,35 @@ +// +// CustomNodeController.h +// TikZiT +// +// Created by Johan Paulsson on 12/4/13. +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "Shape.h" +#import "TikzShape.h" + +#import "GraphicsView.h" +#import "TikzSourceController.h" + +#import "SupportDir.h" + +@interface CustomNodeController : NSViewController <NSTableViewDelegate>{ + NSDictionary *nodeStyles; + NSMutableArray* customNodeStyles; + + GraphicsView *__weak graphicsView; + TikzSourceController *__weak tikzSourceController; + NSTableView *customNodeTable; +} + +@property NSDictionary *nodeStyles; +@property NSMutableArray* customNodeStyles; + +@property IBOutlet NSTableView *customNodeTable; + +@property (weak) IBOutlet GraphicsView *graphicsView; +@property (weak) IBOutlet TikzSourceController *tikzSourceController; + +@end diff --git a/tikzit/src/osx/CustomNodeController.m b/tikzit/src/osx/CustomNodeController.m new file mode 100644 index 0000000..4f46acc --- /dev/null +++ b/tikzit/src/osx/CustomNodeController.m @@ -0,0 +1,58 @@ +// +// CustomNodeController.m +// TikZiT +// +// Created by Johan Paulsson on 12/4/13. +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// + +#import "CustomNodeController.h" +#import "NodeStyle.h" + +@interface CustomNodeController () + +@end + +@implementation CustomNodeController + +@synthesize nodeStyles, customNodeStyles; +@synthesize graphicsView, tikzSourceController; +@synthesize customNodeTable; + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { + nodeStyles = [Shape shapeDictionary]; + customNodeStyles = [NSMutableArray array]; + + for(id key in nodeStyles) { + Shape *value = [nodeStyles objectForKey:key]; + + if([value isKindOfClass:[TikzShape class]]){ + NodeStyle *newNodeStyle = [[NodeStyle alloc] init]; + [newNodeStyle setShapeName:key]; + + [customNodeStyles addObject:newNodeStyle]; + } + } + } + + return self; +} + +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification{ + NSInteger selectedRow = [customNodeTable selectedRow]; + + NodeStyle* selectedNodeStyle = [customNodeStyles objectAtIndex:selectedRow]; + TikzShape *tikzshape = (TikzShape *) [nodeStyles objectForKey:[selectedNodeStyle shapeName]]; + + [[tikzSourceController graphicsView] setEnabled:NO]; + [tikzSourceController setTikz:[tikzshape tikzSrc]]; + [tikzSourceController parseTikz:self]; +} + +- (id)valueForUndefinedKey:(NSString *)key{ + return nil; +} + +@end diff --git a/tikzit/src/osx/CustomNodes.xib b/tikzit/src/osx/CustomNodes.xib new file mode 100644 index 0000000..1cc8db2 --- /dev/null +++ b/tikzit/src/osx/CustomNodes.xib @@ -0,0 +1,249 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> + <dependencies> + <deployment defaultVersion="1070" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/> + </dependencies> + <objects> + <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> + <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..329b1e5 100644 --- a/tikzit/src/osx/GraphicsView.h +++ b/tikzit/src/osx/GraphicsView.h @@ -96,7 +96,7 @@ typedef enum { } @property BOOL enabled; -@property Graph *graph; +@property (weak) Graph *graph; @property 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..dbcdac5 100644 --- a/tikzit/src/osx/NodeLayer.h +++ b/tikzit/src/osx/NodeLayer.h @@ -42,10 +42,10 @@ BOOL dirty; // need to rebuild CGBezierPath of the shape } -@property Node *node; +@property (strong) 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.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..e785358 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,9 +99,14 @@ [[[self window] contentView] replaceSubview:preambleView with:[preambleController view]]; preambleView = [preambleController view]; - [[self window] setContentSize:[preambleView frame].size]; - [[[self window] contentView] addSubview:preambleView]; - currentViewTag = 3; + 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:[engineView frame].size]; + [[[self window] contentView] addSubview:engineView]; + currentViewTag = 1; } - (IBAction)switchView:(id)sender { diff --git a/tikzit/src/osx/Preferences.xib b/tikzit/src/osx/Preferences.xib index 8247c8d..1be3f9f 100644 --- a/tikzit/src/osx/Preferences.xib +++ b/tikzit/src/osx/Preferences.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> <data> <int key="IBDocument.SystemTarget">1070</int> - <string key="IBDocument.SystemVersion">13A603</string> - <string key="IBDocument.InterfaceBuilderVersion">4514</string> - <string key="IBDocument.AppKitVersion">1265</string> - <string key="IBDocument.HIToolboxVersion">695.00</string> + <string key="IBDocument.SystemVersion">13C64</string> + <string key="IBDocument.InterfaceBuilderVersion">5053</string> + <string key="IBDocument.AppKitVersion">1265.19</string> + <string key="IBDocument.HIToolboxVersion">697.40</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">4514</string> + <string key="NS.object.0">5053</string> </object> <array key="IBDocument.IntegratedClassDependencies"> <string>IBNSLayoutConstraint</string> @@ -100,7 +100,7 @@ <string key="NSToolbarItemMaxSize">{0, 0}</string> <bool key="NSToolbarItemEnabled">YES</bool> <bool key="NSToolbarItemAutovalidates">YES</bool> - <int key="NSToolbarItemTag">0</int> + <int key="NSToolbarItemTag">1</int> <bool key="NSToolbarIsUserRemovable">YES</bool> <int key="NSToolbarItemVisibilityPriority">0</int> </object> @@ -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="914743654"/> <reference ref="265637031"/> - <reference ref="641338426"/> + <reference ref="845520355"/> <reference ref="224936444"/> </array> <array key="NSToolbarIBSelectableItems" id="0"/> @@ -178,33 +202,33 @@ <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <array class="NSMutableArray" key="NSSubviews"> - <object class="NSButton" id="764495169"> + <object class="NSButton" id="521024449"> <reference key="NSNextResponder" ref="103531975"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 15}, {214, 18}}</string> + <string key="NSFrame">{{18, 106}, {219, 18}}</string> <reference key="NSSuperview" ref="103531975"/> <reference key="NSWindow"/> <reference key="NSNextKeyView"/> <string key="NSReuseIdentifierKey">_NS:9</string> <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="292348615"> + <object class="NSButtonCell" key="NSCell" id="550678479"> <int key="NSCellFlags">-2080374784</int> <int key="NSCellFlags2">268435456</int> - <string key="NSContents">Bring preview window to focus</string> + <string key="NSContents">Keep inspector windows on top</string> <object class="NSFont" key="NSSupport" id="924461577"> <string key="NSName">.LucidaGrandeUI</string> <double key="NSSize">13</double> <int key="NSfFlags">1044</int> </object> <string key="NSCellIdentifier">_NS:9</string> - <reference key="NSControlView" ref="764495169"/> + <reference key="NSControlView" ref="521024449"/> <int key="NSButtonFlags">1211912448</int> <int key="NSButtonFlags2">2</int> - <object class="NSCustomResource" key="NSNormalImage"> + <object class="NSCustomResource" key="NSNormalImage" id="959728078"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">NSSwitch</string> </object> - <object class="NSButtonImageSource" key="NSAlternateImage"> + <object class="NSButtonImageSource" key="NSAlternateImage" id="808033943"> <string key="NSImageName">NSSwitch</string> </object> <string key="NSAlternateContents"/> @@ -214,10 +238,64 @@ </object> <bool key="NSAllowsLogicalLayoutDirection">NO</bool> </object> + <object class="NSButton" id="118735803"> + <reference key="NSNextResponder" ref="103531975"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{18, 126}, {168, 18}}</string> + <reference key="NSSuperview" ref="103531975"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="521024449"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="63691474"> + <int key="NSCellFlags">-2080374784</int> + <int key="NSCellFlags2">268435456</int> + <string key="NSContents">Autocomplete brackets</string> + <reference key="NSSupport" ref="924461577"/> + <string key="NSCellIdentifier">_NS:9</string> + <reference key="NSControlView" ref="118735803"/> + <int key="NSButtonFlags">1211912448</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSNormalImage" ref="959728078"/> + <reference key="NSAlternateImage" ref="808033943"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + <bool key="NSAllowsLogicalLayoutDirection">NO</bool> + </object> + <object class="NSButton" id="764495169"> + <reference key="NSNextResponder" ref="103531975"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{18, 18}, {214, 18}}</string> + <reference key="NSSuperview" ref="103531975"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="292348615"> + <int key="NSCellFlags">-2080374784</int> + <int key="NSCellFlags2">268435456</int> + <string key="NSContents">Bring preview window to focus</string> + <reference key="NSSupport" ref="924461577"/> + <string key="NSCellIdentifier">_NS:9</string> + <reference key="NSControlView" ref="764495169"/> + <int key="NSButtonFlags">1211912448</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSNormalImage" ref="959728078"/> + <reference key="NSAlternateImage" ref="808033943"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + <bool key="NSAllowsLogicalLayoutDirection">NO</bool> + </object> <object class="NSTextField" id="762565485"> <reference key="NSNextResponder" ref="103531975"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{20, 39}, {440, 22}}</string> + <string key="NSFrame">{{20, 42}, {440, 22}}</string> <reference key="NSSuperview" ref="103531975"/> <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="764495169"/> @@ -256,7 +334,7 @@ <object class="NSTextField" id="539123669"> <reference key="NSNextResponder" ref="103531975"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{18, 69}, {140, 17}}</string> + <string key="NSFrame">{{18, 72}, {140, 17}}</string> <reference key="NSSuperview" ref="103531975"/> <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="762565485"/> @@ -289,10 +367,10 @@ <int key="NSTextFieldAlignmentRectInsetsVersion">1</int> </object> </array> - <string key="NSFrameSize">{480, 96}</string> + <string key="NSFrameSize">{480, 162}</string> <reference key="NSSuperview"/> <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="539123669"/> + <reference key="NSNextKeyView" ref="118735803"/> <string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSClassName">NSView</string> </object> @@ -329,6 +407,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 +498,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"/> @@ -447,6 +552,38 @@ </object> <int key="connectionID">62</int> </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.net.sourceforge.tikzit.autocomplete</string> + <reference key="source" ref="118735803"/> + <reference key="destination" ref="706090457"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="118735803"/> + <reference key="NSDestination" ref="706090457"/> + <string key="NSLabel">value: values.net.sourceforge.tikzit.autocomplete</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.net.sourceforge.tikzit.autocomplete</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">149</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.net.sourceforge.tikzit.inspectorsontop</string> + <reference key="source" ref="521024449"/> + <reference key="destination" ref="706090457"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="521024449"/> + <reference key="NSDestination" ref="706090457"/> + <string key="NSLabel">value: values.net.sourceforge.tikzit.inspectorsontop</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.net.sourceforge.tikzit.inspectorsontop</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">150</int> + </object> </array> <object class="IBMutableOrderedSet" key="objectRecords"> <array key="orderedObjects"> @@ -496,6 +633,7 @@ <reference ref="914743654"/> <reference ref="224936444"/> <reference ref="265637031"/> + <reference ref="845520355"/> </array> <reference key="parent" ref="1005"/> </object> @@ -513,6 +651,24 @@ <int key="objectID">13</int> <reference key="object" ref="103531975"/> <array class="NSMutableArray" key="children"> + <object class="IBNSLayoutConstraint" id="727314944"> + <reference key="firstItem" ref="103531975"/> + <int key="firstAttribute">4</int> + <int key="relation">0</int> + <reference key="secondItem" ref="764495169"/> + <int key="secondAttribute">4</int> + <float key="multiplier">1</float> + <string key="multiplierString">1</string> + <object class="IBNSLayoutSymbolicConstant" key="constant"> + <double key="value">20</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="103531975"/> + <int key="scoringType">8</int> + <float key="scoringTypeFloat">23</float> + <int key="contentType">3</int> + <bool key="placeholder">NO</bool> + </object> <object class="IBNSLayoutConstraint" id="728277728"> <reference key="firstItem" ref="764495169"/> <int key="firstAttribute">3</int> @@ -520,6 +676,7 @@ <reference key="secondItem" ref="762565485"/> <int key="secondAttribute">4</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">8</double> </object> @@ -537,6 +694,7 @@ <reference key="secondItem" ref="103531975"/> <int key="secondAttribute">5</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">20</double> </object> @@ -554,6 +712,7 @@ <reference key="secondItem" ref="762565485"/> <int key="secondAttribute">6</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">20</double> </object> @@ -571,6 +730,7 @@ <reference key="secondItem" ref="539123669"/> <int key="secondAttribute">4</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">8</double> </object> @@ -588,6 +748,7 @@ <reference key="secondItem" ref="103531975"/> <int key="secondAttribute">5</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">20</double> </object> @@ -598,43 +759,101 @@ <int key="contentType">3</int> <bool key="placeholder">NO</bool> </object> - <object class="IBNSLayoutConstraint" id="338893657"> + <object class="IBNSLayoutConstraint" id="559306534"> <reference key="firstItem" ref="539123669"/> - <int key="firstAttribute">3</int> + <int key="firstAttribute">5</int> <int key="relation">0</int> <reference key="secondItem" ref="103531975"/> - <int key="secondAttribute">3</int> + <int key="secondAttribute">5</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> + <object class="IBNSLayoutSymbolicConstant" key="constant"> + <double key="value">20</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="103531975"/> + <int key="scoringType">0</int> + <float key="scoringTypeFloat">29</float> + <int key="contentType">3</int> + <bool key="placeholder">NO</bool> + </object> + <object class="IBNSLayoutConstraint" id="852545348"> + <reference key="firstItem" ref="521024449"/> + <int key="firstAttribute">5</int> + <int key="relation">0</int> + <reference key="secondItem" ref="539123669"/> + <int key="secondAttribute">5</int> + <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBLayoutConstant" key="constant"> - <double key="value">10</double> + <double key="value">0.0</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="103531975"/> + <int key="scoringType">6</int> + <float key="scoringTypeFloat">24</float> + <int key="contentType">2</int> + <bool key="placeholder">NO</bool> + </object> + <object class="IBNSLayoutConstraint" id="750010708"> + <reference key="firstItem" ref="521024449"/> + <int key="firstAttribute">3</int> + <int key="relation">0</int> + <reference key="secondItem" ref="118735803"/> + <int key="secondAttribute">4</int> + <float key="multiplier">1</float> + <string key="multiplierString">1</string> + <object class="IBNSLayoutSymbolicConstant" key="constant"> + <double key="value">6</double> </object> <float key="priority">1000</float> <reference key="containingView" ref="103531975"/> - <int key="scoringType">3</int> - <float key="scoringTypeFloat">9</float> + <int key="scoringType">6</int> + <float key="scoringTypeFloat">24</float> <int key="contentType">3</int> <bool key="placeholder">NO</bool> </object> - <object class="IBNSLayoutConstraint" id="559306534"> - <reference key="firstItem" ref="539123669"/> + <object class="IBNSLayoutConstraint" id="295298081"> + <reference key="firstItem" ref="521024449"/> <int key="firstAttribute">5</int> <int key="relation">0</int> - <reference key="secondItem" ref="103531975"/> + <reference key="secondItem" ref="118735803"/> <int key="secondAttribute">5</int> <float key="multiplier">1</float> + <string key="multiplierString">1</string> + <object class="IBLayoutConstant" key="constant"> + <double key="value">0.0</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="103531975"/> + <int key="scoringType">6</int> + <float key="scoringTypeFloat">24</float> + <int key="contentType">2</int> + <bool key="placeholder">NO</bool> + </object> + <object class="IBNSLayoutConstraint" id="956205451"> + <reference key="firstItem" ref="118735803"/> + <int key="firstAttribute">3</int> + <int key="relation">0</int> + <reference key="secondItem" ref="103531975"/> + <int key="secondAttribute">3</int> + <float key="multiplier">1</float> + <string key="multiplierString">1</string> <object class="IBNSLayoutSymbolicConstant" key="constant"> <double key="value">20</double> </object> <float key="priority">1000</float> <reference key="containingView" ref="103531975"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> + <int key="scoringType">8</int> + <float key="scoringTypeFloat">23</float> <int key="contentType">3</int> <bool key="placeholder">NO</bool> </object> <reference ref="539123669"/> <reference ref="762565485"/> <reference ref="764495169"/> + <reference ref="118735803"/> + <reference ref="521024449"/> </array> <reference key="parent" ref="0"/> </object> @@ -663,11 +882,6 @@ <reference key="parent" ref="103531975"/> </object> <object class="IBObjectRecord"> - <int key="objectID">31</int> - <reference key="object" ref="338893657"/> - <reference key="parent" ref="103531975"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">32</int> <reference key="object" ref="762565485"/> <array class="NSMutableArray" key="children"> @@ -744,6 +958,67 @@ <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> + <object class="IBObjectRecord"> + <int key="objectID">126</int> + <reference key="object" ref="727314944"/> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">127</int> + <reference key="object" ref="118735803"/> + <array class="NSMutableArray" key="children"> + <reference ref="63691474"/> + </array> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">128</int> + <reference key="object" ref="63691474"/> + <reference key="parent" ref="118735803"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">130</int> + <reference key="object" ref="956205451"/> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">131</int> + <reference key="object" ref="521024449"/> + <array class="NSMutableArray" key="children"> + <reference ref="550678479"/> + </array> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">132</int> + <reference key="object" ref="550678479"/> + <reference key="parent" ref="521024449"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="295298081"/> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">135</int> + <reference key="object" ref="750010708"/> + <reference key="parent" ref="103531975"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">153</int> + <reference key="object" ref="852545348"/> + <reference key="parent" ref="103531975"/> + </object> </array> </object> <dictionary class="NSMutableDictionary" key="flattenedProperties"> @@ -758,23 +1033,39 @@ <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> + <string key="126.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="NO" key="127.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> + <string key="127.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="128.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <array key="13.IBNSViewMetadataConstraints"> + <reference ref="956205451"/> + <reference ref="295298081"/> + <reference ref="750010708"/> + <reference ref="852545348"/> <reference ref="559306534"/> - <reference ref="338893657"/> <reference ref="783720041"/> <reference ref="921593038"/> <reference ref="206376115"/> <reference ref="116293249"/> <reference ref="728277728"/> + <reference ref="727314944"/> </array> <string key="13.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="130.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <boolean value="NO" key="131.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> + <string key="131.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="132.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="134.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="135.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="14.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="NO" key="15.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> <string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="153.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="30.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="31.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="NO" key="32.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> <string key="32.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="33.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -794,7 +1085,7 @@ <nil key="activeLocalization"/> <dictionary class="NSMutableDictionary" key="localizations"/> <nil key="sourceID"/> - <int key="maxID">121</int> + <int key="maxID">153</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -813,12 +1104,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 +1155,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..039a30f 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"]; @@ -56,7 +56,12 @@ [self setTargetAnchorNames: [[NSMutableArray alloc] initWithArray:[@"north south west east" componentsSeparatedByString:@" "]]]; - [[self window] setLevel:NSNormalWindowLevel]; + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"net.sourceforge.tikzit.inspectorsontop"] == YES) { + [[self window] setLevel:NSFloatingWindowLevel]; + } else { + [[self window] setLevel:NSNormalWindowLevel]; + } + [self showWindow:self]; return self; } 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..05f0684 100644 --- a/tikzit/src/osx/StylePaletteController.h +++ b/tikzit/src/osx/StylePaletteController.h @@ -43,11 +43,11 @@ NSString *displayedEdgeStyleCategory; } -@property (readonly) NSMutableArray *nodeStyles; -@property (readonly) NSMutableArray *edgeStyles; +@property (strong) NSMutableArray *nodeStyles; +@property (strong) NSMutableArray *edgeStyles; @property (readonly) BOOL documentActive; -@property (assign) NodeStyle *activeNodeStyle; -@property (assign) EdgeStyle *activeEdgeStyle; +@property (strong) NodeStyle *activeNodeStyle; +@property (strong) EdgeStyle *activeEdgeStyle; @property (copy) NSString *displayedNodeStyleCategory; @property (copy) NSString *displayedEdgeStyleCategory; @property (readonly) NSPredicate *displayedNodeStylePredicate; diff --git a/tikzit/src/osx/StylePaletteController.m b/tikzit/src/osx/StylePaletteController.m index 8f87bd9..4fe46be 100644 --- a/tikzit/src/osx/StylePaletteController.m +++ b/tikzit/src/osx/StylePaletteController.m @@ -50,7 +50,12 @@ if (nodeStyles == nil) nodeStyles = [NSMutableArray array]; if (edgeStyles == nil) edgeStyles = [NSMutableArray array]; - [[self window] setLevel:NSNormalWindowLevel]; + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"net.sourceforge.tikzit.inspectorsontop"] == YES) { + [[self window] setLevel:NSFloatingWindowLevel]; + } else { + [[self window] setLevel:NSNormalWindowLevel]; + } + [self showWindow:self]; } 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..cb0865d 100644 --- a/tikzit/src/osx/TikzFormatter.m +++ b/tikzit/src/osx/TikzFormatter.m @@ -50,6 +50,10 @@ NSRange addedRange; NSString *addedString; + if(![[NSUserDefaults standardUserDefaults] boolForKey:@"net.sourceforge.tikzit.autocomplete"]){ + return YES; + } + addedRange = NSMakeRange(origSelRange.location, proposedSelRangePtr->location - origSelRange.location); addedString = [*partialStringPtr substringWithRange: addedRange]; @@ -76,10 +80,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 |