Make internal debugger menu remember its currently selected item, to help make switching CPUs/regions/options easier. Also, set all windows to visible only on initial display.

This commit is contained in:
mahlemiut 2016-01-11 00:15:52 +13:00
parent e42fafc3d7
commit 7520eea004

View File

@ -278,6 +278,7 @@ static DView * focus_view;
static ui_menu * menu; static ui_menu * menu;
static DView_edit * cur_editor; static DView_edit * cur_editor;
static int win_count; static int win_count;
static void* menu_sel; // selected item in the menu
static void set_focus_view(DView *dv) static void set_focus_view(DView *dv)
{ {
@ -1017,7 +1018,7 @@ static void on_memory_window_activate(DView *dv, const ui_menu_event *event)
ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT;
ndv->bounds.setx(0,500); ndv->bounds.setx(0,500);
win_count++; win_count++;
dview_set_state(ndv,VIEW_STATE_VISIBLE,true);
set_focus_view(ndv); set_focus_view(ndv);
} }
@ -1036,6 +1037,7 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event
dview_set_title(ndv, source->name()); dview_set_title(ndv, source->name());
ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT;
win_count++; win_count++;
dview_set_state(ndv,VIEW_STATE_VISIBLE,true);
set_focus_view(ndv); set_focus_view(ndv);
} }
@ -1065,6 +1067,7 @@ static void on_log_window_activate(DView *dv, const ui_menu_event *event)
ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT;
ndv->bounds.setx(0,600); ndv->bounds.setx(0,600);
win_count++; win_count++;
dview_set_state(ndv,VIEW_STATE_VISIBLE,true);
set_focus_view(ndv); set_focus_view(ndv);
} }
@ -1079,6 +1082,7 @@ static void on_bp_window_activate(DView *dv, const ui_menu_event *event)
ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT;
ndv->bounds.setx(0,600); ndv->bounds.setx(0,600);
win_count++; win_count++;
dview_set_state(ndv,VIEW_STATE_VISIBLE,true);
set_focus_view(ndv); set_focus_view(ndv);
} }
@ -1093,6 +1097,7 @@ static void on_wp_window_activate(DView *dv, const ui_menu_event *event)
ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT; ndv->ofs_x = ndv->ofs_y = win_count * TITLE_HEIGHT;
ndv->bounds.setx(0,600); ndv->bounds.setx(0,600);
win_count++; win_count++;
dview_set_state(ndv,VIEW_STATE_VISIBLE,true);
set_focus_view(ndv); set_focus_view(ndv);
} }
@ -1318,7 +1323,10 @@ static void CreateMainMenu(running_machine &machine)
std::string title; std::string title;
if (menu) if (menu)
{
menu_sel = menu->get_selection();
global_free( menu); global_free( menu);
}
menu = global_alloc_clear<ui_menu_debug>(machine, &machine.render().ui_container()); menu = global_alloc_clear<ui_menu_debug>(machine, &machine.render().ui_container());
switch (focus_view->type) switch (focus_view->type)
@ -1419,6 +1427,7 @@ static void CreateMainMenu(running_machine &machine)
if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU)) if (!dview_is_state(focus_view, VIEW_STATE_FOLLOW_CPU))
menu->item_append("Close Window", "[Shift+F4]", 0, (void *)on_close_activate); menu->item_append("Close Window", "[Shift+F4]", 0, (void *)on_close_activate);
menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate); menu->item_append("Exit", nullptr, 0, (void *)on_exit_activate);
menu->set_selection(menu_sel);
} }
static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y) static int map_point(DView *dv, INT32 target_x, INT32 target_y, INT32 *mapped_x, INT32 *mapped_y)
@ -1731,6 +1740,7 @@ static void handle_menus(running_machine &machine)
} }
else if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) else if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
{ {
menu_sel = menu->get_selection();
global_free(menu); global_free(menu);
menu = nullptr; menu = nullptr;
} }
@ -1819,8 +1829,8 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop)
win_count++; win_count++;
DView *statewin = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU); DView *statewin = dview_alloc(target, device.machine(), DVT_STATE, VIEW_STATE_FOLLOW_CPU);
statewin->ofs_x = 350; statewin->ofs_x = 300;
statewin->bounds.set(0,150,0,600); statewin->bounds.set(0,200,0,600);
win_count++; win_count++;
DView *console = dview_alloc(target, device.machine(), DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU); DView *console = dview_alloc(target, device.machine(), DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
@ -1835,9 +1845,11 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop)
} }
followers_set_cpu(&device); followers_set_cpu(&device);
debug_show_all();
if(firststop) if(firststop)
{
debug_show_all();
ui_input_reset(device.machine()); ui_input_reset(device.machine());
}
//ui_update_and_render(device.machine(), device.machine().render().ui_container()()); //ui_update_and_render(device.machine(), device.machine().render().ui_container()());
update_views(); update_views();
device.machine().osd().update(false); device.machine().osd().update(false);