version 1.3, 2006/03/07 11:15:23 |
version 1.4, 2006/03/08 04:58:14 |
Line 18 static int myDocumentSaidTheMessageAboutX = 0; |
|
Line 18 static int myDocumentSaidTheMessageAboutX = 0; |
|
|
|
|
|
@implementation MyDocument |
@implementation MyDocument |
|
static int NoEngine = 0; // experimental. |
|
static NSMenuItem *menuItemNoEngine = nil; // NoEngine |
// For OnState or OffState in the execution menu |
// For OnState or OffState in the execution menu |
static NSMenuItem *menuItemNotebookMode = nil; |
static NSMenuItem *menuItemNotebookMode = nil; |
static NSMenuItem *menuItemBasicMode = nil; |
static NSMenuItem *menuItemBasicMode = nil; |
Line 165 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
Line 167 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
[peerEndEvaluteMark retain]; |
[peerEndEvaluteMark retain]; |
|
|
[self stopIndicator]; |
[self stopIndicator]; |
|
if (NoEngine && (!restartMode)) { task = nil; return; } |
|
|
// Initialization to call /bin/bash |
// Initialization to call /bin/bash |
outboundPipe = [NSPipe pipe]; // since autorelease is called in pipe. |
outboundPipe = [NSPipe pipe]; // since autorelease is called in pipe. |
inboundPipe = [NSPipe pipe]; |
inboundPipe = [NSPipe pipe]; |
Line 227 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
Line 231 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
|
|
-(id) restartMyModel: (enum peer_type) peerType { |
-(id) restartMyModel: (enum peer_type) peerType { |
MyEnvironment *myEnvironment; |
MyEnvironment *myEnvironment; |
|
restartMode = 1; |
[self closeMyModel]; |
[self closeMyModel]; |
myEnvironment = [[MyEnvironment alloc] initFor: peerType]; //BUG. leak memory? |
myEnvironment = [[MyEnvironment alloc] initFor: peerType]; //BUG. leak memory? |
[myEnvironment retain]; |
[myEnvironment retain]; |
Line 251 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
Line 256 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
NSMutableString *cmd; |
NSMutableString *cmd; |
NSRange r; |
NSRange r; |
|
|
|
if (!task) return; |
if (inEvaluation) { |
if (inEvaluation) { |
NSLog(@"In evaluatioin. "); |
NSLog(@"In evaluatioin. "); |
[self messageDialog: NSLocalizedString(@"Evaluating...",nil) with: 0]; |
[self messageDialog: NSLocalizedString(@"Evaluating...",nil) with: 0]; |
Line 313 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
Line 319 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
[alert release]; |
[alert release]; |
|
|
fprintf(stderr,"Trying to interrupt.\n"); |
fprintf(stderr,"Trying to interrupt.\n"); |
[task interrupt]; |
if (task) [task interrupt]; |
inputCounter = outputCounter = 0; |
inputCounter = outputCounter = 0; |
[self stopIndicator]; |
[self stopIndicator]; |
[myDecoder reset]; |
[myDecoder reset]; |
Line 370 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
Line 376 static NSMenuItem *menuItemPrettyPrint = nil; // pret |
|
NSLog(@"Evaluating... "); |
NSLog(@"Evaluating... "); |
NSLog(@"%@",cmd); |
NSLog(@"%@",cmd); |
// Evaluation is here. |
// Evaluation is here. |
|
if (!task) return -1; |
cmdInData = [cmd dataUsingEncoding: NSUTF8StringEncoding]; |
cmdInData = [cmd dataUsingEncoding: NSUTF8StringEncoding]; |
@try { |
@try { |
//todo if (yes) [outboundFileHandle writeData: peerStartEvaluateMark]; |
//todo if (yes) [outboundFileHandle writeData: peerStartEvaluateMark]; |
Line 1047 int debugInbound = 0; |
|
Line 1054 int debugInbound = 0; |
|
if (!oglc) {[self outputErrorString: [NSString stringWithFormat: @"Invalid gid %d in openGLMeta\n",gid]]; return; } |
if (!oglc) {[self outputErrorString: [NSString stringWithFormat: @"Invalid gid %d in openGLMeta\n",gid]]; return; } |
if ([cmd hasPrefix: @"meta_showListOfOglComm"]) { |
if ([cmd hasPrefix: @"meta_showListOfOglComm"]) { |
[self showListOfOglComm: gid]; return ; |
[self showListOfOglComm: gid]; return ; |
|
}else if ([cmd hasPrefix: @"meta_removeAllInit"]) { // longer command must come first, because we use prefix. |
|
[oglc removeAllOfOglInitComm]; |
|
}else if ([cmd hasPrefix: @"meta_removeLastInit"]) { |
|
[oglc removeLastOfOglInitComm]; |
}else if ([cmd hasPrefix: @"meta_removeAll"]) { |
}else if ([cmd hasPrefix: @"meta_removeAll"]) { |
[oglc removeAllOfOglComm]; |
[oglc removeAllOfOglComm]; |
}else if ([cmd hasPrefix: @"meta_removeLast"]) { |
}else if ([cmd hasPrefix: @"meta_removeLast"]) { |
[oglc removeLastOfOglComm]; |
[oglc removeLastOfOglComm]; |
}else if ([cmd hasPrefix: @"meta_removeAllInit"]) { |
|
[oglc removeAllOfOglInitComm]; |
|
}else if ([cmd hasPrefix: @"meta_removeLastInit"]) { |
|
[oglc removeLastOfOglInitComm]; |
|
}else{ |
}else{ |
[self outputErrorString: [NSString stringWithFormat: @"Unknown OpenGL meta command %@\n",cmd]]; |
[self outputErrorString: [NSString stringWithFormat: @"Unknown OpenGL meta command %@\n",cmd]]; |
} |
} |
Line 1188 int debugInbound = 0; |
|
Line 1195 int debugInbound = 0; |
|
if (menuItemPrettyPrint) [menuItemPrettyPrint setState: NSOnState]; |
if (menuItemPrettyPrint) [menuItemPrettyPrint setState: NSOnState]; |
} |
} |
} |
} |
|
-(void) setNoEngine: (id) sender { |
|
if (NoEngine) { |
|
NoEngine = 0; |
|
if (menuItemNoEngine) [menuItemNoEngine setState: NSOffState]; |
|
} else { |
|
NoEngine = 1; |
|
if (menuItemNoEngine) [menuItemNoEngine setState: NSOnState]; |
|
} |
|
} |
|
|
-(void) loadAsirContrib: (id) sender { |
-(void) loadAsirContrib: (id) sender { |
NSString *com; |
NSString *com; |
Line 1274 int debugInbound = 0; |
|
Line 1290 int debugInbound = 0; |
|
[menuItemGotoNextError setTarget: [[NSApp mainWindow] document]]; |
[menuItemGotoNextError setTarget: [[NSApp mainWindow] document]]; |
[menuExec addItem: menuItemGotoNextError]; |
[menuExec addItem: menuItemGotoNextError]; |
|
|
// outputDebugMessage |
|
menuItemOutputDebugMessages = [[[NSMenuItem alloc] init] autorelease]; [menuItemOutputDebugMessages retain]; |
|
[menuItemOutputDebugMessages setTitle: NSLocalizedString(@"Output debug messages",nil)]; |
|
[menuItemOutputDebugMessages setAction: @selector(setDebugMyTunnel:)]; |
|
[menuItemOutputDebugMessages setTarget: [[NSApp mainWindow] document]]; |
|
[menuExec addItem: menuItemOutputDebugMessages]; |
|
|
|
// pretty print |
// pretty print |
menuItemPrettyPrint = [[[NSMenuItem alloc] init] autorelease]; [menuItemPrettyPrint retain]; // it is the static variable. |
menuItemPrettyPrint = [[[NSMenuItem alloc] init] autorelease]; [menuItemPrettyPrint retain]; // it is the static variable. |
[menuItemPrettyPrint setTitle: NSLocalizedString(@"Typeset the output by TeX",nil)]; |
[menuItemPrettyPrint setTitle: NSLocalizedString(@"Typeset the output by TeX",nil)]; |
Line 1335 int debugInbound = 0; |
|
Line 1344 int debugInbound = 0; |
|
[menuExec addItem: menuItemSelectEngine]; |
[menuExec addItem: menuItemSelectEngine]; |
[self updateSelectEngineMenu]; |
[self updateSelectEngineMenu]; |
|
|
|
// outputDebugMessage |
|
menuItemOutputDebugMessages = [[[NSMenuItem alloc] init] autorelease]; [menuItemOutputDebugMessages retain]; |
|
[menuItemOutputDebugMessages setTitle: NSLocalizedString(@"Output debug messages",nil)]; |
|
[menuItemOutputDebugMessages setAction: @selector(setDebugMyTunnel:)]; |
|
[menuItemOutputDebugMessages setTarget: [[NSApp mainWindow] document]]; |
|
[menuExec addItem: menuItemOutputDebugMessages]; |
|
|
|
// NoEngine |
|
menuItemNoEngine = [[[NSMenuItem alloc] init] autorelease]; [menuItemNoEngine retain]; // it is the static variable. |
|
[menuItemNoEngine setTitle: NSLocalizedString(@"Do not start engine at startup",nil)]; |
|
[menuItemNoEngine setAction: @selector(setNoEngine:)]; |
|
[menuItemNoEngine setTarget: [[NSApp mainWindow] document]]; |
|
[menuExec addItem: menuItemNoEngine]; |
|
|
// test |
// test |
menuItemForTest = [[[NSMenuItem alloc] init] autorelease]; |
menuItemForTest = [[[NSMenuItem alloc] init] autorelease]; |