| Previous | 199869 Revisions | Next |
| r35087 Tuesday 17th February, 2015 at 06:32:25 UTC by Vasantha Crabb |
|---|
| Add devices window to cocoa debugger |
| [src/osd/modules/debugger] | debugosx.m |
| [src/osd/modules/debugger/osx] | breakpointsview.h breakpointsview.m consoleview.h consoleview.m debugcommandhistory.h debugcommandhistory.m debugconsole.h debugconsole.m debugosx.h debugview.h debugview.m debugwindowhandler.h debugwindowhandler.m devicesviewer.h* devicesviewer.m* disassemblyview.h disassemblyview.m disassemblyviewer.h disassemblyviewer.m errorlogview.h errorlogview.m errorlogviewer.h errorlogviewer.m memoryview.h memoryview.m memoryviewer.h memoryviewer.m pointsviewer.h pointsviewer.m registersview.h registersview.m watchpointsview.h watchpointsview.m |
| [src/osd/sdl] | sdl.mak |
| r243598 | r243599 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | // TODO: |
| 14 | 14 | // * Automatic scrolling for console and log views |
| 15 | // * Keyboard shortcuts in error log windows | |
| 15 | // * Keyboard shortcuts in error log and devices windows | |
| 16 | 16 | // * Don't accept keyboard input while the game is running |
| 17 | 17 | // * Interior focus rings - standard/exterior focus rings look really ugly here |
| 18 | 18 | // * Improve automatic window sizing - it isn't working all that well |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // breakpointsview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // breakpointsview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // consoleview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // consoleview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugcommandhistory.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugcommandhistory.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugconsole.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
| 41 | 41 | - (IBAction)debugNewDisassemblyWindow:(id)sender; |
| 42 | 42 | - (IBAction)debugNewErrorLogWindow:(id)sender; |
| 43 | 43 | - (IBAction)debugNewPointsWindow:(id)sender; |
| 44 | - (IBAction)debugNewDevicesWindow:(id)sender; | |
| 44 | 45 | |
| 45 | 46 | - (void)debugNewMemoryWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression; |
| 46 | 47 | - (void)debugNewDisassemblyWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression; |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugconsole.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
| 14 | 14 | #import "debugcommandhistory.h" |
| 15 | 15 | #import "consoleview.h" |
| 16 | 16 | #import "debugview.h" |
| 17 | #import "devicesviewer.h" | |
| 17 | 18 | #import "disassemblyview.h" |
| 18 | 19 | #import "disassemblyviewer.h" |
| 19 | 20 | #import "errorlogviewer.h" |
| r243598 | r243599 | |
| 258 | 259 | } |
| 259 | 260 | |
| 260 | 261 | |
| 262 | - (IBAction)debugNewDevicesWindow:(id)sender { | |
| 263 | MAMEDevicesViewer *win = [[MAMEDevicesViewer alloc] initWithMachine:*machine console:self]; | |
| 264 | [auxiliaryWindows addObject:win]; | |
| 265 | [win release]; | |
| 266 | [win activate]; | |
| 267 | } | |
| 268 | ||
| 269 | ||
| 261 | 270 | - (void)debugNewMemoryWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression { |
| 262 | 271 | MAMEMemoryViewer *win = [[MAMEMemoryViewer alloc] initWithMachine:*machine console:self]; |
| 263 | 272 | [auxiliaryWindows addObject:win]; |
| r243598 | r243599 | |
|---|---|---|
| 46 | 46 | @protocol NSTextFieldDelegate <NSControlTextEditingDelegate> |
| 47 | 47 | @end |
| 48 | 48 | |
| 49 | @protocol NSOutlineViewDataSource <NSObject> | |
| 50 | @end | |
| 51 | ||
| 49 | 52 | #endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060 |
| 50 | 53 | |
| 51 | 54 | #endif // MAC_OS_X_VERSION_MAX_ALLOWED |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugwindowhandler.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
| 72 | 72 | - (IBAction)debugNewDisassemblyWindow:(id)sender; |
| 73 | 73 | - (IBAction)debugNewErrorLogWindow:(id)sender; |
| 74 | 74 | - (IBAction)debugNewPointsWindow:(id)sender; |
| 75 | - (IBAction)debugNewDevicesWindow:(id)sender; | |
| 75 | 76 | |
| 76 | 77 | - (void)windowWillClose:(NSNotification *)notification; |
| 77 | 78 |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // debug | |
| 5 | // debugwindowhandler.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
| 33 | 33 | @implementation MAMEDebugWindowHandler |
| 34 | 34 | |
| 35 | 35 | + (void)addCommonActionItems:(NSMenu *)menu { |
| 36 | { | |
| 37 | NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run" | |
| 38 | action:@selector(debugRun:) | |
| 39 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]; | |
| 40 | NSMenu *runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"]; | |
| 41 | [runParentItem setSubmenu:runMenu]; | |
| 42 | [runMenu release]; | |
| 43 | [runParentItem setKeyEquivalentModifierMask:0]; | |
| 44 | [[runMenu addItemWithTitle:@"and Hide Debugger" | |
| 45 | action:@selector(debugRunAndHide:) | |
| 46 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]] | |
| 47 | setKeyEquivalentModifierMask:0]; | |
| 48 | [[runMenu addItemWithTitle:@"to Next CPU" | |
| 49 | action:@selector(debugRunToNextCPU:) | |
| 50 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]] | |
| 51 | setKeyEquivalentModifierMask:0]; | |
| 52 | [[runMenu addItemWithTitle:@"until Next Interrupt on Current CPU" | |
| 53 | action:@selector(debugRunToNextInterrupt:) | |
| 54 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]] | |
| 55 | setKeyEquivalentModifierMask:0]; | |
| 56 | [[runMenu addItemWithTitle:@"until Next VBLANK" | |
| 57 | action:@selector(debugRunToNextVBLANK:) | |
| 58 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]] | |
| 59 | setKeyEquivalentModifierMask:0]; | |
| 60 | } | |
| 61 | { | |
| 62 | NSMenuItem *stepParentItem = [menu addItemWithTitle:@"Step" action:NULL keyEquivalent:@""]; | |
| 63 | NSMenu *stepMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Step"]; | |
| 64 | [stepParentItem setSubmenu:stepMenu]; | |
| 65 | [stepMenu release]; | |
| 66 | [[stepMenu addItemWithTitle:@"Into" | |
| 67 | action:@selector(debugStepInto:) | |
| 68 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]] | |
| 69 | setKeyEquivalentModifierMask:0]; | |
| 70 | [[stepMenu addItemWithTitle:@"Over" | |
| 71 | action:@selector(debugStepOver:) | |
| 72 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] | |
| 73 | setKeyEquivalentModifierMask:0]; | |
| 74 | [[stepMenu addItemWithTitle:@"Out" | |
| 75 | action:@selector(debugStepOut:) | |
| 76 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] | |
| 77 | setKeyEquivalentModifierMask:NSShiftKeyMask]; | |
| 78 | } | |
| 79 | { | |
| 80 | NSMenuItem *resetParentItem = [menu addItemWithTitle:@"Reset" action:NULL keyEquivalent:@""]; | |
| 81 | NSMenu *resetMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Reset"]; | |
| 82 | [resetParentItem setSubmenu:resetMenu]; | |
| 83 | [resetMenu release]; | |
| 84 | [[resetMenu addItemWithTitle:@"Soft" | |
| 85 | action:@selector(debugSoftReset:) | |
| 86 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] | |
| 87 | setKeyEquivalentModifierMask:0]; | |
| 88 | [[resetMenu addItemWithTitle:@"Hard" | |
| 89 | action:@selector(debugHardReset:) | |
| 90 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] | |
| 91 | setKeyEquivalentModifierMask:NSShiftKeyMask]; | |
| 92 | } | |
| 36 | NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run" | |
| 37 | action:@selector(debugRun:) | |
| 38 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]; | |
| 39 | NSMenu *runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"]; | |
| 40 | [runParentItem setSubmenu:runMenu]; | |
| 41 | [runMenu release]; | |
| 42 | [runParentItem setKeyEquivalentModifierMask:0]; | |
| 43 | [[runMenu addItemWithTitle:@"and Hide Debugger" | |
| 44 | action:@selector(debugRunAndHide:) | |
| 45 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]] | |
| 46 | setKeyEquivalentModifierMask:0]; | |
| 47 | [[runMenu addItemWithTitle:@"to Next CPU" | |
| 48 | action:@selector(debugRunToNextCPU:) | |
| 49 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]] | |
| 50 | setKeyEquivalentModifierMask:0]; | |
| 51 | [[runMenu addItemWithTitle:@"until Next Interrupt on Current CPU" | |
| 52 | action:@selector(debugRunToNextInterrupt:) | |
| 53 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]] | |
| 54 | setKeyEquivalentModifierMask:0]; | |
| 55 | [[runMenu addItemWithTitle:@"until Next VBLANK" | |
| 56 | action:@selector(debugRunToNextVBLANK:) | |
| 57 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]] | |
| 58 | setKeyEquivalentModifierMask:0]; | |
| 59 | ||
| 60 | NSMenuItem *stepParentItem = [menu addItemWithTitle:@"Step" action:NULL keyEquivalent:@""]; | |
| 61 | NSMenu *stepMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Step"]; | |
| 62 | [stepParentItem setSubmenu:stepMenu]; | |
| 63 | [stepMenu release]; | |
| 64 | [[stepMenu addItemWithTitle:@"Into" | |
| 65 | action:@selector(debugStepInto:) | |
| 66 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]] | |
| 67 | setKeyEquivalentModifierMask:0]; | |
| 68 | [[stepMenu addItemWithTitle:@"Over" | |
| 69 | action:@selector(debugStepOver:) | |
| 70 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] | |
| 71 | setKeyEquivalentModifierMask:0]; | |
| 72 | [[stepMenu addItemWithTitle:@"Out" | |
| 73 | action:@selector(debugStepOut:) | |
| 74 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] | |
| 75 | setKeyEquivalentModifierMask:NSShiftKeyMask]; | |
| 76 | ||
| 77 | NSMenuItem *resetParentItem = [menu addItemWithTitle:@"Reset" action:NULL keyEquivalent:@""]; | |
| 78 | NSMenu *resetMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Reset"]; | |
| 79 | [resetParentItem setSubmenu:resetMenu]; | |
| 80 | [resetMenu release]; | |
| 81 | [[resetMenu addItemWithTitle:@"Soft" | |
| 82 | action:@selector(debugSoftReset:) | |
| 83 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] | |
| 84 | setKeyEquivalentModifierMask:0]; | |
| 85 | [[resetMenu addItemWithTitle:@"Hard" | |
| 86 | action:@selector(debugHardReset:) | |
| 87 | keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] | |
| 88 | setKeyEquivalentModifierMask:NSShiftKeyMask]; | |
| 89 | ||
| 93 | 90 | [menu addItem:[NSMenuItem separatorItem]]; |
| 94 | { | |
| 95 | NSMenuItem *newParentItem = [menu addItemWithTitle:@"New" action:NULL keyEquivalent:@""]; | |
| 96 | NSMenu *newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"New"]; | |
| 97 | [newParentItem setSubmenu:newMenu]; | |
| 98 | [newMenu release]; | |
| 99 | [newMenu addItemWithTitle:@"Memory Window" | |
| 100 | action:@selector(debugNewMemoryWindow:) | |
| 101 | keyEquivalent:@"d"]; | |
| 102 | [newMenu addItemWithTitle:@"Disassembly Window" | |
| 103 | action:@selector(debugNewDisassemblyWindow:) | |
| 104 | keyEquivalent:@"a"]; | |
| 105 | [newMenu addItemWithTitle:@"Error Log Window" | |
| 106 | action:@selector(debugNewErrorLogWindow:) | |
| 107 | keyEquivalent:@"l"]; | |
| 108 | [newMenu addItemWithTitle:@"(Break|Watch)points Window" | |
| 109 | action:@selector(debugNewPointsWindow:) | |
| 110 | keyEquivalent:@"b"]; | |
| 111 | } | |
| 91 | ||
| 92 | NSMenuItem *newParentItem = [menu addItemWithTitle:@"New" action:NULL keyEquivalent:@""]; | |
| 93 | NSMenu *newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"New"]; | |
| 94 | [newParentItem setSubmenu:newMenu]; | |
| 95 | [newMenu release]; | |
| 96 | [newMenu addItemWithTitle:@"Memory Window" | |
| 97 | action:@selector(debugNewMemoryWindow:) | |
| 98 | keyEquivalent:@"d"]; | |
| 99 | [newMenu addItemWithTitle:@"Disassembly Window" | |
| 100 | action:@selector(debugNewDisassemblyWindow:) | |
| 101 | keyEquivalent:@"a"]; | |
| 102 | [newMenu addItemWithTitle:@"Error Log Window" | |
| 103 | action:@selector(debugNewErrorLogWindow:) | |
| 104 | keyEquivalent:@"l"]; | |
| 105 | [newMenu addItemWithTitle:@"(Break|Watch)points Window" | |
| 106 | action:@selector(debugNewPointsWindow:) | |
| 107 | keyEquivalent:@"b"]; | |
| 108 | [newMenu addItemWithTitle:@"Devices Window" | |
| 109 | action:@selector(debugNewDevicesWindow:) | |
| 110 | keyEquivalent:@"D"]; | |
| 111 | ||
| 112 | 112 | [menu addItem:[NSMenuItem separatorItem]]; |
| 113 | ||
| 113 | 114 | [menu addItemWithTitle:@"Close Window" action:@selector(performClose:) keyEquivalent:@"w"]; |
| 114 | [menu addItemWithTitle:@" | |
| 115 | [menu addItemWithTitle:@"Quit" action:@selector(debugExit:) keyEquivalent:@"q"]; | |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | |
| r243598 | r243599 | |
| 298 | 299 | } |
| 299 | 300 | |
| 300 | 301 | |
| 302 | - (IBAction)debugNewDevicesWindow:(id)sender { | |
| 303 | [console debugNewDevicesWindow:sender]; | |
| 304 | } | |
| 305 | ||
| 306 | ||
| 301 | 307 | - (void)windowWillClose:(NSNotification *)notification { |
| 302 | 308 | [[NSNotificationCenter defaultCenter] postNotificationName:MAMEAuxiliaryDebugWindowWillCloseNotification |
| 303 | 309 | object:self]; |
| r243598 | r243599 | |
| 314 | 320 | windowFrame.size.width += desired.width; |
| 315 | 321 | windowFrame.size.width = MIN(windowFrame.size.width, available.size.width); |
| 316 | 322 | windowFrame.size.height += desired.height; |
| 317 | windowFrame.size.height = MIN(MIN(windowFrame.size.height, 2 | |
| 323 | windowFrame.size.height = MIN(MIN(windowFrame.size.height, 320), available.size.height); | |
| 318 | 324 | windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width; |
| 319 | 325 | windowFrame.origin.y = available.origin.y; |
| 320 | 326 | [window setFrame:windowFrame display:YES]; |
| r0 | r243599 | |
|---|---|---|
| 1 | // license:BSD-3-Clause | |
| 2 | // copyright-holders:Vas Crabb | |
| 3 | //============================================================ | |
| 4 | // | |
| 5 | // devicesviewer.h - MacOS X Cocoa debug window handling | |
| 6 | // | |
| 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. | |
| 8 | // Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | // | |
| 10 | //============================================================ | |
| 11 | ||
| 12 | #import "debugosx.h" | |
| 13 | ||
| 14 | #import "debugwindowhandler.h" | |
| 15 | ||
| 16 | #include "emu.h" | |
| 17 | ||
| 18 | #import <Cocoa/Cocoa.h> | |
| 19 | ||
| 20 | ||
| 21 | @class MAMEDebugConsole, MAMEDeviceWrapper; | |
| 22 | ||
| 23 | @interface MAMEDevicesViewer : MAMEAuxiliaryDebugWindowHandler <NSOutlineViewDataSource> | |
| 24 | { | |
| 25 | MAMEDeviceWrapper *root; | |
| 26 | NSOutlineView *devicesView; | |
| 27 | } | |
| 28 | ||
| 29 | - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c; | |
| 30 | ||
| 31 | @end |
| r0 | r243599 | |
|---|---|---|
| 1 | // license:BSD-3-Clause | |
| 2 | // copyright-holders:Vas Crabb | |
| 3 | //============================================================ | |
| 4 | // | |
| 5 | // devicesviewer.m - MacOS X Cocoa debug window handling | |
| 6 | // | |
| 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. | |
| 8 | // Visit http://mamedev.org for licensing and usage restrictions. | |
| 9 | // | |
| 10 | //============================================================ | |
| 11 | ||
| 12 | #import "devicesviewer.h" | |
| 13 | ||
| 14 | ||
| 15 | @interface MAMEDeviceWrapper : NSObject | |
| 16 | { | |
| 17 | running_machine *machine; | |
| 18 | device_t *device; | |
| 19 | NSArray *children; | |
| 20 | } | |
| 21 | ||
| 22 | - (id)initWithMachine:(running_machine &)m device:(device_t &)d; | |
| 23 | ||
| 24 | - (running_machine &)machine; | |
| 25 | - (device_t &)device; | |
| 26 | - (NSString *)tag; | |
| 27 | - (NSString *)name; | |
| 28 | - (NSUInteger)children; | |
| 29 | - (MAMEDeviceWrapper *)childAtIndex:(NSUInteger)index; | |
| 30 | ||
| 31 | @end | |
| 32 | ||
| 33 | ||
| 34 | @implementation MAMEDeviceWrapper | |
| 35 | ||
| 36 | - (void)wrapChildren { | |
| 37 | NSMutableArray *const tmp = [[NSMutableArray alloc] init]; | |
| 38 | for (device_t *child = device->first_subdevice(); child != NULL; child = child->next()) | |
| 39 | { | |
| 40 | MAMEDeviceWrapper *const wrap = [[MAMEDeviceWrapper alloc] initWithMachine:*machine | |
| 41 | device:*child]; | |
| 42 | [tmp addObject:wrap]; | |
| 43 | [wrap release]; | |
| 44 | } | |
| 45 | children = [[NSArray alloc] initWithArray:tmp]; | |
| 46 | [tmp release]; | |
| 47 | } | |
| 48 | ||
| 49 | ||
| 50 | - (id)initWithMachine:(running_machine &)m device:(device_t &)d { | |
| 51 | if (!(self = [super init])) | |
| 52 | return nil; | |
| 53 | machine = &m; | |
| 54 | device = &d; | |
| 55 | children = nil; | |
| 56 | return self; | |
| 57 | } | |
| 58 | ||
| 59 | ||
| 60 | - (void)dealloc { | |
| 61 | if (children != nil) | |
| 62 | [children release]; | |
| 63 | [super dealloc]; | |
| 64 | } | |
| 65 | ||
| 66 | ||
| 67 | - (running_machine &)machine { | |
| 68 | return *machine; | |
| 69 | } | |
| 70 | ||
| 71 | ||
| 72 | - (device_t &)device { | |
| 73 | return *device; | |
| 74 | } | |
| 75 | ||
| 76 | ||
| 77 | - (NSString *)tag { | |
| 78 | return (device == &machine->root_device()) ? @"<root>" | |
| 79 | : [NSString stringWithUTF8String:device->basetag()]; | |
| 80 | } | |
| 81 | ||
| 82 | ||
| 83 | - (NSString *)name { | |
| 84 | return [NSString stringWithUTF8String:device->name()]; | |
| 85 | } | |
| 86 | ||
| 87 | ||
| 88 | - (NSUInteger)children { | |
| 89 | if (children == nil) | |
| 90 | [self wrapChildren]; | |
| 91 | return [children count]; | |
| 92 | } | |
| 93 | ||
| 94 | ||
| 95 | - (MAMEDeviceWrapper *)childAtIndex:(NSUInteger)index { | |
| 96 | if (children == nil) | |
| 97 | [self wrapChildren]; | |
| 98 | return (index < [children count]) ? [children objectAtIndex:index] : nil; | |
| 99 | } | |
| 100 | ||
| 101 | @end | |
| 102 | ||
| 103 | ||
| 104 | @implementation MAMEDevicesViewer | |
| 105 | ||
| 106 | - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { | |
| 107 | NSScrollView *devicesScroll; | |
| 108 | NSTableColumn *tagColumn, *nameColumn; | |
| 109 | ||
| 110 | if (!(self = [super initWithMachine:m title:@"All Devices" console:c])) | |
| 111 | return nil; | |
| 112 | root = [[MAMEDeviceWrapper alloc] initWithMachine:m device:m.root_device()]; | |
| 113 | ||
| 114 | // create the devices view | |
| 115 | devicesView = [[NSOutlineView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; | |
| 116 | [devicesView setUsesAlternatingRowBackgroundColors:YES]; | |
| 117 | [devicesView setAllowsColumnReordering:YES]; | |
| 118 | [devicesView setAllowsColumnResizing:YES]; | |
| 119 | [devicesView setColumnAutoresizingStyle:NSTableViewUniformColumnAutoresizingStyle]; | |
| 120 | [devicesView setAllowsEmptySelection:YES]; | |
| 121 | [devicesView setAllowsMultipleSelection:NO]; | |
| 122 | [devicesView setAllowsColumnSelection:NO]; | |
| 123 | tagColumn = [[NSTableColumn alloc] initWithIdentifier:@"tag"]; | |
| 124 | [[tagColumn headerCell] setStringValue:@"Tag"]; | |
| 125 | [tagColumn setEditable:NO]; | |
| 126 | [tagColumn setMinWidth:100]; | |
| 127 | [tagColumn setWidth:120]; | |
| 128 | [tagColumn setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)]; | |
| 129 | [devicesView addTableColumn:tagColumn]; | |
| 130 | [tagColumn release]; | |
| 131 | nameColumn = [[NSTableColumn alloc] initWithIdentifier:@"name"]; | |
| 132 | [[nameColumn headerCell] setStringValue:@"Name"]; | |
| 133 | [nameColumn setEditable:NO]; | |
| 134 | [nameColumn setMinWidth:100]; | |
| 135 | [nameColumn setMinWidth:360]; | |
| 136 | [nameColumn setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)]; | |
| 137 | [devicesView addTableColumn:nameColumn]; | |
| 138 | [nameColumn release]; | |
| 139 | [devicesView setOutlineTableColumn:tagColumn]; | |
| 140 | [devicesView setAutoresizesOutlineColumn:YES]; | |
| 141 | [devicesView setDataSource:self]; | |
| 142 | devicesScroll = [[NSScrollView alloc] initWithFrame:[[window contentView] bounds]]; | |
| 143 | [devicesScroll setDrawsBackground:YES]; | |
| 144 | [devicesScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; | |
| 145 | [devicesScroll setHasHorizontalScroller:YES]; | |
| 146 | [devicesScroll setHasVerticalScroller:YES]; | |
| 147 | [devicesScroll setAutohidesScrollers:YES]; | |
| 148 | [devicesScroll setBorderType:NSNoBorder]; | |
| 149 | [devicesScroll setDocumentView:devicesView]; | |
| 150 | [devicesView release]; | |
| 151 | [[window contentView] addSubview:devicesScroll]; | |
| 152 | [devicesScroll release]; | |
| 153 | ||
| 154 | // set default state | |
| 155 | [devicesView expandItem:root expandChildren:YES]; | |
| 156 | [window makeFirstResponder:devicesView]; | |
| 157 | [window setTitle:[NSString stringWithFormat:@"All Devices"]]; | |
| 158 | ||
| 159 | // calculate the optimal size for everything | |
| 160 | NSSize const desired = [NSScrollView frameSizeForContentSize:NSMakeSize(480, 320) | |
| 161 | hasHorizontalScroller:YES | |
| 162 | hasVerticalScroller:YES | |
| 163 | borderType:[devicesScroll borderType]]; | |
| 164 | [self cascadeWindowWithDesiredSize:desired forView:devicesScroll]; | |
| 165 | ||
| 166 | // don't forget the result | |
| 167 | return self; | |
| 168 | } | |
| 169 | ||
| 170 | ||
| 171 | - (void)dealloc { | |
| 172 | if (root != nil) | |
| 173 | [root release]; | |
| 174 | [super dealloc]; | |
| 175 | } | |
| 176 | ||
| 177 | ||
| 178 | - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { | |
| 179 | return [(MAMEDeviceWrapper *)item children] > 0; | |
| 180 | } | |
| 181 | ||
| 182 | ||
| 183 | - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { | |
| 184 | if (item != nil) | |
| 185 | return [(MAMEDeviceWrapper *)item children]; | |
| 186 | else | |
| 187 | return 1; | |
| 188 | } | |
| 189 | ||
| 190 | ||
| 191 | - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { | |
| 192 | if (item != nil) | |
| 193 | return [(MAMEDeviceWrapper *)item childAtIndex:index]; | |
| 194 | else if (index == 0) | |
| 195 | return root; | |
| 196 | else | |
| 197 | return nil; | |
| 198 | } | |
| 199 | ||
| 200 | ||
| 201 | - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { | |
| 202 | if ([[tableColumn identifier] isEqualToString:@"tag"]) | |
| 203 | return [(MAMEDeviceWrapper *)item tag]; | |
| 204 | else if ([[tableColumn identifier] isEqualToString:@"name"]) | |
| 205 | return [(MAMEDeviceWrapper *)item name]; | |
| 206 | else | |
| 207 | return nil; | |
| 208 | } | |
| 209 | ||
| 210 | @end |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // d | |
| 5 | // disassemblyview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // d | |
| 5 | // disassemblyview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // d | |
| 5 | // disassemblyviewer.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // d | |
| 5 | // disassemblyviewer.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
| 24 | 24 | NSScrollView *dasmScroll; |
| 25 | 25 | NSView *expressionContainer; |
| 26 | 26 | NSPopUpButton *actionButton; |
| 27 | NSRect | |
| 27 | NSRect expressionFrame; | |
| 28 | 28 | |
| 29 | 29 | if (!(self = [super initWithMachine:m title:@"Disassembly" console:c])) |
| 30 | 30 | return nil; |
| 31 | contentBounds = [[window contentView] bounds]; | |
| 31 | NSRect const contentBounds = [[window contentView] bounds]; | |
| 32 | 32 | |
| 33 | 33 | // create the expression field |
| 34 | 34 | expressionField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)]; |
| r243598 | r243599 | |
| 108 | 108 | [window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]]; |
| 109 | 109 | |
| 110 | 110 | // calculate the optimal size for everything |
| 111 | { | |
| 112 | NSSize desired = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] | |
| 113 | hasHorizontalScroller:YES | |
| 114 | hasVerticalScroller:YES | |
| 115 | borderType:[dasmScroll borderType]]; | |
| 116 | [self cascadeWindowWithDesiredSize:desired forView:dasmScroll]; | |
| 117 | } | |
| 111 | NSSize const desired = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] | |
| 112 | hasHorizontalScroller:YES | |
| 113 | hasVerticalScroller:YES | |
| 114 | borderType:[dasmScroll borderType]]; | |
| 115 | [self cascadeWindowWithDesiredSize:desired forView:dasmScroll]; | |
| 118 | 116 | |
| 119 | 117 | // don't forget the result |
| 120 | 118 | return self; |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // errorlogview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // errorlogview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // errorlogviewer.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // errorlogviewer.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // memoryview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // memoryview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // memoryviewer.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // memoryviewer.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // pointsviewer.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // pointsviewer.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // registersview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // registersview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // watchpointsview.h - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 2 | 2 | // copyright-holders:Vas Crabb |
| 3 | 3 | //============================================================ |
| 4 | 4 | // |
| 5 | // | |
| 5 | // watchpointsview.m - MacOS X Cocoa debug window handling | |
| 6 | 6 | // |
| 7 | 7 | // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. |
| 8 | 8 | // Visit http://mamedev.org for licensing and usage restrictions. |
| r243598 | r243599 | |
|---|---|---|
| 295 | 295 | $(OSDOBJ)/modules/debugger/osx/debugconsole.o \ |
| 296 | 296 | $(OSDOBJ)/modules/debugger/osx/debugview.o \ |
| 297 | 297 | $(OSDOBJ)/modules/debugger/osx/debugwindowhandler.o \ |
| 298 | $(OSDOBJ)/modules/debugger/osx/devicesviewer.o \ | |
| 298 | 299 | $(OSDOBJ)/modules/debugger/osx/disassemblyview.o \ |
| 299 | 300 | $(OSDOBJ)/modules/debugger/osx/disassemblyviewer.o \ |
| 300 | 301 | $(OSDOBJ)/modules/debugger/osx/errorlogview.o \ |
| https://github.com/mamedev/mame/commit/145ad17fa232f22c188c76d11fd4df75260868b7 |
| Previous | 199869 Revisions | Next |