Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/mac-app/InputPanelController.m
8814 views
1
//
2
// InputPanelController.m
3
//
4
// Created by Ivan Andrus on 7/9/10.
5
// Copyright 2010 __MyCompanyName__. All rights reserved.
6
//
7
8
#import "InputPanelController.h"
9
#import "AppController.h"
10
11
@implementation InputPanelController
12
13
- (void)runCommand:(NSString*)command withPrompt:(NSString*)prompt withArguments:(NSString*)defArgs editingCommand:(BOOL)editable{
14
15
// If it wasn't closed, give the user a bit of a flicker so they know it's a different prompt
16
[self close];
17
18
[label setStringValue:prompt];
19
if (editable) {
20
[textField setStringValue: (defArgs == nil) ? command : [command stringByAppendingFormat:@" %@", defArgs]];
21
commandPrefix = @"";
22
} else {
23
[textField setStringValue: (defArgs == nil ) ? @"" : defArgs];
24
commandPrefix = [command retain];
25
}
26
[NSApp activateIgnoringOtherApps:YES];
27
[window makeKeyAndOrderFront:self];
28
[self showWindow:self];
29
}
30
31
- (IBAction)accept:(id)sender{
32
[self close];
33
NSString * command = [NSString stringWithFormat:@"%@ %@", commandPrefix, [textField stringValue]];
34
[appController terminalRun:command];
35
[commandPrefix release];
36
}
37
38
39
@end
40
41