aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/ScintillaTest/AppController.h1
-rw-r--r--cocoa/ScintillaTest/AppController.mm28
2 files changed, 17 insertions, 12 deletions
diff --git a/cocoa/ScintillaTest/AppController.h b/cocoa/ScintillaTest/AppController.h
index 6fb4dac68..9c54dd88f 100644
--- a/cocoa/ScintillaTest/AppController.h
+++ b/cocoa/ScintillaTest/AppController.h
@@ -16,7 +16,6 @@
IBOutlet NSBox *mEditHost;
ScintillaView* mEditor;
ScintillaView* sciExtra; // For testing Scintilla tear-down
- NSString* sql;
}
- (void) awakeFromNib;
diff --git a/cocoa/ScintillaTest/AppController.mm b/cocoa/ScintillaTest/AppController.mm
index 189e7b0ea..31c0c024a 100644
--- a/cocoa/ScintillaTest/AppController.mm
+++ b/cocoa/ScintillaTest/AppController.mm
@@ -72,25 +72,30 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
[mEditor setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
// Let's load some text for the editor, as initial content.
- NSError* error = nil;
+ NSString *sql = [self exampleText];
+
+ [mEditor setString: sql];
+
+ [self setupEditor];
- NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData"
+ sciExtra = nil;
+}
+
+- (NSString *) exampleText
+{
+ NSError* error = nil;
+
+ NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData"
ofType: @"sql" inDirectory: nil];
-
- sql = [NSString stringWithContentsOfFile: path
+
+ NSString *sql = [NSString stringWithContentsOfFile: path
encoding: NSUTF8StringEncoding
error: &error];
- [sql retain];
-
if (error && [[error domain] isEqual: NSCocoaErrorDomain])
NSLog(@"%@", error);
- [mEditor setString: sql];
-
- [self setupEditor];
-
- sciExtra = nil;
+ return sql;
}
//--------------------------------------------------------------------------------------------------
@@ -291,6 +296,7 @@ static const char * box_xpm[] = {
sciExtra = [[[ScintillaView alloc] initWithFrame: newFrame] autorelease];
[[[mEditHost window]contentView] addSubview: sciExtra];
[sciExtra setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 1];
+ NSString *sql = [self exampleText];
[sciExtra setString: sql];
}
}