Eliminate type drop menu (no longer relevant)

This commit is contained in:
2026-08-07 22:49:23 -04:00
parent c346523d96
commit 4c87a86ab4
2 changed files with 12 additions and 49 deletions
+11 -48
View File
@@ -22,14 +22,11 @@ static TextLayer *s_countdown_txt_layer;
static TextLayer *s_setter_txt_layer;
static Layer *s_setter_highlight_layer;
//// alarm
static TextLayer *s_type_txt_layer;
static TextLayer *s_theta_txt_layer;
static TextLayer *s_parenthesis_txt_layer;
static Layer *s_drop_bg_type_layer;
static Layer *s_drop_bg_function_layer;
static Layer *s_drop_bg_over_layer;
static Layer *s_drop_bg_under_layer;
static TextLayer *s_drop_txt_type_layer;
static TextLayer *s_drop_txt_function_layer;
static TextLayer *s_drop_txt_over_layer;
static TextLayer *s_drop_txt_under_layer;
@@ -68,7 +65,6 @@ static const GColor s_primary_color = GColorJaegerGreen;
#define STORAGE_KEY_ALARM_MINUTE 1
//// alarm
static const uint8_t s_drop_height = 22;
static const GRect s_drop_type_grect = GRect(PBL_IF_ROUND_ELSE(48, 62), (s_top_bar_grect.size.h / 2) - PBL_IF_ROUND_ELSE(-4, s_drop_height / 2), PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(96, 70), s_drop_height);
static const GRect s_drop_function_grect = GRect(PBL_IF_ROUND_ELSE(55, 45), s_bottom_bar_grect.origin.y + ((s_bottom_bar_grect.size.h / 2) - PBL_IF_ROUND_ELSE(s_drop_height - 1, s_drop_height / 2)), 50, s_drop_height);
static const GRect s_drop_over_grect = GRect(s_drop_function_grect.origin.x + 78, s_drop_function_grect.origin.y - 13, s_drop_function_grect.size.w + 1, s_drop_function_grect.size.h);
static const GRect s_drop_under_grect = GRect(s_drop_over_grect.origin.x, s_drop_over_grect.origin.y + s_drop_over_grect.size.h + 5, s_drop_function_grect.size.w, s_drop_over_grect.size.h);
@@ -80,7 +76,6 @@ static const char *s_cos;
static const char *s_tan;
// alarm drop menu options
static const char *s_options_type[3] = {"acute", "obtuse", "right"};
static const char *s_options_function[3];
static char *s_options_over[2];
static char *s_options_under[2];
@@ -383,7 +378,6 @@ 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) {
switch (s_highlight_pos) {
case 0:
case 1:
return 3;
default:
return 2;
@@ -393,15 +387,12 @@ static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index,
static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
switch (s_highlight_pos) {
case 0:
menu_cell_basic_draw(ctx, cell_layer, s_options_type[cell_index->row], NULL, NULL);
break;
case 1:
menu_cell_basic_draw(ctx, cell_layer, s_options_function[cell_index->row], NULL, NULL);
break;
case 2:
case 1:
menu_cell_basic_draw(ctx, cell_layer, s_options_over[cell_index->row], NULL, NULL);
break;
case 3:
case 2:
menu_cell_basic_draw(ctx, cell_layer, s_options_under[cell_index->row], NULL, NULL);
}
}
@@ -409,15 +400,12 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
static void menu_select(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) {
switch (s_highlight_pos) {
case 0:
text_layer_set_text(s_drop_txt_type_layer, s_options_type[cell_index->row]);
break;
case 1:
text_layer_set_text(s_drop_txt_function_layer, s_options_function[cell_index->row]);
break;
case 2:
case 1:
text_layer_set_text(s_drop_txt_over_layer, s_options_over[cell_index->row]);
break;
case 3:
case 2:
text_layer_set_text(s_drop_txt_under_layer, s_options_under[cell_index->row]);
}
window_stack_remove(s_drop_window, true);
@@ -452,17 +440,8 @@ static void alarm_window_load() {
// top&bottom bars
add_bar_layers_to_window(window_layer);
// type text
s_font_mansalva_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MANSALVA_REGULAR_22));
s_type_txt_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 7), PBL_IF_ROUND_ELSE(4, 16), PBL_DISPLAY_WIDTH, 26));
text_layer_set_text_alignment(s_type_txt_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft));
text_layer_set_background_color(s_type_txt_layer, GColorClear);
text_layer_set_text_color(s_type_txt_layer, GColorWhite);
text_layer_set_font(s_type_txt_layer, s_font_mansalva_small);
text_layer_set_text(s_type_txt_layer, "type:");
layer_add_child(window_layer, text_layer_get_layer(s_type_txt_layer));
// theta text
s_font_mansalva_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MANSALVA_REGULAR_22));
s_theta_txt_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 8), s_bottom_bar_grect.origin.y + PBL_IF_ROUND_ELSE(50, 16), PBL_DISPLAY_WIDTH, 26));
text_layer_set_text_alignment(s_theta_txt_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft));
text_layer_set_background_color(s_theta_txt_layer, GColorClear);
@@ -472,10 +451,6 @@ static void alarm_window_load() {
layer_add_child(window_layer, text_layer_get_layer(s_theta_txt_layer));
// drop backgrounds
//// type
s_drop_bg_type_layer = layer_create(s_drop_type_grect);
layer_set_update_proc(s_drop_bg_type_layer, drop_layer_update_proc);
layer_add_child(window_layer, s_drop_bg_type_layer);
//// function
s_drop_bg_function_layer = layer_create(s_drop_function_grect);
layer_set_update_proc(s_drop_bg_function_layer, drop_layer_update_proc);
@@ -490,12 +465,6 @@ static void alarm_window_load() {
layer_add_child(window_layer, s_drop_bg_under_layer);
// drop text (blank by default)
//// type
s_drop_txt_type_layer = text_layer_create(GRect(s_drop_type_grect.origin.x, s_drop_type_grect.origin.y - 3, s_drop_type_grect.size.w, s_drop_type_grect.size.h));
text_layer_set_background_color(s_drop_txt_type_layer, GColorClear);
text_layer_set_font(s_drop_txt_type_layer, s_font_mansalva_small);
text_layer_set_text_alignment(s_drop_txt_type_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(s_drop_txt_type_layer));
//// function
s_drop_txt_function_layer = text_layer_create(GRect(s_drop_function_grect.origin.x, s_drop_function_grect.origin.y - 3, s_drop_function_grect.size.w, s_drop_function_grect.size.h));
text_layer_set_background_color(s_drop_txt_function_layer, GColorClear);
@@ -530,7 +499,7 @@ static void alarm_window_load() {
layer_add_child(window_layer, s_division_layer);
// highlighter
s_alarm_highlight_layer = layer_create(s_drop_type_grect);
s_alarm_highlight_layer = layer_create(s_drop_function_grect);
layer_set_update_proc(s_alarm_highlight_layer, alarm_highlight_layer_update_proc);
layer_add_child(window_layer, s_alarm_highlight_layer);
@@ -540,19 +509,19 @@ static void alarm_window_load() {
// triangle measurements text layers
//// side_a
s_side_a_txt_layer = text_layer_create(GRect(0, s_bottom_bar_grect.origin.y - 25, PBL_DISPLAY_WIDTH, 23));
s_side_a_txt_layer = text_layer_create(GRect(0, s_bottom_bar_grect.origin.y - 25, PBL_DISPLAY_WIDTH, 26));
text_layer_set_background_color(s_side_a_txt_layer, GColorClear);
text_layer_set_font(s_side_a_txt_layer, s_font_mansalva_small);
text_layer_set_text_alignment(s_side_a_txt_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(s_side_a_txt_layer));
//// side_b
s_side_b_txt_layer = text_layer_create(GRect(-3, PBL_DISPLAY_WIDTH / 2, PBL_DISPLAY_WIDTH, 23));
s_side_b_txt_layer = text_layer_create(GRect(-3, PBL_DISPLAY_WIDTH / 2, PBL_DISPLAY_WIDTH, 26));
text_layer_set_background_color(s_side_b_txt_layer, GColorClear);
text_layer_set_font(s_side_b_txt_layer, s_font_mansalva_small);
text_layer_set_text_alignment(s_side_b_txt_layer, GTextAlignmentRight);
layer_add_child(window_layer, text_layer_get_layer(s_side_b_txt_layer));
//// side_c
s_side_c_txt_layer = text_layer_create(GRect(3, PBL_DISPLAY_WIDTH / 2, PBL_DISPLAY_WIDTH, 23));
s_side_c_txt_layer = text_layer_create(GRect(3, PBL_DISPLAY_WIDTH / 2, PBL_DISPLAY_WIDTH, 26));
text_layer_set_background_color(s_side_c_txt_layer, GColorClear);
text_layer_set_font(s_side_c_txt_layer, s_font_mansalva_small);
layer_add_child(window_layer, text_layer_get_layer(s_side_c_txt_layer));
@@ -621,13 +590,10 @@ static void alarm_window_unload() {
text_layer_destroy(s_drop_txt_under_layer);
text_layer_destroy(s_drop_txt_over_layer);
text_layer_destroy(s_drop_txt_function_layer);
text_layer_destroy(s_drop_txt_type_layer);
layer_destroy(s_drop_bg_under_layer);
layer_destroy(s_drop_bg_over_layer);
layer_destroy(s_drop_bg_function_layer);
layer_destroy(s_drop_bg_type_layer);
text_layer_destroy(s_theta_txt_layer);
text_layer_destroy(s_type_txt_layer);
layer_destroy(s_bottom_bar_layer);
layer_destroy(s_top_bar_layer);
fonts_unload_custom_font(s_font_mansalva_big);
@@ -637,15 +603,12 @@ static void alarm_window_unload() {
static void set_alarm_highlighter_frame() {
switch (s_highlight_pos) {
case 0:
layer_set_frame(s_alarm_highlight_layer, s_drop_type_grect);
break;
case 1:
layer_set_frame(s_alarm_highlight_layer, s_drop_function_grect);
break;
case 2:
case 1:
layer_set_frame(s_alarm_highlight_layer, s_drop_over_grect);
break;
case 3:
case 2:
layer_set_frame(s_alarm_highlight_layer, s_drop_under_grect);
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ static void right_triangle_layer_update_proc(Layer *layer, GContext *ctx) {
// circle theta angle
graphics_context_set_stroke_color(ctx, GColorRed);
graphics_draw_circle(ctx, GPoint(tri->theta_angle_is_left ? start_x : end_x, base_y), 3);
graphics_draw_circle(ctx, GPoint(tri->theta_angle_is_left ? start_x : end_x, base_y), 4);
}
RightTriangleLayer *right_triangle_layer_create(GRect frame, GColor color) {