From: Andrew M. <fit...@us...> - 2007-06-03 03:23:42
|
Update of /cvsroot/radmind/radmind-assistant/rsm In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2754 Modified Files: RSMLoadsetEditor.h RSMLoadsetEditor.m Log Message: Support for minus lines in command files. Don't show arrows in pop-up button cells. Index: RSMLoadsetEditor.h =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rsm/RSMLoadsetEditor.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RSMLoadsetEditor.h 14 Dec 2005 18:34:23 -0000 1.7 --- RSMLoadsetEditor.h 3 Jun 2007 03:23:39 -0000 1.8 *************** *** 97,100 **** --- 97,101 ---- - ( void )setupKFileEntryTypePopups; + - ( void )setupKFileEntryMinusPopups; - ( oneway void )command: ( int )cmd finishedWithStatus: ( int )status inThread: ( int )ID; Index: RSMLoadsetEditor.m =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rsm/RSMLoadsetEditor.m,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** RSMLoadsetEditor.m 28 Mar 2006 18:48:36 -0000 1.18 --- RSMLoadsetEditor.m 3 Jun 2007 03:23:39 -0000 1.19 *************** *** 134,137 **** --- 134,138 ---- [ loadsetWindow setFrameAutosaveName: @"RSMLoadsetWindow" ]; + [ self setupKFileEntryMinusPopups ]; [ self setupKFileEntryTypePopups ]; [ self setupCommandFileNameCells ]; *************** *** 562,565 **** --- 563,583 ---- [ protoCell setEditable: YES ]; [ protoCell setBordered: NO ]; + [ protoCell setArrowPosition: NSPopUpNoArrow ]; + [ kColumn setDataCell: protoCell]; + [ protoCell release]; + } + + - ( void )setupKFileEntryMinusPopups + { + id protoCell = [[ NSPopUpButtonCell alloc ] + initTextCell: @"" pullsDown: NO ]; + NSTableColumn *kColumn = [ currentKFileTable tableColumnWithIdentifier: @"minus" ]; + + [ protoCell insertItemWithTitle: @" " atIndex: 0 ]; + [ protoCell insertItemWithTitle: @"-" atIndex: 1 ]; + + [ protoCell setEditable: YES ]; + [ protoCell setBordered: NO ]; + [ protoCell setArrowPosition: NSPopUpNoArrow ]; [ kColumn setDataCell: protoCell]; [ protoCell release]; *************** *** 722,725 **** --- 740,747 ---- } + if ( [[ dict objectForKey: @"minus" ] isEqualToString: @"-" ] ) { + fprintf( tmpkfile, "- " ); + } + fprintf( tmpkfile, "%s %s\n", ( char * )[[ dict objectForKey: @"type" ] UTF8String ], *************** *** 850,854 **** NSString *kfile; FILE *f; ! int tac; char tmp[ MAXPATHLEN ], buf[ MAXPATHLEN ]; char **targv; --- 872,876 ---- NSString *kfile; FILE *f; ! int tac, minus = 0; char tmp[ MAXPATHLEN ], buf[ MAXPATHLEN ]; char **targv; *************** *** 866,869 **** --- 888,892 ---- strcpy( tmp, buf ); tac = argcargv( buf, &targv ); + minus = 0; if ( tac == 0 ) { *************** *** 874,877 **** --- 897,913 ---- } + if ( strcmp( "-", targv[ 0 ] ) == 0 ) { + /* minus line */ + tac--; + targv++; + + if ( tac != 2 ) { + NSLog( @"Invalid command file line: %s", tmp ); + return; + } + + minus = 1; + } + switch ( *targv[ 0 ] ) { case 'n': *************** *** 882,885 **** --- 918,924 ---- [ NSString stringWithUTF8String: targv[ 0 ]], @"type", [ NSString stringWithUTF8String: targv[ 1 ]], @"tname", nil ]; + if ( minus ) { + [ kLine setObject: @"-" forKey: @"minus" ]; + } break; *************** *** 887,890 **** --- 926,930 ---- case '#': kLine = [ NSMutableDictionary dictionaryWithObjectsAndKeys: + @"#", @"minus", @"#", @"type", [ NSString stringWithUTF8String: tmp ], @"tname", nil ]; *************** *** 893,897 **** default: ! NSLog( @"Invalid line in command file: %s", buf ); return; } --- 933,937 ---- default: ! NSLog( @"Invalid command file line: %s", buf ); return; } *************** *** 1027,1054 **** forTableColumn: ( NSTableColumn * )column row: ( int )row { if ( row < 0 ) return; if ( [[ column identifier ] isEqualToString: @"tname" ] ) { [ aCell setTextColor: [ NSColor blackColor ]]; ! if ( [[[ _currentCommandFile objectAtIndex: row ] objectForKey: @"tname" ] ! characterAtIndex: 0 ] == '#' ) { [ aCell setTextColor: [ NSColor blueColor ]]; ! } else if ( [[[ _currentCommandFile objectAtIndex: row ] objectForKey: @"type" ] ! characterAtIndex: 0 ] == 'n' ) { [ aCell setTextColor: [ NSColor redColor ]]; } ! [ aCell setStringValue: [[ _currentCommandFile objectAtIndex: row ] objectForKey: @"tname" ]]; [ aCell setEditable: NO ]; } else if ( [[ column identifier ] isEqualToString: @"type" ] ) { [ aCell setEnabled: YES ]; ! if ( [[[ _currentCommandFile objectAtIndex: row ] objectForKey: @"type" ] ! characterAtIndex: 0 ] == '#' ) { [ aCell setEnabled: NO ]; } ! [ aCell selectItemWithTitle: ! [[ _currentCommandFile objectAtIndex: row ] objectForKey: @"type" ]]; } } --- 1067,1102 ---- forTableColumn: ( NSTableColumn * )column row: ( int )row { + id obj; + if ( row < 0 ) return; + + obj = [ _currentCommandFile objectAtIndex: row ]; if ( [[ column identifier ] isEqualToString: @"tname" ] ) { [ aCell setTextColor: [ NSColor blackColor ]]; ! if ( [[ obj objectForKey: @"tname" ] characterAtIndex: 0 ] == '#' ) { [ aCell setTextColor: [ NSColor blueColor ]]; ! } else if ( [[ obj objectForKey: @"type" ] ! characterAtIndex: 0 ] == 'n' ) { [ aCell setTextColor: [ NSColor redColor ]]; } ! [ aCell setStringValue: [ obj objectForKey: @"tname" ]]; [ aCell setEditable: NO ]; } else if ( [[ column identifier ] isEqualToString: @"type" ] ) { [ aCell setEnabled: YES ]; ! if ( [[ obj objectForKey: @"type" ] characterAtIndex: 0 ] == '#' ) { [ aCell setEnabled: NO ]; } ! [ aCell selectItemWithTitle: [ obj objectForKey: @"type" ]]; ! } else if ( [[ column identifier ] isEqualToString: @"minus" ] ) { ! [ aCell setEnabled: YES ]; ! ! if ( [[ obj objectForKey: @"minus" ] characterAtIndex: 0 ] == '#' ) { ! [ aCell setEnabled: NO ]; ! } ! [ aCell selectItemWithTitle: [ obj objectForKey: @"minus" ]]; } } *************** *** 1065,1073 **** forTableColumn: ( NSTableColumn * )tableColumn row: ( int )row { if ( row < 0 ) return; if ( [[ tableColumn identifier ] isEqualToString: @"type" ] ) { int index = [ object intValue ]; ! NSString *oldtype = [[ _currentCommandFile objectAtIndex: row ] objectForKey: @"type" ]; NSString *newtype; --- 1113,1125 ---- forTableColumn: ( NSTableColumn * )tableColumn row: ( int )row { + id item; + if ( row < 0 ) return; + item = [ _currentCommandFile objectAtIndex: row ]; + if ( [[ tableColumn identifier ] isEqualToString: @"type" ] ) { int index = [ object intValue ]; ! NSString *oldtype = [ item objectForKey: @"type" ]; NSString *newtype; *************** *** 1094,1099 **** if ( ! [ newtype isEqualToString: oldtype ] ) { ! [[ _currentCommandFile objectAtIndex: row ] ! setObject: newtype forKey: @"type" ]; [ self setCommandFileEdited: YES ]; } --- 1146,1175 ---- if ( ! [ newtype isEqualToString: oldtype ] ) { ! [ item setObject: newtype forKey: @"type" ]; ! [ self setCommandFileEdited: YES ]; ! } ! } else if ( [[ tableColumn identifier ] isEqualToString: @"minus" ] ) { ! int index = [ object intValue ]; ! NSString *old = [ item objectForKey: @"minus" ]; ! NSString *new; ! ! switch ( index ) { ! default: ! case 0: /* not a minus line */ ! new = @" "; ! break; ! ! case 1: /* minus line */ ! if ( [[ item objectForKey: @"type" ] isEqualToString: @"k" ] ) { ! /* minus k lines are not yet supported */ ! NSBeep(); ! return; ! } ! new = @"-"; ! break; ! } ! ! if ( ! [ new isEqualToString: old ] ) { ! [ item setObject: new forKey: @"minus" ]; [ self setCommandFileEdited: YES ]; } |