Wrap setting descriptions and tighten content panel layout
- setting_label wraps the description (capped at half the row width) instead of truncating it to a single ellipsized line - drop hard line breaks from the descriptions that had them - run the content panel to the window edge so the wide scrollbar sits at the edge, and keep a clear gap between the content and the scrollbar
This commit is contained in:
committed by
Guillaume Meunier
parent
2e9f2c8646
commit
dba182ea51
@@ -194,17 +194,11 @@ float setting_label(const std::string & title, const std::string & description,
|
|||||||
{
|
{
|
||||||
ImGui::PushFont(nullptr, style.FontSizeBase * metrics::font_description);
|
ImGui::PushFont(nullptr, style.FontSizeBase * metrics::font_description);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, t.text_muted);
|
ImGui::PushStyleColor(ImGuiCol_Text, t.text_muted);
|
||||||
// single line, capped at half the row width and ellipsized so it never wraps or crowds the control
|
// never wider than half the row; wrap to as many lines as needed so it shows in full
|
||||||
const float desc_w = ImMin(text_w, avail * 0.5f);
|
const float desc_w = ImMin(text_w, avail * 0.5f);
|
||||||
std::string text = description;
|
ImGui::PushTextWrapPos(start.x + desc_w);
|
||||||
if (ImGui::CalcTextSize(text.c_str()).x > desc_w)
|
ImGui::TextUnformatted(description.c_str());
|
||||||
{
|
ImGui::PopTextWrapPos();
|
||||||
const float ell_w = ImGui::CalcTextSize("...").x;
|
|
||||||
while (not text.empty() and ImGui::CalcTextSize(text.c_str()).x + ell_w > desc_w)
|
|
||||||
text.pop_back();
|
|
||||||
text += "...";
|
|
||||||
}
|
|
||||||
ImGui::TextUnformatted(text.c_str());
|
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ void settings_performance(const settings_context & ctx)
|
|||||||
list.push_back({
|
list.push_back({
|
||||||
.id = "##refresh",
|
.id = "##refresh",
|
||||||
.label = _("Refresh rate"),
|
.label = _("Refresh rate"),
|
||||||
.description = _("Select refresh rate based on measured application performance.\nMay cause flicker when a change happens."),
|
.description = _("Select refresh rate based on measured application performance. May cause flicker when a change happens."),
|
||||||
.ui = ui_kind::segmented,
|
.ui = ui_kind::segmented,
|
||||||
.get_int = [&config, rates] {
|
.get_int = [&config, rates] {
|
||||||
for (size_t i = 0; i < rates.size(); ++i)
|
for (size_t i = 0; i < rates.size(); ++i)
|
||||||
@@ -430,7 +430,7 @@ void settings_streaming(const settings_context & ctx)
|
|||||||
list.push_back({
|
list.push_back({
|
||||||
.id = "##stream_gui",
|
.id = "##stream_gui",
|
||||||
.label = _("In-stream window"),
|
.label = _("In-stream window"),
|
||||||
.description = _("Enables the configuration window to be shown while the game is streaming.\nIf enabled, the window is activated by pressing both thumbsticks."),
|
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
|
||||||
.ui = ui_kind::toggle,
|
.ui = ui_kind::toggle,
|
||||||
.get_bool = [&config] { return config.enable_stream_gui; },
|
.get_bool = [&config] { return config.enable_stream_gui; },
|
||||||
.set_bool = [&config](bool v) { config.enable_stream_gui = v; config.save(); },
|
.set_bool = [&config](bool v) { config.enable_stream_gui = v; config.save(); },
|
||||||
@@ -487,8 +487,8 @@ void settings_post_processing(const settings_context & ctx)
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
flag_combo("##supersampling", _("Supersampling"), _("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display."), {0, XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB, XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB}, &configuration::openxr_post_processing_settings::super_sampling);
|
flag_combo("##supersampling", _("Supersampling"), _("Reduce flicker for high contrast edges. Useful when the input resolution is high compared to the headset display."), {0, XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB, XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB}, &configuration::openxr_post_processing_settings::super_sampling);
|
||||||
flag_combo("##sharpening", _("Sharpening"), _("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display."), {0, XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}, &configuration::openxr_post_processing_settings::sharpening);
|
flag_combo("##sharpening", _("Sharpening"), _("Improve clarity of high contrast edges and counteract blur. Useful when the input resolution is low compared to the headset display."), {0, XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}, &configuration::openxr_post_processing_settings::sharpening);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::page_header(_S("Post-processing"), _S("OpenXR layer supersampling and sharpening."));
|
ui::page_header(_S("Post-processing"), _S("OpenXR layer supersampling and sharpening."));
|
||||||
|
|||||||
@@ -1146,13 +1146,22 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
|||||||
|
|
||||||
wivrn::ui::top_bar(TopBarH, about_picture, top_items);
|
wivrn::ui::top_bar(TopBarH, about_picture, top_items);
|
||||||
|
|
||||||
// content area, with an equal margin on both sides of the panel
|
// content area: content_margin from the sidebar on the left; the panel runs all the way
|
||||||
|
// to the window's right edge so the scrollbar sits at the edge (no margin beside it).
|
||||||
const float content_margin = wivrn::ui::metrics::content_margin;
|
const float content_margin = wivrn::ui::metrics::content_margin;
|
||||||
ImGui::SetCursorPos({TabWidth + content_margin, TopBarH});
|
ImGui::SetCursorPos({TabWidth + content_margin, TopBarH});
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 20});
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {content_margin, 20});
|
||||||
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX() - content_margin, 0), 0);
|
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0), 0);
|
||||||
|
|
||||||
|
// The scrollbar is wide (30px); WindowPadding alone leaves the content cramped against it.
|
||||||
|
// Pull the work area in on the right so the content keeps a clear gap from the scrollbar.
|
||||||
|
{
|
||||||
|
ImGuiWindow * main_child = ImGui::GetCurrentWindow();
|
||||||
|
main_child->WorkRect.Max.x -= content_margin;
|
||||||
|
main_child->ContentRegionRect.Max.x -= content_margin;
|
||||||
|
}
|
||||||
ImGui::SetCursorPosY(20);
|
ImGui::SetCursorPosY(20);
|
||||||
|
|
||||||
switch (current_tab)
|
switch (current_tab)
|
||||||
|
|||||||
Reference in New Issue
Block a user