diff options
-rw-r--r-- | Interfaces/English.lproj/BundleEditor.xib | 85 | ||||
-rw-r--r-- | Source/SPBundleCommandTextView.m | 21 | ||||
-rw-r--r-- | Source/SPBundleEditorController.h | 7 | ||||
-rw-r--r-- | Source/SPBundleEditorController.m | 55 | ||||
-rw-r--r-- | Source/SPConstants.h | 5 | ||||
-rw-r--r-- | Source/SPConstants.m | 5 |
6 files changed, 91 insertions, 87 deletions
diff --git a/Interfaces/English.lproj/BundleEditor.xib b/Interfaces/English.lproj/BundleEditor.xib index fa9d9776..03cec12d 100644 --- a/Interfaces/English.lproj/BundleEditor.xib +++ b/Interfaces/English.lproj/BundleEditor.xib @@ -23,7 +23,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="686"/> + <integer value="683"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -409,7 +409,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSPopUpButton" id="284549777"> <reference key="NSNextResponder" ref="338542681"/> - <int key="NSvFlags">268</int> + <int key="NSvFlags">288</int> <string key="NSFrame">{{17, 16}, {167, 22}}</string> <reference key="NSSuperview" ref="338542681"/> <bool key="NSEnabled">YES</bool> @@ -424,59 +424,16 @@ <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">400</int> <int key="NSPeriodicInterval">75</int> - <object class="NSMenuItem" key="NSMenuItem" id="629679521"> - <reference key="NSMenu" ref="132896527"/> - <string key="NSTitle">None</string> - <string key="NSKeyEquiv"/> - <int key="NSMnemonicLoc">2147483647</int> - <int key="NSState">1</int> - <reference key="NSOnImage" ref="545549031"/> - <reference key="NSMixedImage" ref="20147930"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="1019011390"/> - </object> + <nil key="NSMenuItem"/> <bool key="NSMenuItemRespectAlignment">YES</bool> <object class="NSMenu" key="NSMenu" id="132896527"> <string key="NSTitle">OtherViews</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="629679521"/> - <object class="NSMenuItem" id="316871289"> - <reference key="NSMenu" ref="132896527"/> - <string key="NSTitle">Database Changed</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="545549031"/> - <reference key="NSMixedImage" ref="20147930"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="1019011390"/> - </object> - <object class="NSMenuItem" id="993040095"> - <reference key="NSMenu" ref="132896527"/> - <string key="NSTitle">Table Changed</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="545549031"/> - <reference key="NSMixedImage" ref="20147930"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="1019011390"/> - </object> - <object class="NSMenuItem" id="51851443"> - <reference key="NSMenu" ref="132896527"/> - <string key="NSTitle">Table Row Changed</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="545549031"/> - <reference key="NSMixedImage" ref="20147930"/> - <string key="NSAction">_popUpItemAction:</string> - <reference key="NSTarget" ref="1019011390"/> - </object> </object> <reference key="NSMenuFont" ref="604392898"/> </object> + <int key="NSSelectedIndex">-1</int> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> <bool key="NSAltersState">YES</bool> @@ -3039,29 +2996,10 @@ <reference key="object" ref="132896527"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="316871289"/> - <reference ref="993040095"/> - <reference ref="51851443"/> - <reference ref="629679521"/> </object> <reference key="parent" ref="1019011390"/> </object> <object class="IBObjectRecord"> - <int key="objectID">1080</int> - <reference key="object" ref="316871289"/> - <reference key="parent" ref="132896527"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1081</int> - <reference key="object" ref="993040095"/> - <reference key="parent" ref="132896527"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">1082</int> - <reference key="object" ref="51851443"/> - <reference key="parent" ref="132896527"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">1083</int> <reference key="object" ref="413102423"/> <object class="NSMutableArray" key="children"> @@ -3075,11 +3013,6 @@ <reference key="object" ref="75217064"/> <reference key="parent" ref="413102423"/> </object> - <object class="IBObjectRecord"> - <int key="objectID">1085</int> - <reference key="object" ref="629679521"/> - <reference key="parent" ref="132896527"/> - </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -3111,13 +3044,9 @@ <string>1078.IBPluginDependency</string> <string>1079.IBEditorWindowLastContentRect</string> <string>1079.IBPluginDependency</string> - <string>1080.IBPluginDependency</string> - <string>1081.IBPluginDependency</string> - <string>1082.IBPluginDependency</string> <string>1083.IBAttributePlaceholdersKey</string> <string>1083.IBPluginDependency</string> <string>1084.IBPluginDependency</string> - <string>1085.IBPluginDependency</string> <string>521.IBEditorWindowLastContentRect</string> <string>521.IBPluginDependency</string> <string>521.IBWindowTemplateEditedContentRect</string> @@ -3266,10 +3195,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{360, 55}, {167, 71}}</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{321, 332}, {167, 4}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableDictionary"> <string key="NS.key.0">ToolTip</string> @@ -3281,7 +3207,6 @@ </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{172, 298}, {691, 444}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{172, 298}, {691, 444}}</string> 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"; |