gui.hpp 3.29 KB
Newer Older
1
2
3
4
5
6
7
// Copyright (c) 2020 INRA Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef ORG_VLEPROJECT_IRRITATOR_APP_GUI_2020
#define ORG_VLEPROJECT_IRRITATOR_APP_GUI_2020

8
9
#include <imgui.h>

Gauthier Quesnel's avatar
Gauthier Quesnel committed
10
11
12
#include <filesystem>
#include <string>

13
14
namespace irt {

15
16
17
18
19
20
21
22
enum class simulation_status
{
    success,
    running,
    uninitialized,
    internal_error,
};

23
24
void
node_editor_initialize();
25

26
27
void
node_editor_show();
28

29
30
31
void
node_editor_shutdown();

32
33
34
35
36
37
38
39
struct window_logger
{
    ImGuiTextBuffer buffer;
    ImGuiTextFilter filter;
    ImVector<int> line_offsets;

    bool auto_scroll = true;
    bool scroll_to_bottom = false;
Gauthier Quesnel's avatar
Gauthier Quesnel committed
40
    window_logger() = default;
41
42
43
44
45
46
47
    void clear() noexcept;

    void log(const int level, const char* fmt, ...) IM_FMTARGS(3);
    void log(const int level, const char* fmt, va_list args) IM_FMTLIST(3);
    void show(bool* is_show);
};

Gauthier Quesnel's avatar
Gauthier Quesnel committed
48
49
50
/* Filesytem dialog box */

bool
Gauthier Quesnel's avatar
Gauthier Quesnel committed
51
load_file_dialog(std::filesystem::path& out);
Gauthier Quesnel's avatar
Gauthier Quesnel committed
52
53

bool
Gauthier Quesnel's avatar
Gauthier Quesnel committed
54
save_file_dialog(std::filesystem::path& out);
Gauthier Quesnel's avatar
Gauthier Quesnel committed
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
static inline const char* simulation_status_string[] = {
    "success",
    "running",
    "uninitialized",
    "internal_error",
};

static inline const char* status_string[] = {
    "success",
    "unknown_dynamics",
    "block_allocator_bad_capacity",
    "block_allocator_not_enough_memory",
    "head_allocator_bad_capacity",
    "head_allocator_not_enough_memory",
    "simulation_not_enough_model",
    "simulation_not_enough_memory_message_list_allocator",
    "simulation_not_enough_memory_input_port_list_allocator",
    "simulation_not_enough_memory_output_port_list_allocator",
    "data_array_init_capacity_error",
    "data_array_not_enough_memory",
    "data_array_archive_init_capacity_error",
    "data_array_archive_not_enough_memory",
    "array_init_capacity_zero",
    "array_init_capacity_too_big",
    "array_init_not_enough_memory",
    "vector_init_capacity_zero",
    "vector_init_capacity_too_big",
    "vector_init_not_enough_memory",
    "dynamics_unknown_id",
    "dynamics_unknown_port_id",
    "dynamics_not_enough_memory",
    "model_connect_output_port_unknown",
    "model_connect_input_port_unknown",
    "model_connect_already_exist",
    "model_adder_empty_init_message",
    "model_adder_bad_init_message",
    "model_adder_bad_external_message",
    "model_mult_empty_init_message",
    "model_mult_bad_init_message",
    "model_mult_bad_external_message",
    "model_integrator_internal_error",
    "model_integrator_output_error",
    "model_integrator_running_without_x_dot",
    "model_integrator_ta_with_bad_x_dot",
    "model_integrator_bad_external_message",
    "model_quantifier_bad_quantum_parameter",
    "model_quantifier_bad_archive_length_parameter",
    "model_quantifier_shifting_value_neg",
    "model_quantifier_shifting_value_less_1",
    "model_quantifier_bad_external_message",
    "model_cross_bad_external_message",
    "model_time_func_bad_init_message",
108
    "model_accumulator_bad_external_message",
109
110
111
112
113
114
115
116
117
118
    "gui_not_enough_memory",
    "io_file_format_error",
    "io_file_format_model_error",
    "io_file_format_model_number_error",
    "io_file_format_model_unknown",
    "io_file_format_dynamics_unknown",
    "io_file_format_dynamics_limit_reach",
    "io_file_format_dynamics_init_error"
};

119
120
} // namespace irt

121
#endif