BugFix Capture menu in Display and Source windows

Support text scaling for small values (<0.7) that caused a UI display bug
This commit is contained in:
Bruno Herbelin
2023-12-29 14:01:18 +01:00
parent caa3e4d07a
commit 698665c4cc
4 changed files with 24 additions and 15 deletions

View File

@@ -328,7 +328,7 @@ void GeometryView::draw()
{ICON_WORKSPACE, std::to_string( workspaces_counts_[Source::WORKSPACE_ANY] )}
};
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
ImGui::SetNextItemWidth( ImGui::GetTextLineHeightWithSpacing() * 2.6);
if ( ImGuiToolkit::ComboIcon ("##WORKSPACE", &Settings::application.current_workspace, _workspaces, _tooltips) ){
// need full update
Mixer::manager().setView(mode_);

View File

@@ -296,8 +296,10 @@ void OutputPreviewWindow::Render()
// Options menu
ImGui::Separator();
ImGui::MenuItem("Settings", nullptr, false, false);
float combo_width = ImGui::GetTextLineHeightWithSpacing() * 7.f;
// offer to open config panel from here for more options
ImGui::SameLine(ImGui::GetContentRegionAvailWidth() + 1.3f * IMGUI_RIGHT_ALIGN);
ImGui::SameLine(combo_width, IMGUI_SAME_LINE);
if (ImGuiToolkit::IconButton(13, 5, "Advanced settings"))
UserInterface::manager().navigator.showConfig();
@@ -314,7 +316,7 @@ void OutputPreviewWindow::Render()
Settings::application.record.path = SystemToolkit::home_path();
snprintf( name_path[0], 1024, "%s", Settings::application.record.path.c_str());
int selected_path = 0;
ImGui::SetNextItemWidth(1.4f * IMGUI_RIGHT_ALIGN);
ImGui::SetNextItemWidth(combo_width);
if (ImGui::Combo("##Path", &selected_path, name_path, 4) ) {
if (selected_path > 2)
recordFolderDialog->open();
@@ -329,26 +331,26 @@ void OutputPreviewWindow::Render()
// offer to open folder location
ImVec2 draw_pos = ImGui::GetCursorPos();
ImGui::SetCursorPos(draw_pos + ImVec2(ImGui::GetContentRegionAvailWidth() - 1.4 * ImGui::GetTextLineHeightWithSpacing(), -ImGui::GetFrameHeight()) );
ImGui::SetCursorPos(draw_pos + ImVec2(combo_width + 3.f * ImGui::GetTextLineHeight(), -ImGui::GetFrameHeight()) );
if (ImGuiToolkit::IconButton(3, 5, "Show in finder"))
SystemToolkit::open(Settings::application.record.path);
ImGui::SetCursorPos(draw_pos);
// Naming menu selection
static const char* naming_style[2] = { ICON_FA_SORT_NUMERIC_DOWN " Sequential", ICON_FA_CALENDAR " Date prefix" };
ImGui::SetNextItemWidth(1.4f * IMGUI_RIGHT_ALIGN);
ImGui::SetNextItemWidth(combo_width);
ImGui::Combo("##Filename", &Settings::application.record.naming_mode, naming_style, IM_ARRAYSIZE(naming_style));
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Filename"))
Settings::application.record.naming_mode = 1;
ImGui::SetNextItemWidth(1.4f * IMGUI_RIGHT_ALIGN);
ImGui::SetNextItemWidth(combo_width);
ImGuiToolkit::SliderTiming ("##Duration", &Settings::application.record.timeout, 1000, RECORD_MAX_TIMEOUT, 1000, "Until stopped");
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Duration"))
Settings::application.record.timeout = RECORD_MAX_TIMEOUT;
ImGui::SetNextItemWidth(1.4f * IMGUI_RIGHT_ALIGN);
ImGui::SetNextItemWidth(combo_width);
ImGui::SliderInt("##Trigger", &Settings::application.record.delay, 0, 5,
Settings::application.record.delay < 1 ? "Immediate" : "After %d s");
ImGui::SameLine(0, IMGUI_SAME_LINE);

View File

@@ -337,7 +337,8 @@ void SourceControlWindow::Render()
// separator and hack for extending menu width
ImGui::Separator();
ImGui::MenuItem("Settings ", nullptr, false, false);
ImGui::MenuItem("Settings ", nullptr, false, false);
float combo_width = ImGui::GetTextLineHeightWithSpacing() * 7.f;
// path menu selection
static char* name_path[4] = { nullptr };
@@ -352,8 +353,8 @@ void SourceControlWindow::Render()
Settings::application.source.capture_path = SystemToolkit::home_path();
snprintf( name_path[0], 1024, "%s", Settings::application.source.capture_path.c_str());
int selected_path = 0;
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Path", &selected_path, name_path, 4);
ImGui::SetNextItemWidth(combo_width);
ImGui::Combo("##Path", &selected_path, name_path, 4);
if (selected_path > 2)
captureFolderDialog->open();
else if (selected_path > 1) {
@@ -366,18 +367,24 @@ void SourceControlWindow::Render()
}
else if (selected_path > 0)
Settings::application.source.capture_path = SystemToolkit::home_path();
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Path"))
Settings::application.source.capture_path = SystemToolkit::home_path();
// offer to open folder location
ImVec2 draw_pos = ImGui::GetCursorPos();
ImGui::SetCursorPos(draw_pos + ImVec2(ImGui::GetContentRegionAvailWidth() - 1.2 * ImGui::GetTextLineHeightWithSpacing(), -ImGui::GetFrameHeight()) );
if (ImGuiToolkit::IconButton( ICON_FA_FOLDER_OPEN, Settings::application.source.capture_path.c_str()))
ImGui::SetCursorPos(draw_pos + ImVec2(combo_width + 3.f * ImGui::GetTextLineHeight() , -ImGui::GetFrameHeight()) );
if (ImGuiToolkit::IconButton( 3, 5, Settings::application.source.capture_path.c_str()))
SystemToolkit::open(Settings::application.source.capture_path);
ImGui::SetCursorPos(draw_pos);
// Naming menu selection
static const char* naming_style[2] = { ICON_FA_SORT_NUMERIC_DOWN " Sequential", ICON_FA_CALENDAR " Date prefix" };
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Filename", &Settings::application.source.capture_naming, naming_style, IM_ARRAYSIZE(naming_style));
ImGui::SetNextItemWidth(combo_width);
ImGui::Combo("##Filename", &Settings::application.source.capture_naming, naming_style, IM_ARRAYSIZE(naming_style));
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Filename"))
Settings::application.source.capture_naming = 0;
ImGui::EndMenu();
}

View File

@@ -656,7 +656,7 @@ void TextureView::draw()
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.24f, 0.24f, 0.24f, 0.46f));
int maskmode = edit_source_->maskShader()->mode;
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
ImGui::SetNextItemWidth( ImGui::GetTextLineHeightWithSpacing() * 2.6);
if (ImGui::BeginCombo("##Mask", MaskShader::mask_icons[maskmode])) {