Hex Editor Find Sheet nib file fixed

This commit is contained in:
Nicholas Shanks 2002-11-16 23:03:59 +00:00
parent 67d2e62f18
commit a484060e30
12 changed files with 542 additions and 20 deletions

View File

@ -53,6 +53,21 @@ Plug_PlugInRef Host_GetPlugRef( WindowRef window )
return null;
}
Plug_ResourceRef Host_GetResource( ResType type, SInt32 resID, Plug_ResourceRef sameFileAsResource )
{
FilWindowPtr file;
if( sameFileAsResource != NULL )
{
// file = ((ResourceObjectPtr) sameFileAsResource)->file;
short oldResFile = CurResFile();
UseResFile( HomeResFile( ((ResourceObjectPtr) sameFileAsResource)->Data() ) );
Get1Resource( type, resID ); // bug: handle ignored at present
UseResFile( oldResFile );
}
else GetResource( type, resID ); // bug: handle ignored at present
return nil; // bug: handle ignored at present
}
Plug_ResourceRef Host_GetTargetResource( Plug_WindowRef plugWindow )
{
return (Plug_ResourceRef) ((EditorWindowPtr) plugWindow)->Resource();

View File

@ -121,8 +121,15 @@ extern "C" // functions beginning "Host_" are in ResKnife/Resurrection
* @discussion You will probably need to call this if the system calls one of your routines directly.
*/
ResCall Plug_PlugInRef Host_GetPlugRef( WindowRef window );
/*!
* @function Host_GetResource
* @discussion Returns a reference to any arbitrary resource.
* @param limitToDoc If true, the function will only search the same document that contains the resource returned by Host_GetTargetResource. If false, it will return any resource in the current resource chain.
*/
ResCall Plug_ResourceRef Host_GetResource( SInt32 type, SInt32 resID, Boolean limitToDoc );
/*!
* @function Host_GetTargetResource
* @discussion Returns the reference to the resource you're actually editing.
*/
ResCall Plug_ResourceRef Host_GetTargetResource( Plug_WindowRef plugWindow );
/*!

View File

@ -0,0 +1,33 @@
{
IBClasses = (
{
ACTIONS = {
findNext = id;
findPrevious = id;
findWithSelection = id;
hideFindSheet = id;
replaceAll = id;
replaceFindNext = id;
showFindSheet = id;
};
CLASS = FindSheetController;
LANGUAGE = ObjC;
OUTLETS = {
cancelButton = NSButton;
caseSensitiveBox = NSButton;
findNextButton = NSButton;
findReplaceForm = NSForm;
matchEntireWordsBox = NSButton;
replaceAllButton = NSButton;
searchASCIIOrHexRadios = NSMatrix;
searchBackwardsBox = NSButton;
searchSelectionOnlyBox = NSButton;
startAtTopBox = NSButton;
wrapAroundBox = NSButton;
};
SUPERCLASS = NSWindowController;
},
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
);
IBVersion = 1;
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>681 234 356 240 0 0 1600 1002 </string>
<key>IBFramework Version</key>
<string>286.0</string>
<key>IBGroupedObjects</key>
<dict>
<key>0</key>
<array>
<string>17</string>
<string>30</string>
<string>31</string>
<string>46</string>
<string>47</string>
<string>48</string>
<string>49</string>
</array>
</dict>
<key>IBLastGroupID</key>
<string>1</string>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
</array>
<key>IBSystem Version</key>
<string>6F21</string>
</dict>
</plist>

Binary file not shown.

View File

@ -2,11 +2,19 @@
@interface FindSheetController : NSWindowController
{
IBOutlet NSButton *cancelButton;
IBOutlet NSButton *findNextButton;
IBOutlet NSForm *form;
IBOutlet NSButton *replaceAllButton;
IBOutlet NSButton *replaceFindNextButton;
IBOutlet NSButton *cancelButton;
IBOutlet NSButton *findNextButton;
IBOutlet NSForm *findReplaceForm;
IBOutlet NSButton *replaceAllButton;
// IBOutlet NSButton *replaceFindNextButton;
IBOutlet NSButton *startAtTopBox;
IBOutlet NSButton *wrapAroundBox;
IBOutlet NSButton *searchBackwardsBox;
IBOutlet NSButton *searchSelectionOnlyBox;
IBOutlet NSButton *caseSensitiveBox;
IBOutlet NSButton *matchEntireWordsBox;
IBOutlet NSMatrix *searchASCIIOrHexRadios;
NSString *findString;
NSString *replaceString;

View File

@ -15,8 +15,8 @@
[findString autorelease];
[replaceString autorelease];
findString = [[[form cellAtIndex:0] stringValue] copy];
replaceString = [[[form cellAtIndex:1] stringValue] copy];
findString = [[[findReplaceForm cellAtIndex:0] stringValue] copy];
replaceString = [[[findReplaceForm cellAtIndex:1] stringValue] copy];
}
/* HIDE AND SHOW SHEET */

View File

@ -18,6 +18,7 @@
- (NSString *)offsetRepresentation:(NSData *)data;
- (NSString *)hexRepresentation:(NSData *)data;
- (NSString *)asciiRepresentation:(NSData *)data;
- (NSString *)hexToAscii:(NSData *)data;
- (NSRange)byteRangeFromHexRange:(NSRange)hexRange;
- (NSRange)hexRangeFromByteRange:(NSRange)byteRange;

View File

@ -116,21 +116,22 @@
return representation;
}
- (NSString *)hexToAscii:(NSData *)data;
- (NSString *)hexToAscii:(NSData *)data
{
NSString *result;
unsigned long bytesEncoded = ([data length] + 1) / 3;
char *buffer = (char *) malloc( bytesEncoded ), hex1, hex2, ascii;
char *buffer = (char *) malloc( bytesEncoded ), hex1, hex2;
for( int i = 0; i < bytesEncoded; i++ )
{
hex1 = ((char *)[data bytes])[3*i];
hex2 = ((char *)[data bytes])[3*i+1];
hex1 -= (hex1 < 'A')? 0x30 : 0x37;
hex2 -= (hex2 < 'A')? 0x30 : 0x37;
hex1 <<= 4;
ascii = hex1 + hex2;
buffer[i] = ascii;
buffer[i] = (hex1 << 4) + hex2;
}
return [NSString stringWithCString:buffer length:bytesEncoded];
result = [NSString stringWithCString:buffer length:bytesEncoded];
free( buffer );
return result;
}
/* delegation methods */

