=================================================================== RCS file: /home/cvs/OpenXM/src/cfep/MyDocument.m,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/cfep/MyDocument.m 2006/03/06 08:55:31 1.2 +++ OpenXM/src/cfep/MyDocument.m 2006/03/07 11:15:23 1.3 @@ -18,7 +18,15 @@ static int myDocumentSaidTheMessageAboutX = 0; @implementation MyDocument +// For OnState or OffState in the execution menu +static NSMenuItem *menuItemNotebookMode = nil; +static NSMenuItem *menuItemBasicMode = nil; +static NSMenuItem *menuItemRisaAsir = nil; +static NSMenuItem *menuItemKanSm1 = nil; +static NSMenuItem *menuItemOutputDebugMessages = nil; //cf. debugMyTunnel; +static NSMenuItem *menuItemPrettyPrint = nil; // prettyPrint. + - (void)dealloc { MyOutputWindowController *mowc; if (myDebug) NSLog(@"dealloc of MyDocument.\n"); @@ -140,6 +148,7 @@ static int myDocumentSaidTheMessageAboutX = 0; myDecoder = [[MyDecoder alloc] init]; [myDecoder retain]; [self openMyModel: myEnvironment ]; + [MyOpenGLController initMyOpenGLController]; // For the second execution, it will do nothing. } -(int) getMyDocumentKey { return myDocumentKey; } @@ -388,7 +397,8 @@ static int myDocumentSaidTheMessageAboutX = 0; else { MyOutputWindowController *mc; mc = [MyOutputWindowController sharedMyOutputWindowController: self]; - [mc outputStringToOutputWindow: amt]; + if (prettyPrint) [mc outputStringToOutputWindow: amt withColor: [NSColor blueColor]]; + else [mc outputStringToOutputWindow: amt]; } } - (void) outputErrorString: (NSString *) amt { @@ -976,6 +986,8 @@ int debugInbound = 0; NSRange r; NSRange r3; int currentLine,i; + [self outputErrorString: NSLocalizedString(@"Move to the line ",nil)]; + [self outputErrorString: [NSString stringWithFormat: @"%d\n",line]]; // move the selection to the line line. s = [textViewIn string]; if (onlySelectedArea || notebookMode) r = [textViewIn selectedRange]; @@ -996,6 +1008,8 @@ int debugInbound = 0; } -(int) gotoNextError: (id) sender{ int n; + if (onlySelectedArea || notebookMode) + [self outputErrorString: NSLocalizedString(@"The next error action will not work properly in this mode.\n",nil)]; n = [self nextLine: 0]; if (n >= 0) { [self gotoLine: n]; return n;} else return -1; @@ -1011,6 +1025,7 @@ int debugInbound = 0; return -1; } gid = [[a objectAtIndex: 0] intValue]; + if ([[a objectAtIndex: 1] hasPrefix: @"meta"]) {[self openGLMeta: [a objectAtIndex: 1] to: gid]; return; } [MyOpenGLController addOglComm: [a objectAtIndex: 1] to: gid from: self]; return 0; } @@ -1026,7 +1041,51 @@ int debugInbound = 0; [MyOpenGLController addOglInitComm: [a objectAtIndex: 1] to: gid from: self]; return 0; } +-(void)openGLMeta: (NSString *) cmd to: (int) gid{ + MyOpenGLController *oglc; + oglc = [MyOpenGLController getOglWindow: gid]; + if (!oglc) {[self outputErrorString: [NSString stringWithFormat: @"Invalid gid %d in openGLMeta\n",gid]]; return; } + if ([cmd hasPrefix: @"meta_showListOfOglComm"]) { + [self showListOfOglComm: gid]; return ; + }else if ([cmd hasPrefix: @"meta_removeAll"]) { + [oglc removeAllOfOglComm]; + }else if ([cmd hasPrefix: @"meta_removeLast"]) { + [oglc removeLastOfOglComm]; + }else if ([cmd hasPrefix: @"meta_removeAllInit"]) { + [oglc removeAllOfOglInitComm]; + }else if ([cmd hasPrefix: @"meta_removeLastInit"]) { + [oglc removeLastOfOglInitComm]; + }else{ + [self outputErrorString: [NSString stringWithFormat: @"Unknown OpenGL meta command %@\n",cmd]]; + } +} +-(void) showListOfOglComm: (int) gid { + MyDocument *md; + MyOpenGLController *oglc; + NSMutableArray *comm; + int i,n; + md = self; + oglc = [MyOpenGLController getOglWindow: gid]; + if (!oglc) {[self outputErrorString: @"Invalid gid in showListOfOglComm\n"]; return; } + comm = [oglc getListOfOglInitComm]; + n = [comm count]; + [md outputString: NSLocalizedString(@"OpenGL init commands\n",nil)]; + for (i=0; i