aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-29 14:53:37 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-29 14:53:37 +0000
commitcef5a0200f433e53bd27b2516e5ac269205f0420 (patch)
treeb8506962744b98ecf1930f0f850def8def2887a4 /Source
parentacc0d65e502eac87ab469db11a96cbc7a4b39593 (diff)
downloadsequelpro-cef5a0200f433e53bd27b2516e5ac269205f0420.tar.gz
sequelpro-cef5a0200f433e53bd27b2516e5ac269205f0420.tar.bz2
sequelpro-cef5a0200f433e53bd27b2516e5ac269205f0420.zip
• Bundle Editor
- fixed an init font setting problem (thanks to Rowan) - further work on triggers
Diffstat (limited to 'Source')
-rw-r--r--Source/SPBundleCommandTextView.m21
-rw-r--r--Source/SPBundleEditorController.h7
-rw-r--r--Source/SPBundleEditorController.m55
-rw-r--r--Source/SPConstants.h5
-rw-r--r--Source/SPConstants.m5
5 files changed, 86 insertions, 7 deletions
diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m
index b90cea43..d5a649bb 100644
--- a/Source/SPBundleCommandTextView.m
+++ b/Source/SPBundleCommandTextView.m
@@ -54,8 +54,8 @@
[prefs addObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth options:NSKeyValueObservingOptionNew context:NULL];
- if([[NSUserDefaults standardUserDefaults] dataForKey:@"BundleEditorFont"]) {
- NSFont *nf = [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] dataForKey:@"BundleEditorFont"]];
+ if([prefs dataForKey:@"BundleEditorFont"]) {
+ NSFont *nf = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"BundleEditorFont"]];
[self setFont:nf];
}
@@ -345,6 +345,15 @@
NSMutableArray *myArrayOfTabs;
NSMutableParagraphStyle *paragraphStyle;
+ if(tvFont == nil && [prefs dataForKey:@"BundleEditorFont"]) {
+ tvFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"BundleEditorFont"]];
+ }
+ if(tvFont == nil) {
+ tvFont = [NSFont fontWithName:SPDefaultMonospacedFontName size:12];
+ [self setFont:tvFont];
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:tvFont] forKey:@"BundleEditorFont"];
+ }
+
BOOL oldEditableStatus = [self isEditable];
[self setEditable:YES];
@@ -719,9 +728,11 @@
// Action receiver for a font change in the font panel
- (void)changeFont:(id)sender
{
- NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[self font]];
- [self setFont:nf];
- [self saveChangedFontInUserDefaults];
+ if (prefs && [self font] != nil) {
+ NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[self font]];
+ [self setFont:nf];
+ [self saveChangedFontInUserDefaults];
+ }
}
@end
diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h
index 6656e9be..5ccd8a9a 100644
--- a/Source/SPBundleEditorController.h
+++ b/Source/SPBundleEditorController.h
@@ -81,6 +81,9 @@
NSMenu *outputInputFieldScopePopUpMenu;
NSMenu *outputDataTableScopePopUpMenu;
NSMenu *inputFallbackInputFieldScopePopUpMenu;
+ NSMenu *triggerInputFieldPopUpMenu;
+ NSMenu *triggerDataTablePopUpMenu;
+ NSMenu *triggerGeneralPopUpMenu;
NSArray *inputGeneralScopeArray;
NSArray *inputInputFieldScopeArray;
@@ -89,6 +92,9 @@
NSArray *outputInputFieldScopeArray;
NSArray *outputDataTableScopeArray;
NSArray *inputFallbackInputFieldScopeArray;
+ NSArray *triggerInputFieldArray;
+ NSArray *triggerDataTableArray;
+ NSArray *triggerGeneralArray;
BOOL doGroupDueToChars;
BOOL allowUndo;
@@ -114,6 +120,7 @@
- (IBAction)metaButtonChanged:(id)sender;
- (BOOL)saveBundle:(NSDictionary*)bundle atPath:(NSString*)aPath;
+- (BOOL)cancelRowEditing;
- (void)setWasCutPaste;
- (void)setDoGroupDueToChars;
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 648ae836..4f415416 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -62,7 +62,6 @@
draggedFilePath = nil;
oldBundleName = nil;
isTableCellEditing = NO;
- bundlePath = [[[NSFileManager defaultManager] applicationSupportDirectoryForSubDirectory:SPBundleSupportFolder createIfNotExists:NO error:nil] retain];
}
return self;
@@ -79,6 +78,9 @@
[outputInputFieldScopePopUpMenu release];
[outputDataTableScopePopUpMenu release];
[inputFallbackInputFieldScopePopUpMenu release];
+ [triggerInputFieldPopUpMenu release];
+ [triggerDataTablePopUpMenu release];
+ [triggerGeneralPopUpMenu release];
[inputNonePopUpMenu release];
[inputGeneralScopeArray release];
@@ -88,6 +90,9 @@
[outputInputFieldScopeArray release];
[outputDataTableScopeArray release];
[inputFallbackInputFieldScopeArray release];
+ [triggerInputFieldArray release];
+ [triggerDataTableArray release];
+ [triggerGeneralArray release];
if(touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil;
if(commandBundleTree) [commandBundleTree release], commandBundleTree = nil;
@@ -104,6 +109,9 @@
// Init all needed variables; popup menus (with the chance for localization); and set
// defaults
+ bundlePath = [[[NSFileManager defaultManager] applicationSupportDirectoryForSubDirectory:SPBundleSupportFolder createIfNotExists:NO error:nil] retain];
+
+
touchedBundleArray = [[NSMutableArray alloc] initWithCapacity:1];
commandBundleTree = [[NSMutableDictionary alloc] initWithCapacity:1];
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:kBundleNameKey ascending:YES selector:@selector(localizedCompare:)];
@@ -123,6 +131,9 @@
outputInputFieldScopePopUpMenu = [[NSMenu alloc] initWithTitle:@""];
outputDataTableScopePopUpMenu = [[NSMenu alloc] initWithTitle:@""];
inputFallbackInputFieldScopePopUpMenu = [[NSMenu alloc] initWithTitle:@""];
+ triggerInputFieldPopUpMenu = [[NSMenu alloc] initWithTitle:@""];
+ triggerDataTablePopUpMenu = [[NSMenu alloc] initWithTitle:@""];
+ triggerGeneralPopUpMenu = [[NSMenu alloc] initWithTitle:@""];
inputGeneralScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, nil] retain];
inputInputFieldScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, SPBundleInputSourceSelectedText, SPBundleInputSourceEntireContent, nil] retain];
@@ -131,6 +142,9 @@
outputGeneralScopeArray = [[NSArray arrayWithObjects:SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML, nil] retain];
outputDataTableScopeArray = [[NSArray arrayWithObjects:SPBundleOutputActionNone, SPBundleOutputActionShowAsTextTooltip, SPBundleOutputActionShowAsHTMLTooltip, SPBundleOutputActionShowAsHTML, nil] retain];
inputFallbackInputFieldScopeArray = [[NSArray arrayWithObjects:SPBundleInputSourceNone, SPBundleInputSourceCurrentWord, SPBundleInputSourceCurrentLine, SPBundleInputSourceCurrentQuery, SPBundleInputSourceEntireContent, nil] retain];
+ triggerInputFieldArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, nil] retain];
+ triggerDataTableArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged, SPBundleTriggerActionTableRowChanged, nil] retain];
+ triggerGeneralArray = [[NSArray arrayWithObjects:SPBundleTriggerActionNone, SPBundleTriggerActionDatabaseChanged, SPBundleTriggerActionTableChanged, nil] retain];
NSMutableArray *allPopupScopeItems = [NSMutableArray array];
[allPopupScopeItems addObjectsFromArray:inputGeneralScopeArray];
@@ -140,6 +154,9 @@
[allPopupScopeItems addObjectsFromArray:outputGeneralScopeArray];
[allPopupScopeItems addObjectsFromArray:outputDataTableScopeArray];
[allPopupScopeItems addObjectsFromArray:inputFallbackInputFieldScopeArray];
+ [allPopupScopeItems addObjectsFromArray:triggerInputFieldArray];
+ [allPopupScopeItems addObjectsFromArray:triggerDataTableArray];
+ [allPopupScopeItems addObjectsFromArray:triggerGeneralArray];
NSDictionary *menuItemTitles = [NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:
@@ -181,6 +198,18 @@
NSLocalizedString(@"Current Line", @"current line item label"),
NSLocalizedString(@"Current Query", @"current query item label"),
NSLocalizedString(@"Entire Content", @"entire content item label"),
+
+ NSLocalizedString(@"None", @"none menu item label"),
+
+ NSLocalizedString(@"None", @"none menu item label"),
+ NSLocalizedString(@"Database changed", @"database changed item label"),
+ NSLocalizedString(@"Table changed", @"table changed item label"),
+ NSLocalizedString(@"Table Row changed", @"table row changed item label"),
+
+ NSLocalizedString(@"None", @"none menu item label"),
+ NSLocalizedString(@"Database changed", @"database changed item label"),
+ NSLocalizedString(@"Table changed", @"table changed item label"),
+
nil]
forKeys:allPopupScopeItems];
@@ -220,6 +249,21 @@
[inputFallbackInputFieldScopePopUpMenu addItem:anItem];
[anItem release];
}
+ for(NSString* title in triggerInputFieldArray) {
+ anItem = [[NSMenuItem alloc] initWithTitle:[menuItemTitles objectForKey:title] action:@selector(triggerButtonChanged:) keyEquivalent:@""];
+ [triggerInputFieldPopUpMenu addItem:anItem];
+ [anItem release];
+ }
+ for(NSString* title in triggerDataTableArray) {
+ anItem = [[NSMenuItem alloc] initWithTitle:[menuItemTitles objectForKey:title] action:@selector(triggerButtonChanged:) keyEquivalent:@""];
+ [triggerDataTablePopUpMenu addItem:anItem];
+ [anItem release];
+ }
+ for(NSString* title in triggerGeneralArray) {
+ anItem = [[NSMenuItem alloc] initWithTitle:[menuItemTitles objectForKey:title] action:@selector(triggerButtonChanged:) keyEquivalent:@""];
+ [triggerGeneralPopUpMenu addItem:anItem];
+ [anItem release];
+ }
anItem = [[NSMenuItem alloc] initWithTitle:[menuItemTitles objectForKey:SPBundleInputSourceNone] action:nil keyEquivalent:@""];
[inputNonePopUpMenu addItem:anItem];
[anItem release];
@@ -858,6 +902,13 @@
}
+- (BOOL)cancelRowEditing
+{
+ [commandsOutlineView abortEditing];
+ isTableCellEditing = NO;
+ return YES;
+}
+
#pragma mark -
#pragma mark NSWindow delegate
@@ -1367,7 +1418,6 @@
- (void)_initTree
{
- NSString *a=[[NSString stringWithString:@"bibiko@eva.mpg.de"] rot13];
[showHideMetaButton setState:NSOffState];
[self _enableMetaDataInput:NO];
@@ -1670,6 +1720,7 @@
[scopePopupButton setEnabled:enabled];
[commandTextView setEditable:enabled];
[outputPopupButton setEnabled:enabled];
+ [triggerPopupButton setEnabled:enabled];
[disabledCheckbox setEnabled:enabled];
[keyEquivalentField setEnabled:enabled];
[categoryTextField setEnabled:enabled];
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index c8a53b0a..fce149f0 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -455,6 +455,10 @@ extern NSString *SPBundleOutputActionReplaceContent;
extern NSString *SPBundleOutputActionShowAsTextTooltip;
extern NSString *SPBundleOutputActionShowAsHTMLTooltip;
extern NSString *SPBundleOutputActionShowAsHTML;
+extern NSString *SPBundleTriggerActionNone;
+extern NSString *SPBundleTriggerActionDatabaseChanged;
+extern NSString *SPBundleTriggerActionTableChanged;
+extern NSString *SPBundleTriggerActionTableRowChanged;
extern NSString *SPBundleFileCommandKey;
extern NSString *SPBundleFileScopeKey;
extern NSString *SPBundleFileNameKey;
@@ -470,6 +474,7 @@ extern NSString *SPBundleFileAuthorKey;
extern NSString *SPBundleFileContactKey;
extern NSString *SPBundleFileUUIDKey;
extern NSString *SPBundleFileDescriptionKey;
+extern NSString *SPBundleFileTriggerKey;
extern NSString *SPBundleInternLabelKey;
extern NSString *SPBundleInternPathToFileKey;
extern NSString *SPBundleInternKeyEquivalentKey;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 0c731abd..2ab44912 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -267,6 +267,10 @@ NSString *SPBundleOutputActionReplaceContent = @"replacecontent";
NSString *SPBundleOutputActionShowAsTextTooltip = @"showastexttooltip";
NSString *SPBundleOutputActionShowAsHTMLTooltip = @"showashtmltooltip";
NSString *SPBundleOutputActionShowAsHTML = @"showashtml";
+NSString *SPBundleTriggerActionNone = @"none";
+NSString *SPBundleTriggerActionDatabaseChanged = @"databasechanged";
+NSString *SPBundleTriggerActionTableChanged = @"tablechanged";
+NSString *SPBundleTriggerActionTableRowChanged = @"tablerowchanged";
NSString *SPBundleFileCommandKey = @"command";
NSString *SPBundleFileScopeKey = @"scope";
NSString *SPBundleFileNameKey = @"name";
@@ -282,6 +286,7 @@ NSString *SPBundleFileAuthorKey = @"author";
NSString *SPBundleFileContactKey = @"contact";
NSString *SPBundleFileUUIDKey = @"uuid";
NSString *SPBundleFileDescriptionKey = @"description";
+NSString *SPBundleFileTriggerKey = @"trigger";
NSString *SPBundleInternLabelKey = @"label";
NSString *SPBundleInternPathToFileKey = @"path";
NSString *SPBundleInternKeyEquivalentKey = @"keyEquivalent";