Skip to content

Commit 4247689

Browse files
authored
Merge pull request #2129 from verilog-to-routing/Seb_UIInitSetupFix
Fixed Bug where VPR UI was not changing when switching mode
2 parents 6531416 + 21eddd1 commit 4247689

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

vpr/src/draw/draw.cpp

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,16 @@ static void default_setup(ezgl::application* app) {
286286
search_setup(app);
287287
}
288288

289+
// Initial Setup functions run default setup if they are a new window. Then, they will run
290+
// the specific hiding/showing functions that separate them from the other init. setup functions
291+
289292
/* function below intializes the interface window with a set of buttons and links
290293
* signals to corresponding functions for situation where the window is opened from
291294
* NO_PICTURE_to_PLACEMENT */
292295
static void initial_setup_NO_PICTURE_to_PLACEMENT(ezgl::application* app,
293296
bool is_new_window) {
294-
if (!is_new_window)
295-
return;
296-
297-
//Configuring visible buttons
298-
default_setup(app);
299-
300-
//THIS WILL BE CHANGED SOON IGNORE
301-
load_block_names(app);
297+
if (is_new_window)
298+
default_setup(app);
302299

303300
//Hiding unused functionality
304301
hide_widget("RoutingMenuButton", app);
@@ -311,9 +308,10 @@ static void initial_setup_NO_PICTURE_to_PLACEMENT(ezgl::application* app,
311308
static void initial_setup_NO_PICTURE_to_PLACEMENT_with_crit_path(
312309
ezgl::application* app,
313310
bool is_new_window) {
314-
if (!is_new_window)
315-
return;
316-
default_setup(app);
311+
if (is_new_window)
312+
default_setup(app);
313+
314+
//Showing given functionality
317315
crit_path_button_setup(app);
318316

319317
//Hiding unused routing menu
@@ -325,11 +323,10 @@ static void initial_setup_NO_PICTURE_to_PLACEMENT_with_crit_path(
325323
* PLACEMENT_to_ROUTING */
326324
static void initial_setup_PLACEMENT_to_ROUTING(ezgl::application* app,
327325
bool is_new_window) {
328-
if (!is_new_window)
329-
return;
330-
default_setup(app);
331-
routing_button_setup(app);
326+
if (is_new_window)
327+
default_setup(app);
332328

329+
routing_button_setup(app);
333330
hide_crit_path_button(app);
334331
}
335332

@@ -338,9 +335,8 @@ static void initial_setup_PLACEMENT_to_ROUTING(ezgl::application* app,
338335
* ROUTING_to_PLACEMENT */
339336
static void initial_setup_ROUTING_to_PLACEMENT(ezgl::application* app,
340337
bool is_new_window) {
341-
if (!is_new_window)
342-
return;
343-
default_setup(app);
338+
if (is_new_window)
339+
default_setup(app);
344340

345341
//Hiding unused functionality
346342
hide_widget("RoutingMenuButton", app);
@@ -352,9 +348,9 @@ static void initial_setup_ROUTING_to_PLACEMENT(ezgl::application* app,
352348
* NO_PICTURE_to_ROUTING */
353349
static void initial_setup_NO_PICTURE_to_ROUTING(ezgl::application* app,
354350
bool is_new_window) {
355-
if (!is_new_window)
356-
return;
357-
default_setup(app);
351+
if (is_new_window)
352+
default_setup(app);
353+
358354
routing_button_setup(app);
359355
hide_crit_path_button(app);
360356
}
@@ -365,9 +361,9 @@ static void initial_setup_NO_PICTURE_to_ROUTING(ezgl::application* app,
365361
static void initial_setup_NO_PICTURE_to_ROUTING_with_crit_path(
366362
ezgl::application* app,
367363
bool is_new_window) {
368-
if (!is_new_window)
369-
return;
370-
default_setup(app);
364+
if (is_new_window)
365+
default_setup(app);
366+
371367
routing_button_setup(app);
372368
crit_path_button_setup(app);
373369
}
@@ -379,7 +375,6 @@ void update_screen(ScreenUpdatePriority priority, const char* msg, enum pic_type
379375
/* Updates the screen if the user has requested graphics. The priority *
380376
* value controls whether or not the Proceed button must be clicked to *
381377
* continue. Saves the pic_on_screen_val to allow pan and zoom redraws. */
382-
383378
t_draw_state* draw_state = get_draw_state_vars();
384379

385380
if (!draw_state->show_graphics)

vpr/src/draw/ui_setup.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ void routing_button_setup(ezgl::application* app) {
145145
//Toggle Router Util
146146
GtkComboBoxText* toggle_router_util = GTK_COMBO_BOX_TEXT(app->get_object("ToggleRoutingUtil"));
147147
g_signal_connect(toggle_router_util, "changed", G_CALLBACK(toggle_router_util_cbk), app);
148+
show_widget("RoutingMenuButton", app);
148149
}
149150

150151
/**
@@ -168,6 +169,7 @@ void search_setup(ezgl::application* app) {
168169
void crit_path_button_setup(ezgl::application* app) {
169170
GtkComboBoxText* toggle_crit_path = GTK_COMBO_BOX_TEXT(app->get_object("ToggleCritPath"));
170171
g_signal_connect(toggle_crit_path, "changed", G_CALLBACK(toggle_crit_path_cbk), app);
172+
show_widget("ToggleCritPath", app);
171173
}
172174

173175
/**
@@ -191,6 +193,11 @@ void hide_widget(std::string widgetName, ezgl::application* app) {
191193
gtk_widget_hide(widget);
192194
}
193195

196+
void show_widget(std::string widgetName, ezgl::application* app) {
197+
GtkWidget* widget = GTK_WIDGET(app->get_object(widgetName.c_str()));
198+
gtk_widget_show(widget);
199+
}
200+
194201
/**
195202
* @brief loads atom and cluster lvl names into gtk list store item used for completion
196203
*

0 commit comments

Comments
 (0)