Skip to content

Commit

Permalink
app: move data_window into project_external_source_editor
Browse files Browse the repository at this point in the history
  • Loading branch information
quesnel committed Jan 9, 2025
1 parent a8875e9 commit bd32733
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions app/gui/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,11 @@ struct graph_editor_dialog {
void show() noexcept;
};

struct data_window {
struct project_external_source_editor {
constexpr static inline const char* name = "Data";

data_window() noexcept;
~data_window() noexcept;
project_external_source_editor() noexcept;
~project_external_source_editor() noexcept;

void show(application& app) noexcept;

Expand Down Expand Up @@ -766,7 +766,7 @@ struct project_window {
tree_node_id m_selected_tree_node = undefined<tree_node_id>();
child_id m_selected_child = undefined<child_id>();

data_window data_ed;
project_external_source_editor data_ed;
};

inline bool project_window::is_simulation_running() const noexcept
Expand Down
24 changes: 12 additions & 12 deletions app/gui/data-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,17 @@ void show_random_distribution_input(random_source& src) noexcept
// }
// }

data_window::data_window() noexcept
project_external_source_editor::project_external_source_editor() noexcept
: context{ ImPlot::CreateContext() }
{}

data_window::~data_window() noexcept
project_external_source_editor::~project_external_source_editor() noexcept
{
if (context)
ImPlot::DestroyContext(context);
}

void data_window::show(application& app) noexcept
void project_external_source_editor::show(application& app) noexcept
{
auto& pj = container_of(this, &project_window::data_ed);

Expand Down Expand Up @@ -1007,58 +1007,58 @@ void show_menu_external_sources(application& app,
}
}

void data_window::selection::clear() noexcept
void project_external_source_editor::selection::clear() noexcept
{
type_sel.reset();
id_sel = 0;
}

void data_window::selection::select(constant_source_id id) noexcept
void project_external_source_editor::selection::select(constant_source_id id) noexcept
{
type_sel = source::source_type::constant;
id_sel = ordinal(id);
}

void data_window::selection::select(text_file_source_id id) noexcept
void project_external_source_editor::selection::select(text_file_source_id id) noexcept
{
type_sel = source::source_type::text_file;
id_sel = ordinal(id);
}

void data_window::selection::select(binary_file_source_id id) noexcept
void project_external_source_editor::selection::select(binary_file_source_id id) noexcept
{
type_sel = source::source_type::binary_file;
id_sel = ordinal(id);
}

void data_window::selection::select(random_source_id id) noexcept
void project_external_source_editor::selection::select(random_source_id id) noexcept
{
type_sel = source::source_type::random;
id_sel = ordinal(id);
}

bool data_window::selection::is(constant_source_id id) const noexcept
bool project_external_source_editor::selection::is(constant_source_id id) const noexcept
{
return type_sel.has_value() and * type_sel ==
source::source_type::constant and
id_sel == ordinal(id);
}

bool data_window::selection::is(text_file_source_id id) const noexcept
bool project_external_source_editor::selection::is(text_file_source_id id) const noexcept
{
return type_sel.has_value() and * type_sel ==
source::source_type::text_file and
id_sel == ordinal(id);
}

bool data_window::selection::is(binary_file_source_id id) const noexcept
bool project_external_source_editor::selection::is(binary_file_source_id id) const noexcept
{
return type_sel.has_value() and * type_sel ==
source::source_type::binary_file and
id_sel == ordinal(id);
}

bool data_window::selection::is(random_source_id id) const noexcept
bool project_external_source_editor::selection::is(random_source_id id) const noexcept
{
return type_sel.has_value() and * type_sel ==
source::source_type::random and
Expand Down

0 comments on commit bd32733

Please sign in to comment.