From: Andrew M. <fit...@us...> - 2006-02-24 22:00:12
|
Update of /cvsroot/radmind/radmind-assistant/rte In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17373 Modified Files: RXTranscript.h RXTranscript.m Log Message: [Bug 1380698] - fix for info tab updates. [Bug 1357554] - path preferences. [Bug 1377424] - path preferences. "Go to line" inteface added. twhich display support. Optional wildcard searches. Index: RXTranscript.m =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/RXTranscript.m,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** RXTranscript.m 15 Nov 2005 19:28:26 -0000 1.102 --- RXTranscript.m 24 Feb 2006 22:00:02 -0000 1.103 *************** *** 32,35 **** --- 32,36 ---- #import "NSImage-RTEExtensions.h" #import "NSAttributedString-Ellipsis.h" + #import "UMWildcard.h" #include <sys/param.h> *************** *** 44,47 **** --- 45,49 ---- #define TWRITE 1 #define FSDIFF 2 + #define TWHICH 3 @implementation RXTranscript *************** *** 301,305 **** [ op setAllowsMultipleSelection: NO ]; [ op setCanChooseDirectories: YES ]; ! /* undocumented method to display hidden files */ if ( [ op respondsToSelector: @selector( _navView ) ] ) { --- 303,307 ---- [ op setAllowsMultipleSelection: NO ]; [ op setCanChooseDirectories: YES ]; ! /* undocumented method to display hidden files */ if ( [ op respondsToSelector: @selector( _navView ) ] ) { *************** *** 325,328 **** --- 327,332 ---- - ( IBAction )addItem: ( id )sender { + NSString *fsdiffOrigin = nil; + NSString *itemPath; BOOL isDir; int rc; *************** *** 364,370 **** [ NSApp endSheet: addItemPanel ]; [ self readFile: [ NSDictionary dictionaryWithObjectsAndKeys: [ NSNumber numberWithInt: FSDIFF ], @"action", ! [ addItemPathField stringValue ], @"filea", @"", @"fileb", nil ]]; --- 368,383 ---- [ NSApp endSheet: addItemPanel ]; + if (( fsdiffOrigin = [[ NSUserDefaults standardUserDefaults ] + objectForKey: @"RTEBasePath" ] ) == nil || + [ fsdiffOrigin isEqualToString: @"/" ] ) { + fsdiffOrigin = @""; + } + + itemPath = [ fsdiffOrigin stringByAppendingString: + [ addItemPathField stringValue ]]; + [ self readFile: [ NSDictionary dictionaryWithObjectsAndKeys: [ NSNumber numberWithInt: FSDIFF ], @"action", ! itemPath, @"filea", @"", @"fileb", nil ]]; *************** *** 857,860 **** --- 870,882 ---- [ rxtbarItem setAction: @selector( auditTranscript: ) ]; [ rxtbarItem setTarget: self ]; + } else if ( [ itemIdent isEqualToString: RTEToolbarTwhichIdentifier ] ) { + [ rxtbarItem setLabel: NSLocalizedString( @"Source Transcript", @"Source Transcript" ) ]; + [ rxtbarItem setPaletteLabel: NSLocalizedString( @"Source Transcript", @"Source Transcript" ) ]; + [ rxtbarItem setToolTip: NSLocalizedString( + @"Show transcripts containing the selected path", + @"Show transcripts containing the selected path" ) ]; + [ rxtbarItem setImage: [ NSImage imageNamed: @"comment.png" ]]; + [ rxtbarItem setAction: @selector( showSourceTranscripts: ) ]; + [ rxtbarItem setTarget: self ]; } *************** *** 1028,1031 **** --- 1050,1097 ---- } + - ( void )showSourceTranscripts: ( id )sender + { + NSArray *args, *lines; + NSString *path; + int row; + + if (( row = [ tContentsTableView selectedRow ] ) < 0 ) { + return; + } + + lines = ( mode == SEARCH ? searchResults : parsedLines ); + + if (( path = [[ lines objectAtIndex: row ] objectForKey: @"path" ] ) == nil ) { + return; + } + + args = [ NSArray arrayWithObjects: @"-A", @"ExecuteCommand", + [ NSString stringWithFormat: @"-U%@", + [[ self delegate ] sessionUserName ]], + @"--", @"/usr/local/bin/twhich", + @"-a", path, nil ]; + + [ self executeAuthorizedAction: TWHICH arguments: args ]; + } + + - ( oneway void )displayTwhichOutput: ( NSString * )output fromThreadWithID: ( int )ID + { + NSString *string; + + if ( ID != [ self helperThreadID ] ) { + return; + } + + string = [ output retain ]; + + if ( twhichDisplay == nil ) { + twhichDisplay = [[ RTETwhichDisplay alloc ] init ]; + [ NSBundle loadNibNamed: @"TwhichResults" owner: twhichDisplay ]; + } + + [ twhichDisplay parseAndDisplayTwhichString: string ]; + [ string release ]; + } + - ( IBAction )toggleCommentOnSelectedLine: ( id )sender { *************** *** 1150,1173 **** } ! #ifdef notdef ! - ( IBAction )jumpToLine: ( id )sender { ! unsigned long int ln; ! int i; ! for ( i = 0; i < [[ tbJumpToLineField stringValue ] length ]; i++ ) { ! char c = [[ tbJumpToLineField stringValue ] ! characterAtIndex: i ]; ! if ( ! isdigit( c )) { ! NSRunAlertPanel( @"Error", @"The line number must only contain digits.", ! @"OK", @"", @"" ); ! return; ! } } /* subtract one: rows are counted from 0, not 1 ) */ ! ln = ( [ tbJumpToLineField intValue ] - 1 ); ! ! if ( ln < 0 || ln > [ ( mode == SEARCH ? searchResults : parsedLines ) count ] ) ln = 0; [ tContentsTableView selectRow: ln byExtendingSelection: NO ]; --- 1216,1239 ---- } ! - ( IBAction )showGotoLinePanel: ( id )sender { ! [ gotoLinePanel makeKeyAndOrderFront: nil ]; ! } ! ! - ( IBAction )gotoLine: ( id )sender ! { ! NSMutableArray *lines = parsedLines; ! int ln; ! if ( mode == SEARCH ) { ! lines = searchResults; } /* subtract one: rows are counted from 0, not 1 ) */ ! ln = ( [ gotoLineField intValue ] - 1 ); ! if (( ln < 0 ) || ( ln >= [ lines count ] )) { ! NSBeep(); ! return; ! } [ tContentsTableView selectRow: ln byExtendingSelection: NO ]; *************** *** 1175,1179 **** [ tWindow makeFirstResponder: tContentsTableView ]; } - #endif /* notdef */ - ( void )controlTextDidChange: ( NSNotification * )aNotification --- 1241,1244 ---- *************** *** 1201,1208 **** --- 1266,1277 ---- { NSString *searchkey = nil, *searchString = searchTerm; + BOOL wildcard; int i; [ searchResults removeAllObjects ]; + wildcard = [[ NSUserDefaults standardUserDefaults ] + boolForKey: @"RTEWildcardSearches" ]; + mode = SEARCH; *************** *** 1237,1247 **** NSDictionary *dict = [ parsedLines objectAtIndex: i ]; NSString *tl = [ dict objectForKey: searchkey ]; ! if ( tl == nil ) continue; ! if ( [ tl containsString: searchString useCaseInsensitiveComparison: ci ] ) { ! [ searchResults addObject: dict ]; ! } } [ tContentsTableView reloadData ]; [ lineCountField setStringValue: [ NSString stringWithFormat: @"%d match%@", --- 1306,1327 ---- NSDictionary *dict = [ parsedLines objectAtIndex: i ]; NSString *tl = [ dict objectForKey: searchkey ]; + BOOL match = NO; ! if ( tl == nil ) { ! continue; ! } ! if ( wildcard ) { ! match = [ tl matchesWildcard: searchString caseSensitive: !ci ]; ! } else { ! match = [ tl containsString: searchString ! useCaseInsensitiveComparison: ci ]; ! } ! ! if ( match ) { ! [ searchResults addObject: dict ]; ! } } + [ tContentsTableView reloadData ]; [ lineCountField setStringValue: [ NSString stringWithFormat: @"%d match%@", *************** *** 1623,1626 **** --- 1703,1707 ---- [ tWindow setDocumentEdited: YES ]; + [ self showInfo: nil ]; } *************** *** 1687,1690 **** --- 1768,1772 ---- [ tWindow setDocumentEdited: YES ]; [ self updateChangeCount: NSChangeDone ]; + [ self showInfo: nil ]; } *************** *** 1821,1824 **** --- 1903,1907 ---- [ tWindow setDocumentEdited: YES ]; + [ self showInfo: nil ]; } *************** *** 2653,2657 **** ofSubviewAt: ( int )offset { ! return(( proposedMax - 210.0 )); } --- 2736,2740 ---- ofSubviewAt: ( int )offset { ! return(( proposedMax - 316.0 )); } *************** *** 2660,2664 **** ofSubviewAt: ( int )offset { ! return(( proposedMin + 210.0 )); } --- 2743,2747 ---- ofSubviewAt: ( int )offset { ! return(( proposedMin + 316.0 )); } Index: RXTranscript.h =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/RXTranscript.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** RXTranscript.h 19 May 2005 00:10:54 -0000 1.39 --- RXTranscript.h 24 Feb 2006 22:00:02 -0000 1.40 *************** *** 30,33 **** --- 30,34 ---- #import "RMSplitView.h" #import "RTEAuditorDisplay.h" + #import "RTETwhichDisplay.h" #include <pwd.h> *************** *** 40,48 **** #define RTEToolbarDeleteIdentifier @"RTEToolbarDelete" #define RTEToolbarSearchIdentifier @"RTEToolbarSearch" - #define RTEToolbarJumpToLineIdentifier @"RTEToolbarJumpToLine" #define RTEToolbarConvertIdentifier @"RTEToolbarConvert" #define RTEToolbarToggleCommentIdentifier @"RTEToolbarToggleComment" #define RTEToolbarAddCommentIdentifier @"RTEToolbarAddComment" #define RTEToolbarAuditIdentifier @"RTEToolbarAudit" /* custom pasteboard type */ --- 41,49 ---- #define RTEToolbarDeleteIdentifier @"RTEToolbarDelete" #define RTEToolbarSearchIdentifier @"RTEToolbarSearch" #define RTEToolbarConvertIdentifier @"RTEToolbarConvert" #define RTEToolbarToggleCommentIdentifier @"RTEToolbarToggleComment" #define RTEToolbarAddCommentIdentifier @"RTEToolbarAddComment" #define RTEToolbarAuditIdentifier @"RTEToolbarAudit" + #define RTEToolbarTwhichIdentifier @"RTEToolbarTwhich" /* custom pasteboard type */ *************** *** 94,97 **** --- 95,102 ---- IBOutlet NSButton *advancedSearchCaseSensitivity; + /* go to line panel */ + IBOutlet NSPanel *gotoLinePanel; + IBOutlet NSTextField *gotoLineField; + /* window split view */ IBOutlet RMSplitView *transcriptSplitView; *************** *** 147,150 **** --- 152,156 ---- RTEAuditorDisplay *auditorDisplay; + RTETwhichDisplay *twhichDisplay; @private *************** *** 210,213 **** --- 216,224 ---- - ( void )auditTranscript: ( id )sender; + /* twhich methods */ + - ( void )showSourceTranscripts: ( id )sender; + - ( oneway void )displayTwhichOutput: ( NSString * )output + fromThreadWithID: ( int )ID; + /* comment methods */ - ( IBAction )toggleCommentOnSelectedLine: ( id )sender; *************** *** 224,227 **** --- 235,242 ---- - ( void )searchFor: ( NSString * )searchString searchType: ( int )type caseInsensitive: ( BOOL )ci; + + /* go to line */ + - ( IBAction )showGotoLinePanel: ( id )sender; + - ( IBAction )gotoLine: ( id )sender; /* conversion methods */ *************** *** 237,240 **** --- 252,257 ---- - ( IBAction )toggleDrawer: ( id )sender; + - ( NSString * )retrievePassword; + @end |