aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldEditorController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r--Source/SPFieldEditorController.m36
1 files changed, 32 insertions, 4 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 73fafe39..52a90fcd 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -4,7 +4,7 @@
// SPFieldEditorController.m
// sequel-pro
//
-// Created by Hans-Jörg Bibiko on July 16, 2009
+// Created by Hans-Jörg Bibiko on July 16, 2009
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@
#import "SPGeometryDataView.h"
#import "SPCopyTable.h"
#include <objc/objc-runtime.h>
+#import "SPCustomQuery.h"
+#import "SPTableContent.h"
@interface SPFieldEditorController (SPFieldEditorControllerDelegate)
@@ -110,6 +112,7 @@
[qlTypesItems addObject:type];
}
}
+#ifndef SP_REFACTOR
// Load user-defined QL types
if([prefs objectForKey:SPQuickLookTypes]) {
for(id type in [prefs objectForKey:SPQuickLookTypes]) {
@@ -122,6 +125,7 @@
[qlTypesItems addObject:type];
}
}
+#endif
qlTypes = [[NSDictionary dictionaryWithObject:qlTypesItems forKey:SPQuickLookTypes] retain];
[qlTypesItems release];
@@ -239,14 +243,28 @@
usedSheet = editSheet;
// If required, use monospaced fonts
+#ifndef SP_REFACTOR
if (![prefs objectForKey:SPFieldEditorSheetFont]) {
- [editTextView setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+#endif
+ [editTextView setFont:
+#ifndef SP_REFACTOR
+ ([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] :
+#endif
+ [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+#ifndef SP_REFACTOR
}
else {
[editTextView setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"FieldEditorSheetFont"]]];
}
+#endif
- [editTextView setContinuousSpellCheckingEnabled:[prefs boolForKey:SPBlobTextEditorSpellCheckingEnabled]];
+ [editTextView setContinuousSpellCheckingEnabled:
+#ifndef SP_REFACTOR
+ [prefs boolForKey:SPBlobTextEditorSpellCheckingEnabled]
+#else
+ NO
+#endif
+ ];
[hexTextView setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
@@ -532,8 +550,10 @@
- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+#ifndef SP_REFACTOR
// Remember spell cheecker status
[prefs setBool:[editTextView isContinuousSpellCheckingEnabled] forKey:SPBlobTextEditorSpellCheckingEnabled];
+#endif
}
/**
@@ -551,7 +571,7 @@
// and suppress closing the sheet
if(sender == editSheetOkButton) {
if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:SPNullValue]]) {
- [editTextView setSelectedRange:NSMakeRange((NSUInteger)maxTextLength, [[editTextView textStorage] length] - (NSUInteger)maxTextLength)];
+ [editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
[editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)];
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %llu.", @"Text is too long. Maximum text length is set to %llu."), maxTextLength]];
return;
@@ -580,7 +600,15 @@
if(callerInstance) {
id returnData = ( editSheetReturnCode && _isEditable ) ? (_isGeometry) ? [editTextView string] : sheetEditData : nil;
+
+#ifdef SP_REFACTOR /* patch */
+ if ( [callerInstance isKindOfClass:[SPCustomQuery class]] )
+ [(SPCustomQuery*)callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
+ else if ( [callerInstance isKindOfClass:[SPTableContent class]] )
+ [(SPTableContent*)callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
+#else
[callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
+#endif
}
}