aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppleScriptSupport.m17
-rw-r--r--Source/SPBundleEditorController.h12
-rw-r--r--Source/SPBundleEditorController.m86
-rw-r--r--Source/SPBundleHTMLOutputController.h6
-rw-r--r--Source/SPTableTriggers.m1
5 files changed, 34 insertions, 88 deletions
diff --git a/Source/SPAppleScriptSupport.m b/Source/SPAppleScriptSupport.m
index 90ab240e..337a14dc 100644
--- a/Source/SPAppleScriptSupport.m
+++ b/Source/SPAppleScriptSupport.m
@@ -31,23 +31,6 @@
@implementation SPAppController (SPAppleScriptSupport)
-//////////////// Examples to catch AS core events - maybe for further stuff
-// - (void)handleQuitEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
-// {
-// [NSApp terminate:self];
-// }
-// - (void)handleOpenEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
-// {
-// NSLog(@"OPEN ");
-// }
-//
-// - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
-// {
-// NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager];
-// [aeManager setEventHandler:self andSelector:@selector(handleQuitEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
-// [aeManager setEventHandler:self andSelector:@selector(handleOpenEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenApplication];
-// }
-
/**
* Is needed to interact with AppleScript for set/get internal SP variables
*/
diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h
index 5ea1658f..96b85e26 100644
--- a/Source/SPBundleEditorController.h
+++ b/Source/SPBundleEditorController.h
@@ -42,9 +42,6 @@
IBOutlet NSTextField *fallbackLabelField;
IBOutlet NSTextField *withBlobLabelField;
IBOutlet NSTextField *commandLabelField;
- IBOutlet NSTextField *authorLabelField;
- IBOutlet NSTextField *contactLabelField;
- IBOutlet NSTextField *descriptionLabelField;
IBOutlet NSPopUpButton *inputPopupButton;
IBOutlet NSPopUpButton *inputFallbackPopupButton;
IBOutlet NSPopUpButton *outputPopupButton;
@@ -56,16 +53,16 @@
IBOutlet NSButton *saveButton;
IBOutlet NSButton *cancelButton;
IBOutlet NSButton *helpButton;
- IBOutlet NSButton *showHideMetaButton;
+ IBOutlet NSButton *displayMetaInfoButton;
IBOutlet NSMenuItem *duplicateMenuItem;
IBOutlet NSMenuItem *revealInFinderMenuItem;
IBOutlet SRRecorderControl *keyEquivalentField;
IBOutlet NSButton *disabledCheckbox;
IBOutlet NSScrollView *commandScrollView;
- IBOutlet NSScrollView *descriptionScrollView;
IBOutlet BWSplitView *splitView;
- IBOutlet id undeleteSheet;
+ IBOutlet NSWindow *undeleteSheet;
+ IBOutlet NSWindow *metaInfoSheet;
IBOutlet NSTableView *undeleteTableView;
IBOutlet NSTreeController *commandBundleTreeController;
@@ -128,10 +125,11 @@
- (IBAction)showHelp:(id)sender;
- (IBAction)saveAndCloseWindow:(id)sender;
- (IBAction)reloadBundles:(id)sender;
-- (IBAction)metaButtonChanged:(id)sender;
- (IBAction)performClose:(id)sender;
- (IBAction)undeleteDefaultBundles:(id)sender;
- (IBAction)closeUndeleteDefaultBundlesSheet:(id)sender;
+- (IBAction)displayBundleMetaInfo:(id)sender;
+- (IBAction)closeSheet:(id)sender;
- (BOOL)saveBundle:(NSDictionary*)bundle atPath:(NSString*)aPath;
- (BOOL)cancelRowEditing;
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 5d3555fa..ff88f246 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -40,13 +40,12 @@
#define SP_BUNDLEEDITOR_SPLITVIEW_AUTOSAVE_STRING @"SPBundleEditorSplitView"
-@interface SPBundleEditorController (PrivateAPI)
+@interface SPBundleEditorController ()
- (void)_updateBundleDataView;
- (id)_currentSelectedObject;
- (id)_currentSelectedNode;
- (void)_enableBundleDataInput:(BOOL)enabled;
-- (void)_enableMetaDataInput:(BOOL)enabled;
- (void)_initTree;
- (NSUInteger)_arrangedScopeIndexForScopeIndex:(NSUInteger)scopeIndex;
- (NSUInteger)_scopeIndexForArrangedScopeIndex:(NSUInteger)scopeIndex;
@@ -73,12 +72,10 @@
}
return self;
-
}
- (void)dealloc
{
-
[inputGeneralScopePopUpMenu release];
[inputInputFieldScopePopUpMenu release];
[inputDataTableScopePopUpMenu release];
@@ -106,13 +103,12 @@
[shellVariableSuggestions release];
[deletedDefaultBundles release];
- if(touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil;
- if(commandBundleTree) [commandBundleTree release], commandBundleTree = nil;
- if(sortDescriptor) [sortDescriptor release], sortDescriptor = nil;
- if(bundlePath) [bundlePath release], bundlePath = nil;
+ if (touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil;
+ if (commandBundleTree) [commandBundleTree release], commandBundleTree = nil;
+ if (sortDescriptor) [sortDescriptor release], sortDescriptor = nil;
+ if (bundlePath) [bundlePath release], bundlePath = nil;
[super dealloc];
-
}
- (void)awakeFromNib
@@ -799,14 +795,6 @@
}
/**
- * Show/Hide meta data input fields
- */
-- (IBAction)metaButtonChanged:(id)sender
-{
- [self _enableMetaDataInput:([sender state] == NSOnState) ? YES : NO];
-}
-
-/**
* Read all installed bundles and order front the Bundle Editor
*/
- (IBAction)showWindow:(id)sender
@@ -840,7 +828,21 @@
[sender orderOut:nil];
else if ([sender respondsToSelector:@selector(window)])
[[sender window] orderOut:nil];
+}
+- (IBAction)displayBundleMetaInfo:(id)sender
+{
+ [NSApp beginSheet:metaInfoSheet
+ modalForWindow:[self window]
+ modalDelegate:self
+ didEndSelector:nil
+ contextInfo:nil];
+}
+
+- (IBAction)closeSheet:(id)sender
+{
+ [NSApp endSheet:[sender window] returnCode:[sender tag]];
+ [[sender window] orderOut:self];
}
/**
@@ -848,7 +850,6 @@
*/
- (IBAction)saveAndCloseWindow:(id)sender
{
-
// Commit all pending edits
if([commandBundleTreeController commitEditing]) {
@@ -1282,7 +1283,6 @@
*/
- (void)outlineViewSelectionDidChange:(NSNotification *)aNotification
{
-
if([aNotification object] != commandsOutlineView) return;
// Remember selected bundle name to reset the name if the user cancelled
@@ -1302,6 +1302,7 @@
[touchedBundleArray addObject:oldBundleName];
[self _updateBundleDataView];
+
[commandTextView setSelectedRange:NSMakeRange(0,0)];
}
@@ -1477,7 +1478,6 @@
[commandBundleTreeController rearrangeObjects];
[commandsOutlineView reloadData];
}
-
}
#pragma mark -
@@ -1488,17 +1488,17 @@
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
-
SEL action = [menuItem action];
- if ( (action == @selector(duplicateCommandBundle:))
- || (action == @selector(revealCommandBundleInFinder:))
- || (action == @selector(saveBundle:))
- || (action == @selector(removeCommandBundle:))
- )
+ if ((action == @selector(duplicateCommandBundle:)) ||
+ (action == @selector(revealCommandBundleInFinder:)) ||
+ (action == @selector(saveBundle:)) ||
+ (action == @selector(removeCommandBundle:)) ||
+ (action == @selector(displayBundleMetaInfo:)))
{
// Allow to record short-cuts used by the Bundle Editor
if([[NSApp mainWindow] firstResponder] == keyEquivalentField) return NO;
+
return ([[commandBundleTreeController selectedObjects] count] == 1 && ![[[commandBundleTreeController selectedObjects] objectAtIndex:0] objectForKey:kChildrenKey]);
}
@@ -1507,7 +1507,6 @@
}
return YES;
-
}
#pragma mark -
@@ -1674,18 +1673,8 @@
doGroupDueToChars = YES;
}
-@end
-
-#pragma mark -
-
-@implementation SPBundleEditorController (PrivateAPI)
-
- (void)_initTree
{
-
- [showHideMetaButton setState:NSOffState];
- [self _enableMetaDataInput:NO];
-
// Re-init commandBundleTree
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:kInputFieldScopeArrayIndex] setObject:[NSMutableArray array] forKey:kChildrenKey];
[[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:kDataTableScopeArrayIndex] setObject:[NSMutableArray array] forKey:kChildrenKey];
@@ -1821,7 +1810,6 @@
*/
- (void)_updateBundleDataView
{
-
NSInteger anIndex;
if([commandsOutlineView selectedRow] < 0) return;
@@ -1989,7 +1977,6 @@
*/
- (NSUInteger)_arrangedScopeIndexForScopeIndex:(NSUInteger)scopeIndex
{
-
NSString *unsortedBundleName = [[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:scopeIndex] objectForKey:kBundleNameKey];
if(!unsortedBundleName || ![unsortedBundleName length]) return scopeIndex;
@@ -2004,7 +1991,6 @@
}
return k;
-
}
/**
@@ -2012,7 +1998,6 @@
*/
- (NSUInteger)_scopeIndexForArrangedScopeIndex:(NSUInteger)scopeIndex
{
-
NSString *bName = [[[[[[[commandBundleTreeController arrangedObjects] childNodes] objectAtIndex:0] childNodes] objectAtIndex:scopeIndex] representedObject] objectForKey:kBundleNameKey];
NSUInteger k = 0;
for(id i in [commandBundleTree objectForKey:kChildrenKey]) {
@@ -2042,24 +2027,7 @@
[authorTextField setEnabled:enabled];
[contactTextField setEnabled:enabled];
[descriptionTextView setEditable:enabled];
-}
-
-/**
- * Enable / disable meta input
- */
-- (void)_enableMetaDataInput:(BOOL)enabled
-{
- [commandTextView setHidden:enabled];
- [disabledCheckbox setHidden:enabled];
- [commandLabelField setHidden:enabled];
- [commandScrollView setHidden:enabled];
- [authorLabelField setHidden:!enabled];
- [contactLabelField setHidden:!enabled];
- [descriptionLabelField setHidden:!enabled];
- [descriptionTextView setHidden:!enabled];
- [authorTextField setHidden:!enabled];
- [contactTextField setHidden:!enabled];
- [descriptionScrollView setHidden:!enabled];
+ [displayMetaInfoButton setEnabled:enabled];
}
/**
diff --git a/Source/SPBundleHTMLOutputController.h b/Source/SPBundleHTMLOutputController.h
index de67799c..01460a85 100644
--- a/Source/SPBundleHTMLOutputController.h
+++ b/Source/SPBundleHTMLOutputController.h
@@ -22,11 +22,10 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
-@interface SPBundleHTMLOutputController : NSWindowController {
-
+@interface SPBundleHTMLOutputController : NSWindowController
+{
IBOutlet WebView *webView;
NSString *docTitle;
@@ -35,7 +34,6 @@
NSString *docUUID;
BOOL suppressExceptionAlerting;
WebPreferences *webPreferences;
-
}
@property(readwrite,retain) NSString *docTitle;
diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m
index 742579d8..de2c51cd 100644
--- a/Source/SPTableTriggers.m
+++ b/Source/SPTableTriggers.m
@@ -267,7 +267,6 @@ static const NSString *SPTriggerSQLMode = @"TriggerSQLMode";
*/
- (IBAction)addTrigger:(id)sender
{
-
// Check whether table editing is permitted (necessary as some actions - eg table double-click - bypass validation)
if ([tableDocumentInstance isWorking] || [tablesListInstance tableType] != SPTableTypeTable) return;