summaryrefslogtreecommitdiff
path: root/tikzit/src/osx/PreambleController.m
diff options
context:
space:
mode:
authorJohan Paulsson <gonz@Akita.local>2013-12-02 11:28:52 -0800
committerJohan Paulsson <gonz@Akita.local>2013-12-02 11:28:52 -0800
commit000084adfd36c87051fb7df912a00fca35365f4e (patch)
tree236cbe625532de1551d6c465f92eebf8142263ae /tikzit/src/osx/PreambleController.m
parent7e7e0607d0ab5a5c28ae593adc4a3235ee4b429e (diff)
osx gui: Moved preamble window to preferences.
Moved the preamble window to the preference panel as a new tab. The PreambleController is now a subclass of NSView with related changes to the Preamble.xib. The toolbar that controlled default or custom preamble has been replaced with buttons in the interface.
Diffstat (limited to 'tikzit/src/osx/PreambleController.m')
-rw-r--r--tikzit/src/osx/PreambleController.m30
1 files changed, 12 insertions, 18 deletions
diff --git a/tikzit/src/osx/PreambleController.m b/tikzit/src/osx/PreambleController.m
index af9a778..3e55eaf 100644
--- a/tikzit/src/osx/PreambleController.m
+++ b/tikzit/src/osx/PreambleController.m
@@ -28,8 +28,8 @@
@synthesize preambleText, preambles;
-- (id)initWithWindowNibName:(NSString *)windowNibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg {
- [super initWithWindowNibName:windowNibName];
+- (id)initWithNibName:(NSString *)nibName plist:(NSString*)plist styles:(NSArray*)sty edges:(NSArray*)edg {
+ [super initWithNibName:nibName bundle:Nil];
preambles = (Preambles*)[NSKeyedUnarchiver unarchiveObjectWithFile:plist];
[preambles setStyles:sty];
@@ -83,17 +83,6 @@
attributes:textAttrs]];
}
-- (void)showWindow:(id)sender {
- [super showWindow:sender];
- if ([self useDefaultPreamble]) {
- [toolbar setSelectedItemIdentifier:[defaultToolbarItem itemIdentifier]];
- } else {
- [toolbar setSelectedItemIdentifier:[customToolbarItem itemIdentifier]];
- }
-
- [self setPreamble:self];
-}
-
- (void)savePreambles:(NSString*)plist {
[self flushText];
[NSKeyedArchiver archiveRootObject:preambles toFile:plist];
@@ -125,11 +114,16 @@
return selectionIndexes;
}
+- (IBAction)setPreambleToDefault:(id)sender{
+ [self setCurrentPreamble:@"default"];
+ [textView setBackgroundColor:ghostColor];
+}
+
- (IBAction)setPreamble:(id)sender {
- if ([[toolbar selectedItemIdentifier] isEqualToString:[defaultToolbarItem itemIdentifier]]) {
- [self setCurrentPreamble:@"default"];
- [textView setBackgroundColor:ghostColor];
- } else if ([[toolbar selectedItemIdentifier] isEqualToString:[customToolbarItem itemIdentifier]]) {
+ //if ([[toolbar selectedItemIdentifier] isEqualToString:[defaultToolbarItem itemIdentifier]]) {
+ // [self setCurrentPreamble:@"default"];
+ // [textView setBackgroundColor:ghostColor];
+ //} else if ([[toolbar selectedItemIdentifier] isEqualToString:[customToolbarItem itemIdentifier]]) {
NSString *key = nil;
if ([selectionIndexes count]==1) {
int i = [selectionIndexes firstIndex];
@@ -143,7 +137,7 @@
//NSLog(@"preamble set to custom");
}
[textView setBackgroundColor:[NSColor whiteColor]];
- }
+ //}
}
- (IBAction)insertDefaultStyles:(id)sender {