Skip to content

Search Update + NoC GUI Update #2102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
360 changes: 212 additions & 148 deletions vpr/main.ui

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions vpr/src/draw/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,6 @@ gint label_left_start_col = 0;
gint box_left_start_col = 0;
gint button_row = 2; // 2 is the row num of the window button in main.ui, add buttons starting from this row

void button_for_displaying_noc() {
GObject* main_window = application.get_object(application.get_main_window_id().c_str());
GObject* main_window_grid = application.get_object("InnerGrid");
t_draw_state* draw_state = get_draw_state_vars();

// if the user did not turn on the "noc" option then we don't give the option to display the noc to the user
if (!draw_state->show_noc_button) {
return;
}

// if we are here then the user turned the "noc" option on, so create a button to allow the user to display the noc

//combo box for toggle_noc_display
GtkWidget* toggle_noc_display_widget = gtk_combo_box_text_new();
GtkWidget* toggle_noc_display_label = gtk_label_new("Toggle NoC Display:");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "None");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "NoC Links");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget), "NoC Link Usage");

gtk_combo_box_set_active((GtkComboBox*)toggle_noc_display_widget, 0); // default set to None which has an index 0
gtk_widget_set_name(toggle_noc_display_widget, "toggle_noc_display");

//attach to the grid
gtk_grid_attach((GtkGrid*)main_window_grid, toggle_noc_display_label, label_left_start_col, button_row++, box_width, box_height);
gtk_grid_attach((GtkGrid*)main_window_grid, toggle_noc_display_widget, box_left_start_col, button_row++, box_width, box_height);

// show the newy added check box
gtk_widget_show_all((GtkWidget*)main_window);

//connect signals
g_signal_connect_swapped(GTK_COMBO_BOX_TEXT(toggle_noc_display_widget),
"changed",
G_CALLBACK(toggle_noc_display),
toggle_noc_display_widget);
}

void delete_button(const char* button_name) {
GObject* main_window_grid = application.get_object("InnerGrid");
GList* list_of_widgets = gtk_container_get_children(GTK_CONTAINER(main_window_grid));
Expand Down
2 changes: 0 additions & 2 deletions vpr/src/draw/buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
# include "ezgl/application.hpp"
# include "ezgl/graphics.hpp"

void button_for_displaying_noc();

void delete_button(const char* button_name);
GtkWidget* find_button(const char* button_name);
#endif /* NO_GRAPHICS */
Expand Down
21 changes: 17 additions & 4 deletions vpr/src/draw/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ static void default_setup(ezgl::application* app) {
basic_button_setup(app);
net_button_setup(app);
block_button_setup(app);
search_setup(app);
}

/* function below intializes the interface window with a set of buttons and links
Expand All @@ -301,7 +302,6 @@ static void initial_setup_NO_PICTURE_to_PLACEMENT(ezgl::application* app,
//Hiding unused functionality
hide_widget("RoutingMenuButton", app);
hide_crit_path_button(app);
button_for_displaying_noc();
}

/* function below intializes the interface window with a set of buttons and links
Expand Down Expand Up @@ -356,7 +356,6 @@ static void initial_setup_NO_PICTURE_to_ROUTING(ezgl::application* app,
default_setup(app);
routing_button_setup(app);
hide_crit_path_button(app);
button_for_displaying_noc();
}

/* function below intializes the interface window with a set of buttons and links
Expand Down Expand Up @@ -675,12 +674,26 @@ bool draw_if_net_highlighted(ClusterNetId inet) {
}

# if defined(X11) && !defined(__MINGW32__)
void act_on_key_press(ezgl::application* /*app*/, GdkEventKey* /*event*/, char* key_name) {
void act_on_key_press(ezgl::application* app, GdkEventKey* /*event*/, char* key_name) {
//VTR_LOG("Key press %c (%d)\n", key_pressed, keysym);
std::string key(key_name);
if (gtk_widget_is_focus(GTK_WIDGET(app->get_object("TextInput")))) {
if (key == "Return") {
enable_autocomplete(app);
}
}
}
# else
void act_on_key_press(ezgl::application* /*app*/, GdkEventKey* /*event*/, char* /*key_name*/) {
void act_on_key_press(ezgl::application* app, GdkEventKey* /*event*/, char* key_name) {
std::string key(key_name);
GtkWidget* searchBar = GTK_WIDGET(app->get_object("TextInput"));
if (gtk_widget_is_focus(searchBar)) {
if (key == "Return") {
std::string oldText(gtk_entry_get_text(GTK_ENTRY(searchBar)));
enable_autocomplete(app);
gtk_editable_set_position(GTK_EDITABLE(searchBar), oldText.length());
}
}
}
# endif

Expand Down
16 changes: 10 additions & 6 deletions vpr/src/draw/draw_toggle_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,19 @@ void toggle_expansion_cost_cbk(GtkComboBoxText* self, ezgl::application* app) {
app->refresh_drawing();
}

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

gchar* combo_box_content = gtk_combo_box_text_get_active_text(
GTK_COMBO_BOX_TEXT(toggle_crit_path));
gchar* combo_box_content = gtk_combo_box_text_get_active_text(self);
if (strcmp(combo_box_content, "None") == 0) {
draw_state->draw_noc = DRAW_NO_NOC;
} else if (strcmp(combo_box_content, "NoC Links") == 0)
Expand All @@ -423,7 +427,7 @@ void toggle_noc_display(GtkWidget* /*widget*/, gint /*response_id*/, gpointer /*
draw_state->draw_noc = DRAW_NOC_LINK_USAGE;

g_free(combo_box_content);
application.refresh_drawing();
app->refresh_drawing();
}

/**
Expand Down
5 changes: 2 additions & 3 deletions vpr/src/draw/draw_toggle_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ void toggle_crit_path_cbk(GtkComboBoxText* self, ezgl::application* app);
* Draws different router expansion costs based on user input. Changes value of draw_state->show_router_expansion_cost. */
void toggle_expansion_cost_cbk(GtkComboBoxText* self, ezgl::application* app);

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

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