cocoa debugger: save/restore console split positions

This commit is contained in:
Vas Crabb 2017-07-21 18:25:06 +10:00
parent 298f379212
commit 3e60ab4a04
3 changed files with 25 additions and 2 deletions

View File

@ -21,6 +21,7 @@
MAMEDebugCommandHistory *history;
NSMutableArray *auxiliaryWindows;
NSSplitView *regSplit, *dasmSplit;
MAMERegistersView *regView;
MAMEDisassemblyView *dasmView;
MAMEDebugView *consoleView;

View File

@ -31,7 +31,6 @@
@implementation MAMEDebugConsole
- (id)initWithMachine:(running_machine &)m {
NSSplitView *regSplit, *dasmSplit;
NSScrollView *regScroll, *dasmScroll, *consoleScroll;
NSView *consoleContainer;
NSPopUpButton *actionButton;
@ -426,12 +425,32 @@
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
[super saveConfigurationToNode:node];
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_CONSOLE);
util::xml::data_node *const splits = node->add_child("splits", nullptr);
if (splits)
{
splits->set_attribute_float("state",
[regSplit isSubviewCollapsed:[[regSplit subviews] objectAtIndex:0]]
? 0.0
: NSMaxX([[[regSplit subviews] objectAtIndex:0] frame]));
splits->set_attribute_float("disassembly",
[dasmSplit isSubviewCollapsed:[[dasmSplit subviews] objectAtIndex:0]]
? 0.0
: NSMaxY([[[dasmSplit subviews] objectAtIndex:0] frame]));
}
[dasmView saveConfigurationToNode:node];
}
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
[super restoreConfigurationFromNode:node];
util::xml::data_node const *const splits = node->get_child("splits");
if (splits)
{
[regSplit setPosition:splits->get_attribute_float("state", NSMaxX([[[regSplit subviews] objectAtIndex:0] frame]))
ofDividerAtIndex:0];
[dasmSplit setPosition:splits->get_attribute_float("disassembly", NSMaxY([[[dasmSplit subviews] objectAtIndex:0] frame]))
ofDividerAtIndex:0];
}
[dasmView restoreConfigurationFromNode:node];
}

View File

@ -203,7 +203,8 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
- (void)adjustSizeAndRecomputeVisible {
NSSize const clip = [[[self enclosingScrollView] contentView] bounds].size;
NSScrollView *const scroller = [self enclosingScrollView];
NSSize const clip = [[scroller contentView] bounds].size;
NSSize content = NSMakeSize((fontWidth * totalWidth) + (2 * [textContainer lineFragmentPadding]),
fontHeight * totalHeight);
if (wholeLineScroll)
@ -211,6 +212,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
[self setFrameSize:NSMakeSize(ceil(std::max(clip.width, content.width)),
ceil(std::max(clip.height, content.height)))];
[self recomputeVisible];
[scroller reflectScrolledClipView:[scroller contentView]];
}
@ -287,6 +289,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
content.height += (fontHeight * 2) - 1;
[self setFrameSize:NSMakeSize(ceil(std::max(clip.width, content.width)),
ceil(std::max(clip.height, content.height)))];
[scroller reflectScrolledClipView:[scroller contentView]];
}
totalWidth = newSize.x;
totalHeight = newSize.y;