Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ProjectDirtyStateManager.cpp « GUI « slic3r « src - github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9a19676b25bb1ac1d4462bd3edcf04fbb0148c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "libslic3r/libslic3r.h"
#include "ProjectDirtyStateManager.hpp"
#include "ImGuiWrapper.hpp"
#include "GUI_App.hpp"

#if ENABLE_PROJECT_DIRTY_STATE

namespace Slic3r {
namespace GUI {

#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
void ProjectDirtyStateManager::render_debug_window() const
{
    auto color = [](bool value) {
        return value ? ImVec4(1.0f, 0.49f, 0.216f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
    };
    auto text = [](bool value) {
        return value ? "true" : "false";
    };

    std::string title = "Project dirty state statistics";
    ImGuiWrapper& imgui = *wxGetApp().imgui();
    imgui.begin(title, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);

    bool dirty = is_dirty();
    imgui.text_colored(color(dirty), "State:");
    ImGui::SameLine();
    imgui.text_colored(color(dirty), text(dirty));

    ImGui::Separator();
    imgui.text_colored(color(m_state.plater), "Plater:");
    ImGui::SameLine();
    imgui.text_colored(color(m_state.plater), text(m_state.plater));

    imgui.text_colored(color(m_state.presets), "Presets:");
    ImGui::SameLine();
    imgui.text_colored(color(m_state.presets), text(m_state.presets));

    imgui.end();
}
#endif // ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW

} // namespace GUI
} // namespace Slic3r

#endif // ENABLE_PROJECT_DIRTY_STATE