reset / hard reset menus.

This commit is contained in:
Kelvin Sherlock 2018-02-28 21:06:06 -05:00
parent bcf03e124b
commit 020b095542
11 changed files with 80 additions and 47 deletions

View File

@ -268,13 +268,16 @@
} }
-(void)reset -(void)reset: (BOOL)hard
{ {
%%write init; %%write init;
_context.window = iRect(0, 0, _columns, 24);
_context.cursor = iPoint(0,0);
_context.flags = 0; _context.flags = 0;
if (hard) {
_context.window = iRect(0, 0, _columns, 24);
_context.cursor = iPoint(0,0);
}
} }
-(BOOL)resizable -(BOOL)resizable
@ -299,7 +302,7 @@
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
[self reset]; [self reset: YES];
} }
return self; return self;
@ -414,9 +417,9 @@
return "appleIIe"; return "appleIIe";
} }
-(void) reset { -(void) reset: (BOOL)hard {
_columns = 40; _columns = 40;
[super reset]; [super reset: hard];
} }
-(CharacterGenerator *)characterGenerator { -(CharacterGenerator *)characterGenerator {
@ -448,9 +451,9 @@
return "appleIIe"; return "appleIIe";
} }
-(void) reset { -(void) reset: (BOOL)hard {
_columns = 80; _columns = 80;
[super reset]; [super reset: hard];
} }
@end @end

View File

@ -50,7 +50,7 @@ extern "C" unsigned EventCharacters(NSEvent *event, std::u32string &rv);
-(void)keyDown: (NSEvent *)event screen: (Screen *)screen output: (OutputChannel *)output; -(void)keyDown: (NSEvent *)event screen: (Screen *)screen output: (OutputChannel *)output;
-(void)reset; -(void)reset: (BOOL)hard;
+(NSString *)name; +(NSString *)name;
-(NSString *)name; -(NSString *)name;

View File

@ -411,19 +411,19 @@
} }
-(void)reset -(void)reset: (BOOL)hard
{ {
%%write init; %%write init;
_context.flags = 0; _context.flags = 0;
_context.window = iRect(0, 0, 80, 24);
_context.cursor = iPoint(0,0);
_cursorType = Screen::CursorTypeUnderscore; _cursorType = Screen::CursorTypeUnderscore;
// set flags to plain text. if (hard) {
_context.window = iRect(0, 0, 80, 24);
_context.cursor = iPoint(0,0);
}
} }
-(BOOL)resizable -(BOOL)resizable
@ -448,7 +448,7 @@
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
[self reset]; [self reset: YES];
} }
return self; return self;

View File

@ -496,20 +496,23 @@ static void advance(Screen *screen, gsos_context &ctx) {
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
[self reset]; [self reset: YES];
} }
return self; return self;
} }
-(void)reset -(void)reset: (BOOL)hard
{ {
%%write init; %%write init;
_context.window = iRect(0, 0, 80, 24); if (hard) {
_context.cursor = iPoint(0,0); _context_stack.clear();
_context.window = iRect(0, 0, 80, 24);
_context.cursor = iPoint(0,0);
}
_context.consWrap = true; _context.consWrap = true;
_context.consAdvance = true; _context.consAdvance = true;

View File

@ -306,20 +306,15 @@
return "proterm-special"; return "proterm-special";
} }
-(void)reset: (Screen *)screen -(void)reset: (BOOL)hard
{
[self reset];
if (screen) screen->eraseScreen();
}
-(void)reset
{ {
%%write init; %%write init;
_context.cursor = iPoint(0,0);
_context.window = iRect(0,0,80,24);
_context.flags = 0; _context.flags = 0;
if (hard) {
_context.cursor = iPoint(0,0);
_context.window = iRect(0,0,80,24);
}
} }
-(BOOL)resizable -(BOOL)resizable
@ -336,7 +331,7 @@
-(id)init -(id)init
{ {
[self reset]; [self reset: YES];
return self; return self;
} }

View File

