|
6 | 6 | #include "globals.h" |
7 | 7 | #include "pathhelper.h" |
8 | 8 | #include "telegramoptions.h" |
9 | | -#include "gtkcomboboxhelper.h" |
| 9 | +#include <gtk/gtk.h> |
| 10 | + |
10 | 11 |
|
11 | 12 | #include <ezgl/application.hpp> |
12 | 13 |
|
@@ -134,14 +135,24 @@ void TaskResolver::process_draw_critical_path_task(ezgl::application* app, const |
134 | 135 | server_ctx.crit_path_element_indexes = std::move(path_elements); |
135 | 136 | server_ctx.draw_crit_path_contour = draw_path_contour; |
136 | 137 |
|
137 | | - // update gtk UI |
138 | | - GtkComboBox* toggle_crit_path = GTK_COMBO_BOX(app->get_object("ToggleCritPath")); |
139 | | - gint high_light_mode_index = get_item_index_by_text(toggle_crit_path, high_light_mode.c_str()); |
140 | | - if (high_light_mode_index != -1) { |
141 | | - gtk_combo_box_set_active(toggle_crit_path, high_light_mode_index); |
| 138 | + // get GTK widgets |
| 139 | + GtkSwitch* crit_path_switch = GTK_SWITCH(app->get_object("ToggleCritPath")); |
| 140 | + GtkToggleButton* crit_path_flylines_button = GTK_TOGGLE_BUTTON(app->get_object("ToggleCritPathFlylines")); |
| 141 | + GtkToggleButton* crit_path_routing_button = GTK_TOGGLE_BUTTON(app->get_object("ToggleCritPathRouting")); |
| 142 | + GtkToggleButton* crit_path_delays_button = GTK_TOGGLE_BUTTON(app->get_object("ToggleCritPathDelays")); |
| 143 | + |
| 144 | + if (crit_path_switch && crit_path_flylines_button && crit_path_routing_button && crit_path_delays_button) { |
| 145 | + bool draw_flylines = (high_light_mode.find("flylines") != std::string::npos); |
| 146 | + bool draw_routing = (high_light_mode.find("routing") != std::string::npos); |
| 147 | + bool draw_delays = (high_light_mode.find("delays") != std::string::npos); |
| 148 | + |
| 149 | + gtk_switch_set_active(crit_path_switch, TRUE); |
| 150 | + gtk_toggle_button_set_active(crit_path_flylines_button, draw_flylines); |
| 151 | + gtk_toggle_button_set_active(crit_path_routing_button, draw_routing); |
| 152 | + gtk_toggle_button_set_active(crit_path_delays_button, draw_delays); |
142 | 153 | task->set_success(); |
143 | 154 | } else { |
144 | | - std::string msg{"cannot find ToggleCritPath qcombobox index for item " + high_light_mode}; |
| 155 | + std::string msg{"Cannot find critical path widgets. Was the UI layout changed?"}; |
145 | 156 | VTR_LOG_ERROR(msg.c_str()); |
146 | 157 | task->set_fail(msg); |
147 | 158 | } |
|
0 commit comments