aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseViewController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-04-22 17:44:57 +0000
committerstuconnolly <stuart02@gmail.com>2011-04-22 17:44:57 +0000
commit4611475c5b255eed9202474dd3bdee147e932946 (patch)
tree39bdc50e046f802265950c6e2607ca9ebda453be /Source/SPDatabaseViewController.m
parent3ed8b33deeadcc98185911f41bc6bcb4e53b4719 (diff)
downloadsequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.gz
sequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.bz2
sequelpro-4611475c5b255eed9202474dd3bdee147e932946.zip
Bring outline view branch up to date with trunk (r3234:3277).
Diffstat (limited to 'Source/SPDatabaseViewController.m')
-rw-r--r--Source/SPDatabaseViewController.m53
1 files changed, 48 insertions, 5 deletions
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index 3b6cfc1f..171ff8f6 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -32,6 +32,9 @@
#import "SPTableData.h"
#import "SPTablesList.h"
#import "SPTableTriggers.h"
+#ifdef SP_REFACTOR /* headers */
+#import "SPTableStructure.h"
+#endif
@interface SPDatabaseDocument (SPDatabaseViewControllerPrivateAPI)
@@ -46,6 +49,7 @@
#pragma mark -
#pragma mark Getters
+#ifndef SP_REFACTOR /* getters */
/**
* Returns the master database view, containing the tables list and views for
* table setup and contents.
@@ -54,6 +58,7 @@
{
return parentView;
}
+#endif
/**
* Returns the name of the currently selected table/view/procedure/function.
@@ -95,6 +100,7 @@
return statusLoaded;
}
+#ifndef SP_REFACTOR /* toolbar ibactions */
#pragma mark -
#pragma mark Tab view control and delegate methods
@@ -204,6 +210,7 @@
[prefs setInteger:SPTriggersViewMode forKey:SPLastViewMode];
}
+#endif
/**
* Mark the structure tab for refresh when it's next switched to,
@@ -224,7 +231,11 @@
*/
- (void)setContentRequiresReload:(BOOL)reload
{
- if (reload && selectedTableName && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewContent) {
+ if (reload && selectedTableName
+#ifndef SP_REFACTOR /* check which tab is selected */
+ && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewContent
+#endif
+ ) {
[tableContentInstance loadTable:selectedTableName];
} else {
contentLoaded = !reload;
@@ -237,14 +248,18 @@
*/
- (void)setStatusRequiresReload:(BOOL)reload
{
- if (reload && selectedTableName && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewStatus) {
+ if (reload && selectedTableName
+#ifndef SP_REFACTOR /* check which tab is selected */
+ && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewStatus
+#endif
+ ) {
[[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
} else {
statusLoaded = !reload;
}
}
-
+#ifndef SP_REFACTOR /* !!! respond to tab change */
/**
* Triggers a task to update the newly selected tab view, ensuring
* the data is fully loaded and up-to-date.
@@ -258,6 +273,7 @@
[self _loadTabTask:tabViewItem];
}
}
+#endif
#pragma mark -
#pragma mark Table control
@@ -286,21 +302,29 @@
[[tablesListInstance onMainThread] setSelectionState:nil];
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
+#ifndef SP_REFACTOR /* [extendedTableInfoInstance loadTable:] */
[[extendedTableInfoInstance onMainThread] loadTable:nil];
[[tableTriggersInstance onMainThread] resetInterface];
+#endif
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
triggersLoaded = NO;
+#ifndef SP_REFACTOR
// Update the window title
[self updateWindowTitle:self];
// Add a history entry
[spHistoryControllerInstance updateHistoryEntries];
+#endif
// Notify listeners of the table change
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#endif
return;
}
@@ -370,6 +394,7 @@
contentLoaded = YES;
}
break;
+#ifndef SP_REFACTOR /* case SPTableViewStatus: case SPTableViewTriggers: */
case SPTableViewStatus:
if (!statusLoaded) {
[[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
@@ -382,6 +407,7 @@
triggersLoaded = YES;
}
break;
+#endif
}
[self endTask];
@@ -397,8 +423,10 @@
NSAutoreleasePool *loadPool = [[NSAutoreleasePool alloc] init];
NSString *tableEncoding = nil;
+#ifndef SP_REFACTOR /* Update the window title */
// Update the window title
[self updateWindowTitle:self];
+#endif
// Reset table information caches and mark that all loaded views require their data reloading
[tableDataInstance resetAllData];
@@ -439,24 +467,35 @@
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
// Notify listeners of the table change now that the state is fully set up.
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#ifndef SP_REFACTOR
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#endif
+#ifndef SP_REFACTOR /* [spHistoryControllerInstance restoreViewStates] */
// Restore view states as appropriate
[spHistoryControllerInstance restoreViewStates];
+#endif
// Load the currently selected view if looking at a table or view
if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable))
{
+#ifndef SP_REFACTOR /* load everything */
NSInteger selectedTabViewIndex = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
switch (selectedTabViewIndex) {
case SPTableViewStructure:
+#endif
[tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
+#ifndef SP_REFACTOR /* load everything */
break;
case SPTableViewContent:
+#endif
[tableContentInstance loadTable:selectedTableName];
contentLoaded = YES;
+#ifndef SP_REFACTOR /* load everything */
break;
case SPTableViewStatus:
[[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
@@ -467,6 +506,7 @@
triggersLoaded = YES;
break;
}
+#endif
}
// Clear any views which haven't been loaded as they weren't visible. Note
@@ -477,6 +517,7 @@
if (!statusLoaded) [[extendedTableInfoInstance onMainThread] loadTable:nil];
if (!triggersLoaded) [[tableTriggersInstance onMainThread] resetInterface];
+#ifndef SP_REFACTOR /* show Create Table syntax */
// Update the "Show Create Syntax" window if it's already opened
// according to the selected table/view/proc/func
if([[[self onMainThread] getCreateTableSyntaxWindow] isVisible])
@@ -484,10 +525,11 @@
// Add a history entry
[spHistoryControllerInstance updateHistoryEntries];
-
+#endif
// Empty the loading pool and exit the thread
[self endTask];
+#ifndef SP_REFACTOR /* triggered commands */
NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged];
for(NSString* cmdPath in triggeredCommands) {
NSArray *data = [cmdPath componentsSeparatedByString:@"|"];
@@ -524,6 +566,7 @@
}
}
}
+#endif
[loadPool drain];