diff --git a/src/single_window/main_window.cpp b/src/single_window/main_window.cpp index e7f0d06..40983b9 100644 --- a/src/single_window/main_window.cpp +++ b/src/single_window/main_window.cpp @@ -24,31 +24,31 @@ int Render::MainWindow() { ImDrawList* draw_list = ImGui::GetWindowDrawList(); draw_list->AddLine( - ImVec2(main_window_width_default_ / 2, title_bar_height_ + 25.0f), - ImVec2(main_window_width_default_ / 2, title_bar_height_ + 240.0f), + ImVec2(main_window_width_default_ / 2, title_bar_height_ + 15.0f), + ImVec2(main_window_width_default_ / 2, title_bar_height_ + 225.0f), IM_COL32(0, 0, 0, 122), 1.0f); RemoteWindow(); ImGui::EndChild(); ImGui::SetNextWindowPos( - ImVec2(0, title_bar_height_ + local_window_height_ - 1), + ImVec2(0, title_bar_height_ + local_window_height_ - 1.0f), ImGuiCond_Always); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); - ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 1.0f, 1.0f, 0.0f)); - ImGui::BeginChild("RecentConnectionsWindow", - ImVec2(main_window_width_default_, - main_window_height_default_ - title_bar_height_ - - local_window_height_ - status_bar_height_), - ImGuiChildFlags_Border, - ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | - ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | - ImGuiWindowFlags_NoBringToFrontOnFocus); + ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); + ImGui::BeginChild( + "RecentConnectionsWindow", + ImVec2(main_window_width_default_, + main_window_height_default_ - title_bar_height_ - + local_window_height_ - status_bar_height_ + 1.0f), + ImGuiChildFlags_Border, + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | + ImGuiWindowFlags_NoBringToFrontOnFocus); ImGui::PopStyleVar(); ImGui::PopStyleColor(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + - main_window_text_y_padding_ / 2); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + main_window_text_y_padding_); ImGui::Indent(main_child_window_x_padding_); ImGui::SetWindowFontScale(0.8f); @@ -57,14 +57,6 @@ int Render::MainWindow() { localization::recent_connections[localization_language_index_].c_str()); ImGui::SetWindowFontScale(1.0f); - draw_list->AddLine( - ImVec2(25.0f, title_bar_height_ + local_window_height_ + 35.0f), - ImVec2(main_window_width_default_ - 25.0f, - title_bar_height_ + local_window_height_ + 35.0f), - IM_COL32(0, 0, 0, 122), 1.0f); - - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + - main_window_text_y_padding_ / 2); ShowRecentConnections(); ImGui::EndChild(); @@ -76,6 +68,17 @@ int Render::MainWindow() { } int Render::ShowRecentConnections() { + ImGui::SetCursorPosX(25.0f); + ImGui::BeginChild("RecentConnectionsContainer", + ImVec2(main_window_width_default_ - 50.0f, 152.0f), + ImGuiChildFlags_Border, + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | + ImGuiWindowFlags_NoBringToFrontOnFocus | + ImGuiWindowFlags_AlwaysHorizontalScrollbar); + + int recent_connections_count = recent_connection_textures_.size(); + int count = 0; for (auto it = recent_connection_textures_.begin(); it != recent_connection_textures_.end(); ++it) { std::string recent_connection_sub_window_name = @@ -103,8 +106,10 @@ int Render::ShowRecentConnections() { ImGui::Text("%s", it->first.c_str()); ImGui::SetWindowFontScale(1.0f); ImGui::EndChild(); - ImGui::SameLine(); + count++; + ImGui::SameLine(0, count != recent_connections_count ? 23.0f : 0.0f); } + ImGui::EndChild(); return 0; } \ No newline at end of file diff --git a/src/single_window/render.cpp b/src/single_window/render.cpp index 71a8ebc..6204d17 100644 --- a/src/single_window/render.cpp +++ b/src/single_window/render.cpp @@ -914,6 +914,7 @@ int Render::Run() { int ret = thumbnail_.LoadThumbnail( main_renderer_, recent_connection_textures_, &recent_connection_image_width_, &recent_connection_image_height_); + LOG_ERROR("load [{} {}]", ret, recent_connection_textures_.size()); if (!ret) { LOG_INFO("Load recent connection thumbnails"); } diff --git a/src/single_window/render.h b/src/single_window/render.h index b974ae8..9a56356 100644 --- a/src/single_window/render.h +++ b/src/single_window/render.h @@ -176,16 +176,16 @@ class Render { int control_window_width_ = 170; int control_window_height_ = 40; int local_window_width_ = 320; - int local_window_height_ = 260; + int local_window_height_ = 235; int remote_window_width_ = 320; - int remote_window_height_ = 260; + int remote_window_height_ = 235; int local_child_window_width_ = 266; int local_child_window_height_ = 180; int remote_child_window_width_ = 266; int remote_child_window_height_ = 180; - int main_window_text_y_padding_ = 20; + int main_window_text_y_padding_ = 10; int main_child_window_x_padding_ = 27; - int main_child_window_y_padding_ = 60; + int main_child_window_y_padding_ = 45; int status_bar_height_ = 20; int connection_status_window_width_ = 200; int connection_status_window_height_ = 150;