Previous 199869 Revisions Next

r35024 Saturday 14th February, 2015 at 07:00:56 UTC by Vasantha Crabb
More intuitive command/expression history
[src/osd/modules/debugger]debugosx.m
[src/osd/modules/debugger/osx]debugosxdebugcommandhistory.h debugosxdebugcommandhistory.m debugosxdebugconsole.h debugosxdebugconsole.m debugosxdebugview.h debugosxdebugwindowhandler.h debugosxdebugwindowhandler.m

trunk/src/osd/modules/debugger/debugosx.m
r243535r243536
4242class debugger_osx : public osd_module, public debug_module
4343{
4444public:
45    debugger_osx()
46    : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
47      m_machine(NULL),
48      m_console(nil)
49    {
50    }
45   debugger_osx()
46   : osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
47     m_machine(NULL),
48     m_console(nil)
49   {
50   }
5151
52    virtual ~debugger_osx()
53    {
54    }
52   virtual ~debugger_osx()
53   {
54      if (m_console != nil)
55         [m_console release];
56   }
5557
56    virtual int init()
57    {
58       return 0;
59    }
58   virtual int init()
59   {
60      return 0;
61   }
6062
61    virtual void exit()
62    {
63    }
63   virtual void exit()
64   {
65   }
6466
65    virtual void init_debugger(running_machine &machine);
66    virtual void wait_for_debugger(device_t &device, bool firststop);
67    virtual void debugger_update();
67   virtual void init_debugger(running_machine &machine);
68   virtual void wait_for_debugger(device_t &device, bool firststop);
69   virtual void debugger_update();
6870
6971private:
70    running_machine *m_machine;
72   running_machine *m_machine;
7173   MAMEDebugConsole *m_console;
7274};
7375
trunk/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h
r243535r243536
3131- (void)add:(NSString *)entry;
3232- (NSString *)previous:(NSString *)cur;
3333- (NSString *)next:(NSString *)cur;
34- (void)edit;
3435- (void)reset;
3536- (void)clear;
3637
trunk/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m
r243535r243536
5050
5151- (void)setLength:(NSInteger)l {
5252   length = l;
53   while ([history count] > length)
54      [history removeLastObject];
53   if ([history count] > length)
54      [history removeObjectsInRange:NSMakeRange(length, [history count] - length)];
5555}
5656
5757
r243535r243536
6161      while ([history count] > length)
6262         [history removeLastObject];
6363   }
64   position = -1;
64   position = 0;
6565}
6666
6767
r243535r243536
8181- (NSString *)next:(NSString *)cur {
8282   if (position > 0) {
8383      return [history objectAtIndex:--position];
84   } else if (position == 0) {
84   } else if ((position == 0) && (current != nil) && ![current isEqualToString:[history objectAtIndex:0]]) {
8585      position--;
8686      return [[current retain] autorelease];
8787   } else {
r243535r243536
9090}
9191
9292
93- (void)edit {
94   if (position == 0)
95      position--;
96}
97
9398- (void)reset {
9499   position = -1;
95100   if (current != nil) {
trunk/src/osd/modules/debugger/osx/debugosxdebugconsole.h
r243535r243536
1212#import "debugosx.h"
1313#import "debugosxdebugwindowhandler.h"
1414
15#include "device.h"
1615#include "emu.h"
1716
1817#import <Cocoa/Cocoa.h>
r243535r243536
4443- (void)showDebugger:(NSNotification *)notification;
4544- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
4645
46- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
4747- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
4848
4949- (void)windowWillClose:(NSNotification *)notification;
trunk/src/osd/modules/debugger/osx/debugosxdebugconsole.m
r243535r243536
218218   NSString *command = [sender stringValue];
219219   if ([command length] == 0) {
220220      debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
221      [history reset];
221222   } else {
222223      debug_console_execute_command(*machine, [command UTF8String], 1);
223224      [history add:command];
225      [history edit];
224226   }
225227   [sender setStringValue:@""];
226228}
r243535r243536
264266}
265267
266268
269- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
270   if (control == commandField)
271      [history edit];
272
273   return YES;
274}
275
276
267277- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
268278   if (control == commandField) {
269279      if (command == @selector(cancelOperation:)) {
trunk/src/osd/modules/debugger/osx/debugosxdebugview.h
r243535r243536
1717#import <Cocoa/Cocoa.h>
1818
1919
20@protocol MAMEDebugViewSubviewSupport <NSObject>
21
22- (NSString *)selectedSubviewName;
23- (int)selectedSubviewIndex;
24- (void)selectSubviewAtIndex:(int)index;
25- (void)selectSubviewForCPU:(device_t *)device;
26
27@end
28
29
30@protocol MAMEDebugViewExpressionSupport <NSObject>
31
32- (NSString *)expression;
33- (void)setExpression:(NSString *)exp;
34
35@end
36
37
3820@interface MAMEDebugView : NSView
3921{
4022   int            type;
r243535r243536
6648- (void)windowDidResignKey:(NSNotification *)notification;
6749
6850@end
51
52
53@protocol MAMEDebugViewSubviewSupport <NSObject>
54
55- (NSString *)selectedSubviewName;
56- (int)selectedSubviewIndex;
57- (void)selectSubviewAtIndex:(int)index;
58- (void)selectSubviewForCPU:(device_t *)device;
59
60@end
61
62
63@protocol MAMEDebugViewExpressionSupport <NSObject>
64
65- (NSString *)expression;
66- (void)setExpression:(NSString *)exp;
67
68@end
trunk/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h
r243535r243536
9191
9292- (IBAction)doExpression:(id)sender;
9393
94- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
9495- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
9596
9697@end
trunk/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m
r243535r243536
357357}
358358
359359
360- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
361{
362   [history edit];
363   return YES;
364}
365
366
360367- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
361368   if (control == expressionField) {
362369      if (command == @selector(cancelOperation:)) {


Previous 199869 Revisions Next


© 1997-2024 The MAME Team