diff --git a/src/c/main.c b/src/c/main.c index ef0c447..0992663 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -378,7 +378,13 @@ static void alarm_highlight_layer_update_proc(Layer *layer, GContext *ctx) { } static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *context) { - return 3; + switch (s_highlight_pos) { + case 0: + case 1: + return 3; + default: + return 2; + } } static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { @@ -440,28 +446,6 @@ static void alarm_window_load() { // change highlight color to avoid changing color of bottom bar s_setter_highlight_color = s_primary_color; - // determine trigonometric function options - s_sin = s_sin_arr[rand() % 2]; - s_cos = s_cos_arr[rand() % 2]; - s_tan = s_tan_arr[rand() % 2]; - - // set up menu options - s_options_function[0] = s_sin; - s_options_function[1] = s_cos; - s_options_function[2] = s_tan; - s_options_over[0] = "1"; // TODO - s_options_over[1] = "2"; // TODO - s_options_over[2] = "3"; // TODO - s_options_under[0] = "1"; // TODO - s_options_under[1] = "2"; // TODO - s_options_under[2] = "3"; // TODO - - // drop window - s_drop_window = window_create(); // TODO destroy on window unload? - window_set_window_handlers( - s_drop_window, - (WindowHandlers){.unload = drop_menu_window_unload}); - // top&bottom bars add_bar_layers_to_window(window_layer); @@ -551,6 +535,25 @@ static void alarm_window_load() { s_triangle_layer = triangle_layer_create(GRect(0, s_top_bar_grect.size.h + 1, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT - (s_top_bar_grect.size.h * 2)), GColorBlack); layer_add_child(window_layer, s_triangle_layer->layer); + // drop menus + //// determine trigonometric function options + s_sin = s_sin_arr[rand() % 2]; + s_cos = s_cos_arr[rand() % 2]; + s_tan = s_tan_arr[rand() % 2]; + //// set up menu options + s_options_function[0] = s_sin; + s_options_function[1] = s_cos; + s_options_function[2] = s_tan; + s_options_over[0] = "1"; + s_options_over[1] = "2"; + s_options_under[0] = "1"; + s_options_under[1] = "2"; + //// create drop window + s_drop_window = window_create(); // TODO destroy on window unload? + window_set_window_handlers( + s_drop_window, + (WindowHandlers){.unload = drop_menu_window_unload}); + schedule_fallback_alarm(); tick_timer_service_subscribe(SECOND_UNIT, alarm_seconds_handler); }