=================================================================== RCS file: /home/cvs/OpenXM/src/cfep/MyDocument.m,v retrieving revision 1.4 retrieving revision 1.13 diff -u -p -r1.4 -r1.13 --- OpenXM/src/cfep/MyDocument.m 2006/03/08 04:58:14 1.4 +++ OpenXM/src/cfep/MyDocument.m 2016/10/07 05:13:42 1.13 @@ -74,6 +74,11 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret [self addMenuExec]; // adding the execution menu. [textViewIn setAllowsUndo:YES]; if ([textViewIn isContinuousSpellCheckingEnabled]) [textViewIn toggleContinuousSpellChecking: self]; // Turn off the spell checking. + if ([textViewIn isAutomaticQuoteSubstitutionEnabled]) [textViewIn toggleAutomaticQuoteSubstitution: self]; // Turn off the smart quote. + if ([MyEnvironment isX11Installed] != 1) + [self messageDialog: NSLocalizedString(@"XQuartz(X11) is not installed and cfep/asir will not run properly. To install it, visit http://www.xquartz.org.",nil) with: 0]; +// if ([MyEnvironment isGccInstalled] != 1) +// [self messageDialog: NSLocalizedString(@"gcc is not installed. To install it, insert MacOS DVD1 and open Xcode Tools->XcodeTools.mpkg",nil) with: 0]; [self sayTheMessageAboutX]; [self initAux]; } @@ -152,7 +157,7 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret [self openMyModel: myEnvironment ]; [MyOpenGLController initMyOpenGLController]; // For the second execution, it will do nothing. } --(int) getMyDocumentKey { return myDocumentKey; } +-(NSString *) getMyDocumentKey { return myDocumentKey; } -(id) openMyModel: (MyEnvironment *) myEnvironment { [myEnvironment showForDebug]; // for debug. @@ -167,7 +172,7 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret [peerEndEvaluteMark retain]; [self stopIndicator]; - if (NoEngine && (!restartMode)) { task = nil; return; } + if (NoEngine && (!restartMode)) { task = nil; return self; } // Initialization to call /bin/bash outboundPipe = [NSPipe pipe]; // since autorelease is called in pipe. @@ -244,9 +249,27 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret -(void) sayTheMessageAboutX { NSLog(@"myDocumentSaidTheMessageAboutX=%d\n",myDocumentSaidTheMessageAboutX); if (!myDocumentSaidTheMessageAboutX) { - if ([MyEnvironment checkX] != 1) - [self messageDialog: - NSLocalizedString(@"A few commands (plot, ...) cannot be used, because X11 is not running.",nil) with: 0]; + // [[NSWorkspace sharedWorkspace] launchApplication: @"Console"]; // check if it works for apps in Utilities + if ([MyEnvironment checkX] != 1) { + // [self messageDialog: + // NSLocalizedString(@"A few commands (plot, ...) cannot be used, because X11 is not running.",nil) with: 0]; + [self changeOutputCounterFieldWithString: + [NSLocalizedString(@"Output mini-view: ",nil) stringByAppendingString: + NSLocalizedString(@"Starting XQuartz(X11). Please wait.",nil)]]; + if ([[NSWorkspace sharedWorkspace] launchApplication: @"XQuartz"]) { + NSLog(@"Starting XQuartz.\n"); + }else{ + NSLog(@"Starting XQuartz failed.\n"); + [self messageDialog: + NSLocalizedString(@"Starting XQuartz(X11) failed. A few commands (plot, ...) cannot be used, because X11 is not running.",nil) with: 0]; + } + while ([MyEnvironment checkX]!=1) { + sleep(1); + } + [self changeOutputCounterFieldWithString: + [NSLocalizedString(@"Output mini-view: ",nil) stringByAppendingString: + NSLocalizedString(@"Started XQuartz(X11)",nil)]]; + } myDocumentSaidTheMessageAboutX = 1; } } @@ -289,7 +312,13 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret [textViewIn replaceCharactersInRange: NSMakeRange(pos,0) withString: @"\n"]; } cmd0 = [cmd0 substringWithRange:r ]; - } + } + [self outputBorderLine: [NSColor magentaColor]]; + [self outputString: cmd0]; + if ([cmd0 length] > 0) { + if ([cmd0 characterAtIndex: ([cmd0 length]-1)] != 0xa) [self outputString: @"\n"]; + } + [self outputBorderLine: [NSColor yellowColor]]; }else{ cmd0 = [textViewIn string]; MyOutputWindowController *mc; @@ -408,6 +437,11 @@ static NSMenuItem *menuItemPrettyPrint = nil; // pret else [mc outputStringToOutputWindow: amt]; } } +-(void)outputBorderLine: (NSColor *)color { + MyOutputWindowController *mc; + mc = [MyOutputWindowController sharedMyOutputWindowController: self]; + [mc outputStringToOutputWindow: @"----------------------------------------\n" withColor: color]; +} - (void) outputErrorString: (NSString *) amt { int oldEnd; int newEnd; @@ -1032,7 +1066,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; } + if ([[a objectAtIndex: 1] hasPrefix: @"meta"]) {[self openGLMeta: [a objectAtIndex: 1] to: gid]; return 0; } [MyOpenGLController addOglComm: [a objectAtIndex: 1] to: gid from: self]; return 0; } @@ -1051,7 +1085,8 @@ int debugInbound = 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 (!oglc) {[self printErrorMessage: + [NSString stringWithFormat: @"Invalid gid %d in openGLMeta command %@\n",gid,cmd]]; return; } if ([cmd hasPrefix: @"meta_showListOfOglComm"]) { [self showListOfOglComm: gid]; return ; }else if ([cmd hasPrefix: @"meta_removeAllInit"]) { // longer command must come first, because we use prefix. @@ -1063,7 +1098,7 @@ int debugInbound = 0; }else if ([cmd hasPrefix: @"meta_removeLast"]) { [oglc removeLastOfOglComm]; }else{ - [self outputErrorString: [NSString stringWithFormat: @"Unknown OpenGL meta command %@\n",cmd]]; + [self printErrorMessage: [NSString stringWithFormat: @"Unknown OpenGL meta command %@\n",cmd]]; } } -(void) showListOfOglComm: (int) gid { @@ -1108,7 +1143,7 @@ int debugInbound = 0; // NSLog(@"%@",a); if ([[a objectAtIndex: 0] hasPrefix: @"notAvailable"]) { [self messageDialog: - NSLocalizedString(@"Typeset the output by TeX is not available. latex, dvips, and pstoimg must be installed.",nil) with: 0]; + NSLocalizedString(@"Typeset the output by TeX is not available. latex and dvipng must be installed.",nil) with: 0]; prettyPrint = 1; [self setPrettyPrint: nil]; return; } else if ([[a objectAtIndex: 0] compare: @"showFile"] == NSOrderedSame) {