debugimgui: removed scrollbar from memory windows, and let the view itself control what is displays. Use cursors/pageup/pagedown to control the memory window when the view cursor is visible.

This commit is contained in:
mahlemiut 2016-06-02 19:06:39 +12:00
parent b08a496e6c
commit 27a8e715bc

View File

@ -499,9 +499,17 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change)
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
// if the view has changed its expression (disasm, memory), then update scroll bar
// if the view has changed its expression (disasm, memory), then update scroll bar and view cursor
if(exp_change)
{
if(view_ptr->view->cursor_supported())
{
view_ptr->view->set_cursor_visible(true);
view_ptr->view->set_cursor_position(debug_view_xy(0,view_ptr->view->visible_position().y));
}
if(view_ptr->type != DVT_MEMORY) // no scroll bars in memory views
ImGui::SetScrollY(view_ptr->view->visible_position().y * fsize.y);
}
// update view location, while the cursor is at 0,0.
view_ptr->ofs_x = ImGui::GetCursorScreenPos().x;
@ -512,6 +520,7 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change)
drawlist = ImGui::GetWindowDrawList();
// temporarily set cursor to the last line, this will set the scroll bar range
if(view_ptr->type != DVT_MEMORY) // no scroll bars in memory views
ImGui::SetCursorPosY((totalsize.y) * fsize.y);
// set the visible area to be displayed
@ -520,9 +529,12 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change)
view_ptr->view->set_visible_size(vsize);
// set the visible position
if(view_ptr->type != DVT_MEMORY) // since ImGui cannot handle huge memory views, we'll just let the view control the displayed area
{
pos.x = 0;
pos.y = ImGui::GetScrollY() / fsize.y;
view_ptr->view->set_visible_position(pos);
}
viewdata = view_ptr->view->viewdata();