BugFix color picker dialog

Also blocks UI until color dialog is closed
This commit is contained in:
Bruno Herbelin
2023-04-12 22:51:53 +02:00
parent c507d0ed7e
commit f4add84a13
2 changed files with 20 additions and 11 deletions

View File

@@ -299,6 +299,9 @@ int DisplaysView::size ()
void DisplaysView::draw() void DisplaysView::draw()
{ {
// White ballance color button
static DialogToolkit::ColorPickerDialog whitebalancedialog;
// draw all windows // draw all windows
int i = 0; int i = 0;
for (; i < Settings::application.num_output_windows; ++i) { for (; i < Settings::application.num_output_windows; ++i) {
@@ -477,9 +480,6 @@ void DisplaysView::draw()
ImGui::SameLine(0, g.Style.FramePadding.x); ImGui::SameLine(0, g.Style.FramePadding.x);
ImGuiToolkit::ButtonIconToggle(11,1,11,1, &Settings::application.windows[1+current_window_].show_pattern, "Test pattern"); ImGuiToolkit::ButtonIconToggle(11,1,11,1, &Settings::application.windows[1+current_window_].show_pattern, "Test pattern");
// White ballance color button
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);
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
@@ -501,14 +501,6 @@ void DisplaysView::draw()
} }
ImGui::PopFont(); ImGui::PopFont();
// get icked color if dialog finished
if (whitebalancedialog.closed()){
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.y = std::get<1>(c);
Settings::application.windows[1+current_window_].whitebalance.z = std::get<2>(c);
}
// White ballance temperature // White ballance temperature
ImGui::SameLine(); ImGui::SameLine();
window->DC.CursorPos.y -= g.Style.FramePadding.y; window->DC.CursorPos.y -= g.Style.FramePadding.y;
@@ -549,6 +541,13 @@ void DisplaysView::draw()
} }
ImGui::PopFont(); ImGui::PopFont();
// get picked color if dialog finished
if (whitebalancedialog.closed()){
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.y = std::get<1>(c);
Settings::application.windows[1+current_window_].whitebalance.z = std::get<2>(c);
}
// display popup menu // display popup menu
if (show_window_menu_ && current_window_ > -1) { if (show_window_menu_ && current_window_ > -1) {

View File

@@ -792,6 +792,16 @@ void UserInterface::NewFrame()
} }
} }
// overlay to ensure file color dialog is closed after use
if (DialogToolkit::ColorPickerDialog::busy()){
if (!ImGui::IsPopupOpen("##Color"))
ImGui::OpenPopup("##Color");
if (ImGui::BeginPopup("##Color")) {
ImGui::Text("Validate color dialog to return to vimix.");
ImGui::EndPopup();
}
}
// popup to inform to save before close // popup to inform to save before close
if (pending_save_on_exit) { if (pending_save_on_exit) {
if (!ImGui::IsPopupOpen(MENU_SAVE_ON_EXIT)) if (!ImGui::IsPopupOpen(MENU_SAVE_ON_EXIT))