diff --git a/src/DisplaysView.cpp b/src/DisplaysView.cpp index 8855ca1..aac6a32 100644 --- a/src/DisplaysView.cpp +++ b/src/DisplaysView.cpp @@ -129,11 +129,6 @@ void DisplaysView::update(float dt) FrameBuffer *render = Mixer::manager().session()->frame(); if (render) output_render_->setTextureIndex( render->texture() ); - -// // prevent invalid scaling -// float s = CLAMP(scene.root()->scale_.x, DISPLAYS_MIN_SCALE, DISPLAYS_MAX_SCALE); -// scene.root()->scale_.x = s; -// scene.root()->scale_.y = s; } } @@ -164,7 +159,7 @@ void DisplaysView::recenter () m->attach(surf); Frame *frame = new Frame(Frame::SHARP, Frame::THIN, Frame::GLOW); - frame->color = glm::vec4(COLOR_MONITOR, 1.f); + frame->color = glm::vec4( COLOR_MONITOR, 1.f); m->attach(frame); Glyph *label = new Glyph(4); label->setChar( std::to_string(index).back() ); @@ -202,12 +197,33 @@ void DisplaysView::recenter () void DisplaysView::resize ( int scale ) { +// glm::vec3 scene_center = Rendering::manager().unProject(resolution() * 0.5f, scene.root()->transform_); +// scene_center.z = 0.f; + + float z = CLAMP(0.01f * (float) scale, 0.f, 1.f); z *= z; z *= DISPLAYS_MAX_SCALE - DISPLAYS_MIN_SCALE; z += DISPLAYS_MIN_SCALE; scene.root()->scale_.x = z; scene.root()->scale_.y = z; + +// scene.root()->update(0.f); +// glm::vec3 scene_center2 = Rendering::manager().unProject(resolution() * 0.5f, scene.root()->transform_); +// scene_center2.z = 0.f; + +// g_printerr(" resol %f %f - center %f %f %f\n",resolution().x, resolution().y, +// scene_center.x, scene_center.y, scene_center.z); + +// g_printerr(" scene.root()->translation_ %f %f \n",scene.root()->translation_.x, +// scene.root()->translation_.y); + +// scene.root()->translation_ += scene_center2 -scene_center; + +// // Clamp translation to acceptable area +// glm::vec3 left(-10.f, -5.f, 0.f); +// glm::vec3 right(5.f, 5.f, 0.f); +// scene.root()->translation_ = glm::clamp(scene.root()->translation_, left, right); } int DisplaysView::size () @@ -605,7 +621,7 @@ void DisplaysView::select(glm::vec2 A, glm::vec2 B) scene.accept(pv); output_selected_ = !pv.empty(); - output_overlays_->setActive(output_selected_ ? 0 : 1); + output_overlays_->setActive(output_selected_ ? 1 : 0); } void DisplaysView::initiate() diff --git a/src/GeometryView.cpp b/src/GeometryView.cpp index 51828ba..5ee0a05 100644 --- a/src/GeometryView.cpp +++ b/src/GeometryView.cpp @@ -169,7 +169,8 @@ void GeometryView::update(float dt) // the current view is the geometry view if (Mixer::manager().view() == this ) { - updateSelectionOverlay(); + ImVec4 c = ImGuiToolkit::HighlightColor(); + updateSelectionOverlay(glm::vec4(c.x, c.y, c.z, c.w)); // overlay_selection_icon_->visible_ = false; } } @@ -249,38 +250,64 @@ void GeometryView::draw() scene.accept(draw_foreground); // display interface - // Locate window at upper left corner - glm::vec2 P = glm::vec2(-output_surface_->scale_.x - 0.02f, output_surface_->scale_.y + 0.01 ); + // Locate window at upper right corner + glm::vec2 P = glm::vec2(output_surface_->scale_.x + 0.02f, output_surface_->scale_.y ); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); // Set window position depending on icons size ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); - ImGui::SetNextWindowPos(ImVec2(P.x, P.y - 1.5f * ImGui::GetFrameHeight() ), ImGuiCond_Always); + ImGui::SetNextWindowPos(ImVec2(P.x, P.y), ImGuiCond_Always); if (ImGui::Begin("##GeometryViewOptions", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus )) { - // style grey - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME_LIGHT, 1.f)); // 1 + // style + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME_LIGHT, 1.f)); ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); - ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.36f, 0.36f, 0.36f, 0.9f)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.36f, 0.36f, 0.36f, 0.5f)); + ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.1f, 0.1f, 0.1f, 0.0f)); + ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.1f, 0.1, 0.1, 0.8f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.00f)); ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.14f, 0.14f, 0.14f, 0.46f)); - ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.14f, 0.14f, 0.14f, 0.00f)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.14f, 0.14f, 0.14f, 0.46f)); // 8 + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.914f, 0.14f, 0.14f, 1.00f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.914f, 0.14f, 0.14f, 0.46f)); // 8 - static std::vector< std::pair > icons_ws = { {10,16}, {11,16}, {12,16} }; - static std::vector< std::string > labels_ws = { "Background", "Workspace", "Foreground" }; - if ( ImGuiToolkit::ComboIcon (icons_ws, labels_ws, &Settings::application.current_workspace) ){ - ++View::need_deep_update_; + // draw vertical slider + ImVec2 _pos = ImGui::GetCursorPos(); + int selected_ws = Source::FOREGROUND - Settings::application.current_workspace; + const ImVec2 slider_size(40, 132); + if (ImGui::VSliderInt("##sliderworkspace", slider_size, &selected_ws, 0, 2, "") ) { + Settings::application.current_workspace = Source::FOREGROUND - selected_ws; + ++View::need_deep_update_; + } + if (ImGui::IsItemActive()) { + if ( Settings::application.current_workspace == Source::BACKGROUND ) + ImGuiToolkit::ToolTip("Background"); + else if ( Settings::application.current_workspace == Source::FOREGROUND ) + ImGuiToolkit::ToolTip("Foreground"); + else + ImGuiToolkit::ToolTip("Workspace"); } - ImGui::PopStyleColor(8); // 14 colors + // draw icons on top of slider + ImGui::SetCursorPos( _pos ); + static std::vector< std::pair > icons_ws = { {10,16}, {11,16}, {12,16} }; + std::vector >::iterator it_icon = icons_ws.begin(); + for(int i = 0 ; it_icon != icons_ws.end(); i++, ++it_icon) { + // current workspace icon is light color + if ( Settings::application.current_workspace != i) { + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME, 1.f)); + ImGuiToolkit::Icon( (*it_icon).first, (*it_icon).second ); + ImGui::PopStyleColor(); + } + else + ImGuiToolkit::Icon( (*it_icon).first, (*it_icon).second ); + } + + ImGui::PopStyleColor(8); ImGui::End(); } ImGui::PopFont(); - // display popup menu + // display popup menu source if (show_context_menu_ == MENU_SOURCE) { ImGui::OpenPopup( "GeometrySourceContextMenu" ); show_context_menu_ = MENU_NONE; @@ -321,7 +348,7 @@ void GeometryView::draw() } ImGui::EndPopup(); } - // display popup menu + // display popup menu selection if (show_context_menu_ == MENU_SELECTION) { ImGui::OpenPopup( "GeometrySelectionContextMenu" ); show_context_menu_ = MENU_NONE; @@ -1110,9 +1137,9 @@ void GeometryView::arrow (glm::vec2 movement) } } -void GeometryView::updateSelectionOverlay() +void GeometryView::updateSelectionOverlay(glm::vec4 color) { - View::updateSelectionOverlay(); + View::updateSelectionOverlay(color); // create first if (overlay_selection_scale_ == nullptr) { diff --git a/src/GeometryView.h b/src/GeometryView.h index fe8e666..0ebe789 100644 --- a/src/GeometryView.h +++ b/src/GeometryView.h @@ -36,7 +36,7 @@ private: Node *overlay_scaling_grid_; Node *overlay_crop_; - void updateSelectionOverlay() override; + void updateSelectionOverlay(glm::vec4 color) override; bool overlay_selection_active_; Group *overlay_selection_stored_status_; Handles *overlay_selection_scale_; diff --git a/src/ImageShader.cpp b/src/ImageShader.cpp index 6dfb872..8993dc6 100644 --- a/src/ImageShader.cpp +++ b/src/ImageShader.cpp @@ -39,7 +39,7 @@ std::vector< ShadingProgram > maskPrograms = { }; const char* MaskShader::mask_names[3] = { ICON_FA_EXPAND, ICON_FA_EDIT, ICON_FA_SHAPES }; -const char* MaskShader::mask_shapes[5] = { "Elipse", "Oblong", "Rectangle", "Horizontal", "Vertical" }; +const char* MaskShader::mask_shapes[5] = { "Ellipse", "Oblong", "Rectangle", "Horizontal", "Vertical" }; ImageShader::ImageShader(): Shader(), mask_texture(0), stipple(0.f) { diff --git a/src/ImageShader.h b/src/ImageShader.h index 5ceb358..6feb77d 100644 --- a/src/ImageShader.h +++ b/src/ImageShader.h @@ -52,7 +52,7 @@ public: uint mode; enum Shapes { - ELIPSE = 0, + ELLIPSE = 0, OBLONG = 1, RECTANGLE = 2, HORIZONTAL = 3, diff --git a/src/LayerView.cpp b/src/LayerView.cpp index bf0d1c6..12791ed 100644 --- a/src/LayerView.cpp +++ b/src/LayerView.cpp @@ -38,7 +38,6 @@ #include "UserInterfaceManager.h" #include "BoundingBoxVisitor.h" #include "ActionManager.h" -#include "Log.h" #include "LayerView.h" @@ -193,7 +192,8 @@ void LayerView::update(float dt) if (Mixer::manager().view() == this ) { // update the selection overlay - updateSelectionOverlay(); + ImVec4 c = ImGuiToolkit::HighlightColor(); + updateSelectionOverlay(glm::vec4(c.x, c.y, c.z, c.w)); } } @@ -328,6 +328,11 @@ View::Cursor LayerView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pair info << "Depth " << std::fixed << std::setprecision(2) << d << " "; current_action_ = s->name() + ": " + info.str(); + if ( d > LAYER_FOREGROUND ) + info << "\n (Foreground)"; + else if ( d < LAYER_BACKGROUND ) + info << "\n (Background)"; + return Cursor(Cursor_ResizeNESW, info.str() ); } @@ -393,9 +398,9 @@ void LayerView::arrow (glm::vec2 movement) -void LayerView::updateSelectionOverlay() +void LayerView::updateSelectionOverlay(glm::vec4 color) { - View::updateSelectionOverlay(); + View::updateSelectionOverlay(color); if (overlay_selection_->visible_) { // calculate bbox on selection diff --git a/src/LayerView.h b/src/LayerView.h index bd1d2b6..d21b33c 100644 --- a/src/LayerView.h +++ b/src/LayerView.h @@ -24,7 +24,7 @@ public: float setDepth (Source *, float d = -1.f); private: - void updateSelectionOverlay() override; + void updateSelectionOverlay(glm::vec4 color) override; float aspect_ratio; Mesh *persp_left_, *persp_right_; diff --git a/src/MixingView.cpp b/src/MixingView.cpp index ccd7341..6c81cd8 100644 --- a/src/MixingView.cpp +++ b/src/MixingView.cpp @@ -39,7 +39,6 @@ #include "BoundingBoxVisitor.h" #include "ActionManager.h" #include "MixingGroup.h" -#include "Log.h" #include "MixingView.h" @@ -78,13 +77,13 @@ MixingView::MixingView() : View(MIXING), limbo_scale_(MIXING_MIN_THRESHOLD) limbo_slider_root_->attach(limbo_slider_); limbo_up_ = new Mesh("mesh/triangle_point.ply"); limbo_up_->scale_ = glm::vec3(0.8f, 0.8f, 1.f); - limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, 0.01f ); + limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.01f ); limbo_slider_root_->attach(limbo_up_); limbo_down_ = new Mesh("mesh/triangle_point.ply"); limbo_down_->translation_ = glm::vec3(0.f, -0.02f, 0.f); limbo_down_->scale_ = glm::vec3(0.8f, 0.8f, 1.f); limbo_down_->rotation_ = glm::vec3(0.f, 0.f, M_PI); - limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, 0.01f ); + limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.01f ); limbo_slider_root_->attach(limbo_down_); mixingCircle_ = new Mesh("mesh/disk.ply"); @@ -136,7 +135,22 @@ MixingView::MixingView() : View(MIXING), limbo_scale_(MIXING_MIN_THRESHOLD) tmp->translation_ = glm::vec3(0.0f, 1.0f, 0.f); tmp->shader()->color = glm::vec4( COLOR_SLIDER_CIRCLE, 1.0f ); slider_root_->attach(tmp); - + // show arrows indicating movement of slider + slider_arrows_ = new Group; + slider_arrows_->visible_ = false; + slider_root_->attach(slider_arrows_); + tmp = new Mesh("mesh/triangle_point.ply"); + tmp->translation_ = glm::vec3(-0.012f, 1.0f, 0.f); + tmp->scale_ = glm::vec3(0.7f, 0.7f, 1.f); + tmp->rotation_ = glm::vec3(0.f, 0.f, M_PI_2); + tmp->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.1f ); + slider_arrows_->attach(tmp); + tmp = new Mesh("mesh/triangle_point.ply"); + tmp->translation_ = glm::vec3(0.012f, 1.0f, 0.f); + tmp->scale_ = glm::vec3(0.7f, 0.7f, 1.f); + tmp->rotation_ = glm::vec3(0.f, 0.f, -M_PI_2); + tmp->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.1f ); + slider_arrows_->attach(tmp); // stashCircle_ = new Disk(); // stashCircle_->scale_ = glm::vec3(0.5f, 0.5f, 1.f); @@ -305,7 +319,8 @@ void MixingView::resize ( int scale ) scene.root()->scale_.y = z; // Clamp translation to acceptable area - glm::vec2 res = resolution(); + const ImGuiIO& io = ImGui::GetIO(); + glm::vec2 res = glm::vec2(io.DisplaySize.x, io.DisplaySize.y); glm::vec3 border(2.3f * res.x/res.y, 2.3f, 0.f); scene.root()->translation_ = glm::clamp(scene.root()->translation_, -border, border); } @@ -379,7 +394,8 @@ void MixingView::update(float dt) mixingCircle_->shader()->color = glm::vec4(f, f, f, 1.f); // update the selection overlay - updateSelectionOverlay(); + ImVec4 c = ImGuiToolkit::HighlightColor(); + updateSelectionOverlay(glm::vec4(c.x, c.y, c.z, c.w)); } } @@ -498,6 +514,7 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai // cursor feedback slider_->color = glm::vec4( COLOR_CIRCLE_OVER, 0.9f ); + slider_arrows_->visible_ = true; std::ostringstream info; info << ICON_FA_ADJUST << " Output fading " << 100 - int(f * 100.0) << " %"; return Cursor(Cursor_Hand, info.str() ); @@ -511,8 +528,8 @@ View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pai Mixer::manager().session()->setActivationThreshold(p); // color change of arrow indicators - limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, p < MIXING_MAX_THRESHOLD ? 0.15f : 0.01f ); - limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, p > MIXING_MIN_THRESHOLD ? 0.15f : 0.01f ); + limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, p < MIXING_MAX_THRESHOLD ? 0.15f : 0.01f ); + limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, p > MIXING_MIN_THRESHOLD ? 0.15f : 0.01f ); std::ostringstream info; info << ICON_FA_SNOWFLAKE " Deactivation limit"; @@ -595,20 +612,23 @@ View::Cursor MixingView::over (glm::vec2 pos) // deal with internal interactive objects if ( pick.first == slider_ ) { - slider_->color = glm::vec4( COLOR_CIRCLE_OVER, 0.9f ); - ret.type = Cursor_Hand; - } - else - slider_->color = glm::vec4( COLOR_CIRCLE, 0.9f ); - - if ( pick.first == limbo_slider_ ) { - limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, limbo_slider_root_->translation_.y < MIXING_MAX_THRESHOLD ? 0.1f : 0.01f ); - limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, limbo_slider_root_->translation_.y > MIXING_MIN_THRESHOLD ? 0.1f : 0.01f ); + slider_->color = glm::vec4( COLOR_CIRCLE_OVER, 0.9f ); + slider_arrows_->visible_ = true; ret.type = Cursor_Hand; } else { - limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, 0.01f ); - limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_OVER, 0.01f ); + slider_arrows_->visible_ = false; + slider_->color = glm::vec4( COLOR_CIRCLE, 0.9f ); + } + + if ( pick.first == limbo_slider_ ) { + limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, limbo_slider_root_->translation_.y < MIXING_MAX_THRESHOLD ? 0.1f : 0.01f ); + limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, limbo_slider_root_->translation_.y > MIXING_MIN_THRESHOLD ? 0.1f : 0.01f ); + ret.type = Cursor_Hand; + } + else { + limbo_up_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.01f ); + limbo_down_->shader()->color = glm::vec4( COLOR_CIRCLE_ARROW, 0.01f ); } @@ -707,9 +727,9 @@ void MixingView::setAlpha(Source *s) } -void MixingView::updateSelectionOverlay() +void MixingView::updateSelectionOverlay(glm::vec4 color) { - View::updateSelectionOverlay(); + View::updateSelectionOverlay(color); if (overlay_selection_->visible_) { // calculate bbox on selection diff --git a/src/MixingView.h b/src/MixingView.h index b82d726..aff6fbc 100644 --- a/src/MixingView.h +++ b/src/MixingView.h @@ -28,12 +28,13 @@ public: void setAlpha (Source *s); private: - void updateSelectionOverlay() override; + void updateSelectionOverlay(glm::vec4 color) override; float limbo_scale_; Group *slider_root_; Disk *slider_; + Group *slider_arrows_; Disk *button_white_; Disk *button_black_; // Disk *stashCircle_; diff --git a/src/Source.h b/src/Source.h index 9c6d022..fc696f4 100644 --- a/src/Source.h +++ b/src/Source.h @@ -7,6 +7,7 @@ #include #include +#include "SourceList.h" #include "View.h" #define DEFAULT_MIXING_TRANSLATION -1.f, 1.f diff --git a/src/TextureView.cpp b/src/TextureView.cpp index e6d4638..01f8968 100644 --- a/src/TextureView.cpp +++ b/src/TextureView.cpp @@ -206,8 +206,8 @@ TextureView::TextureView() : View(TEXTURE), edit_source_(nullptr), need_edit_upd overlay_rotation_->visible_ = false; // Mask draw - mask_cursor_paint_ = 0; - mask_cursor_shape_ = 0; + mask_cursor_paint_ = 1; + mask_cursor_shape_ = 1; stored_mask_size_ = glm::vec3(0.f); mask_cursor_circle_ = new Mesh("mesh/icon_circle.ply"); mask_cursor_circle_->scale_ = glm::vec3(0.2f, 0.2f, 1.f); @@ -260,6 +260,12 @@ int TextureView::size () return (int) ( sqrt(z) * 100.f); } +void TextureView::recenter () +{ + // restore default view + restoreSettings(); +} + void TextureView::select(glm::vec2 A, glm::vec2 B) { // unproject mouse coordinate into scene coordinates @@ -441,7 +447,7 @@ void TextureView::adjustBackground() mask_node_->visible_ = edit_source_->maskShader()->mode > MaskShader::PAINT && mask_cursor_shape_ > 0; int shape = edit_source_->maskShader()->shape; - mask_circle_->visible_ = shape == MaskShader::ELIPSE; + mask_circle_->visible_ = shape == MaskShader::ELLIPSE; mask_square_->visible_ = shape == MaskShader::OBLONG || shape == MaskShader::RECTANGLE; mask_horizontal_->visible_ = shape == MaskShader::HORIZONTAL; mask_vertical_->visible_ = shape == MaskShader::VERTICAL; diff --git a/src/TextureView.h b/src/TextureView.h index b163c0a..2811d72 100644 --- a/src/TextureView.h +++ b/src/TextureView.h @@ -18,6 +18,7 @@ public: int size () override; bool canSelect(Source *) override; void select(glm::vec2 A, glm::vec2 B) override; + void recenter () override; std::pair pick(glm::vec2 P) override; Cursor grab (Source *s, glm::vec2 from, glm::vec2 to, std::pair pick) override; diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index 02bf24c..21a5c1e 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -429,12 +429,14 @@ void UserInterface::handleKeyboard() // button tab to select next else if ( !alt_modifier_active && ImGui::IsKeyPressed( GLFW_KEY_TAB )) { // cancel selection - if (!Mixer::selection().empty()) + if (Mixer::selection().size() > 1) Mixer::selection().clear(); if (shift_modifier_active) Mixer::manager().setCurrentPrevious(); else Mixer::manager().setCurrentNext(); + if (navigator.pannelVisible()) + navigator.showPannelSource( Mixer::manager().indexCurrentSource() ); } // arrow keys to act on current view else if ( ImGui::IsKeyDown( GLFW_KEY_LEFT ) || @@ -1129,7 +1131,7 @@ int UserInterface::RenderViewNavigator(int *shift) for (int v = View::MIXING; v < View::TRANSITION; ++v) { ImGui::NextColumn(); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (ImGui::GetColumnWidth() - ImGui::CalcTextSize(Settings::application.views[v].name.c_str()).x) * 0.5f - ImGui::GetStyle().ItemSpacing.x); - ImGuiToolkit::PushFont(Settings::application.current_view == 4 ? ImGuiToolkit::FONT_BOLD : ImGuiToolkit::FONT_DEFAULT); + ImGuiToolkit::PushFont(Settings::application.current_view == v ? ImGuiToolkit::FONT_BOLD : ImGuiToolkit::FONT_DEFAULT); ImGui::Text("%s", Settings::application.views[v].name.c_str()); ImGui::PopFont(); } @@ -6430,7 +6432,7 @@ void Navigator::RenderViewPannel(ImVec2 draw_pos , ImVec2 draw_size) // Source pannel : *s was checked before void Navigator::RenderSourcePannel(Source *s) { - if (s == nullptr || Settings::application.current_view >= View::TRANSITION) + if (s == nullptr || Settings::application.current_view == View::TRANSITION) return; // Next window is a side pannel diff --git a/src/View.cpp b/src/View.cpp index 1d6c647..c131e31 100644 --- a/src/View.cpp +++ b/src/View.cpp @@ -26,7 +26,6 @@ #include #include -#include "ImGuiToolkit.h" #include "defines.h" #include "Settings.h" @@ -261,7 +260,7 @@ bool View::canSelect(Source *s) { return ( s!=nullptr && !s->locked() ); } -void View::updateSelectionOverlay() +void View::updateSelectionOverlay(glm::vec4 color) { // create first if (overlay_selection_ == nullptr) { @@ -280,9 +279,9 @@ void View::updateSelectionOverlay() if (Mixer::selection().size() > 1) { // show group overlay overlay_selection_->visible_ = true; - ImVec4 c = ImGuiToolkit::HighlightColor(); - overlay_selection_frame_->color = glm::vec4(c.x, c.y, c.z, c.w * 0.8f); - overlay_selection_icon_->color = glm::vec4(c.x, c.y, c.z, c.w); + overlay_selection_frame_->color = color; + overlay_selection_frame_->color.a *= 0.8; + overlay_selection_icon_->color = color; } // no selection: reset drawing selection overlay else @@ -299,9 +298,3 @@ void View::lock(Source *s, bool on) Action::manager().store(s->name() + std::string(": unlock.")); } - -glm::vec2 View::resolution() const -{ - const ImGuiIO& io = ImGui::GetIO(); - return glm::vec2(io.DisplaySize.x, io.DisplaySize.y); -} diff --git a/src/View.h b/src/View.h index c73c4a7..4a3d152 100644 --- a/src/View.h +++ b/src/View.h @@ -5,7 +5,6 @@ #include "Scene.h" #include "FrameBuffer.h" -#include "SourceList.h" class Session; class SessionFileSource; @@ -67,8 +66,10 @@ public: virtual std::pair pick(glm::vec2); // select sources provided a start and end selection points in screen coordinates - virtual void select (glm::vec2, glm::vec2); + virtual void select(glm::vec2, glm::vec2); + // select all sources that can be selected in the view virtual void selectAll (); + // indicates if a source can be selected in the view virtual bool canSelect (Source *); // drag the view provided a start and an end point in screen coordinates @@ -86,7 +87,7 @@ public: return Cursor (); } - // test mouse over provided a point in screen coordinates + // trigger double clic event on view, returns false if event not used virtual bool doubleclic (glm::vec2) { return false; } @@ -94,9 +95,6 @@ public: // left-right [-1 1] and up-down [1 -1] action from arrow keys virtual void arrow (glm::vec2) {} - // resolution on screen - glm::vec2 resolution() const; - // accessible scene Scene scene; @@ -120,7 +118,7 @@ protected: Group *overlay_selection_; Frame *overlay_selection_frame_; Handles *overlay_selection_icon_; - virtual void updateSelectionOverlay (); + virtual void updateSelectionOverlay (glm::vec4 color); // contex menu typedef enum { diff --git a/src/defines.h b/src/defines.h index f051b2b..579af55 100644 --- a/src/defines.h +++ b/src/defines.h @@ -103,7 +103,8 @@ #define COLOR_FRAME 0.75f, 0.2f, 0.75f #define COLOR_FRAME_LIGHT 0.9f, 0.6f, 0.9f #define COLOR_CIRCLE 0.75f, 0.2f, 0.75f -#define COLOR_CIRCLE_OVER 0.8f, 0.8f, 0.8f +#define COLOR_CIRCLE_OVER 0.75f, 0.5f, 0.75f +#define COLOR_CIRCLE_ARROW 0.78f, 0.8f, 0.8f #define COLOR_MIXING_GROUP 0.f, 0.95f, 0.2f #define COLOR_LIMBO_CIRCLE 0.173f, 0.173f, 0.173f #define COLOR_SLIDER_CIRCLE 0.11f, 0.11f, 0.11f