From 0a4c80268572470c0488429b737f671bee1ad4e9 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 19 Jul 2026 23:00:46 -0400 Subject: [PATCH] Begin neat_bar port --- .gitmodules | 3 ++ neat_bar | 1 + package.json | 14 ------- resources/action_icon_minus.png | Bin 87 -> 69 bytes resources/action_icon_plus.png | Bin 92 -> 88 bytes resources/icon~bw.png | Bin 0 -> 154 bytes resources/{icon.png => icon~color.png} | Bin resources/patch_bottom.png | Bin 91 -> 0 bytes resources/patch_top.png | Bin 92 -> 0 bytes src/c/main.c | 53 ++++++------------------- wscript | 2 +- 11 files changed, 17 insertions(+), 56 deletions(-) create mode 100644 .gitmodules create mode 160000 neat_bar create mode 100644 resources/icon~bw.png rename resources/{icon.png => icon~color.png} (100%) delete mode 100644 resources/patch_bottom.png delete mode 100644 resources/patch_top.png diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e7d9260 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "neat_bar"] + path = neat_bar + url = https://git.wetfence.xyz/RandyTheSilly/neat_bar.git diff --git a/neat_bar b/neat_bar new file mode 160000 index 0000000..147a230 --- /dev/null +++ b/neat_bar @@ -0,0 +1 @@ +Subproject commit 147a230c977b07904551f5678fe4cc3c61afb3fa diff --git a/package.json b/package.json index ef71164..e63875d 100644 --- a/package.json +++ b/package.json @@ -50,20 +50,6 @@ "spaceOptimization": "storage", "type": "bitmap" }, - { - "file": "patch_bottom.png", - "memoryFormat": "Smallest", - "name": "PATCH_BOTTOM", - "spaceOptimization": "storage", - "type": "bitmap" - }, - { - "file": "patch_top.png", - "memoryFormat": "Smallest", - "name": "PATCH_TOP", - "spaceOptimization": "storage", - "type": "bitmap" - }, { "file": "icon.png", "memoryFormat": "Smallest", diff --git a/resources/action_icon_minus.png b/resources/action_icon_minus.png index cd71d4c8c030ec20109808c11d6c2ddf410cda69..65cd53b942c8c431b10d762160e0805fa6affcf5 100644 GIT binary patch literal 69 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CC2qYLL#XeRC33$3VhEy;n|M<_?$DlWfeQ(_J Q*3}?+Pgg&ebxsLQ0L17JV*mgE literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx?BpA#)4xIr~OeH~n!3+##lh0a!q&!_5Ln;`P g53qcz7vNxKU?{o9@|JJvTQ-mmPgg&ebxsLQ0NbP!=l}o! diff --git a/resources/action_icon_plus.png b/resources/action_icon_plus.png index 8796a75eaf41e4045d71638fcf2b29a3dc3b7e82..e56414020b6eb2a93b5bcaa775d5aac4fc4f3b77 100644 GIT binary patch literal 88 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;nBpB-W61{*FQ%R6tFatx`!jv*C{ m$qfw8m^o7Zv-brYImp1kV#v*U^G?AfkTy?OKbLh*2~7Z0Xcj^M diff --git a/resources/icon~bw.png b/resources/icon~bw.png new file mode 100644 index 0000000000000000000000000000000000000000..863024d9fef42f9bb2e0f640eb5ab20b72226c2c GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^k|4|oBpBXI+Hnp@C3?CzhEy=>`lvEF1q#gBUBsl6 z+vl=Wablm?lij;tPu^tRS2>T<+P|aPLh!4`xpy1p#Vx3^ou2PC_4Iz;hsR9|MW64z zDZG56QdQ-@wddwu65TrS!jY5Pv)A>h9THRb`+AS*#j!va-K%jwL6&;D`njxgN@xNA DSmHcT literal 0 HcmV?d00001 diff --git a/resources/icon.png b/resources/icon~color.png similarity index 100% rename from resources/icon.png rename to resources/icon~color.png diff --git a/resources/patch_bottom.png b/resources/patch_bottom.png deleted file mode 100644 index 858b74708930ca6779cfab96865e34f4f7a0a0dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 91 zcmeAS@N?(olHy`uVBq!ia0vp^Nz11gL>t3?d`rn9^T>GE{-b6Mw<&;$VItrL#` diff --git a/resources/patch_top.png b/resources/patch_top.png deleted file mode 100644 index 0c74c891fe8793a241f48536f4e661a0a3c48c88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 92 zcmeAS@N?(olHy`uVBq!ia0vp^NT+S9TwETN55Two1)z4*}Q$iB}0ml?b diff --git a/src/c/main.c b/src/c/main.c index 70e5d66..665ba62 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -1,3 +1,4 @@ +#include "../../neat_bar/src/c/neat_bar.h" #include #define COUNT_PKEY 1 @@ -10,25 +11,11 @@ static GBitmap *s_action_icon_plus; static GBitmap *s_action_icon_minus; static GBitmap *s_action_icon_reset; -static ActionBarLayer *s_action_bar_layer; +static NeatBarLayer *s_neat_bar_layer; static StatusBarLayer *s_status_bar_layer; static int s_count; -#if PBL_RECT -static GBitmap *s_legacy_actionbar_patch_bottom; -static GBitmap *s_legacy_actionbar_patch_top; -static BitmapLayer *s_patch_bottom_layer; -static BitmapLayer *s_patch_top_layer; -#if PBL_DISPLAY_WIDTH >= 200 -static const GRect s_patch_bottom_grect = GRect(166, 222, 34, 6); -static const GRect s_patch_top_grect = GRect(166, 20, 34, 6); -#else -static const GRect s_patch_bottom_grect = GRect(114, 163, 34, 5); -static const GRect s_patch_top_grect = GRect(114, 15, 34, 6); -#endif -#endif - void update() { static char buffer[10]; snprintf(buffer, sizeof(buffer), "%i", s_count); @@ -80,25 +67,17 @@ void click_config_provider(void *context) { void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); - s_action_bar_layer = action_bar_layer_create(); - action_bar_layer_set_click_config_provider(s_action_bar_layer, click_config_provider); - action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, s_action_icon_reset); - action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_SELECT, s_action_icon_plus); - action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, s_action_icon_minus); - action_bar_layer_add_to_window(s_action_bar_layer, window); - + s_neat_bar_layer = neat_bar_layer_create(); + neat_bar_layer_set_click_config_provider(s_neat_bar_layer, click_config_provider); + neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_UP, s_action_icon_reset); + neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_SELECT, s_action_icon_plus); + neat_bar_layer_set_icon(s_neat_bar_layer, BUTTON_ID_DOWN, s_action_icon_minus); #if PBL_RECT - s_patch_bottom_layer = bitmap_layer_create(s_patch_bottom_grect); - bitmap_layer_set_bitmap(s_patch_bottom_layer, s_legacy_actionbar_patch_bottom); - bitmap_layer_set_background_color(s_patch_bottom_layer, GColorClear); - bitmap_layer_set_compositing_mode(s_patch_bottom_layer, GCompOpSet); - layer_add_child(window_layer, bitmap_layer_get_layer(s_patch_bottom_layer)); - s_patch_top_layer = bitmap_layer_create(s_patch_top_grect); - bitmap_layer_set_bitmap(s_patch_top_layer, s_legacy_actionbar_patch_top); - bitmap_layer_set_background_color(s_patch_top_layer, GColorClear); - bitmap_layer_set_compositing_mode(s_patch_top_layer, GCompOpSet); - layer_add_child(window_layer, bitmap_layer_get_layer(s_patch_top_layer)); + neat_bar_layer_set_corner_radius(s_neat_bar_layer, 3); + neat_bar_layer_set_height(s_neat_bar_layer, PBL_DISPLAY_HEIGHT - 28); + neat_bar_layer_set_y_offset(s_neat_bar_layer, 24); #endif + neat_bar_layer_add_to_window(s_neat_bar_layer, window); GRect bounds = layer_get_frame(window_layer); const int16_t width = layer_get_frame(window_layer).size.w - ACTION_BAR_WIDTH; @@ -117,21 +96,13 @@ void window_load(Window *window) { void window_unload(Window *window) { status_bar_layer_destroy(s_status_bar_layer); text_layer_destroy(s_text_layer); -#if PBL_RECT - bitmap_layer_destroy(s_patch_top_layer); - bitmap_layer_destroy(s_patch_bottom_layer); -#endif - action_bar_layer_destroy(s_action_bar_layer); + neat_bar_layer_destroy(s_neat_bar_layer); } void init() { s_action_icon_plus = gbitmap_create_with_resource(RESOURCE_ID_PLUS); s_action_icon_minus = gbitmap_create_with_resource(RESOURCE_ID_MINUS); s_action_icon_reset = gbitmap_create_with_resource(RESOURCE_ID_RESET); -#if PBL_RECT - s_legacy_actionbar_patch_bottom = gbitmap_create_with_resource(RESOURCE_ID_PATCH_BOTTOM); - s_legacy_actionbar_patch_top = gbitmap_create_with_resource(RESOURCE_ID_PATCH_TOP); -#endif s_window = window_create(); diff --git a/wscript b/wscript index 5238bc8..331af78 100644 --- a/wscript +++ b/wscript @@ -34,7 +34,7 @@ def build(ctx): ctx.env = ctx.all_envs[platform] ctx.set_group(ctx.env.PLATFORM_NAME) app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR) - ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app') + ctx.pbl_build(source=ctx.path.ant_glob(['src/c/**/*.c', 'neat_bar/src/c/**/*.c']), target=app_elf, bin_type='app') if build_worker: worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)