From ef74faeef464beb9f9291f55219c582c278994fd Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 23 Apr 2023 19:11:32 +0200 Subject: [PATCH] BugFix UI Source toolbox and Display view --- src/DisplaysView.cpp | 34 ++++++++++++++-------------------- src/GeometryView.cpp | 2 +- src/LayerView.cpp | 4 ++-- src/MixingView.cpp | 2 +- src/UserInterfaceManager.cpp | 12 ++++++------ src/UserInterfaceManager.h | 2 +- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/DisplaysView.cpp b/src/DisplaysView.cpp index a2f64fd..75f9ec9 100644 --- a/src/DisplaysView.cpp +++ b/src/DisplaysView.cpp @@ -190,6 +190,19 @@ void DisplaysView::update(float dt) windows_[i].output_group_->visible_ = false; } + if ( current_window_ == i ) { + windows_[i].overlays_->setActive(1); + windows_[i].output_handles_->visible_ = true; + windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 1.f ); + windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 1.f ); + } + else { + windows_[i].overlays_->setActive(0); + windows_[i].output_handles_->visible_ = false; + windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 0.3f ); + windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 0.8f ); + } + } output_ar = Mixer::manager().session()->frame()->aspectRatio(); @@ -684,16 +697,6 @@ std::pair DisplaysView::pick(glm::vec2 P) (pick.first == windows_[i].output_handles_) || (pick.first == windows_[i].menu_) ) { current_window_ = i; - windows_[i].overlays_->setActive(1); - windows_[i].output_handles_->visible_ = true; - windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 1.f ); - windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 1.f ); - } - else { - windows_[i].overlays_->setActive(0); - windows_[i].output_handles_->visible_ = false; - windows_[i].output_frame_->color = glm::vec4( COLOR_FRAME, 0.3f ); - windows_[i].title_->shader()->color = glm::vec4( COLOR_WINDOW, 0.8f ); } } @@ -728,18 +731,9 @@ void DisplaysView::select(glm::vec2 A, glm::vec2 B) for (; itp != pv.rend(); ++itp){ // search for WindowPreview auto w = std::find_if(windows_.begin(), windows_.end(), WindowPreview::hasNode(itp->first)); - if (w != windows_.end()) { - // cancel previous current - if (current_window_>-1) { - windows_[current_window_].overlays_->setActive(0); - windows_[current_window_].output_group_->visible_ = false; - } + if (w != windows_.end()) // set current current_window_ = (int) std::distance(windows_.begin(), w); - windows_[current_window_].overlays_->setActive(1); - windows_[current_window_].output_group_->visible_ = true; - } - } } diff --git a/src/GeometryView.cpp b/src/GeometryView.cpp index 04b5b54..bfbe801 100644 --- a/src/GeometryView.cpp +++ b/src/GeometryView.cpp @@ -396,7 +396,7 @@ void GeometryView::draw() } Action::manager().store(std::string("Selection: Align.")); } - if (ImGui::Selectable( ICON_FA_COMPRESS " Best Fit" )){ + if (ImGui::Selectable( ICON_FA_OBJECT_GROUP " Best Fit" )){ glm::mat4 T = glm::translate(glm::identity(), -overlay_selection_->translation_); float factor = 1.f; float angle = -overlay_selection_->rotation_.z; diff --git a/src/LayerView.cpp b/src/LayerView.cpp index eed8587..eb148d2 100644 --- a/src/LayerView.cpp +++ b/src/LayerView.cpp @@ -129,7 +129,7 @@ void LayerView::draw() ImGui::Separator(); // manipulation of sources in Mixing view - if (ImGui::Selectable( ICON_FA_ALIGN_CENTER " Distribute" )){ + if (ImGui::Selectable( ICON_FA_GRIP_LINES_VERTICAL ICON_FA_GRIP_LINES_VERTICAL " Distribute" )){ SourceList dsl = depth_sorted(Mixer::selection().getCopy()); SourceList::iterator it = dsl.begin(); float depth = (*it)->depth(); @@ -140,7 +140,7 @@ void LayerView::draw() } Action::manager().store(std::string("Selection: Layer Distribute")); } - if (ImGui::Selectable( ICON_FA_RULER_HORIZONTAL " Compress" )){ + if (ImGui::Selectable( ICON_FA_CARET_RIGHT ICON_FA_CARET_LEFT " Compress" )){ SourceList dsl = depth_sorted(Mixer::selection().getCopy()); SourceList::iterator it = dsl.begin(); float depth = (*it)->depth(); diff --git a/src/MixingView.cpp b/src/MixingView.cpp index 7ecc8f8..1eebbfe 100644 --- a/src/MixingView.cpp +++ b/src/MixingView.cpp @@ -271,7 +271,7 @@ void MixingView::draw() } Action::manager().store(std::string("Selection: Mixing Distribute in circle")); } - if (ImGui::Selectable( ICON_FA_ELLIPSIS_V " Align & Distribute" )){ + if (ImGui::Selectable( ICON_FA_ALIGN_CENTER " Align & Distribute" )){ SourceList list; glm::vec2 center = glm::vec2(0.f, 0.f); for (SourceList::iterator it = Mixer::selection().begin(); it != Mixer::selection().end(); ++it) { diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index 2386810..04a2a86 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -1552,7 +1552,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode ImGui::SetNextItemWidth( sliderwidth ); if ( ImGui::DragFloat("##ScaleX", &v, 1.f, -MAX_SCALE * out.x, MAX_SCALE * out.x, "%.0fpx") ) { if (v > 10.f) { - n->scale_.x = v / out.x; + n->scale_.x = v / ( out.y * s->frame()->aspectRatio()); if (*p_mode & SourceToolbar_linkar) n->scale_.y = n->scale_.x / ar_scale; s->touch(); @@ -1560,7 +1560,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode } if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){ v += io.MouseWheel; - n->scale_.x = v / out.x; + n->scale_.x = v / ( out.y * s->frame()->aspectRatio()); if (*p_mode & SourceToolbar_linkar) n->scale_.y = n->scale_.x / ar_scale; s->touch(); @@ -1760,7 +1760,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode ImGui::SetNextItemWidth( 2.7f * ImGui::GetTextLineHeightWithSpacing() ); if ( ImGui::DragFloat("##ScaleX", &v, 1.f, -MAX_SCALE * out.x, MAX_SCALE * out.x, "%.0f") ) { if (v > 10.f) { - n->scale_.x = v / out.x; + n->scale_.x = v / ( out.y * s->frame()->aspectRatio()); if (*p_mode & SourceToolbar_linkar) n->scale_.y = n->scale_.x / ar_scale; s->touch(); @@ -1768,7 +1768,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode } if (ImGui::IsItemHovered() && io.MouseWheel != 0.f && v > 10.f){ v += io.MouseWheel; - n->scale_.x = v / out.x; + n->scale_.x = v / ( out.y * s->frame()->aspectRatio()); if (*p_mode & SourceToolbar_linkar) n->scale_.y = n->scale_.x / ar_scale; s->touch(); @@ -8900,9 +8900,9 @@ void Navigator::RenderMainPannelVimix() ImGui::SameLine(0, ImGui::GetTextLineHeight()); ImGuiToolkit::IconToggle( ICON_FA_HAND_PAPER, &Settings::application.widget.inputs, TOOLTIP_INPUTS, SHORTCUT_INPUTS); - ImGui::SameLine(0, ImGui::GetTextLineHeight()); + ImGui::SameLine(0, ImGui::GetTextLineHeight() - IMGUI_SAME_LINE); static uint counter_menu_timeout = 0; - if ( ImGuiToolkit::IconButton( ICON_FA_ELLIPSIS_V ) || ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) ) { + if ( ImGuiToolkit::IconButton( " " ICON_FA_ELLIPSIS_V " " ) || ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) ) { counter_menu_timeout=0; ImGui::OpenPopup( "MenuToolboxWindows" ); } diff --git a/src/UserInterfaceManager.h b/src/UserInterfaceManager.h index 950a68b..52cfd7b 100644 --- a/src/UserInterfaceManager.h +++ b/src/UserInterfaceManager.h @@ -77,7 +77,7 @@ #define MENU_NOTE ICON_FA_STICKY_NOTE " Add sticky note" #define MENU_METRICS ICON_FA_TACHOMETER_ALT " Metrics" -#define MENU_SOURCE_TOOL ICON_FA_VECTOR_SQUARE " Source editor" +#define MENU_SOURCE_TOOL ICON_FA_LIST_ALT " Source toolbox" #define MENU_HELP ICON_FA_LIFE_RING " Help" #define SHORTCUT_HELP CTRL_MOD "H" #define MENU_LOGS ICON_FA_LIST_UL " Logs"