aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2015-10-23 23:19:42 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2015-10-23 23:19:42 +1100
commit99c9ad7ef1f1d77b713577df72eae32d3f479cf6 (patch)
treebd6a570e0fe8a976df9b1aba6a27c2333147d840
parente2dca05cbb61dbaeff984e6f2dca350c24fdaec3 (diff)
downloadscintilla-mirror-99c9ad7ef1f1d77b713577df72eae32d3f479cf6.tar.gz
Add a menu command to ScintillaTest to add or remove an extra Scintilla
view on the right of the window to allow testing deletion of a ScintillaView.
-rw-r--r--cocoa/ScintillaTest/AppController.h3
-rw-r--r--cocoa/ScintillaTest/AppController.mm26
-rw-r--r--cocoa/ScintillaTest/English.lproj/MainMenu.xib6
3 files changed, 34 insertions, 1 deletions
diff --git a/cocoa/ScintillaTest/AppController.h b/cocoa/ScintillaTest/AppController.h
index 6025f6a50..6fb4dac68 100644
--- a/cocoa/ScintillaTest/AppController.h
+++ b/cocoa/ScintillaTest/AppController.h
@@ -15,10 +15,13 @@
@interface AppController : NSObject {
IBOutlet NSBox *mEditHost;
ScintillaView* mEditor;
+ ScintillaView* sciExtra; // For testing Scintilla tear-down
+ NSString* sql;
}
- (void) awakeFromNib;
- (void) setupEditor;
- (IBAction) searchText: (id) sender;
+- (IBAction) addRemoveExtra: (id) sender;
@end
diff --git a/cocoa/ScintillaTest/AppController.mm b/cocoa/ScintillaTest/AppController.mm
index 44cd6e97f..189e7b0ea 100644
--- a/cocoa/ScintillaTest/AppController.mm
+++ b/cocoa/ScintillaTest/AppController.mm
@@ -77,15 +77,20 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData"
ofType: @"sql" inDirectory: nil];
- NSString* sql = [NSString stringWithContentsOfFile: path
+ 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;
}
//--------------------------------------------------------------------------------------------------
@@ -271,6 +276,25 @@ static const char * box_xpm[] = {
[self showAutocompletion];
}
+- (IBAction) addRemoveExtra: (id) sender
+{
+ if (sciExtra) {
+ [sciExtra removeFromSuperview];
+ sciExtra = nil;
+ } else {
+ NSRect newFrame = mEditHost.frame;
+ newFrame.origin.x += newFrame.size.width + 5;
+ newFrame.origin.y += 46;
+ newFrame.size.width = 96;
+ newFrame.size.height -= 60;
+
+ sciExtra = [[[ScintillaView alloc] initWithFrame: newFrame] autorelease];
+ [[[mEditHost window]contentView] addSubview: sciExtra];
+ [sciExtra setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 1];
+ [sciExtra setString: sql];
+ }
+}
+
-(IBAction) setFontQuality: (id) sender
{
[ScintillaView directCall:mEditor message:SCI_SETFONTQUALITY wParam:[sender tag] lParam:0];
diff --git a/cocoa/ScintillaTest/English.lproj/MainMenu.xib b/cocoa/ScintillaTest/English.lproj/MainMenu.xib
index 32f850eee..efe9bc5b0 100644
--- a/cocoa/ScintillaTest/English.lproj/MainMenu.xib
+++ b/cocoa/ScintillaTest/English.lproj/MainMenu.xib
@@ -509,6 +509,12 @@
<action selector="runToolbarCustomizationPalette:" target="-1" id="365"/>
</connections>
</menuItem>
+ <menuItem isSeparatorItem="YES" id="K3d-cY-vZn"/>
+ <menuItem title="Add or Remove Extra Scintilla" keyEquivalent="d" id="zQU-z1-l5t">
+ <connections>
+ <action selector="addRemoveExtra:" target="450" id="9HG-Le-GbA"/>
+ </connections>
+ </menuItem>
</items>
</menu>
</menuItem>