From 7e7e0607d0ab5a5c28ae593adc4a3235ee4b429e Mon Sep 17 00:00:00 2001 From: Johan Paulsson Date: Sun, 1 Dec 2013 23:25:55 -0800 Subject: osx gui: Added preference tab for Sparkle updater. --- tikzit/src/osx/PreferenceController.h | 4 + tikzit/src/osx/PreferenceController.m | 28 ++---- tikzit/src/osx/Preferences.xib | 135 ++++++++++++++++++++++++---- tikzit/src/osx/UpdatePreferenceController.h | 34 +++++++ tikzit/src/osx/UpdatePreferenceController.m | 49 ++++++++++ tikzit/src/osx/UpdatePreferencePanel.xib | 95 ++++++++++++++++++++ 6 files changed, 308 insertions(+), 37 deletions(-) create mode 100644 tikzit/src/osx/UpdatePreferenceController.h create mode 100644 tikzit/src/osx/UpdatePreferenceController.m create mode 100644 tikzit/src/osx/UpdatePreferencePanel.xib (limited to 'tikzit/src/osx') diff --git a/tikzit/src/osx/PreferenceController.h b/tikzit/src/osx/PreferenceController.h index bc6ed67..04fd324 100644 --- a/tikzit/src/osx/PreferenceController.h +++ b/tikzit/src/osx/PreferenceController.h @@ -23,11 +23,15 @@ // #import +#import "UpdatePreferenceController.h" @interface PreferenceController : NSWindowController{ IBOutlet NSView *engineView; IBOutlet NSView *generalView; + IBOutlet NSView *updateView; + + UpdatePreferenceController *updateController; int currentViewTag; } diff --git a/tikzit/src/osx/PreferenceController.m b/tikzit/src/osx/PreferenceController.m index 75d7ef7..6ccedd0 100644 --- a/tikzit/src/osx/PreferenceController.m +++ b/tikzit/src/osx/PreferenceController.m @@ -30,25 +30,7 @@ @implementation PreferenceController -- (id)initWithWindow:(NSWindow *)window -{ - self = [super initWithWindow:window]; - if (self) { - // Initialization code here. - } - - return self; -} - -- (void)windowDidLoad -{ - [super windowDidLoad]; - - // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. -} - - (NSRect)newFrameForNewContentView:(NSView*)view { - NSWindow *window = [self window]; NSRect newFrameRect = [window frameRectForContentRect:[view frame]]; NSRect oldFrameRect = [window frame]; @@ -73,6 +55,9 @@ case 1: view = engineView; break; + case 2: + view = updateView; + break; } return view; @@ -90,6 +75,11 @@ [[self window] setContentSize:[generalView frame].size]; [[[self window] contentView] addSubview:generalView]; [[[self window] contentView] setWantsLayer:YES]; + + updateController = [[UpdatePreferenceController alloc] initWithNibName:@"UpdatePreferencePanel" bundle:nil]; + [[updateController view] setFrame:[updateView frame]]; + [[[self window] contentView] replaceSubview:updateView with:[updateController view]]; + updateView = [updateController view]; } - (IBAction)switchView:(id)sender { @@ -110,7 +100,7 @@ [[[self window] animator] setFrame:newFrame display:YES]; [NSAnimationContext endGrouping]; - + } @end diff --git a/tikzit/src/osx/Preferences.xib b/tikzit/src/osx/Preferences.xib index 1b2d0c3..3cf1677 100644 --- a/tikzit/src/osx/Preferences.xib +++ b/tikzit/src/osx/Preferences.xib @@ -1,14 +1,14 @@ - 1080 - 12C60 - 2840 - 1187.34 - 625.00 + 1070 + 13A603 + 4514 + 1265 + 695.00 com.apple.InterfaceBuilder.CocoaPlugin - 2840 + 4514 IBNSLayoutConstraint @@ -60,6 +60,28 @@ 1 1 + + + 197F9408-AFB0-404B-B2B6-4DB1250B0A80 + + Update + Update + + + + NSImage + NSUserAccounts + + + + {0, 0} + {0, 0} + YES + YES + 2 + YES + 0 + A3DDD070-5637-444B-92C6-905084CAC389 @@ -102,26 +124,27 @@ 0 - + + - + + - 256 {480, 270} - {{0, 0}, {1680, 1050}} + {{0, 0}, {1680, 1028}} {10000000000000, 10000000000000} YES @@ -132,7 +155,7 @@ 268 - {{18, 15}, {215, 18}} + {{18, 15}, {214, 18}} @@ -143,7 +166,7 @@ 268435456 Bring preview window to focus - LucidaGrande + .LucidaGrandeUI 13 1044 @@ -202,11 +225,12 @@ NO + 1 268 - {{17, 69}, {142, 17}} + {{18, 69}, {140, 17}} @@ -236,6 +260,7 @@ NO + 1 {480, 96} @@ -269,6 +294,7 @@ NO + 1 {480, 96} @@ -278,6 +304,17 @@ _NS:9 NSView + + + 12 + + {480, 115} + + + + _NS:9 + NSView + YES @@ -324,6 +361,22 @@ 27 + + + switchView: + + + + 116 + + + + updateView + + + + 117 + delegate @@ -411,6 +464,7 @@ + @@ -443,6 +497,7 @@ 6 24 3 + NO @@ -456,9 +511,10 @@ 1000 - 8 + 0 29 3 + NO @@ -472,9 +528,10 @@ 1000 - 8 + 0 29 3 + NO @@ -491,6 +548,7 @@ 6 24 3 + NO @@ -504,9 +562,10 @@ 1000 - 8 + 0 29 3 + NO @@ -523,6 +582,7 @@ 3 9 3 + NO @@ -536,9 +596,10 @@ 1000 - 8 + 0 29 3 + NO @@ -565,6 +626,7 @@ 5 22 2 + NO @@ -581,6 +643,7 @@ 5 22 2 + NO @@ -688,6 +751,17 @@ + + 64 + + + + + + 115 + + + @@ -698,6 +772,7 @@ {{357, 418}, {480, 270}} com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -738,15 +813,24 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin - 62 + 117 + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + PreferenceController NSWindowController @@ -764,6 +848,7 @@ NSView NSView + NSView @@ -774,6 +859,10 @@ generalView NSView + + updateView + NSView + IBProjectSource @@ -784,11 +873,21 @@ 0 IBCocoaFramework + YES + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + YES 3 {32, 32} {15, 15} + {32, 32} YES diff --git a/tikzit/src/osx/UpdatePreferenceController.h b/tikzit/src/osx/UpdatePreferenceController.h new file mode 100644 index 0000000..816322f --- /dev/null +++ b/tikzit/src/osx/UpdatePreferenceController.h @@ -0,0 +1,34 @@ +// +// UpdatePreferenceController.h +// TikZiT +// +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// +// +// This file is part of TikZiT. +// +// TikZiT is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TikZiT is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TikZiT. If not, see . +// + +#import +#import + +@interface UpdatePreferenceController : NSViewController{ + IBOutlet SUUpdater *sharedUpdater; + IBOutlet NSDate *lastUpdate; +} + +- (IBAction)checkForUpdates:(id)sender; + +@end diff --git a/tikzit/src/osx/UpdatePreferenceController.m b/tikzit/src/osx/UpdatePreferenceController.m new file mode 100644 index 0000000..2ff270f --- /dev/null +++ b/tikzit/src/osx/UpdatePreferenceController.m @@ -0,0 +1,49 @@ +// +// UpdatePreferenceController.h +// TikZiT +// +// Copyright (c) 2013 Aleks Kissinger. All rights reserved. +// +// +// This file is part of TikZiT. +// +// TikZiT is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TikZiT is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TikZiT. If not, see . +// + +#import "UpdatePreferenceController.h" + +@interface UpdatePreferenceController () + +@end + +@implementation UpdatePreferenceController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + sharedUpdater = [SUUpdater sharedUpdater]; + } + return self; +} + +- (IBAction)checkForUpdates:(id)sender{ + [sharedUpdater checkForUpdates:sender]; +} + +- (NSDate*)getLastUpdate{ + return [sharedUpdater lastUpdateCheckDate]; +} + +@end diff --git a/tikzit/src/osx/UpdatePreferencePanel.xib b/tikzit/src/osx/UpdatePreferencePanel.xib new file mode 100644 index 0000000..a9f57bd --- /dev/null +++ b/tikzit/src/osx/UpdatePreferencePanel.xib @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3