diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp index 71e7b04..63259d9 100644 --- a/src/ImGuiVisitor.cpp +++ b/src/ImGuiVisitor.cpp @@ -481,9 +481,10 @@ void ImGuiVisitor::visit (Source& s) width = height * s.frame()->aspectRatio() * ( s.frame()->projectionArea().x / s.frame()->projectionArea().y); } // centered image - ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y + 0.5f * (preview_height-height-space)) ); - ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height)); - + if (s.ready()) { + ImGui::SetCursorPos( ImVec2(pos.x + 0.5f * (preview_width-width), pos.y + 0.5f * (preview_height-height-space)) ); + ImGui::Image((void*)(uintptr_t) s.frame()->texture(), ImVec2(width, height)); + } // inform on visibility status ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y ) ); if (s.active()) { @@ -703,7 +704,7 @@ void ImGuiVisitor::visit (MediaSource& s) top.x += ImGui::GetFrameHeight(); } ImGui::SetCursorPos(top); - if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) + if (ImGuiToolkit::IconButton(2, 5, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename(s.path())); ImGui::SetCursorPos(botom); @@ -866,7 +867,7 @@ void ImGuiVisitor::visit (SessionFileSource& s) } ImGui::SetCursorPos(top); - if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) + if (ImGuiToolkit::IconButton(2, 5, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename(s.path())); } @@ -1668,7 +1669,7 @@ void ImGuiVisitor::visit (MultiFileSource& s) // offer to open file browser at location ImGui::SetCursorPos(top); - if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) + if (ImGuiToolkit::IconButton(2, 5, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename( s.sequence().location )); ImGui::SetCursorPos(botom); diff --git a/src/SourceControlWindow.cpp b/src/SourceControlWindow.cpp index 90428ce..bc4c104 100644 --- a/src/SourceControlWindow.cpp +++ b/src/SourceControlWindow.cpp @@ -1097,10 +1097,13 @@ ImRect DrawSourceWithSlider(Source *s, ImVec2 top, ImVec2 rendersize, bool with_ /// const ImVec2 top_image = top + corner; ImGui::SetCursorScreenPos(top_image); - // 100% opacity for the image (ensure true colors) - ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 1.f); - DrawSource(s, framesize, top_image, true, with_inspector); - ImGui::PopStyleVar(); + + if (s->ready()) { + // 100% opacity for the image (ensure true colors) + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 1.f); + DrawSource(s, framesize, top_image, true, with_inspector); + ImGui::PopStyleVar(); + } return ImRect( top_image, top_image + framesize); } @@ -1125,7 +1128,8 @@ int SourceControlWindow::SourceButton(Source *s, ImVec2 framesize) ImU32 icon_color = ImGui::GetColorU32(ImGuiCol_NavWindowingHighlight); // 1. draw texture of source - DrawSource(s, framesize, frame_top); + if (s->ready()) + DrawSource(s, framesize, frame_top); // 2. interactive centered button Play / Pause if (s->active() && s->playable()) { diff --git a/src/TextureView.cpp b/src/TextureView.cpp index b917ea6..b053edc 100644 --- a/src/TextureView.cpp +++ b/src/TextureView.cpp @@ -755,15 +755,20 @@ void TextureView::draw() if (mask_cursor_paint_ > 0) { ImGui::SameLine(0, 50); - ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6); - const char* items[] = { ICON_FA_CIRCLE, ICON_FA_SQUARE }; - static int item = 0; - item = (int) round(Settings::application.brush.z); - if(ImGui::Combo("##BrushShape", &item, items, IM_ARRAYSIZE(items))) { - Settings::application.brush.z = float(item); - } + if (ImGui::Button(ICON_FA_PEN ICON_FA_SORT_DOWN )) + ImGui::OpenPopup("brush_shape_popup"); if (ImGui::IsItemHovered()) ImGuiToolkit::ToolTip("Shape"); + if (ImGui::BeginPopup( "brush_shape_popup" )) + { + ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); + if (ImGui::Selectable( ICON_FA_CIRCLE " Circle")) + Settings::application.brush.z = 0.f; + if (ImGui::Selectable( ICON_FA_SQUARE " Square")) + Settings::application.brush.z = 1.f; + ImGui::PopFont(); + ImGui::EndPopup(); + } ImGui::SameLine(); show_cursor_forced_ = false; @@ -778,7 +783,7 @@ void TextureView::draw() int pixel_size = int(Settings::application.brush.x * edit_source_->frame()->height() ); show_cursor_forced_ = true; ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); - ImGuiToolkit::Indication("Large ", 16, 1, ICON_FA_ARROW_RIGHT); + ImGuiToolkit::Indication("Large ", 16, 1); if (ImGui::VSliderInt("##BrushSize", ImVec2(30,260), &pixel_size, pixel_size_min, pixel_size_max, "") ){ Settings::application.brush.x = CLAMP(float(pixel_size) / edit_source_->frame()->height(), BRUSH_MIN_SIZE, BRUSH_MAX_SIZE); } @@ -787,7 +792,7 @@ void TextureView::draw() ImGui::Text("%d px", pixel_size); ImGui::EndTooltip(); } - ImGuiToolkit::Indication("Small ", 15, 1, ICON_FA_ARROW_LEFT); + ImGuiToolkit::Indication("Small ", 15, 1); ImGui::PopFont(); ImGui::EndPopup(); } @@ -804,14 +809,14 @@ void TextureView::draw() if (ImGui::BeginPopup("brush_pressure_popup", ImGuiWindowFlags_NoMove)) { ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); - ImGuiToolkit::Indication("Light ", ICON_FA_FEATHER_ALT, ICON_FA_ARROW_UP); + ImGuiToolkit::Indication("Light ", ICON_FA_FEATHER_ALT); ImGui::VSliderFloat("##BrushPressure", ImVec2(30,260), &Settings::application.brush.y, BRUSH_MAX_PRESS, BRUSH_MIN_PRESS, "", 0.3f); if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) { ImGui::BeginTooltip(); ImGui::Text("%.1f%%", Settings::application.brush.y * 100.0); ImGui::EndTooltip(); } - ImGuiToolkit::Indication("Heavy ", ICON_FA_WEIGHT_HANGING, ICON_FA_ARROW_DOWN); + ImGuiToolkit::Indication("Heavy ", ICON_FA_WEIGHT_HANGING); ImGui::PopFont(); ImGui::EndPopup(); } @@ -924,7 +929,10 @@ void TextureView::draw() ImGuiToolkit::ToolTip("Select shape"); ImGui::SameLine(0, 20); - if (ImGui::Button(ICON_FA_RADIATION_ALT ICON_FA_SORT_DOWN )) + + char buf[128]; + snprintf(buf, 128, "%d%%" ICON_FA_SORT_DOWN, blur_percent); + if (ImGui::Button(buf)) ImGui::OpenPopup("shape_smooth_popup"); if (ImGui::IsItemHovered()) ImGuiToolkit::ToolTip("Blur"); @@ -932,7 +940,7 @@ void TextureView::draw() { static bool smoothchanged = false; ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); - ImGuiToolkit::Indication("Blured ", 7, 16, ICON_FA_ARROW_UP); + ImGuiToolkit::Indication("Blurry ", 7, 16); if (ImGui::VSliderInt("##shapeblur", ImVec2(30,260), &blur_percent, 0, 100, "") ){ edit_source_->maskShader()->blur = float(blur_percent) / 100.f; edit_source_->touch(Source::SourceUpdate_Mask); @@ -948,10 +956,10 @@ void TextureView::draw() } if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) { ImGui::BeginTooltip(); - ImGui::Text("%.d%%", blur_percent); + ImGui::Text("%.d%% blur", blur_percent); ImGui::EndTooltip(); } - ImGuiToolkit::Indication("Sharp ", 8, 16, ICON_FA_ARROW_DOWN); + ImGuiToolkit::Indication("Sharp ", 8, 16); ImGui::PopFont(); ImGui::EndPopup(); } diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index 0b1d8e0..a6101c0 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -3573,6 +3573,7 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize) } } else if (new_media_mode == MEDIA_FOLDER) { + ImGui::PushID("##new_media_directory_actions"); // close list ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y) ); if (ImGuiToolkit::IconButton( 4, 5, "Close directory")) { @@ -3585,7 +3586,6 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize) } // ordering list ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y + ImGui::GetFrameHeightWithSpacing()) ); - ImGui::PushID("##new_media_mode_changed"); if ( ImGuiToolkit::IconMultistate(icons_ordering_files, &Settings::application.recentImportFolders.ordering, tooltips_ordering_files) ) new_media_mode_changed = true; ImGui::PopID(); @@ -4219,7 +4219,7 @@ void Navigator::RenderMainPannelSession() if ( ImGuiToolkit::IconButton(ICON_FA_FILE_DOWNLOAD, "Save as")) UserInterface::manager().saveOrSaveAs(); } else { - if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) + if (ImGuiToolkit::IconButton(2, 5, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename(Mixer::manager().session()->filename())); } ImGui::SetCursorPos(pos); @@ -4981,7 +4981,9 @@ void Navigator::RenderMainPannelPlaylist() if ( !ImGui::IsItemHovered()) session_tooltip_ = 0; - // ordering list + // Closing and ordering button + ImGui::PushID("##playlist_directory_actions"); + // close list ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y) ); if (ImGuiToolkit::IconButton( 4, 5, "Close directory")) { Settings::application.recentFolders.filenames.remove(Settings::application.recentFolders.path); @@ -4990,8 +4992,8 @@ void Navigator::RenderMainPannelPlaylist() else Settings::application.recentFolders.assign( Settings::application.recentFolders.filenames.front() ); } - ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y + ImGui::GetTextLineHeightWithSpacing())); - ImGui::PushID("##folder_ordering_changed"); + // ordering list + ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y + ImGui::GetFrameHeightWithSpacing())); if ( ImGuiToolkit::IconMultistate(icons_ordering_files, &Settings::application.recentFolders.ordering, tooltips_ordering_files) ) Settings::application.recentFolders.changed = true; ImGui::PopID();