diff options
author | 2017-07-21 18:25:06 +1000 | |
---|---|---|
committer | 2017-07-21 18:25:06 +1000 | |
commit | 3e60ab4a04882a141fa8187bd3b485db50c56451 (patch) | |
tree | 45f5c08e2f3414ba5833cb5dfdcccbb803748196 /src/osd | |
parent | 298f3792121a39d9b6b82a9ac5227720bb96338a (diff) |
cocoa debugger: save/restore console split positions
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/modules/debugger/osx/debugconsole.h | 1 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugconsole.mm | 21 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugview.mm | 5 |
3 files changed, 25 insertions, 2 deletions
diff --git a/src/osd/modules/debugger/osx/debugconsole.h b/src/osd/modules/debugger/osx/debugconsole.h index 3c6ceb7395e..82677778df2 100644 --- a/src/osd/modules/debugger/osx/debugconsole.h +++ b/src/osd/modules/debugger/osx/debugconsole.h @@ -21,6 +21,7 @@ MAMEDebugCommandHistory *history; NSMutableArray *auxiliaryWindows; + NSSplitView *regSplit, *dasmSplit; MAMERegistersView *regView; MAMEDisassemblyView *dasmView; MAMEDebugView *consoleView; diff --git a/src/osd/modules/debugger/osx/debugconsole.mm b/src/osd/modules/debugger/osx/debugconsole.mm index ac17b10bdac..417ca12ce2f 100644 --- a/src/osd/modules/debugger/osx/debugconsole.mm +++ b/src/osd/modules/debugger/osx/debugconsole.mm @@ -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]; } diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm index 26d84d6038d..f3e4c6b8b64 100644 --- a/src/osd/modules/debugger/osx/debugview.mm +++ b/src/osd/modules/debugger/osx/debugview.mm @@ -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; |