void main_platform() { if(button_read_button(&down_btn)) { if(is_view(gfx_mono_active_menu)) { if(gfx_mono_active_menu != NO_GPS_VIEW) { display_next_view(); } } // If it's not a view then the down button should be used for menu navigation. else { gfx_mono_menu_process_key(&menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)], GFX_MONO_MENU_KEYCODE_DOWN); ssd1306_write_display(); } } if(button_read_button(&select_btn)) { if(is_view(gfx_mono_active_menu)) { ssd1306_clear_display(); display_menu(MAIN_MENU); } else { volatile uint8_t menuChoice = gfx_mono_menu_process_key(&menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)], GFX_MONO_MENU_KEYCODE_ENTER); menu_link menu = menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].element_links[menuChoice]; // TODO: Skriv om snyggare :) if(menu == EXIT_MENU) { menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].current_page = 0; menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].current_selection = 0; if(is_view(menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent)) { display_view(menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent); } else { menu = menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent; display_menu(menu); } } else { display_menu(menu); } } } }
/* * Walker function to find a view */ static bool view_walker(Node *node, void *context) { SelectContext *ctx = (SelectContext *) context; char *relname; if (node == NULL) return false; if (IsA(node, RangeVar)) { RangeVar *rgv = (RangeVar *) node; relname = make_table_name_from_rangevar(rgv); ereport(DEBUG1, (errmsg("view walker. checking relation \"%s\"", relname))); if (is_view(relname)) { ctx->has_view = true; return false; } } return raw_expression_tree_walker(node, view_walker, context); }
/* * Walker function to find a view */ static bool view_walker(Node *node, void *context) { SelectContext *ctx = (SelectContext *) context; char *relname; if (node == NULL) return false; if (IsA(node, RangeVar)) { RangeVar *rgv = (RangeVar *)node; relname = make_table_name_from_rangevar(rgv); pool_debug("view_walker: relname: %s", relname); if (is_view(relname)) { ctx->has_view = true; return false; } } return raw_expression_tree_walker(node, view_walker, context); }