Skip to content

Commit a80248d

Browse files
authored
Merge pull request #2102 from verilog-to-routing/Seb_Search
Search Update + NoC GUI Update
2 parents 7989197 + a5d0c24 commit a80248d

11 files changed

+612
-271
lines changed

vpr/main.ui

Lines changed: 212 additions & 148 deletions
Large diffs are not rendered by default.

vpr/src/draw/buttons.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,6 @@ gint label_left_start_col = 0;
2828
gint box_left_start_col = 0;
2929
gint button_row = 2; // 2 is the row num of the window button in main.ui, add buttons starting from this row
3030

31-
void button_for_displaying_noc() {
32-
GObject* main_window = application.get_object(application.get_main_window_id().c_str());
33-
GObject* main_window_grid = application.get_object("InnerGrid");
34-
t_draw_state* draw_state = get_draw_state_vars();
35-
36-
// if the user did not turn on the "noc" option then we don't give the option to display the noc to the user
37-
if (!draw_state->show_noc_button) {
38-
return;
39-
}
40-
41-
// if we are here then the user turned the "noc" option on, so create a button to allow the user to display the noc
42-
43-
//combo box for toggle_noc_display
44-
GtkWidget* toggle_noc_display_widget = gtk_combo_box_text_new();
45-
GtkWidget* toggle_noc_display_label = gtk_label_new("Toggle NoC Display:");
46-
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "None");
47-
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "NoC Links");
48-
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "NoC Link Usage");
49-
50-
gtk_combo_box_set_active((GtkComboBox*)toggle_noc_display_widget, 0); // default set to None which has an index 0
51-
gtk_widget_set_name(toggle_noc_display_widget, "toggle_noc_display");
52-
53-
//attach to the grid
54-
gtk_grid_attach((GtkGrid*)main_window_grid, toggle_noc_display_label, label_left_start_col, button_row++, box_width, box_height);
55-
gtk_grid_attach((GtkGrid*)main_window_grid, toggle_noc_display_widget, box_left_start_col, button_row++, box_width, box_height);
56-
57-
// show the newy added check box
58-
gtk_widget_show_all((GtkWidget*)main_window);
59-
60-
//connect signals
61-
g_signal_connect_swapped(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget),
62-
"changed",
63-
G_CALLBACK(toggle_noc_display),
64-
toggle_noc_display_widget);
65-
}
66-
6731
void delete_button(const char* button_name) {
6832
GObject* main_window_grid = application.get_object("InnerGrid");
6933
GList* list_of_widgets = gtk_container_get_children(GTK_CONTAINER(main_window_grid));

vpr/src/draw/buttons.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# include "ezgl/application.hpp"
1010
# include "ezgl/graphics.hpp"
1111

12-
void button_for_displaying_noc();
13-
1412
void delete_button(const char* button_name);
1513
GtkWidget* find_button(const char* button_name);
1614
#endif /* NO_GRAPHICS */

vpr/src/draw/draw.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <sstream>
2121
#include <array>
2222
#include <iostream>
23+
#include <time.h>
2324

2425
#include "vtr_assert.h"
2526
#include "vtr_ndoffsetmatrix.h"
@@ -282,6 +283,7 @@ static void default_setup(ezgl::application* app) {
282283
basic_button_setup(app);
283284
net_button_setup(app);
284285
block_button_setup(app);
286+
search_setup(app);
285287
}
286288

287289
/* function below intializes the interface window with a set of buttons and links
@@ -301,7 +303,6 @@ static void initial_setup_NO_PICTURE_to_PLACEMENT(ezgl::application* app,
301303
//Hiding unused functionality
302304
hide_widget("RoutingMenuButton", app);
303305
hide_crit_path_button(app);
304-
button_for_displaying_noc();
305306
}
306307

307308
/* function below intializes the interface window with a set of buttons and links
@@ -356,7 +357,6 @@ static void initial_setup_NO_PICTURE_to_ROUTING(ezgl::application* app,
356357
default_setup(app);
357358
routing_button_setup(app);
358359
hide_crit_path_button(app);
359-
button_for_displaying_noc();
360360
}
361361

362362
/* function below intializes the interface window with a set of buttons and links
@@ -670,19 +670,33 @@ bool draw_if_net_highlighted(ClusterNetId inet) {
670670
if (draw_state->net_color[inet] != DEFAULT_RR_NODE_COLOR) {
671671
return true;
672672
}
673-
674673
return false;
675674
}
676675

677-
# if defined(X11) && !defined(__MINGW32__)
678-
void act_on_key_press(ezgl::application* /*app*/, GdkEventKey* /*event*/, char* key_name) {
679-
//VTR_LOG("Key press %c (%d)\n", key_pressed, keysym);
676+
/**
677+
* @brief cbk function for key press
678+
*
679+
* At the moment, only does something if user is currently typing in searchBar and
680+
* hits enter, at which point it runs autocomplete
681+
*/
682+
void act_on_key_press(ezgl::application* app, GdkEventKey* /*event*/, char* key_name) {
680683
std::string key(key_name);
684+
GtkWidget* searchBar = GTK_WIDGET(app->get_object("TextInput"));
685+
std::string text(gtk_entry_get_text(GTK_ENTRY(searchBar)));
686+
t_draw_state* draw_state = get_draw_state_vars();
687+
if (gtk_widget_is_focus(searchBar)) {
688+
if (key == "Return") {
689+
enable_autocomplete(app);
690+
gtk_editable_set_position(GTK_EDITABLE(searchBar), text.length());
691+
return;
692+
}
693+
}
694+
if (draw_state->justEnabled) {
695+
draw_state->justEnabled = false;
696+
} else {
697+
gtk_entry_set_completion(GTK_ENTRY(searchBar), nullptr);
698+
}
681699
}
682-
# else
683-
void act_on_key_press(ezgl::application* /*app*/, GdkEventKey* /*event*/, char* /*key_name*/) {
684-
}
685-
# endif
686700

687701
void act_on_mouse_press(ezgl::application* app, GdkEventButton* event, double x, double y) {
688702
// std::cout << "User clicked the ";

vpr/src/draw/draw_toggle_functions.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,18 @@ void toggle_expansion_cost_cbk(GtkComboBoxText* self, ezgl::application* app) {
406406
app->refresh_drawing();
407407
}
408408

409-
void toggle_noc_display(GtkWidget* /*widget*/, gint /*response_id*/, gpointer /*data*/) {
410-
/* this is the callback function for runtime created toggle_noc_display button
411-
* which is written in button.cpp */
409+
/**
410+
* @brief cbk fn to toggle Network-On-Chip (Noc) visibility
411+
* alters draw_state->draw_noc to reflect new state
412+
* Reacts to main.ui created combo box, setup in ui_setup.cpp
413+
*
414+
* @param self ptr to combo box
415+
* @param app ezgl application
416+
*/
417+
void toggle_noc_cbk(GtkComboBoxText* self, ezgl::application* app) {
412418
t_draw_state* draw_state = get_draw_state_vars();
413-
std::string button_name = "toggle_noc_display";
414-
auto toggle_crit_path = find_button(button_name.c_str());
415419

416-
gchar* combo_box_content = gtk_combo_box_text_get_active_text(
417-
GTK_COMBO_BOX_TEXT(toggle_crit_path));
420+
gchar* combo_box_content = gtk_combo_box_text_get_active_text(self);
418421
if (strcmp(combo_box_content, "None") == 0) {
419422
draw_state->draw_noc = DRAW_NO_NOC;
420423
} else if (strcmp(combo_box_content, "NoC Links") == 0)
@@ -423,7 +426,7 @@ void toggle_noc_display(GtkWidget* /*widget*/, gint /*response_id*/, gpointer /*
423426
draw_state->draw_noc = DRAW_NOC_LINK_USAGE;
424427

425428
g_free(combo_box_content);
426-
application.refresh_drawing();
429+
app->refresh_drawing();
427430
}
428431

429432
/**

vpr/src/draw/draw_toggle_functions.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,10 @@ void toggle_crit_path_cbk(GtkComboBoxText* self, ezgl::application* app);
107107
* Draws different router expansion costs based on user input. Changes value of draw_state->show_router_expansion_cost. */
108108
void toggle_expansion_cost_cbk(GtkComboBoxText* self, ezgl::application* app);
109109

110-
/* Callback function for runtime created toggle_noc_display
111-
* in button.cpp.
110+
/* Callback function for main.ui created ToggleNocBox in ui_setup.cpp
112111
* Controls if the NoC on chip should be visualized and whether the link usage
113112
* in the NoC should be visualized. Changes value of draw_state->draw_noc */
114-
void toggle_noc_display(GtkWidget* widget, gint /*response_id*/, gpointer /*data*/);
113+
void toggle_noc_cbk(GtkComboBoxText* self, ezgl::application* app);
115114

116115
/* Callback function for main.ui created netMaxFanout widget in button.cpp.
117116
* Sets draw_state->draw_net_max_fanout to its corresponding value in the UI. */

vpr/src/draw/draw_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ struct t_draw_state {
217217
bool show_noc_button = false;
218218
e_draw_noc draw_noc = DRAW_NO_NOC;
219219
std::shared_ptr<const vtr::ColorMap> noc_usage_color_map = nullptr; // color map used to display noc link bandwidth usage
220+
bool justEnabled = false; //Whether auto-complete was just enabled
220221

221222
std::vector<Breakpoint> list_of_breakpoints;
222223

0 commit comments

Comments
 (0)