=================================================================== RCS file: /home/cvs/OpenXM/src/cfep/MyDocument.m,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -p -r1.1.1.1 -r1.3 --- OpenXM/src/cfep/MyDocument.m 2006/03/03 23:31:12 1.1.1.1 +++ 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"); @@ -63,6 +71,7 @@ static int myDocumentSaidTheMessageAboutX = 0; } [self addMenuExec]; // adding the execution menu. [textViewIn setAllowsUndo:YES]; + if ([textViewIn isContinuousSpellCheckingEnabled]) [textViewIn toggleContinuousSpellChecking: self]; // Turn off the spell checking. [self sayTheMessageAboutX]; [self initAux]; } @@ -139,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; } @@ -387,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 { @@ -481,7 +492,7 @@ static int myDocumentSaidTheMessageAboutX = 0; //bug. temporary. path = [OpenXM_HOME stringByAppendingString: @"/doc/cfep/intro-ja.html"]; - ans = [[NSWorkspace sharedWorkspace] openFile:path withApplication: @"Help Viewer"]; + ans = [[NSWorkspace sharedWorkspace] openFile:path withApplication: @"Safari"]; //We do not use Help Viewer if (ans != YES) { [self messageDialog: NSLocalizedString(@"Help file is not found at cfep.app/OpenXM/doc/cfep",nil) with: 0]; } @@ -575,8 +586,10 @@ int debugInbound = 0; if (debugMyTunnel) [self outputErrorString: act]; // for debug. channel = [myDecoder getChannel]; if (channel == 0) [self errorActionFor: act]; + // cf. MyDecode.h for the list of channel numbers. else if (channel == 1) [self openGLActionFor: act]; else if (channel == 2) [self openGLInitActionFor: act]; + else if (channel == 10) [self pngActionFor: act]; } state = 0; break; default: @@ -973,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]; @@ -993,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; @@ -1008,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; } @@ -1023,7 +1041,87 @@ 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