aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/FieldEditorSheet.xib14
-rw-r--r--Source/SPFieldEditorController.h2
-rw-r--r--Source/SPFieldEditorController.m48
3 files changed, 48 insertions, 16 deletions
diff --git a/Interfaces/English.lproj/FieldEditorSheet.xib b/Interfaces/English.lproj/FieldEditorSheet.xib
index cb389882..a46ac1a8 100644
--- a/Interfaces/English.lproj/FieldEditorSheet.xib
+++ b/Interfaces/English.lproj/FieldEditorSheet.xib
@@ -45,7 +45,7 @@
<string key="NSWindowRect">{{364, 183}, {667, 428}}</string>
<int key="NSWTFlags">544735232</int>
<string key="NSWindowTitle">Field Editor</string>
- <string key="NSWindowClass">NSPanel</string>
+ <string key="NSWindowClass">NSWindow</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
@@ -516,7 +516,7 @@
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
- <int key="NSFlags">4067</int>
+ <int key="NSFlags">12259</int>
<int key="NSTextCheckingTypes">0</int>
<nil key="NSMarkedAttributes"/>
<reference key="NSBackgroundColor" ref="940290613"/>
@@ -4893,6 +4893,14 @@
</object>
<int key="connectionID">528</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">initialFirstResponder</string>
+ <reference key="source" ref="172882781"/>
+ <reference key="destination" ref="702566211"/>
+ </object>
+ <int key="connectionID">529</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -7248,7 +7256,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">528</int>
+ <int key="maxID">529</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index 12342fea..af914f82 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -130,6 +130,8 @@
IBOutlet NSTextField *bitSheetBitLabel48;
IBOutlet NSTextField *bitSheetBitLabel56;
+ id usedSheet;
+
id sheetEditData;
BOOL editSheetWillBeInitialized;
BOOL _isBlob;
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 16823fed..56f2407d 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -29,6 +29,7 @@
#import "SPDataCellFormatter.h"
#import "SPTooltip.h"
#import "SPGeometryDataView.h"
+#include <objc/objc-runtime.h>
@implementation SPFieldEditorController
@@ -196,7 +197,7 @@
isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)theWindow
{
- id usedSheet;
+ usedSheet = nil;
_isEditable = isEditable;
@@ -304,11 +305,11 @@
// Set window's min size since no segment and quicklook buttons are hidden
if (_isBlob || _isBINARY) {
- [editSheet setFrameAutosaveName:@"SPFieldEditorBlobSheet"];
- [editSheet setMinSize:NSMakeSize(560, 200)];
+ [usedSheet setFrameAutosaveName:@"SPFieldEditorBlobSheet"];
+ [usedSheet setMinSize:NSMakeSize(560, 200)];
} else {
- [editSheet setFrameAutosaveName:@"SPFieldEditorTextSheet"];
- [editSheet setMinSize:NSMakeSize(340, 150)];
+ [usedSheet setFrameAutosaveName:@"SPFieldEditorTextSheet"];
+ [usedSheet setMinSize:NSMakeSize(340, 150)];
}
[editTextView setEditable:_isEditable];
@@ -398,9 +399,9 @@
// Set focus
if(image == nil || _isGeometry)
- [editSheet makeFirstResponder:editTextView];
+ [usedSheet makeFirstResponder:editTextView];
else
- [editSheet makeFirstResponder:editImage];
+ [usedSheet makeFirstResponder:editImage];
[stringValue release], stringValue = nil;
}
@@ -415,8 +416,14 @@
NSModalSession session = [NSApp beginModalSessionForWindow:usedSheet];
NSInteger cycleCounter = 0;
BOOL doGroupDueToChars = NO;
+ BOOL findPanelIsOpen = NO;
+
+ id textFinder = [objc_getClass("NSTextFinder") sharedTextFinder];
+ id textFinderPanel = nil;
+
for (;;) {
+
// Break the run loop if editSheet was closed
if ([NSApp runModalSession:session] != NSRunContinuesResponse
|| ![usedSheet isVisible])
@@ -426,6 +433,16 @@
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
+
+ if([[textFinder findPanel:NO] isVisible]) {
+ textFinderPanel = [textFinder findPanel:NO];
+ [textFinderPanel setWorksWhenModal:YES];
+ // [textFinderPanel setLevel:NSDockWindowLevel];
+ findPanelIsOpen = YES;
+ } else {
+ findPanelIsOpen = NO;
+ }
+
// Allow undo grouping if user typed a ' ' (for word level undo)
// or a RETURN but not for each char due to writing speed
if([[NSApp currentEvent] type] == NSKeyDown
@@ -466,6 +483,11 @@
// Remember spell cheecker status
[prefs setBool:[editTextView isContinuousSpellCheckingEnabled] forKey:SPBlobTextEditorSpellCheckingEnabled];
+ // Close findPanel for convenience
+ if(findPanelIsOpen && textFinderPanel) {
+ [textFinderPanel close];
+ }
+
return ( editSheetReturnCode && _isEditable ) ? (_isGeometry) ? [editTextView string] : sheetEditData : nil;
}
@@ -535,7 +557,7 @@
{
[[NSOpenPanel openPanel] beginSheetForDirectory:nil
file:@""
- modalForWindow:[self window]
+ modalForWindow:usedSheet
modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
@@ -552,7 +574,7 @@
[editImage setHidden:YES];
[hexTextView setHidden:YES];
[hexTextScrollView setHidden:YES];
- [[self window] makeFirstResponder:editTextView];
+ [usedSheet makeFirstResponder:editTextView];
break;
case 1: // image
[editTextView setHidden:YES];
@@ -560,10 +582,10 @@
[editImage setHidden:NO];
[hexTextView setHidden:YES];
[hexTextScrollView setHidden:YES];
- [[self window] makeFirstResponder:editImage];
+ [usedSheet makeFirstResponder:editImage];
break;
case 2: // hex - load on demand
- [[self window] makeFirstResponder:hexTextView];
+ [usedSheet makeFirstResponder:hexTextView];
if([[hexTextView string] isEqualToString:@""]) {
[editSheetProgressBar startAnimation:self];
if([sheetEditData isKindOfClass:[NSData class]]) {
@@ -602,7 +624,7 @@
[panel beginSheetForDirectory:nil
file:fileDefault
- modalForWindow:[self window]
+ modalForWindow:usedSheet
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
@@ -1191,7 +1213,7 @@
*/
- (IBAction)bitSheetSelectBit0:(id)sender
{
- [[self window] makeFirstResponder:[self valueForKeyPath:@"bitSheetBitButton0"]];
+ [usedSheet makeFirstResponder:[self valueForKeyPath:@"bitSheetBitButton0"]];
}
/**