Skip to content

Commit 348f972

Browse files
author
Jamie C. Driver
committed
gui consistency: remove gui_ prefix from internal static function names
1 parent a98c5b8 commit 348f972

File tree

1 file changed

+33
-44
lines changed

1 file changed

+33
-44
lines changed

main/gui.c

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void gui_set_active(gui_view_node_t* node, const bool value)
317317
gui_repaint(node);
318318
}
319319

320-
static gui_view_node_t* gui_get_first_active_node(gui_activity_t* activity)
320+
static gui_view_node_t* get_first_active_node(gui_activity_t* activity)
321321
{
322322
JADE_ASSERT(activity);
323323

@@ -339,7 +339,7 @@ static gui_view_node_t* gui_get_first_active_node(gui_activity_t* activity)
339339
// select the previous item in the selectables list
340340
// Returns true if the selection is 'moved' to a prior item, or false if not (and selection left unchanged)
341341
// eg. no current item selected, no other selectable items, no prior selectable items [and not wrapping] etc.
342-
static bool gui_select_prev(gui_activity_t* activity)
342+
static bool select_prev(gui_activity_t* activity)
343343
{
344344
JADE_ASSERT(activity);
345345

@@ -393,7 +393,7 @@ static bool gui_select_prev(gui_activity_t* activity)
393393

394394
// Note: node must exist and be active/selectable.
395395
// Any prior selection will be cleared.
396-
void gui_select_node(gui_view_node_t* node)
396+
static void select_node(gui_view_node_t* node)
397397
{
398398
JADE_ASSERT(node);
399399
JADE_ASSERT(node->activity);
@@ -447,7 +447,7 @@ void gui_select_node(gui_view_node_t* node)
447447
// select the next item in the selectables list
448448
// Returns true if the selection is 'moved' to a subsequent item, or false if not (and selection left unchanged)
449449
// eg. no current item selected, no other selectable items, no later selectable items [and not wrapping] etc.
450-
static bool gui_select_next(gui_activity_t* activity)
450+
static bool select_next(gui_activity_t* activity)
451451
{
452452
JADE_ASSERT(activity);
453453

@@ -532,7 +532,7 @@ void gui_activity_set_active_selection(gui_activity_t* activity, gui_view_node_t
532532
set_tree_active(nodes[i], active[i]);
533533
if (nodes[i] == selected) {
534534
JADE_ASSERT(active[i]); // can only select active node
535-
gui_select_node(nodes[i]);
535+
select_node(nodes[i]);
536536
set_selected = true;
537537
}
538538
}
@@ -774,7 +774,7 @@ static void switch_activity_callback(void* handler_arg, esp_event_base_t base, i
774774
gui_set_current_activity(activity);
775775
}
776776

777-
static void gui_connect_button_activity(gui_view_node_t* node, gui_activity_t* activity)
777+
static void connect_button_activity(gui_view_node_t* node, gui_activity_t* activity)
778778
{
779779
JADE_ASSERT(node);
780780
JADE_ASSERT(node->activity);
@@ -801,12 +801,12 @@ void gui_chain_activities(const link_activity_t* link_act, linked_activities_inf
801801
if (pActInfo->last_activity) {
802802
if (link_act->prev_button) {
803803
// connect our "prev" btn to prev activity
804-
gui_connect_button_activity(link_act->prev_button, pActInfo->last_activity);
804+
connect_button_activity(link_act->prev_button, pActInfo->last_activity);
805805
}
806806

807807
// connect prev "next" btn to this activity
808808
if (pActInfo->last_activity_next_button) {
809-
gui_connect_button_activity(pActInfo->last_activity_next_button, link_act->activity);
809+
connect_button_activity(pActInfo->last_activity_next_button, link_act->activity);
810810
}
811811
}
812812

@@ -1558,7 +1558,7 @@ void gui_set_text_font(gui_view_node_t* node, uint32_t font)
15581558
void gui_set_text_default_font(gui_view_node_t* node) { gui_set_text_font(node, GUI_DEFAULT_FONT); }
15591559

15601560
// resolve translated strings/etc
1561-
static void gui_resolve_text(gui_view_node_t* node)
1561+
static void resolve_text(gui_view_node_t* node)
15621562
{
15631563
JADE_ASSERT(node);
15641564
JADE_ASSERT(node->kind == TEXT);
@@ -1579,20 +1579,9 @@ static void gui_resolve_text(gui_view_node_t* node)
15791579
node->render_data.resolved_text_length = strlen(node->render_data.resolved_text);
15801580
}
15811581

1582-
// Helper to get the ultimate root node for any given node
1583-
static inline gui_view_node_t* gui_get_root_node(gui_view_node_t* node)
1584-
{
1585-
JADE_ASSERT(node);
1586-
gui_view_node_t* root = node;
1587-
while (root->parent) {
1588-
root = root->parent;
1589-
}
1590-
return root;
1591-
}
1592-
15931582
// Helper function to just update the text node internal text data - does not repaint,
15941583
// so several nodes can be updated then a single repaint issued - eg. the status bar
1595-
static void gui_update_text_node_text(gui_view_node_t* node, const char* text)
1584+
static void update_text_node_text(gui_view_node_t* node, const char* text)
15961585
{
15971586
JADE_ASSERT(node);
15981587
JADE_ASSERT(node->kind == TEXT);
@@ -1609,7 +1598,7 @@ static void gui_update_text_node_text(gui_view_node_t* node, const char* text)
16091598
node->text->text = new_text;
16101599

16111600
// resolve text references
1612-
gui_resolve_text(node);
1601+
resolve_text(node);
16131602
}
16141603

16151604
// Takes the gui_mutex, updates the text node, and then only draws the
@@ -1623,7 +1612,7 @@ void gui_update_text(gui_view_node_t* node, const char* text)
16231612
// if part of current activity release the mutex and post
16241613
// a message to the gui task to repaint it.
16251614
JADE_SEMAPHORE_TAKE(gui_mutex);
1626-
gui_update_text_node_text(node, text);
1615+
update_text_node_text(node, text);
16271616
const bool repaint = current_activity && node->activity == current_activity;
16281617
JADE_SEMAPHORE_GIVE(gui_mutex);
16291618

@@ -1747,7 +1736,7 @@ static void render_node(gui_view_node_t* node, const dispWin_t constraints, cons
17471736

17481737
// resolve the value for text objects
17491738
if (node->kind == TEXT) {
1750-
gui_resolve_text(node);
1739+
resolve_text(node);
17511740
}
17521741

17531742
node->render_data.is_first_time = false;
@@ -2087,7 +2076,7 @@ static void repaint_node(gui_view_node_t* node)
20872076
}
20882077
}
20892078

2090-
static void gui_render_activity(gui_activity_t* activity)
2079+
static void render_activity(gui_activity_t* activity)
20912080
{
20922081
JADE_ASSERT(activity);
20932082
JADE_ASSERT(activity->root_node);
@@ -2100,12 +2089,12 @@ static void gui_render_activity(gui_activity_t* activity)
21002089
// If not, select the first active item
21012090
if (activity->initial_selection && activity->initial_selection->is_active) {
21022091
JADE_ASSERT(activity->initial_selection->activity == activity);
2103-
gui_select_node(activity->initial_selection);
2092+
select_node(activity->initial_selection);
21042093
} else {
2105-
gui_view_node_t* const node = gui_get_first_active_node(activity);
2094+
gui_view_node_t* const node = get_first_active_node(activity);
21062095
if (node) {
21072096
JADE_ASSERT(node->activity == activity);
2108-
gui_select_node(node);
2097+
select_node(node);
21092098
}
21102099
}
21112100
}
@@ -2134,7 +2123,7 @@ static bool update_status_bar(const bool force_redraw)
21342123
dispWin_t status_bar_cs = GUI_DISPLAY_WINDOW;
21352124
status_bar_cs.y2 = status_bar_cs.y1 + GUI_STATUS_BAR_HEIGHT;
21362125

2137-
// NOTE: we use the internal 'gui_update_text_node_text()' method here
2126+
// NOTE: we use the internal 'update_text_node_text()' method here
21382127
// since we don't want to redraw each update individually, but rather
21392128
// capture in a single repaint after all nodes are updated.
21402129
if ((status_bar.battery_update_counter % 10) == 0) {
@@ -2147,9 +2136,9 @@ static bool update_status_bar(const bool force_redraw)
21472136
if (new_ble != status_bar.last_ble_val) {
21482137
status_bar.last_ble_val = new_ble;
21492138
if (new_ble) {
2150-
gui_update_text_node_text(status_bar.ble_text, (char[]){ 'E', '\0' });
2139+
update_text_node_text(status_bar.ble_text, (char[]){ 'E', '\0' });
21512140
} else {
2152-
gui_update_text_node_text(status_bar.ble_text, (char[]){ 'F', '\0' });
2141+
update_text_node_text(status_bar.ble_text, (char[]){ 'F', '\0' });
21532142
}
21542143
status_bar.updated = true;
21552144
}
@@ -2158,11 +2147,11 @@ static bool update_status_bar(const bool force_redraw)
21582147
if (new_usb != status_bar.last_usb_val) {
21592148
status_bar.last_usb_val = new_usb;
21602149
if (new_usb) {
2161-
gui_update_text_node_text(status_bar.usb_text, (char[]){ 'C', '\0' });
2150+
update_text_node_text(status_bar.usb_text, (char[]){ 'C', '\0' });
21622151
// FIXME: change to charging rather than usb connected
21632152
// serial_start();
21642153
} else {
2165-
gui_update_text_node_text(status_bar.usb_text, (char[]){ 'D', '\0' });
2154+
update_text_node_text(status_bar.usb_text, (char[]){ 'D', '\0' });
21662155
// FIXME: change to no power rather than usb connected
21672156
// serial_stop();
21682157
}
@@ -2180,7 +2169,7 @@ static bool update_status_bar(const bool force_redraw)
21802169
if (new_bat != status_bar.last_battery_val) {
21812170
status_bar.last_battery_val = new_bat;
21822171
gui_set_color(status_bar.battery_text, color);
2183-
gui_update_text_node_text(status_bar.battery_text, (char[]){ new_bat + '0', '\0' });
2172+
update_text_node_text(status_bar.battery_text, (char[]){ new_bat + '0', '\0' });
21842173
status_bar.updated = true;
21852174
}
21862175
status_bar.battery_update_counter = 60;
@@ -2245,12 +2234,12 @@ static size_t handle_gui_input_queue(bool* switched_activities)
22452234
// Update the status bar text for the new activity
22462235
if (current_activity->status_bar) {
22472236
const bool force_redraw = true;
2248-
gui_update_text_node_text(status_bar.title, current_activity->title ? current_activity->title : "");
2237+
update_text_node_text(status_bar.title, current_activity->title ? current_activity->title : "");
22492238
update_status_bar(force_redraw);
22502239
}
22512240

22522241
// Draw the new activity
2253-
gui_render_activity(current_activity);
2242+
render_activity(current_activity);
22542243

22552244
// Register new events
22562245
activity_event_t* l = current_activity->activity_events;
@@ -2374,37 +2363,37 @@ void gui_front_click(void)
23742363
}
23752364
}
23762365

2377-
static void gui_next_right(void)
2366+
void select_next_right(void)
23782367
{
23792368
if (!idletimer_register_activity(true)) {
2380-
gui_select_next(current_activity);
2369+
select_next(current_activity);
23812370
esp_event_post(GUI_EVENT, GUI_WHEEL_RIGHT_EVENT, NULL, 0, 50 / portTICK_PERIOD_MS);
23822371
}
23832372
}
23842373

2385-
static void gui_prev_left(void)
2374+
void select_prev_left(void)
23862375
{
23872376
if (!idletimer_register_activity(true)) {
2388-
gui_select_prev(current_activity);
2377+
select_prev(current_activity);
23892378
esp_event_post(GUI_EVENT, GUI_WHEEL_LEFT_EVENT, NULL, 0, 50 / portTICK_PERIOD_MS);
23902379
}
23912380
}
23922381

23932382
void gui_next(void)
23942383
{
23952384
if (gui_orientation_flipped) {
2396-
gui_prev_left();
2385+
select_prev_left();
23972386
} else {
2398-
gui_next_right();
2387+
select_next_right();
23992388
}
24002389
}
24012390

24022391
void gui_prev(void)
24032392
{
24042393
if (gui_orientation_flipped) {
2405-
gui_next_right();
2394+
select_next_right();
24062395
} else {
2407-
gui_prev_left();
2396+
select_prev_left();
24082397
}
24092398
}
24102399

0 commit comments

Comments
 (0)