From b86e805f9b7325e4e4ce144069722f56a0a811b7 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Fri, 12 Nov 2010 01:38:11 +0000 Subject: - Tweak master view loading on table change, avoiding clearing active views unnecessarily. This improves speed slightly by reducing interface interaction, and preserves state better during actions, fixing bugs like Issue #574. --- Source/SPDatabaseViewController.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index cb5b5bb2..0ea8216e 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -434,15 +434,11 @@ // Restore view states as appropriate [spHistoryControllerInstance restoreViewStates]; - // Reset all loaded views + // Mark that all loaded views require their data reloading structureLoaded = NO; contentLoaded = NO; statusLoaded = NO; triggersLoaded = NO; - [tableSourceInstance loadTable:nil]; - [tableContentInstance loadTable:nil]; - [[extendedTableInfoInstance onMainThread] loadTable:nil]; - [[tableTriggersInstance onMainThread] loadTriggers]; // Load the currently selected view if looking at a table or view if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable)) @@ -469,6 +465,14 @@ } } + // Clear any views which haven't been loaded as they weren't visible. Note + // that this should be done after reloading visible views, instead of clearing all + // views, to reduce UI operations and avoid resetting state unnecessarily. + if (!structureLoaded) [tableSourceInstance loadTable:nil]; + if (!contentLoaded) [tableContentInstance loadTable:nil]; + if (!statusLoaded) [[extendedTableInfoInstance onMainThread] loadTable:nil]; + if (!triggersLoaded) [[tableTriggersInstance onMainThread] loadTriggers]; + // Update the "Show Create Syntax" window if it's already opened // according to the selected table/view/proc/func if([[[self onMainThread] getCreateTableSyntaxWindow] isVisible]) -- cgit v1.2.3