Skip to content

Commit eeadc05

Browse files
Added file comments, changed some fn names for readability reasons
1 parent f875f86 commit eeadc05

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

vpr/src/draw/draw_toggle_functions.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
/*draw_toggle_functions.cpp contains callback functions that change draw_state variables
2-
* connected to buttons and sliders on the GUI.
1+
/**
2+
* @file draw_toggle_functions.cpp
3+
* @author Sebastian Lievano ([email protected])
4+
* @brief Callback functions for ui elements
5+
* @date July 4th, 2022
6+
*
7+
* This file contains all of the callback functions for UI elements.
8+
* Please add any new callback functions here, and if it makes sense, add _cbk at the end
9+
* of function name to prevent someone else calling it in any non gtk context.
310
*/
11+
412
#include <cstdio>
513
#include <cfloat>
614
#include <cstring>
@@ -405,7 +413,7 @@ void toggle_expansion_cost_cbk(GtkComboBoxText* self, ezgl::application* app) {
405413
* @param self self ptr to GtkSpinButton
406414
* @param app ezgl::app
407415
*/
408-
void set_net_max_fanout(GtkSpinButton* self, ezgl::application* app) {
416+
void set_net_max_fanout_cbk(GtkSpinButton* self, ezgl::application* app) {
409417
t_draw_state* draw_state = get_draw_state_vars();
410418
draw_state->draw_net_max_fanout = gtk_spin_button_get_value_as_int(self);
411419
app->refresh_drawing();
@@ -418,7 +426,7 @@ void set_net_max_fanout(GtkSpinButton* self, ezgl::application* app) {
418426
* @param self
419427
* @param app
420428
*/
421-
void set_net_alpha_value(GtkSpinButton* self, ezgl::application* app) {
429+
void set_net_alpha_value_cbk(GtkSpinButton* self, ezgl::application* app) {
422430
t_draw_state* draw_state = get_draw_state_vars();
423431
draw_state->net_alpha = gtk_spin_button_get_value_as_int(self);
424432
app->refresh_drawing();

vpr/src/draw/draw_toggle_functions.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef DRAW_TOGGLE_FUNCTIONS_H
22
#define DRAW_TOGGLE_FUNCTIONS_H
33

4+
/**
5+
* @file draw_toggle_functions.h
6+
* @author Sebastian Lievano
7+
* @brief Declarations of callback functions.
8+
*/
9+
410
#include <cstdio>
511
#include <cfloat>
612
#include <cstring>
@@ -47,12 +53,12 @@ void toggle_nets_cbk(GtkComboBox* self, ezgl::application* app);
4753

4854
/* Callback function for runtime created netMaxFanout widget in ui_setup.cpp.
4955
* Sets draw_state->draw_net_max_fanout to its corresponding value in the UI. */
50-
void set_net_max_fanout(GtkSpinButton* self, ezgl::application* app);
56+
void set_net_max_fanout_cbk(GtkSpinButton* self, ezgl::application* app);
5157

5258
/* Callback function for runtime created netAlpha widget in ui_setup.cpp.
5359
* Sets draw_state->net_alpha (a value from 0 to 1 representing transparency) to
5460
* its corresponding value in the UI. */
55-
void set_net_alpha_value(GtkSpinButton* self, ezgl::application* app);
61+
void set_net_alpha_value_cbk(GtkSpinButton* self, ezgl::application* app);
5662

5763
/* Callback function for runtime created toggle_blk_internal button in ui_setup.cpp.
5864
* With each consecutive click of the button, a lower level in the

vpr/src/draw/ui_setup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ void net_button_setup(ezgl::application* app) {
6565

6666
//Manages net alpha
6767
GtkSpinButton* net_alpha = GTK_SPIN_BUTTON(app->get_object("NetAlpha"));
68-
g_signal_connect(net_alpha, "value-changed", G_CALLBACK(set_net_alpha_value), app);
68+
g_signal_connect(net_alpha, "value-changed", G_CALLBACK(set_net_alpha_value_cbk), app);
6969
gtk_spin_button_set_increments(net_alpha, 1, 1);
7070
gtk_spin_button_set_range(net_alpha, 1, 255);
7171

7272
//Manages net max fanout
7373
GtkSpinButton* max_fanout = GTK_SPIN_BUTTON(app->get_object("NetMaxFanout"));
74-
g_signal_connect(max_fanout, "value-changed", G_CALLBACK(set_net_max_fanout), app);
74+
g_signal_connect(max_fanout, "value-changed", G_CALLBACK(set_net_max_fanout_cbk), app);
7575
gtk_spin_button_set_increments(max_fanout, 1, 1);
7676
gtk_spin_button_set_range(max_fanout, 0., (double)get_max_fanout());
7777
}

0 commit comments

Comments
 (0)