Commit abccb34f authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: enable generator/buffer external sources

parent acb8b5f8
......@@ -1910,6 +1910,23 @@ show_dynamics_inputs(buffer& dyn)
{
ImGui::InputDouble("value", &dyn.default_value);
ImGui::InputDouble("offset", &dyn.default_offset);
{
const char* title = "Select time sources";
if (ImGui::Button("Times"))
ImGui::OpenPopup(title);
ImGui::SameLine();
if (dyn.default_lambda_source.data == nullptr) {
ImGui::TextUnformatted("<None>");
} else {
ImGui::Text("%" PRIu32 "-%" PRIu32,
dyn.default_lambda_source.type,
dyn.default_lambda_source.id);
}
app.srcs.show_menu(title, dyn.default_lambda_source);
}
}
static void
......@@ -1918,17 +1935,39 @@ show_dynamics_inputs(generator& dyn)
ImGui::InputDouble("value", &dyn.default_value);
ImGui::InputDouble("offset", &dyn.default_offset);
if (ImGui::Button("Select.."))
ImGui::OpenPopup("Select source");
{
const char* title = "Select values sources";
if (ImGui::Button("Values"))
ImGui::OpenPopup(title);
ImGui::SameLine();
if (dyn.default_value_source.data == nullptr) {
ImGui::TextUnformatted("<None>");
} else {
ImGui::Text("%" PRIu32 "-%" PRIu32,
dyn.default_value_source.type,
dyn.default_value_source.id);
}
app.srcs.show_menu(title, dyn.default_value_source);
}
{
const char* title = "Select time sources";
if (ImGui::Button("Times"))
ImGui::OpenPopup(title);
ImGui::SameLine();
if (dyn.default_value_source_id == external_source_id{ 0 }) {
if (dyn.default_lambda_source.data == nullptr) {
ImGui::TextUnformatted("<None>");
} else {
ImGui::Text("%" PRIu64, static_cast<u64>(dyn.default_value_source_id));
ImGui::Text("%" PRIu32 "-%" PRIu32,
dyn.default_lambda_source.type,
dyn.default_lambda_source.id);
}
external_source src;
app.srcs.show_menu(src);
app.srcs.show_menu(title, dyn.default_lambda_source);
}
}
static void
......
......@@ -311,7 +311,7 @@ struct sources
irt::source::text_file* new_text_file() noexcept;
void show(bool* is_show);
void show_menu(external_source& src);
void show_menu(const char *title, external_source& src);
};
struct editor
......
......@@ -763,14 +763,14 @@ sources::show(bool* is_show)
}
void
sources::show_menu(external_source& src)
sources::show_menu(const char* title, external_source& src)
{
small_string<16> tmp;
std::pair<const int, source::constant>* constant_ptr = nullptr;
std::pair<const int, source::binary_file>* binary_file_ptr = nullptr;
std::pair<const int, source::text_file>* text_file_ptr = nullptr;
if (ImGui::BeginPopup("Select source")) {
if (ImGui::BeginPopup(title)) {
if (!csts.empty() && ImGui::BeginMenu("Constant")) {
for (auto& elem : csts) {
fmt::format_to_n(tmp.begin(), tmp.capacity(), "{}", elem.first);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment