73{
74
75
76 if (ImGui::BeginTable("##NewChannelMapping", 2, table_flags)) {
77 ImGui::TableSetupColumn("Signal", ImGuiTableColumnFlags_WidthStretch);
78 ImGui::TableSetupColumn("Sensor", ImGuiTableColumnFlags_WidthStretch);
79 ImGui::TableHeadersRow();
80 ImGui::TableNextRow();
81 ImGui::TableNextColumn();
82
83 bool need_to_force = false;
84
85
87 if (ImGui::BeginCombo(
88 "##NewAssociationSignal",
89 new_entry_cache.signal == nullptr ? "Select signal..." : new_entry_cache.signal->get_imgui_name(),
90 0
91 )) {
92 for (const auto& signal : active_project->observe_signals()) {
93 const bool is_selected = new_entry_cache.signal ==
nullptr ? false :
signal == *new_entry_cache.signal;
94
95
96 if (ImGui::Selectable(
signal.get_imgui_name(), is_selected))
97 new_entry_cache.signal = &
signal;
98
99
100 if (is_selected)
101 ImGui::SetItemDefaultFocus();
102 }
103
104 ImGui::EndCombo();
105 need_to_force = true;
106 }
107
108 ImGui::TableNextColumn();
109
110
112 if (ImGui::BeginCombo(
113 "##NewAssociationSensor",
114 new_entry_cache.sensor == nullptr ? "Select sensor..." : new_entry_cache.sensor->get_imgui_name(),
115 0
116 )) {
117 for (const auto& sensor : active_project->observe_sensors()) {
118 const bool is_selected = new_entry_cache.sensor == nullptr ? false : sensor == *new_entry_cache.sensor;
119
120 if (ImGui::Selectable(sensor.get_imgui_name(), is_selected))
121 new_entry_cache.sensor = &sensor;
122
123 if (is_selected)
124 ImGui::SetItemDefaultFocus();
125 }
126
127 ImGui::EndCombo();
128 need_to_force = true;
129 }
130
131 ImGui::EndTable();
132
133 if (need_to_force)
134 app->increment_forced_frames();
135 }
136}