|
From: Geisschaes <gei...@us...> - 2005-05-09 19:49:31
|
Update of /cvsroot/macattrick/macattrick In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3842 Modified Files: FormulasViewController.h FormulasViewController.m Position.m PositionHeap.h PositionHeap.m Log Message: import and export buttons added. but import has some memory problem Index: Position.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Position.m,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Position.m 8 May 2005 20:17:47 -0000 1.10 --- Position.m 9 May 2005 19:48:49 -0000 1.11 *************** *** 419,423 **** ! + savePositionsToUserDefaults { NSEnumerator *en = [positionsDictionary objectEnumerator]; Position *current; --- 419,423 ---- ! + (void) savePositionsToUserDefaults { NSEnumerator *en = [positionsDictionary objectEnumerator]; Position *current; *************** *** 426,431 **** } } - (void)dealloc { ! [identifier release]; [super dealloc]; } --- 426,432 ---- } } + - (void)dealloc { ! // [identifier release]; [super dealloc]; } Index: FormulasViewController.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/FormulasViewController.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FormulasViewController.h 27 Feb 2005 15:14:44 -0000 1.5 --- FormulasViewController.h 9 May 2005 19:48:49 -0000 1.6 *************** *** 58,62 **** ! - (IBAction) export:(id)sender; --- 58,62 ---- ! - (IBAction) import:(id)sender; - (IBAction) export:(id)sender; Index: PositionHeap.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/PositionHeap.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PositionHeap.m 8 May 2005 20:17:48 -0000 1.2 --- PositionHeap.m 9 May 2005 19:48:49 -0000 1.3 *************** *** 55,64 **** } ! - (void) loadPositionHeapFromFileName: (NSString*) filename { NSDictionary *dic = [[NSDictionary alloc] initWithContentsOfFile:filename]; NSEnumerator *en = [dic keyEnumerator]; NSString *currentKey = nil; while(currentKey = [en nextObject]) { ! Position *newPosition = [[Position alloc] initFromSaveString:[dic valueForKey:currentKey]]; [positionsDictionary setValue: newPosition forKey: currentKey]; [newPosition release]; --- 55,65 ---- } ! - (void) loadPositionHeapFromFile: (NSString*) filename { NSDictionary *dic = [[NSDictionary alloc] initWithContentsOfFile:filename]; NSEnumerator *en = [dic keyEnumerator]; NSString *currentKey = nil; while(currentKey = [en nextObject]) { ! NSString *value = [dic valueForKey:currentKey]; ! Position *newPosition = [[Position alloc] initFromSaveString:value]; [positionsDictionary setValue: newPosition forKey: currentKey]; [newPosition release]; Index: FormulasViewController.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/FormulasViewController.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FormulasViewController.m 27 Feb 2005 15:14:44 -0000 1.5 --- FormulasViewController.m 9 May 2005 19:48:49 -0000 1.6 *************** *** 68,71 **** --- 68,74 ---- } + + + -(void) cancel { [self loadPositions]; *************** *** 104,107 **** --- 107,118 ---- + - (IBAction) import:(id)sender { + NSOpenPanel *sp = [NSOpenPanel openPanel]; + int runResult; + runResult = [sp runModal]; + if(runResult == NSOKButton) { + [[PositionHeap uniqueInstance] loadPositionHeapFromFile:[sp filename]]; + } + } Index: PositionHeap.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/PositionHeap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PositionHeap.h 8 May 2005 20:17:47 -0000 1.2 --- PositionHeap.h 9 May 2005 19:48:49 -0000 1.3 *************** *** 39,43 **** + (PositionHeap*) uniqueInstance; ! - (void) loadPositionHeapFromFileName: (NSString*) filename; - (Position*) positionWithIdentifier: (NSString*) positionsIdentifier; --- 39,43 ---- + (PositionHeap*) uniqueInstance; ! - (void) loadPositionHeapFromFile: (NSString*) filename; - (Position*) positionWithIdentifier: (NSString*) positionsIdentifier; *************** *** 49,53 **** - (NSArray*) positionsIdentifiers; - - (void) initialize; - (void) loadPositions; --- 49,52 ---- |