Minor UX improvement Display View

This commit is contained in:
Bruno Herbelin
2023-03-03 19:52:12 +01:00
parent 128ba084ad
commit 7d91ffbafa
3 changed files with 27 additions and 15 deletions

View File

@@ -414,20 +414,18 @@ void DisplaysView::draw()
// Output options // Output options
ImGui::SameLine(0, 2.f * g.Style.FramePadding.x); ImGui::SameLine(0, 2.f * g.Style.FramePadding.x);
ImGuiToolkit::ButtonIconToggle(8,5,9,5, &Settings::application.windows[1+current_window_].scaled, "Scaled to window"); ImGuiToolkit::ButtonIconToggle(8,5,9,5, &Settings::application.windows[1+current_window_].scaled, "Window fit");
ImGui::SameLine(0, g.Style.FramePadding.x); ImGui::SameLine(0, g.Style.FramePadding.x);
ImGuiToolkit::ButtonIconToggle(10,1,11,1, &Settings::application.windows[1+current_window_].show_pattern, "Test pattern"); ImGuiToolkit::ButtonIconToggle(10,1,11,1, &Settings::application.windows[1+current_window_].show_pattern, "Test pattern");
// White ballance color // White ballance color button
static DialogToolkit::ColorPickerDialog whitebalancedialog; static DialogToolkit::ColorPickerDialog whitebalancedialog;
ImGui::SameLine(0, 1.5f * g.Style.FramePadding.x); ImGui::SameLine(0, 1.5f * g.Style.FramePadding.x);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
// hack to re-align color button to text
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
window->DC.CursorPos.y += g.Style.FramePadding.y; window->DC.CursorPos.y += g.Style.FramePadding.y; // hack to re-align color button to text
if (ImGui::ColorButton("White balance", ImVec4(Settings::application.windows[1+current_window_].whitebalance.x, if (ImGui::ColorButton("White balance", ImVec4(Settings::application.windows[1+current_window_].whitebalance.x,
Settings::application.windows[1+current_window_].whitebalance.y, Settings::application.windows[1+current_window_].whitebalance.y,
@@ -440,7 +438,7 @@ void DisplaysView::draw()
} }
ImGui::PopFont(); ImGui::PopFont();
// get picked color if dialog finished // get icked color if dialog finished
if (whitebalancedialog.closed()){ if (whitebalancedialog.closed()){
std::tuple<float, float, float> c = whitebalancedialog.RGB(); std::tuple<float, float, float> c = whitebalancedialog.RGB();
Settings::application.windows[1+current_window_].whitebalance.x = std::get<0>(c); Settings::application.windows[1+current_window_].whitebalance.x = std::get<0>(c);
@@ -453,20 +451,33 @@ void DisplaysView::draw()
window->DC.CursorPos.y -= g.Style.FramePadding.y; window->DC.CursorPos.y -= g.Style.FramePadding.y;
if (ImGui::Button(ICON_FA_THERMOMETER_HALF ICON_FA_SORT_DOWN )) if (ImGui::Button(ICON_FA_THERMOMETER_HALF ICON_FA_SORT_DOWN ))
ImGui::OpenPopup("temperature_popup"); ImGui::OpenPopup("temperature_popup");
if (ImGui::BeginPopup("temperature_popup", ImGuiWindowFlags_NoMove))
{
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
ImGuiToolkit::Indication("9000 K", " " ICON_FA_THERMOMETER_FULL); if (ImGui::IsItemHovered()){
ImGui::BeginTooltip();
ImGui::Text("%d Kelvin", 4000 + (int) ceil(Settings::application.windows[1+current_window_].whitebalance.w * 5000.f));
ImGui::EndTooltip();
}
if (ImGui::BeginPopup("temperature_popup", ImGuiWindowFlags_NoMove)) {
// High Kelvin = blue
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.4f, 0.4f, 1.f, 1.0f));
ImGui::Text(" " ICON_FA_THERMOMETER_FULL );
ImGui::PopStyleColor(1);
// Slider Temperature K
ImGui::VSliderFloat("##Temperature", ImVec2(30,260), &Settings::application.windows[1+current_window_].whitebalance.w, 0.0, 1.0, ""); ImGui::VSliderFloat("##Temperature", ImVec2(30,260), &Settings::application.windows[1+current_window_].whitebalance.w, 0.0, 1.0, "");
if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) { if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text("%d K", 4000 + (int) ceil(Settings::application.windows[1+current_window_].whitebalance.w * 5000.f)); ImGui::Text("%d K", 4000 + (int) ceil(Settings::application.windows[1+current_window_].whitebalance.w * 5000.f));
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGuiToolkit::Indication("4000 K", " " ICON_FA_THERMOMETER_EMPTY); // High Kelvin = blue
ImGui::PopFont(); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 0.4f, 0.4f, 1.0f));
ImGui::Text(" " ICON_FA_THERMOMETER_EMPTY );
ImGui::PopStyleColor(1);
ImGui::EndPopup(); ImGui::EndPopup();
} }
ImGui::PopFont();
} }

View File

@@ -77,13 +77,11 @@ private:
bool draw_pending_; bool draw_pending_;
float output_ar; float output_ar;
std::vector<WindowPreview> windows_; std::vector<WindowPreview> windows_;
int current_window_; int current_window_;
Group *current_window_status_; Group *current_window_status_;
bool show_window_menu_; bool show_window_menu_;
// bool window_selected_;
int display_action_; int display_action_;

View File

@@ -574,8 +574,11 @@ void UserInterface::handleMouse()
Mixer::manager().view()->initiate(); Mixer::manager().view()->initiate();
} }
// no source is selected // no source is selected
else else {
// unset current
Mixer::manager().unsetCurrentSource(); Mixer::manager().unsetCurrentSource();
navigator.hidePannel();
}
} }
if (clear_selection) { if (clear_selection) {
// unset current // unset current