aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPConstants.h10
-rw-r--r--Source/SPDatabaseDocument.h1
-rw-r--r--Source/SPDatabaseDocument.m43
-rw-r--r--Source/SPDatabaseViewController.m28
-rw-r--r--Source/SPHistoryController.h1
-rw-r--r--Source/SPHistoryController.m42
-rw-r--r--Source/SPPrintController.m28
-rw-r--r--Source/SPTableContent.m36
-rw-r--r--Source/SPTableStructure.m4
-rw-r--r--Source/SPTablesList.m5
10 files changed, 109 insertions, 89 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 969d709f..34da4f65 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -108,16 +108,18 @@ typedef enum
SPTableTypeEvent = 4
} SPTableType;
-// History views
-typedef enum
+// Content views
+typedef NS_ENUM(NSInteger, SPTableViewType)
{
SPTableViewStructure = 0,
SPTableViewContent = 1,
SPTableViewCustomQuery = 2,
SPTableViewStatus = 3,
SPTableViewRelations = 4,
- SPTableViewTriggers = 5
-} SPTableViewType;
+ SPTableViewTriggers = 5,
+
+ SPTableViewInvalid = NSNotFound
+};
// SSH tunnel password modes
typedef enum
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 5430b39f..96c78d1a 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -463,6 +463,7 @@
- (NSArray *)allTableNames;
- (SPTablesList *)tablesListInstance;
- (SPCreateDatabaseInfo *)createDatabaseInfo;
+- (SPTableViewType) currentlySelectedView;
#ifndef SP_CODA /* method decls */
// Notification center methods
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 6091ed3b..2a10b900 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2691,14 +2691,12 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
{
[parentWindow endEditingFor:nil];
#ifndef SP_CODA
- switch ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]]) {
+ switch ([self currentlySelectedView]) {
- // Table structure view
- case 0:
+ case SPTableViewStructure:
return [tableSourceInstance saveRowOnDeselect];
- // Table content view
- case 1:
+ case SPTableViewContent:
return [tableContentInstance saveRowOnDeselect];
default:
@@ -2884,6 +2882,35 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
return [dbInfo autorelease];
}
+/**
+ * Retrieve the view that is currently selected from the database
+ *
+ * MUST BE CALLED ON THE UI THREAD!
+ */
+- (SPTableViewType)currentlySelectedView
+{
+ SPTableViewType theView = NSNotFound;
+
+ // -selectedTabViewItem is a UI method according to Xcode 9.2!
+ NSString *viewName = [[tableTabView selectedTabViewItem] identifier];
+
+ if ([viewName isEqualToString:@"source"]) {
+ theView = SPTableViewStructure;
+ } else if ([viewName isEqualToString:@"content"]) {
+ theView = SPTableViewContent;
+ } else if ([viewName isEqualToString:@"customQuery"]) {
+ theView = SPTableViewCustomQuery;
+ } else if ([viewName isEqualToString:@"status"]) {
+ theView = SPTableViewStatus;
+ } else if ([viewName isEqualToString:@"relations"]) {
+ theView = SPTableViewRelations;
+ } else if ([viewName isEqualToString:@"triggers"]) {
+ theView = SPTableViewTriggers;
+ }
+
+ return theView;
+}
+
#pragma mark -
#pragma mark Notification center methods
@@ -3736,7 +3763,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
// If Custom Query Tab is active the textView will handle printDocument by itself
// if it is first responder; otherwise allow to print the Query Result table even
// if no db/table is selected
- [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2);
+ [self currentlySelectedView] == SPTableViewCustomQuery);
}
#endif
@@ -4687,7 +4714,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
[sessionState setObject:[self table] forKey:@"table"];
NSString *currentlySelectedViewName;
- switch ([spHistoryControllerInstance currentlySelectedView]) {
+ switch ([self currentlySelectedView]) {
case SPTableViewStructure:
currentlySelectedViewName = @"SP_VIEW_STRUCTURE";
break;
@@ -5921,7 +5948,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
// Locate the sheet "Reset Auto Increment" just centered beneath the chosen index row
// if Structure Pane is active
- if([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
+ if([self currentlySelectedView] == SPTableViewStructure
&& [[sheet title] isEqualToString:@"Reset Auto Increment"]) {
id it = [tableSourceInstance valueForKeyPath:@"indexesTableView"];
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index 194ee3b4..8f0e8c38 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -50,7 +50,7 @@
@interface SPDatabaseDocument (SPDatabaseViewControllerPrivateAPI)
-- (void)_loadTabTask:(NSTabViewItem *)tabViewItem;
+- (void)_loadTabTask:(NSNumber *)tabViewItemIndexNumber;
- (void)_loadTableTask;
@end
@@ -120,7 +120,7 @@
- (IBAction)viewStructure:(id)sender
{
// Cancel the selection if currently editing a view and unable to save
- if (![self couldCommitCurrentViewActions]) {
+ if (![[self onMainThread] couldCommitCurrentViewActions]) {
[[mainToolbar onMainThread] setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]];
return;
}
@@ -226,7 +226,7 @@
BOOL reloadRequired = reload;
#ifndef SP_CODA
- if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewStructure) {
+ if ([self currentlySelectedView] == SPTableViewStructure) {
reloadRequired = NO;
}
#endif
@@ -247,7 +247,7 @@
{
if (reload && selectedTableName
#ifndef SP_CODA /* check which tab is selected */
- && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewContent
+ && [self currentlySelectedView] == SPTableViewContent
#endif
) {
[tableContentInstance loadTable:selectedTableName];
@@ -265,7 +265,7 @@
{
if (reload && selectedTableName
#ifndef SP_CODA /* check which tab is selected */
- && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewStatus
+ && [self currentlySelectedView] == SPTableViewStatus
#endif
) {
[[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
@@ -283,7 +283,7 @@
{
if (reload && selectedTableName
#ifndef SP_CODA /* check which tab is selected */
- && [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == SPTableViewRelations
+ && [self currentlySelectedView] == SPTableViewRelations
#endif
) {
[[tableRelationsInstance onMainThread] refreshRelations:self];
@@ -301,15 +301,19 @@
- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
{
[self startTaskWithDescription:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), [self table]]];
-
+
+ // We can't pass aTabView or tabViewItem UI objects to a bg thread, but since the change should already
+ // be done in *did*SelectTabViewItem we can just ask the tab view for the current selection index and use that
+ SPTableViewType newView = [self currentlySelectedView];
+
if ([NSThread isMainThread]) {
[NSThread detachNewThreadWithName:SPCtxt(@"SPDatabaseViewController view load task",self)
target:self
selector:@selector(_loadTabTask:)
- object:tabViewItem];
+ object:@(newView)];
}
else {
- [self _loadTabTask:tabViewItem];
+ [self _loadTabTask:@(newView)];
}
}
#endif
@@ -408,7 +412,7 @@
* In a threaded task, ensure that the supplied tab is loaded -
* usually as a result of switching to it.
*/
-- (void)_loadTabTask:(NSTabViewItem *)tabViewItem
+- (void)_loadTabTask:(NSNumber *)tabViewItemIndexNumber
{
NSAutoreleasePool *tabLoadPool = [[NSAutoreleasePool alloc] init];
@@ -421,7 +425,7 @@
}
// Get the tab view index and ensure the associated view is loaded
- NSInteger selectedTabViewIndex = [[tabViewItem tabView] indexOfTabViewItem:tabViewItem];
+ SPTableViewType selectedTabViewIndex = [tabViewItemIndexNumber integerValue];
switch (selectedTabViewIndex) {
case SPTableViewStructure:
@@ -531,7 +535,7 @@
if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable))
{
#ifndef SP_CODA /* load everything */
- NSInteger selectedTabViewIndex = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
+ NSInteger selectedTabViewIndex = [[self onMainThread] currentlySelectedView];
switch (selectedTabViewIndex) {
case SPTableViewStructure:
diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h
index c14aefaf..6ba86d58 100644
--- a/Source/SPHistoryController.h
+++ b/Source/SPHistoryController.h
@@ -55,7 +55,6 @@
- (void)goBackInHistory;
- (void)goForwardInHistory;
- (IBAction) historyControlClicked:(NSSegmentedControl *)theControl;
-- (NSUInteger) currentlySelectedView;
- (void) setupInterface;
- (void) startDocumentTask:(NSNotification *)aNotification;
- (void) endDocumentTask:(NSNotification *)aNotification;
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 11442308..ec05c4af 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -170,33 +170,6 @@
}
/**
- * Retrieve the view that is currently selected from the database
- */
-- (NSUInteger) currentlySelectedView
-{
- NSUInteger theView = NSNotFound;
-
- NSString *viewName = [[[theDocument valueForKey:@"tableTabView"] selectedTabViewItem] identifier];
-
- if ([viewName isEqualToString:@"source"]) {
- theView = SPTableViewStructure;
- } else if ([viewName isEqualToString:@"content"]) {
- theView = SPTableViewContent;
- } else if ([viewName isEqualToString:@"customQuery"]) {
- theView = SPTableViewCustomQuery;
- } else if ([viewName isEqualToString:@"status"]) {
- theView = SPTableViewStatus;
- } else if ([viewName isEqualToString:@"relations"]) {
- theView = SPTableViewRelations;
- }
- else if ([viewName isEqualToString:@"triggers"]) {
- theView = SPTableViewTriggers;
- }
-
- return theView;
-}
-
-/**
* Set up the toolbar items as appropriate.
* State tracking is necessary as manipulating items not on the toolbar
* can cause crashes.
@@ -267,15 +240,16 @@
// Don't modify anything if we're in the process of restoring an old history state
if (modifyingState) return;
+#warning Basically all of those next calls do stuff that must be done on the main thread (AND en block in order to be consistent). This needs to be refactored!
// Work out the current document details
NSString *theDatabase = [theDocument database];
NSString *theTable = [theDocument table];
- NSUInteger theView = [self currentlySelectedView];
+ SPTableViewType theView = [[theDocument onMainThread] currentlySelectedView];
NSString *contentSortCol = [tableContentInstance sortColumnName];
BOOL contentSortColIsAsc = [tableContentInstance sortColumnIsAscending];
NSUInteger contentPageNumber = [tableContentInstance pageNumber];
- NSDictionary *contentSelectedRows = [tableContentInstance selectionDetailsAllowingIndexSelection:YES];
- NSRect contentViewport = [tableContentInstance viewport];
+ NSDictionary *contentSelectedRows = [[tableContentInstance onMainThread] selectionDetailsAllowingIndexSelection:YES];
+ NSRect contentViewport = [[tableContentInstance onMainThread] viewport];
NSDictionary *contentFilter = [[tableContentInstance onMainThread] filterSettings];
NSData *filterTableData = [tableContentInstance filterTableData];
if (!theDatabase) return;
@@ -411,8 +385,8 @@
// If the database, table, and view are the same and content - just trigger a table reload (filters)
if ([[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]]
&& [historyEntry objectForKey:@"table"] && [[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]
- && [[historyEntry objectForKey:@"view"] unsignedIntegerValue] == [self currentlySelectedView]
- && [[historyEntry objectForKey:@"view"] unsignedIntegerValue] == SPTableViewContent)
+ && [[historyEntry objectForKey:@"view"] integerValue] == [theDocument currentlySelectedView]
+ && [[historyEntry objectForKey:@"view"] integerValue] == SPTableViewContent)
{
[tableContentInstance loadTable:[historyEntry objectForKey:@"table"]];
modifyingState = NO;
@@ -441,7 +415,7 @@
}
// Check and set the view
- if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] unsignedIntegerValue]) {
+ if ([theDocument currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) {
switch ([[historyEntry objectForKey:@"view"] integerValue]) {
case SPTableViewStructure:
[theDocument viewStructure:self];
@@ -462,7 +436,7 @@
[theDocument viewTriggers:self];
break;
}
- if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] unsignedIntegerValue]) {
+ if ([theDocument currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) {
return [self abortEntryLoadWithPool:loadPool];
}
}
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index 8b17e5bf..ab2cda9a 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -108,7 +108,7 @@
- (IBAction)printDocument:(id)sender
{
// Only display warning for the 'Table Content' view
- if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1) {
+ if ([self currentlySelectedView] == SPTableViewContent) {
NSInteger rowLimit = [prefs integerForKey:SPPrintWarningRowLimit];
@@ -160,7 +160,7 @@
{
[self startTaskWithDescription:NSLocalizedString(@"Generating print document...", @"generating print document status message")];
- BOOL isTableInformation = ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 3);
+ BOOL isTableInformation = ([self currentlySelectedView] == SPTableViewStatus);
if ([NSThread isMainThread]) {
printThread = [[NSThread alloc] initWithTarget:self selector:(isTableInformation) ? @selector(generateTableInfoHTMLForPrinting) : @selector(generateHTMLForPrinting) object:nil];
@@ -217,10 +217,10 @@
NSMutableDictionary *printData = [NSMutableDictionary dictionary];
- NSUInteger view = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
+ SPTableViewType view = [self currentlySelectedView];
// Table source view
- if (view == 0) {
+ if (view == SPTableViewStructure) {
NSDictionary *tableSource = [tableSourceInstance tableSourceForPrinting];
@@ -257,7 +257,7 @@
[indexes release];
}
// Table content view
- else if (view == 1) {
+ else if (view == SPTableViewContent) {
NSArray *data = [tableContentInstance currentDataResultWithNULLs:NO hideBLOBs:YES];
@@ -274,7 +274,7 @@
[rows release];
}
// Custom query view
- else if (view == 2) {
+ else if (view == SPTableViewCustomQuery) {
NSArray *data = [customQueryInstance currentResult];
@@ -291,7 +291,7 @@
[rows release];
}
// Table relations view
- else if (view == 4) {
+ else if (view == SPTableViewRelations) {
NSArray *data = [tableRelationsInstance relationDataForPrinting];
@@ -307,7 +307,7 @@
[rows release];
}
// Table triggers view
- else if (view == 5) {
+ else if (view == SPTableViewTriggers) {
NSArray *data = [tableTriggersInstance triggerDataForPrinting];
@@ -392,30 +392,30 @@
{
NSArray *columns = nil;
- NSUInteger view = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
+ SPTableViewType view = [self currentlySelectedView];
// Table source view
- if ((view == 0) && ([[tableSourceInstance tableSourceForPrinting] count] > 0)) {
+ if ((view == SPTableViewStructure) && ([[tableSourceInstance tableSourceForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[[tableSourceInstance tableSourceForPrinting] objectForKey:@"structure"] objectAtIndex:0] copyItems:YES];
}
// Table content view
- else if ((view == 1) && ([[tableContentInstance currentResult] count] > 0)) {
+ else if ((view == SPTableViewContent) && ([[tableContentInstance currentResult] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableContentInstance currentResult] objectAtIndex:0] copyItems:YES];
}
// Custom query view
- else if ((view == 2) && ([[customQueryInstance currentResult] count] > 0)) {
+ else if ((view == SPTableViewCustomQuery) && ([[customQueryInstance currentResult] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[customQueryInstance currentResult] objectAtIndex:0] copyItems:YES];
}
// Table relations view
- else if ((view == 4) && ([[tableRelationsInstance relationDataForPrinting] count] > 0)) {
+ else if ((view == SPTableViewRelations) && ([[tableRelationsInstance relationDataForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableRelationsInstance relationDataForPrinting] objectAtIndex:0] copyItems:YES];
}
// Table triggers view
- else if ((view == 5) && ([[tableTriggersInstance triggerDataForPrinting] count] > 0)) {
+ else if ((view == SPTableViewTriggers) && ([[tableTriggersInstance triggerDataForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableTriggersInstance triggerDataForPrinting] objectAtIndex:0] copyItems:YES];
}
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 48871c11..2366cbf0 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -1065,14 +1065,16 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
tableRowsCount = [tableValues count];
- // If the final column autoresize wasn't performed, perform it
- if (tableLoadLastRowCount < 200) [[self onMainThread] autosizeColumns];
+ SPMainQSync(^{
+ // If the final column autoresize wasn't performed, perform it
+ if (tableLoadLastRowCount < 200) [self autosizeColumns];
- // Ensure the table is aware of changes
- [[tableContentView onMainThread] noteNumberOfRowsChanged];
+ // Ensure the table is aware of changes
+ [tableContentView noteNumberOfRowsChanged]; // UI method!
- // Reset the progress indicator
- [dataLoadingIndicator setIndeterminate:YES];
+ // Reset the progress indicator
+ [dataLoadingIndicator setIndeterminate:YES]; // UI method!
+ });
}
/**
@@ -1200,13 +1202,14 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
// If rows are selected, append selection count
- if ([tableContentView numberOfSelectedRows] > 0) {
+ NSInteger selectedRows = [[tableContentView onMainThread] numberOfSelectedRows]; // -numberOfSelectedRows is a UI method!
+ if (selectedRows > 0) {
[countString appendString:@"; "];
- if ([tableContentView numberOfSelectedRows] == 1)
+ if (selectedRows == 1)
rowString = [NSString stringWithString:NSLocalizedString(@"row", @"singular word for row")];
else
rowString = [NSString stringWithString:NSLocalizedString(@"rows", @"plural word for rows")];
- [countString appendFormat:NSLocalizedString(@"%@ %@ selected", @"text showing how many rows are selected"), [numberFormatter stringFromNumber:[NSNumber numberWithInteger:[tableContentView numberOfSelectedRows]]], rowString];
+ [countString appendFormat:NSLocalizedString(@"%@ %@ selected", @"text showing how many rows are selected"), [numberFormatter stringFromNumber:[NSNumber numberWithInteger:selectedRows]], rowString];
}
#ifndef SP_CODA
@@ -2008,7 +2011,10 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
[alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %ld rows from this table? This action cannot be undone.", @"delete rows informative message"), (long)[tableContentView numberOfSelectedRows]]];
}
- [alert beginSheetModalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:@selector(removeRowSheetDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
+ [alert beginSheetModalForWindow:[tableDocumentInstance parentWindow]
+ modalDelegate:self
+ didEndSelector:@selector(removeRowSheetDidEnd:returnCode:contextInfo:)
+ contextInfo:contextInfo];
}
/**
@@ -3018,7 +3024,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
// Save any edits which have been started but not saved to the underlying table/data structures
// yet - but not if currently undoing/redoing, as this can cause a processing loop
- if (![[[[tableContentView window] firstResponder] undoManager] isUndoing] && ![[[[tableContentView window] firstResponder] undoManager] isRedoing]) {
+ if (![[[[tableContentView window] firstResponder] undoManager] isUndoing] && ![[[[tableContentView window] firstResponder] undoManager] isRedoing]) { // -window is a UI method!
[[tableDocumentInstance parentWindow] endEditingFor:nil];
}
@@ -3732,6 +3738,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
* identifier for each selected row. If no primary key is available, the returned
* dictionary will contain details and a list of the selected row *indexes* if the
* supplied argument is set to true, which may not always be appropriate.
+ *
+ * MUST BE CALLED ON THE UI THREAD!
*/
- (NSDictionary *)selectionDetailsAllowingIndexSelection:(BOOL)allowIndexFallback
{
@@ -3799,7 +3807,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
if (allowIndexFallback) {
return [NSDictionary dictionaryWithObjectsAndKeys:
SPSelectionDetailTypeIndexed, @"type",
- [tableContentView selectedRowIndexes], @"rows",
+ [tableContentView selectedRowIndexes], @"rows", // -selectedRowIndexes is a UI method!
nil];
}
@@ -3820,10 +3828,12 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
/**
* Provide a getter for the table's current viewport
+ *
+ * MUST BE CALLED FROM THE UI THREAD!
*/
- (NSRect) viewport
{
- return [tableContentView visibleRect];
+ return [tableContentView visibleRect]; // UI method!
}
/**
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index d17d1807..c1b007c3 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -516,7 +516,7 @@ static inline SPFieldTypeHelp *MakeFieldTypeHelp(NSString *typeName,NSString *ty
[resetAutoIncrementLine setHidden:YES];
- if ([[tableDocumentInstance valueForKeyPath:@"tableTabView"] indexOfTabViewItem:[[tableDocumentInstance valueForKeyPath:@"tableTabView"] selectedTabViewItem]] == 0)
+ if ([tableDocumentInstance currentlySelectedView] == SPTableViewStructure)
[resetAutoIncrementLine setHidden:NO];
// Begin the sheet
@@ -678,7 +678,7 @@ static inline SPFieldTypeHelp *MakeFieldTypeHelp(NSString *typeName,NSString *ty
// reload data
[tableDataInstance resetStatusData];
- if([[tableDocumentInstance valueForKeyPath:@"tableTabView"] indexOfTabViewItem:[[tableDocumentInstance valueForKeyPath:@"tableTabView"] selectedTabViewItem]] == 3) {
+ if([tableDocumentInstance currentlySelectedView] == SPTableViewStatus) {
[tableDataInstance resetAllData];
#ifndef SP_CODA
[extendedTableInfoInstance loadTable:selTable];
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index c75198b7..34d1dfcb 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -316,7 +316,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Set the filter placeholder text
if ([tableDocumentInstance database]) {
- [[[listFilterField cell] onMainThread] setPlaceholderString:NSLocalizedString(@"Filter", @"filter label")];
+ SPMainQSync(^{
+ // -cell is a UI call according to Xcode 9.2 (and -setPlaceholderString: is too, obviously)
+ [[listFilterField cell] setPlaceholderString:NSLocalizedString(@"Filter", @"filter label")];
+ });
}
#endif