mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
* Save/restore more Cocoa debugger state
* Fix some Cocoa debugger desync issues - Scroll to selection on gaining focus by keyboard (e.g. tab) only - Fixes jump on clicking a memory or disasm view that you've scrolled
This commit is contained in:
parent
c36c1572ec
commit
b6d7d31d49
@ -53,6 +53,7 @@
|
||||
- (void)loadConfiguration:(util::xml::data_node const *)parentnode;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
|
||||
|
@ -426,9 +426,17 @@
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_CONSOLE);
|
||||
[dasmView saveConfigurationToNode:node];
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
[dasmView restoreConfigurationFromNode:node];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
|
||||
if (control == commandField)
|
||||
[history edit];
|
||||
|
@ -20,7 +20,7 @@
|
||||
debug_view *view;
|
||||
BOOL wholeLineScroll;
|
||||
|
||||
int32_t totalWidth, totalHeight, originTop;
|
||||
int32_t totalWidth, totalHeight, originTop;
|
||||
|
||||
NSFont *font;
|
||||
CGFloat fontWidth, fontHeight, fontAscent;
|
||||
@ -56,6 +56,9 @@
|
||||
|
||||
- (void)addContextMenuItemsToMenu:(NSMenu *)menu;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include "modules/lib/osdobj_common.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -484,6 +486,54 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
if (view->cursor_supported())
|
||||
{
|
||||
util::xml::data_node *const selection = node->add_child("selection", nullptr);
|
||||
if (selection)
|
||||
{
|
||||
debug_view_xy const pos = view->cursor_position();
|
||||
selection->set_attribute_int("visible", view->cursor_visible() ? 1 : 0);
|
||||
selection->set_attribute_int("start_x", pos.x);
|
||||
selection->set_attribute_int("start_y", pos.y);
|
||||
}
|
||||
}
|
||||
|
||||
util::xml::data_node *const scroll = node->add_child("scroll", nullptr);
|
||||
if (scroll)
|
||||
{
|
||||
NSRect const visible = [self visibleRect];
|
||||
scroll->set_attribute_float("position_x", visible.origin.x);
|
||||
scroll->set_attribute_float("position_y", visible.origin.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
if (view->cursor_supported())
|
||||
{
|
||||
util::xml::data_node const *const selection = node->get_child("selection");
|
||||
if (selection)
|
||||
{
|
||||
debug_view_xy pos = view->cursor_position();
|
||||
view->set_cursor_visible(0 != selection->get_attribute_int("visible", view->cursor_visible() ? 1 : 0));
|
||||
pos.x = selection->get_attribute_int("start_x", pos.x);
|
||||
pos.y = selection->get_attribute_int("start_y", pos.y);
|
||||
view->set_cursor_position(pos);
|
||||
}
|
||||
}
|
||||
|
||||
util::xml::data_node const *const scroll = node->get_child("scroll");
|
||||
if (scroll)
|
||||
{
|
||||
NSRect visible = [self visibleRect];
|
||||
visible.origin.x = scroll->get_attribute_float("position_x", visible.origin.x);
|
||||
visible.origin.y = scroll->get_attribute_float("position_y", visible.origin.y);
|
||||
[self scrollRectToVisible:visible];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)acceptsFirstResponder {
|
||||
return view->cursor_supported();
|
||||
}
|
||||
@ -492,13 +542,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
||||
- (BOOL)becomeFirstResponder {
|
||||
if (view->cursor_supported())
|
||||
{
|
||||
debug_view_xy pos;
|
||||
view->set_cursor_visible(true);
|
||||
pos = view->cursor_position();
|
||||
[self scrollRectToVisible:NSMakeRect((pos.x * fontWidth) + [textContainer lineFragmentPadding],
|
||||
pos.y * fontHeight,
|
||||
fontWidth,
|
||||
fontHeight)]; // FIXME: metrics
|
||||
[self setNeedsDisplay:YES];
|
||||
return [super becomeFirstResponder];
|
||||
}
|
||||
@ -799,6 +843,15 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
||||
}
|
||||
|
||||
|
||||
- (void)keyUp:(NSEvent *)event {
|
||||
debug_view_xy const pos = view->cursor_position();
|
||||
[self scrollRectToVisible:NSMakeRect((pos.x * fontWidth) + [textContainer lineFragmentPadding],
|
||||
pos.y * fontHeight,
|
||||
fontWidth,
|
||||
fontHeight)]; // FIXME: metrics
|
||||
}
|
||||
|
||||
|
||||
- (void)insertTab:(id)sender {
|
||||
if ([[self window] firstResponder] == self)
|
||||
[[self window] selectNextKeyView:self];
|
||||
|
@ -40,4 +40,7 @@
|
||||
- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
|
||||
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "debug/debugvw.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEDisassemblyView
|
||||
|
||||
@ -265,4 +267,18 @@
|
||||
[menu insertItem:[NSMenuItem separatorItem] atIndex:index++];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
debug_view_disasm *const dasmView = downcast<debug_view_disasm *>(view);
|
||||
node->set_attribute_int("rightbar", dasmView->right_column());
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
debug_view_disasm *const dasmView = downcast<debug_view_disasm *>(view);
|
||||
dasmView->set_right_column((disasm_right_column)node->get_attribute_int("rightbar", dasmView->right_column()));
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -34,5 +34,6 @@
|
||||
- (IBAction)changeSubview:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
@ -232,6 +232,17 @@
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER);
|
||||
node->set_attribute_int("cpu", [dasmView selectedSubviewIndex]);
|
||||
[dasmView saveConfigurationToNode:node];
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
int const region = node->get_attribute_int("cpu", [dasmView selectedSubviewIndex]);
|
||||
[dasmView selectSubviewAtIndex:region];
|
||||
[subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[dasmView selectedSubviewIndex]]];
|
||||
[dasmView restoreConfigurationFromNode:node];
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,20 +201,22 @@
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
debug_view_memory *const memView = downcast<debug_view_memory *>(view);
|
||||
node->set_attribute_int("memoryregion", [self selectedSubviewIndex]);
|
||||
node->set_attribute_int("reverse", memView->reverse() ? 1 : 0);
|
||||
node->set_attribute_int("addressmode", memView->physical() ? 1 : 0);
|
||||
node->set_attribute_int("dataformat", memView->get_data_format());
|
||||
node->set_attribute_int("rowchunks", memView->chunks_per_row());
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
debug_view_memory *const memView = downcast<debug_view_memory *>(view);
|
||||
[self selectSubviewAtIndex:node->get_attribute_int("memoryregion", [self selectedSubviewIndex])];
|
||||
memView->set_reverse(0 != node->get_attribute_int("reverse", memView->reverse() ? 1 : 0));
|
||||
memView->set_physical(0 != node->get_attribute_int("addressmode", memView->physical() ? 1 : 0));
|
||||
memView->set_data_format(node->get_attribute_int("dataformat", memView->get_data_format()));
|
||||
memView->set_chunks_per_row(node->get_attribute_int("rowchunks", memView->chunks_per_row()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,12 +179,16 @@
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER);
|
||||
node->set_attribute_int("memoryregion", [memoryView selectedSubviewIndex]);
|
||||
[memoryView saveConfigurationToNode:node];
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
int const region = node->get_attribute_int("memoryregion", [memoryView selectedSubviewIndex]);
|
||||
[memoryView selectSubviewAtIndex:region];
|
||||
[subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[memoryView selectedSubviewIndex]]];
|
||||
[memoryView restoreConfigurationFromNode:node];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user