mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
More intuitive command/expression history
This commit is contained in:
parent
146653f9d7
commit
6ec9472c84
@ -42,32 +42,34 @@
|
||||
class debugger_osx : public osd_module, public debug_module
|
||||
{
|
||||
public:
|
||||
debugger_osx()
|
||||
: osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
|
||||
m_machine(NULL),
|
||||
m_console(nil)
|
||||
{
|
||||
}
|
||||
debugger_osx()
|
||||
: osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
|
||||
m_machine(NULL),
|
||||
m_console(nil)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~debugger_osx()
|
||||
{
|
||||
}
|
||||
virtual ~debugger_osx()
|
||||
{
|
||||
if (m_console != nil)
|
||||
[m_console release];
|
||||
}
|
||||
|
||||
virtual int init()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int init()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void exit()
|
||||
{
|
||||
}
|
||||
virtual void exit()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
virtual void wait_for_debugger(device_t &device, bool firststop);
|
||||
virtual void debugger_update();
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
virtual void wait_for_debugger(device_t &device, bool firststop);
|
||||
virtual void debugger_update();
|
||||
|
||||
private:
|
||||
running_machine *m_machine;
|
||||
running_machine *m_machine;
|
||||
MAMEDebugConsole *m_console;
|
||||
};
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
- (void)add:(NSString *)entry;
|
||||
- (NSString *)previous:(NSString *)cur;
|
||||
- (NSString *)next:(NSString *)cur;
|
||||
- (void)edit;
|
||||
- (void)reset;
|
||||
- (void)clear;
|
||||
|
||||
|
@ -50,8 +50,8 @@
|
||||
|
||||
- (void)setLength:(NSInteger)l {
|
||||
length = l;
|
||||
while ([history count] > length)
|
||||
[history removeLastObject];
|
||||
if ([history count] > length)
|
||||
[history removeObjectsInRange:NSMakeRange(length, [history count] - length)];
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
while ([history count] > length)
|
||||
[history removeLastObject];
|
||||
}
|
||||
position = -1;
|
||||
position = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
- (NSString *)next:(NSString *)cur {
|
||||
if (position > 0) {
|
||||
return [history objectAtIndex:--position];
|
||||
} else if (position == 0) {
|
||||
} else if ((position == 0) && (current != nil) && ![current isEqualToString:[history objectAtIndex:0]]) {
|
||||
position--;
|
||||
return [[current retain] autorelease];
|
||||
} else {
|
||||
@ -90,6 +90,11 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)edit {
|
||||
if (position == 0)
|
||||
position--;
|
||||
}
|
||||
|
||||
- (void)reset {
|
||||
position = -1;
|
||||
if (current != nil) {
|
||||
|
@ -12,7 +12,6 @@
|
||||
#import "debugosx.h"
|
||||
#import "debugosxdebugwindowhandler.h"
|
||||
|
||||
#include "device.h"
|
||||
#include "emu.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
@ -44,6 +43,7 @@
|
||||
- (void)showDebugger:(NSNotification *)notification;
|
||||
- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification;
|
||||
|
@ -218,9 +218,11 @@
|
||||
NSString *command = [sender stringValue];
|
||||
if ([command length] == 0) {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
|
||||
[history reset];
|
||||
} else {
|
||||
debug_console_execute_command(*machine, [command UTF8String], 1);
|
||||
[history add:command];
|
||||
[history edit];
|
||||
}
|
||||
[sender setStringValue:@""];
|
||||
}
|
||||
@ -264,6 +266,14 @@
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
|
||||
if (control == commandField)
|
||||
[history edit];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
|
||||
if (control == commandField) {
|
||||
if (command == @selector(cancelOperation:)) {
|
||||
|
@ -17,24 +17,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@protocol MAMEDebugViewSubviewSupport <NSObject>
|
||||
|
||||
- (NSString *)selectedSubviewName;
|
||||
- (int)selectedSubviewIndex;
|
||||
- (void)selectSubviewAtIndex:(int)index;
|
||||
- (void)selectSubviewForCPU:(device_t *)device;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol MAMEDebugViewExpressionSupport <NSObject>
|
||||
|
||||
- (NSString *)expression;
|
||||
- (void)setExpression:(NSString *)exp;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MAMEDebugView : NSView
|
||||
{
|
||||
int type;
|
||||
@ -66,3 +48,21 @@
|
||||
- (void)windowDidResignKey:(NSNotification *)notification;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol MAMEDebugViewSubviewSupport <NSObject>
|
||||
|
||||
- (NSString *)selectedSubviewName;
|
||||
- (int)selectedSubviewIndex;
|
||||
- (void)selectSubviewAtIndex:(int)index;
|
||||
- (void)selectSubviewForCPU:(device_t *)device;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol MAMEDebugViewExpressionSupport <NSObject>
|
||||
|
||||
- (NSString *)expression;
|
||||
- (void)setExpression:(NSString *)exp;
|
||||
|
||||
@end
|
||||
|
@ -91,6 +91,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
|
||||
|
||||
- (IBAction)doExpression:(id)sender;
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
|
||||
|
||||
@end
|
||||
|
@ -357,6 +357,13 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
|
||||
{
|
||||
[history edit];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
|
||||
if (control == expressionField) {
|
||||
if (command == @selector(cancelOperation:)) {
|
||||
|
Loading…
Reference in New Issue
Block a user