@ -72,7 +72,7 @@ enum {
-(id)init { -(id)init {
if ((self = [super init])) { if ((self = [super init])) {
_model = ModelVT50; _model = ModelVT50;
[self reset]; [self reset: YES];
} }
return self; return self;
@ -104,7 +104,7 @@ enum {
-(id)init { -(id)init {
if ((self = [super init])) { if ((self = [super init])) {
_model = ModelVT50H; _model = ModelVT50H;
[self reset]; [self reset: YES];
} }
return self; return self;
@ -141,7 +141,7 @@ enum {
-(id)init { -(id)init {
if ((self = [super init])) { if ((self = [super init])) {
_model = ModelVT52; _model = ModelVT52;
[self reset]; [self reset: YES];
} }
return self; return self;
} }
@ -168,7 +168,7 @@ enum {
-(id)init { -(id)init {
if ((self = [super init])) { if ((self = [super init])) {
_model = ModelVT55; _model = ModelVT55;
[self reset]; [self reset: YES];
} }
return self; return self;
@ -319,15 +319,18 @@ enum {
} }
} }
-(void)reset -(void)reset: (BOOL)hard
{ {
cs = StateText; cs = StateText;
_escape = false; _escape = false;
_altKeyPad = false; _altKeyPad = false;
_graphics = false; _graphics = false;
_context.cursor = iPoint(0,0);
_context.window = iRect(0, 0, 80, 24); if (hard) {
if (_model <= ModelVT50H) _context.window = iRect(0, 0, 80, 12); _context.cursor = iPoint(0,0);
_context.window = iRect(0, 0, 80, 24);
if (_model <= ModelVT50H) _context.window = iRect(0, 0, 80, 12);
}
_context.flags = 0; _context.flags = 0;
} }

View File

@ -63,8 +63,8 @@
</items> </items>
</menu> </menu>
</menuItem> </menuItem>
<menuItem title="File" id="83"> <menuItem title="Shell" id="83">
<menu key="submenu" title="File" id="81"> <menu key="submenu" title="Shell" id="81">
<items> <items>
<menuItem title="New" keyEquivalent="n" id="82"> <menuItem title="New" keyEquivalent="n" id="82">
<connections> <connections>
@ -112,6 +112,19 @@
<action selector="revertDocumentToSaved:" target="-1" id="364"/> <action selector="revertDocumentToSaved:" target="-1" id="364"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="1Bf-fE-VAI"/>
<menuItem title="Reset" keyEquivalent="r" id="h3z-Y4-dyj">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="resetTerminal:" target="-1" id="Afh-EL-aOa"/>
</connections>
</menuItem>
<menuItem title="Hard Reset" keyEquivalent="r" id="CX0-e3-Dg4">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
<connections>
<action selector="hardResetTerminal:" target="-1" id="bVS-nP-oag"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="74"> <menuItem isSeparatorItem="YES" id="74">
<modifierMask key="keyEquivalentModifierMask" command="YES"/> <modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem> </menuItem>

View File

@ -57,6 +57,9 @@
-(void)setParameters: (NSDictionary *)parameters; -(void)setParameters: (NSDictionary *)parameters;
-(IBAction)resetTerminal: (id)sender;
-(IBAction)hardResetTerminal: (id)sender;
@end @end

View File

@ -248,8 +248,14 @@
[_emulatorView processData: (uint8_t *)buffer size: size]; [_emulatorView processData: (uint8_t *)buffer size: size];
} }
-(IBAction)resetTerminal: (id)sender {
[_emulator reset: NO];
}
-(IBAction)hardResetTerminal: (id)sender {
[_emulator reset: YES];
[_emulatorView reset];
}
#pragma mark - #pragma mark -
#pragma mark NSWindowDelegate #pragma mark NSWindowDelegate
@ -413,6 +419,7 @@
} }
} }
- (IBAction)foregroundColor:(id)sender { - (IBAction)foregroundColor:(id)sender {
[self updateForegroundColor]; [self updateForegroundColor];
} }
@ -463,7 +470,6 @@
[_emulatorView setBackgroundColor: color]; [_emulatorView setBackgroundColor: color];
} }
@end @end

View File

@ -111,6 +111,8 @@ private:
-(void)processData: (uint8_t *)data size: (size_t)size; -(void)processData: (uint8_t *)data size: (size_t)size;
-(void)childFinished: (int)status; -(void)childFinished: (int)status;
-(void)childBegan; -(void)childBegan;
-(void)reset;
@end @end

View File

@ -888,7 +888,12 @@
} }
-(void)reset {
_screen.eraseScreen();
_screen.setCursor(iPoint(0,0));
_cursorOn = YES;
[self setNeedsDisplay: YES];
}
@end @end