From 76629ee6bfd0ed03de92ab95567e6bd1179c7dea Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Sat, 11 Jun 2016 19:07:09 +1200 Subject: debugimgui: draw a light rectangle around a view if it has focus, gives a visual cue as which view accepts input. --- src/osd/modules/debugger/debugimgui.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/osd/modules/debugger/debugimgui.cpp') diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 504899f560a..b935525f8f9 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -560,6 +560,15 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change) xy1.y += fsize.y; xy2.y += fsize.y; } + + // draw a rect around a view if it has focus + if(view_ptr->has_focus) + { + ImU32 col = ImGui::ColorConvertFloat4ToU32(ImVec4(0.5f,0.5f,0.5f,0.3f)); + drawlist->AddRect(ImVec2(view_ptr->ofs_x,view_ptr->ofs_y + ImGui::GetScrollY()), + ImVec2(view_ptr->ofs_x + view_ptr->view_width,view_ptr->ofs_y + ImGui::GetScrollY() + view_ptr->view_height),col); + } + ImGui::PopStyleVar(2); } @@ -938,6 +947,7 @@ void debug_imgui::draw_console() draw_view(view_main_console,false); ImGui::EndChild(); ImGui::Separator(); + ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue; if(m_running) flags |= ImGuiInputTextFlags_ReadOnly; -- cgit v1.2.3 From d881a058e41717b11f1d3323c2f5ab41a1dfa0bb Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Mon, 13 Jun 2016 23:32:47 +1200 Subject: debugimgui: use IM_COL32 macro --- src/osd/modules/debugger/debugimgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/osd/modules/debugger/debugimgui.cpp') diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index b935525f8f9..fe2567b07ac 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -540,12 +540,12 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change) { char str[2]; map_attr_to_fg_bg(viewdata->attrib,&fg,&bg); - ImU32 fg_col = ImGui::ColorConvertFloat4ToU32(ImVec4(fg.r()/255.0f,fg.g()/255.0f,fg.b()/255.0f,fg.a()/255.0f)); + ImU32 fg_col = IM_COL32(fg.r(),fg.g(),fg.b(),fg.a()); str[0] = v = viewdata->byte; str[1] = '\0'; if(bg != base) { - ImU32 bg_col = ImGui::ColorConvertFloat4ToU32(ImVec4(bg.r()/255.0f,bg.g()/255.0f,bg.b()/255.0f,bg.a()/255.0f)); + ImU32 bg_col = IM_COL32(bg.r(),bg.g(),bg.b(),bg.a()); xy1.x++; xy2.x++; drawlist->AddRectFilled(xy1,xy2,bg_col); xy1.x--; xy2.x--; @@ -564,7 +564,7 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change) // draw a rect around a view if it has focus if(view_ptr->has_focus) { - ImU32 col = ImGui::ColorConvertFloat4ToU32(ImVec4(0.5f,0.5f,0.5f,0.3f)); + ImU32 col = IM_COL32(127,127,127,76); drawlist->AddRect(ImVec2(view_ptr->ofs_x,view_ptr->ofs_y + ImGui::GetScrollY()), ImVec2(view_ptr->ofs_x + view_ptr->view_width,view_ptr->ofs_y + ImGui::GetScrollY() + view_ptr->view_height),col); } -- cgit v1.2.3 From 7a23493dccaa1fd036dcab81c3c49464a02ee412 Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Tue, 14 Jun 2016 22:30:08 +1200 Subject: debugimgui: if console window is active, then give console input widget focus. Note that this means that the disassmbly view in the console cannot get focus at all (but separate disasm windows still can). --- src/osd/modules/debugger/debugimgui.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/osd/modules/debugger/debugimgui.cpp') diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index fe2567b07ac..81f13926376 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -954,6 +954,8 @@ void debug_imgui::draw_console() ImGui::PushItemWidth(-1.0f); if(ImGui::InputText("##console_input",view_main_console->console_input,512,flags)) view_main_console->exec_cmd = true; + if ((ImGui::IsRootWindowOrAnyChildFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0))) + ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget ImGui::PopItemWidth(); ImGui::EndChild(); ImGui::End(); -- cgit v1.2.3