View File

@ -1,7 +1,5 @@
#import "HexTextView.h"
@class _NSUndoStack;
@implementation HexTextView
- (void)drawRect:(NSRect)rect
@ -82,7 +80,7 @@
NSMenu *editMenu = [[item menu] supermenu];
[[editMenu itemAtIndex:[editMenu indexOfItemWithSubmenu:[item menu]]] setEnabled:[super validateMenuItem:item]];
}
else return [super validateMenuItem:item];
return [super validateMenuItem:item];
}
- (IBAction)cut:(id)sender
@ -216,7 +214,7 @@
- (unsigned int)_insertionGlyphIndexForDrag:(id <NSDraggingInfo>)sender
{
int charIndex = [super _insertionGlyphIndexForDrag:sender];
unsigned int charIndex = [super _insertionGlyphIndexForDrag:sender];
if( self == [[self delegate] hex] )
charIndex -= charIndex % 3;
return charIndex;
@ -258,7 +256,6 @@ static NSRange draggedRange;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSRange range;
NSPasteboard *pb = [sender draggingPasteboard];
NSData *pastedData = [pb dataForType:NSStringPboardType];
int charIndex = [self _insertionGlyphIndexForDrag:sender];
@ -433,11 +430,11 @@ static NSRange draggedRange;
// manipulate undo stack to concatenate multiple undos
BOOL closeUndoGroup = NO;
_NSUndoStack *undoStack = nil;
id undoStack = nil; // object of class _NSUndoStack
if( ![[[self window] undoManager] isUndoing] )
undoStack = [[[self window] undoManager] _undoStack];
if( undoStack && [undoStack count] > 0 && [[[self window] undoManager] groupingLevel] == 0 )
if( undoStack && (int)[undoStack count] > 0 && [[[self window] undoManager] groupingLevel] == 0 )
{
[undoStack popUndoObject]; // pop endUndoGrouping item
closeUndoGroup = YES;

Binary file not shown.

View File

@ -5,6 +5,428 @@
};
objectVersion = 38;
objects = {
F5041736036BD60801A8010A = {
isa = PBXFileReference;
path = ResKnife.scriptSuite;
refType = 4;
};
F5041737036BD60801A8010A = {
fileRef = F5041736036BD60801A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFE16036C203F01A8010A = {
children = (
F50DFE17036C203F01A8010A,
);
isa = PBXVariantGroup;
name = ResKnife.scriptTerminology;
path = "";
refType = 4;
};
F50DFE17036C203F01A8010A = {
isa = PBXFileReference;
name = English;
path = Cocoa/English.lproj/ResKnife.scriptTerminology;
refType = 2;
};
F50DFE18036C203F01A8010A = {
fileRef = F50DFE16036C203F01A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFE19036C255E01A8010A = {
buildActionMask = 2147483647;
files = (
F50DFE80036C258301A8010A,
F50DFEA9036C258301A8010A,
F50DFEAC036C258301A8010A,
F50DFEAE036C258301A8010A,
F50DFEB0036C258301A8010A,
F50DFEB2036C258301A8010A,
F50DFEB7036C258301A8010A,
F50DFEBE036C258301A8010A,
F50DFEBF036C2C2D01A8010A,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
F50DFE1A036C255E01A8010A = {
buildActionMask = 2147483647;
files = (
F50DFEAA036C258301A8010A,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
F50DFE1B036C255E01A8010A = {
buildActionMask = 2147483647;
files = (
F50DFE7F036C258301A8010A,
F50DFEA8036C258301A8010A,
F50DFEAB036C258301A8010A,
F50DFEAD036C258301A8010A,
F50DFEAF036C258301A8010A,
F50DFEB1036C258301A8010A,
F50DFEB6036C258301A8010A,
F50DFEB8036C258301A8010A,
F50DFEBD036C258301A8010A,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
F50DFE1C036C255E01A8010A = {
buildActionMask = 2147483647;
files = (
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
F50DFE1D036C255E01A8010A = {
buildActionMask = 2147483647;
files = (
F50DFEBC036C258301A8010A,
);
isa = PBXRezBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
F50DFE1E036C255E01A8010A = {
buildPhases = (
F50DFE19036C255E01A8010A,
F50DFE1A036C255E01A8010A,
F50DFE1B036C255E01A8010A,
F50DFE1C036C255E01A8010A,
F50DFE1D036C255E01A8010A,
);
buildSettings = {
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = "Ulis Template Editor";
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
WRAPPER_EXTENSION = bundle;
};
dependencies = (
);
isa = PBXBundleTarget;
name = "Uli's Template Editor";
productInstallPath = "$(USER_LIBRARY_DIR)/Bundles";
productName = "Uli's Template Editor";
productReference = F50DFE1F036C255E01A8010A;
productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string></string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>ResK</string>
<key>CFBundleVersion</key>
<string>0.0.1d1</string>
</dict>
</plist>
";
shouldUseHeadermap = 0;
};
F50DFE1F036C255E01A8010A = {
isa = PBXBundleReference;
path = "Ulis Template Editor.bundle";
refType = 3;
};
F50DFE20036C258201A8010A = {
children = (
F50DFE21036C258201A8010A,
F50DFE63036C258301A8010A,
F50DFE62036C258301A8010A,
F50DFE67036C258301A8010A,
F50DFE22036C258201A8010A,
F50DFE23036C258201A8010A,
F50DFE56036C258301A8010A,
F50DFE57036C258301A8010A,
F50DFE5A036C258301A8010A,
F50DFE5B036C258301A8010A,
F50DFE5C036C258301A8010A,
F50DFE5D036C258301A8010A,
F50DFE5E036C258301A8010A,
F50DFE5F036C258301A8010A,
F50DFE60036C258301A8010A,
F50DFE61036C258301A8010A,
F50DFE65036C258301A8010A,
F50DFE66036C258301A8010A,
F50DFE6D036C258301A8010A,
F50DFE6E036C258301A8010A,
F50DFE64036C258301A8010A,
F50DFE6C036C258301A8010A,
F50DFE58036C258301A8010A,
);
isa = PBXGroup;
path = "Uli's Template Editor";
refType = 2;
};
F50DFE21036C258201A8010A = {
isa = PBXFileReference;
path = .DS_Store;
refType = 4;
};
F50DFE22036C258201A8010A = {
isa = PBXFileReference;
path = BoolTemplateField.cpp;
refType = 4;
};
F50DFE23036C258201A8010A = {
isa = PBXFileReference;
path = BoolTemplateField.h;
refType = 4;
};
F50DFE56036C258301A8010A = {
isa = PBXFileReference;
path = DividerTemplateField.cpp;
refType = 4;
};
F50DFE57036C258301A8010A = {
isa = PBXFileReference;
path = DividerTemplateField.h;
refType = 4;
};
F50DFE58036C258301A8010A = {
children = (
F50DFE59036C258301A8010A,
);
isa = PBXVariantGroup;
name = InfoPlist.strings;
path = "";
refType = 4;
};
F50DFE59036C258301A8010A = {
isa = PBXFileReference;
name = English;
path = English.lproj/InfoPlist.strings;
refType = 4;
};
F50DFE5A036C258301A8010A = {
isa = PBXFileReference;
path = IntegerTemplateField.cpp;
refType = 4;
};
F50DFE5B036C258301A8010A = {
isa = PBXFileReference;
path = IntegerTemplateField.h;
refType = 4;
};
F50DFE5C036C258301A8010A = {
isa = PBXFileReference;
path = KHandleStream.cpp;
refType = 4;
};
F50DFE5D036C258301A8010A = {
isa = PBXFileReference;
path = KHandleStream.h;
refType = 4;
};
F50DFE5E036C258301A8010A = {
isa = PBXFileReference;
path = ListTemplateField.cpp;
refType = 4;
};
F50DFE5F036C258301A8010A = {
isa = PBXFileReference;
path = ListTemplateField.h;
refType = 4;
};
F50DFE60036C258301A8010A = {
isa = PBXFileReference;
path = LSTCTemplateField.cpp;
refType = 4;
};
F50DFE61036C258301A8010A = {
isa = PBXFileReference;
path = LSTCTemplateField.h;
refType = 4;
};
F50DFE62036C258301A8010A = {
isa = PBXFileReference;
path = main.cpp;
refType = 4;
};
F50DFE63036C258301A8010A = {
isa = PBXFileReference;
path = main.h;
refType = 4;
};
F50DFE64036C258301A8010A = {
isa = PBXFileReference;
path = main.r;
refType = 4;
};
F50DFE65036C258301A8010A = {
isa = PBXFileReference;
path = StringTemplateField.cpp;
refType = 4;
};
F50DFE66036C258301A8010A = {
isa = PBXFileReference;
path = StringTemplateField.h;
refType = 4;
};
F50DFE67036C258301A8010A = {
isa = PBXFileReference;
path = Templar.cpp;
refType = 4;
};
F50DFE6C036C258301A8010A = {
isa = PBXFileReference;
path = Templar.rsrc;
refType = 4;
};
F50DFE6D036C258301A8010A = {
isa = PBXFileReference;
path = TemplateWindow.cpp;
refType = 4;
};
F50DFE6E036C258301A8010A = {
isa = PBXFileReference;
path = TemplateWindow.h;
refType = 4;
};
F50DFE7F036C258301A8010A = {
fileRef = F50DFE22036C258201A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFE80036C258301A8010A = {
fileRef = F50DFE23036C258201A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEA8036C258301A8010A = {
fileRef = F50DFE56036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEA9036C258301A8010A = {
fileRef = F50DFE57036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAA036C258301A8010A = {
fileRef = F50DFE58036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAB036C258301A8010A = {
fileRef = F50DFE5A036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAC036C258301A8010A = {
fileRef = F50DFE5B036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAD036C258301A8010A = {
fileRef = F50DFE5C036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAE036C258301A8010A = {
fileRef = F50DFE5D036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEAF036C258301A8010A = {
fileRef = F50DFE5E036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB0036C258301A8010A = {
fileRef = F50DFE5F036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB1036C258301A8010A = {
fileRef = F50DFE60036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB2036C258301A8010A = {
fileRef = F50DFE61036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB6036C258301A8010A = {
fileRef = F50DFE65036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB7036C258301A8010A = {
fileRef = F50DFE66036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEB8036C258301A8010A = {
fileRef = F50DFE67036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEBC036C258301A8010A = {
fileRef = F50DFE6C036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEBD036C258301A8010A = {
fileRef = F50DFE6D036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEBE036C258301A8010A = {
fileRef = F50DFE6E036C258301A8010A;
isa = PBXBuildFile;
settings = {
};
};
F50DFEBF036C2C2D01A8010A = {
fileRef = F5B588920156D6D901000001;
isa = PBXBuildFile;
settings = {
};
};
F51C71F60269C7E701A8010C = {
fileRef = F54E622B021D192201A80001;
isa = PBXBuildFile;
@ -1275,6 +1697,7 @@
F5B588D20156D78201000001,
F5B588EE0156DAF301000001,
F5B5890B0156DC2201000001,
F50DFE1E036C255E01A8010A,
);
};
F5B588100156D2A601000001 = {
@ -1301,6 +1724,7 @@
F5B588D10156D78201000001,
F5B588ED0156DAF301000001,
F5B589030156DC2201000001,
F50DFE1F036C255E01A8010A,
);
isa = PBXGroup;
name = Products;
@ -1479,6 +1903,8 @@
F577A8FF0211E4D401A80001,
F577A8F50211D05E01A80001,
F577A8F90211DC1E01A80001,
F5041737036BD60801A8010A,
F50DFE18036C203F01A8010A,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@ -1692,6 +2118,8 @@
F5B588420156D40B01000001,
F5B588440156D40B01000001,
F5730B930159528A01000001,
F5041736036BD60801A8010A,
F50DFE16036C203F01A8010A,
F5B588460156D40B01000001,
F5B588470156D40B01000001,
F5B588480156D40B01000001,
@ -3725,6 +4153,7 @@
};
F5EA10690254A7B401A80001 = {
children = (
F50DFE20036C258201A8010A,
F5DF1BDA0254AD8801A80001,
F5DF1BEF0254AD8801A80001,
);