diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-06-14 13:34:41 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-06-14 13:34:41 +1000 |
| commit | 5086ab96ea648cd842addb02b188f29bff7bbadd (patch) | |
| tree | 7a3579d655c906ace9e76c394c33eb164d7ce7aa /lib/luavgl/src/widgets | |
| parent | 194f0e6b59259986b36448c376788c227d490f06 (diff) | |
| parent | 37ed3996017e43b343e4880981d70c4a6d4a5636 (diff) | |
| download | tangara-fw-5086ab96ea648cd842addb02b188f29bff7bbadd.tar.gz | |
Merge branch 'jqln/lvgl-bump'
Diffstat (limited to 'lib/luavgl/src/widgets')
| -rw-r--r-- | lib/luavgl/src/widgets/bar.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/btn.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/calendar.c | 2 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/checkbox.c | 2 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/dropdown.c | 22 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/img.c | 40 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/keyboard.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/label.c | 11 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/led.c | 2 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/list.c | 2 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/roller.c | 2 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/slider.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/switch.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/textarea.c | 4 | ||||
| -rw-r--r-- | lib/luavgl/src/widgets/widgets.c | 12 |
15 files changed, 57 insertions, 62 deletions
diff --git a/lib/luavgl/src/widgets/bar.c b/lib/luavgl/src/widgets/bar.c index bab38aae..7f762a45 100644 --- a/lib/luavgl/src/widgets/bar.c +++ b/lib/luavgl/src/widgets/bar.c @@ -1,7 +1,7 @@ #include "luavgl.h" #include "private.h" #include <src/misc/lv_anim.h> -#include <src/widgets/lv_bar.h> +#include <src/widgets/bar/lv_bar.h> static int luavgl_bar_create(lua_State *L) { @@ -46,7 +46,7 @@ LUALIB_API int luavgl_bar_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for bar.\n"); + LV_LOG_ERROR("unkown property for bar.\n"); } return ret; diff --git a/lib/luavgl/src/widgets/btn.c b/lib/luavgl/src/widgets/btn.c index 848b0b45..c07afbdb 100644 --- a/lib/luavgl/src/widgets/btn.c +++ b/lib/luavgl/src/widgets/btn.c @@ -12,7 +12,7 @@ LUALIB_API int luavgl_btn_set_property_kv(lua_State *L, void *data) /* a base obj property? */ int ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for btn.\n"); + LV_LOG_ERROR("unkown property for btn.\n"); } return ret; @@ -46,7 +46,7 @@ static const luaL_Reg luavgl_btn_methods[] = { static void luavgl_btn_init(lua_State *L) { - luavgl_obj_newmetatable(L, &lv_btn_class, "lv_btn", luavgl_btn_methods); + luavgl_obj_newmetatable(L, &lv_button_class, "lv_btn", luavgl_btn_methods); lua_pushcfunction(L, luavgl_btn_tostring); lua_setfield(L, -2, "__tostring"); lua_pop(L, 1); diff --git a/lib/luavgl/src/widgets/calendar.c b/lib/luavgl/src/widgets/calendar.c index 2fb8fd9b..20e5175b 100644 --- a/lib/luavgl/src/widgets/calendar.c +++ b/lib/luavgl/src/widgets/calendar.c @@ -65,7 +65,7 @@ LUALIB_API int luavgl_calendar_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for calendar.\n"); + LV_LOG_ERROR("unkown property for calendar."); } return ret; diff --git a/lib/luavgl/src/widgets/checkbox.c b/lib/luavgl/src/widgets/checkbox.c index e7885c8e..a74238cd 100644 --- a/lib/luavgl/src/widgets/checkbox.c +++ b/lib/luavgl/src/widgets/checkbox.c @@ -32,7 +32,7 @@ LUALIB_API int luavgl_checkbox_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for checkbox.\n"); + LV_LOG_ERROR("unkown property for checkbox"); } return ret; diff --git a/lib/luavgl/src/widgets/dropdown.c b/lib/luavgl/src/widgets/dropdown.c index a211c10b..d2bcfc0b 100644 --- a/lib/luavgl/src/widgets/dropdown.c +++ b/lib/luavgl/src/widgets/dropdown.c @@ -36,7 +36,7 @@ LUALIB_API int luavgl_dropdown_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for dropdown.\n"); + LV_LOG_ERROR("unkown property for dropdown"); } return ret; @@ -72,7 +72,7 @@ static int luavgl_dropdown_get(lua_State *L) } const char *key = lua_tostring(L, 2); - if (strcmp(key, "list") == 0) { + if (lv_strcmp(key, "list") == 0) { lv_obj_t *list = lv_dropdown_get_list(obj); lua_pushlightuserdata(L, list); lua_rawget(L, LUA_REGISTRYINDEX); @@ -83,45 +83,47 @@ static int luavgl_dropdown_get(lua_State *L) return 1; } - if (strcmp(key, "text") == 0) { + if (lv_strcmp(key, "text") == 0) { lua_pushstring(L, lv_dropdown_get_text(obj)); return 1; } - if (strcmp(key, "options") == 0) { + if (lv_strcmp(key, "options") == 0) { lua_pushstring(L, lv_dropdown_get_options(obj)); return 1; } - if (strcmp(key, "selected") == 0) { + if (lv_strcmp(key, "selected") == 0) { lua_pushinteger(L, lv_dropdown_get_selected(obj)); return 1; } - if (strcmp(key, "option_cnt") == 0) { + if (lv_strcmp(key, "option_cnt") == 0) { lua_pushinteger(L, lv_dropdown_get_option_cnt(obj)); return 1; } - if (strcmp(key, "selected_str") == 0) { + if (lv_strcmp(key, "selected_str") == 0) { char buf[64]; lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); lua_pushstring(L, buf); return 1; } - if (strcmp(key, "option_index") == 0) { +#if LV_VERSION_CHECK(8, 3, 0) + if (lv_strcmp(key, "option_index") == 0) { const char *option = lua_tostring(L, 3); lua_pushinteger(L, lv_dropdown_get_option_index(obj, option)); return 1; } +#endif - if (strcmp(key, "symbol") == 0) { + if (lv_strcmp(key, "symbol") == 0) { lua_pushlightuserdata(L, (void *)lv_dropdown_get_symbol(obj)); return 1; } - if (strcmp(key, "dir") == 0) { + if (lv_strcmp(key, "dir") == 0) { lua_pushinteger(L, lv_dropdown_get_dir(obj)); return 1; } diff --git a/lib/luavgl/src/widgets/img.c b/lib/luavgl/src/widgets/img.c index 9332cd99..7f92ef65 100644 --- a/lib/luavgl/src/widgets/img.c +++ b/lib/luavgl/src/widgets/img.c @@ -3,14 +3,14 @@ static int luavgl_img_create(lua_State *L) { - return luavgl_obj_create_helper(L, lv_img_create); + return luavgl_obj_create_helper(L, lv_image_create); } -static void _lv_img_set_pivot(void *obj, lua_State *L) +static void lv_image_set_pivot_(void *obj, lua_State *L) { if (!lua_istable(L, -1)) { luaL_argerror(L, -1, "should be table."); - debug("para should be table."); + LV_LOG_ERROR("para should be table."); return; } @@ -22,18 +22,18 @@ static void _lv_img_set_pivot(void *obj, lua_State *L) lv_coord_t y = lua_tointeger(L, -1); lua_pop(L, 1); - lv_img_set_pivot(obj, x, y); + lv_image_set_pivot(obj, x, y); } static const luavgl_value_setter_t img_property_table[] = { {"src", - SETTER_TYPE_IMGSRC, {.setter_pointer = (setter_pointer_t)lv_img_set_src}}, - {"offset_x", 0, {.setter = (setter_int_t)lv_img_set_offset_x} }, - {"offset_y", 0, {.setter = (setter_int_t)lv_img_set_offset_y} }, + SETTER_TYPE_IMGSRC, {.setter_pointer = (setter_pointer_t)lv_image_set_src}}, + {"offset_x", 0, {.setter = (setter_int_t)lv_image_set_offset_x} }, + {"offset_y", 0, {.setter = (setter_int_t)lv_image_set_offset_y} }, {"angle", 0, {.setter = (setter_int_t)lv_img_set_angle} }, {"zoom", 0, {.setter = (setter_int_t)lv_img_set_zoom} }, - {"antialias", 0, {.setter = (setter_int_t)lv_img_set_antialias} }, - {"pivot", SETTER_TYPE_STACK, {.setter_stack = _lv_img_set_pivot} }, + {"antialias", 0, {.setter = (setter_int_t)lv_image_set_antialias} }, + {"pivot", SETTER_TYPE_STACK, {.setter_stack = lv_image_set_pivot_} }, }; LUALIB_API int luavgl_img_set_property_kv(lua_State *L, void *data) @@ -48,7 +48,7 @@ LUALIB_API int luavgl_img_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for image.\n"); + LV_LOG_ERROR("unkown property for image"); } return ret; @@ -69,11 +69,11 @@ static int luavgl_img_set(lua_State *L) const char *src = NULL; if (lua_isuserdata(L, -1)) { src = lua_touserdata(L, -1); - debug("set img src to user data: %p\n", src); + LV_LOG_INFO("set img src to user data: %p", src); } else { src = lua_tostring(L, -1); } - lv_img_set_src(obj, src); + lv_image_set_src(obj, src); } lua_pop(L, 1); @@ -90,7 +90,7 @@ static int luavgl_img_set_src(lua_State *L) lv_obj_t *obj = luavgl_to_obj(L, 1); const char *src = luavgl_toimgsrc(L, 2); if (src != NULL) { - lv_img_set_src(obj, src); + lv_image_set_src(obj, src); } return 0; @@ -114,14 +114,14 @@ static int luavgl_img_set_offset(lua_State *L) if (!lua_isnil(L, -1)) { v = lua_tointeger(L, -1); lua_pop(L, 1); - lv_img_set_offset_x(obj, v); + lv_image_set_offset_x(obj, v); } lua_getfield(L, -1, "y"); if (!lua_isnil(L, -1)) { v = lua_tointeger(L, -1); lua_pop(L, 1); - lv_img_set_offset_y(obj, v); + lv_image_set_offset_y(obj, v); } return 0; @@ -145,7 +145,7 @@ static int luavgl_img_set_pivot(lua_State *L) lua_getfield(L, -1, "y"); y = lua_tointeger(L, -1); - lv_img_set_pivot(obj, x, y); + lv_image_set_pivot(obj, x, y); return 0; } @@ -161,13 +161,13 @@ static int luavgl_get_img_size(lua_State *L) const void *src = NULL; if (lua_isnoneornil(L, 2)) { - src = lv_img_get_src(obj); + src = lv_image_get_src(obj); } else { src = luavgl_toimgsrc(L, 2); } - lv_img_header_t header; - if (src == NULL || lv_img_decoder_get_info(src, &header) != LV_RES_OK) { + lv_image_header_t header; + if (src == NULL || lv_image_decoder_get_info(src, &header) != LV_RES_OK) { lua_pushnil(L); lua_pushnil(L); } else { @@ -191,6 +191,6 @@ static const luaL_Reg luavgl_img_methods[] = { static void luavgl_img_init(lua_State *L) { - luavgl_obj_newmetatable(L, &lv_img_class, "lv_img", luavgl_img_methods); + luavgl_obj_newmetatable(L, &lv_image_class, "lv_img", luavgl_img_methods); lua_pop(L, 1); } diff --git a/lib/luavgl/src/widgets/keyboard.c b/lib/luavgl/src/widgets/keyboard.c index e7121de0..366f4693 100644 --- a/lib/luavgl/src/widgets/keyboard.c +++ b/lib/luavgl/src/widgets/keyboard.c @@ -36,7 +36,7 @@ LUALIB_API int luavgl_keyboard_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for keyboard.\n"); + LV_LOG_ERROR("unkown property for keyboard"); } return ret; @@ -67,7 +67,7 @@ static void luavgl_keyboard_init(lua_State *L) static const luaL_Reg btm_methods[] = { {NULL, NULL}, }; - luavgl_obj_newmetatable(L, &lv_btnmatrix_class, "lv_btnm", btm_methods); + luavgl_obj_newmetatable(L, &lv_buttonmatrix_class, "lv_btnm", btm_methods); lua_pop(L, 1); luavgl_obj_newmetatable(L, &lv_keyboard_class, "lv_keyboard", diff --git a/lib/luavgl/src/widgets/label.c b/lib/luavgl/src/widgets/label.c index 701c56f3..df4163f2 100644 --- a/lib/luavgl/src/widgets/label.c +++ b/lib/luavgl/src/widgets/label.c @@ -19,7 +19,6 @@ static void _lv_label_set_txt(void *obj, lua_State *L) static const luavgl_value_setter_t label_property_table[] = { {"text", SETTER_TYPE_STACK, {.setter_stack = _lv_label_set_txt} }, {"long_mode", 0, {.setter = (setter_int_t)lv_label_set_long_mode} }, - {"recolor", 0, {.setter = (setter_int_t)lv_label_set_recolor} }, #if LVGL_VERSION_MAJOR == 9 {"text_selection_start", 0, {.setter = (setter_int_t)lv_label_set_text_selection_start}}, @@ -47,7 +46,7 @@ LUALIB_API int luavgl_label_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for label.\n"); + LV_LOG_ERROR("unkown property for label"); } return ret; @@ -81,13 +80,6 @@ static int luavgl_label_get_long_mode(lua_State *L) return 1; } -static int luavgl_label_get_recolor(lua_State *L) -{ - lv_obj_t *obj = luavgl_to_obj(L, 1); - lua_pushinteger(L, lv_label_get_recolor(obj)); - return 1; -} - static int luavgl_label_ins_text(lua_State *L) { lv_obj_t *obj = luavgl_to_obj(L, 1); @@ -139,7 +131,6 @@ static const luaL_Reg luavgl_label_methods[] = { {"set_text_static", luavgl_label_set_text_static}, {"get_text", luavgl_label_get_text }, {"get_long_mode", luavgl_label_get_long_mode }, - {"get_recolor", luavgl_label_get_recolor }, {"ins_text", luavgl_label_ins_text }, {"cut_text", luavgl_label_cut_text }, diff --git a/lib/luavgl/src/widgets/led.c b/lib/luavgl/src/widgets/led.c index 38f22a05..3e9d19b8 100644 --- a/lib/luavgl/src/widgets/led.c +++ b/lib/luavgl/src/widgets/led.c @@ -25,7 +25,7 @@ LUALIB_API int luavgl_led_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for led.\n"); + LV_LOG_ERROR("unkown property for led"); } return ret; diff --git a/lib/luavgl/src/widgets/list.c b/lib/luavgl/src/widgets/list.c index 825a7bff..dc41b3dc 100644 --- a/lib/luavgl/src/widgets/list.c +++ b/lib/luavgl/src/widgets/list.c @@ -24,7 +24,7 @@ LUALIB_API int luavgl_list_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for list.\n"); + LV_LOG_ERROR("unkown property for list"); } return ret; diff --git a/lib/luavgl/src/widgets/roller.c b/lib/luavgl/src/widgets/roller.c index 574fc066..4d3ea548 100644 --- a/lib/luavgl/src/widgets/roller.c +++ b/lib/luavgl/src/widgets/roller.c @@ -69,7 +69,7 @@ LUALIB_API int luavgl_roller_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for roller.\n"); + LV_LOG_ERROR("unkown property for roller"); } return ret; diff --git a/lib/luavgl/src/widgets/slider.c b/lib/luavgl/src/widgets/slider.c index ad093fb5..f6e0e258 100644 --- a/lib/luavgl/src/widgets/slider.c +++ b/lib/luavgl/src/widgets/slider.c @@ -1,7 +1,7 @@ #include "lua.h" #include "luavgl.h" #include "private.h" -#include <src/widgets/lv_slider.h> +#include <src/widgets/slider/lv_slider.h> static int luavgl_slider_create(lua_State *L) { return luavgl_obj_create_helper(L, lv_slider_create); @@ -42,7 +42,7 @@ LUALIB_API int luavgl_slider_set_property_kv(lua_State *L, void *data) { /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for slider.\n"); + LV_LOG_ERROR("unkown property for slider.\n"); } return ret; diff --git a/lib/luavgl/src/widgets/switch.c b/lib/luavgl/src/widgets/switch.c index e66f620e..b7e38d07 100644 --- a/lib/luavgl/src/widgets/switch.c +++ b/lib/luavgl/src/widgets/switch.c @@ -1,6 +1,6 @@ #include "luavgl.h" #include "private.h" -#include <src/widgets/lv_switch.h> +#include <src/widgets/switch/lv_switch.h> static int luavgl_switch_create(lua_State *L) { return luavgl_obj_create_helper(L, lv_switch_create); @@ -11,7 +11,7 @@ LUALIB_API int luavgl_switch_set_property_kv(lua_State *L, void *data) { /* switches only use base properties */ int ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for switch.\n"); + LV_LOG_ERROR("unkown property for switch.\n"); } return ret; diff --git a/lib/luavgl/src/widgets/textarea.c b/lib/luavgl/src/widgets/textarea.c index 7c6170c1..e197c413 100644 --- a/lib/luavgl/src/widgets/textarea.c +++ b/lib/luavgl/src/widgets/textarea.c @@ -28,12 +28,14 @@ static void _lv_textarea_set_placeholder_txt(void *obj, lua_State *L) static void _lv_textarea_set_password_bullet(void *obj, lua_State *L) { +#if LV_VERSION_CHECK(8, 3, 0) if (!lua_isstring(L, -1)) { luaL_argerror(L, -1, "expect string"); return; } lv_textarea_set_password_bullet(obj, lua_tostring(L, -1)); +#endif } static void _lv_textarea_set_accepted_chars(void *obj, lua_State *L) @@ -72,7 +74,7 @@ LUALIB_API int luavgl_textarea_set_property_kv(lua_State *L, void *data) /* a base obj property? */ ret = luavgl_obj_set_property_kv(L, obj); if (ret != 0) { - debug("unkown property for textarea: %s\n", lua_tostring(L, -2)); + LV_LOG_ERROR("unkown property for textarea: %s", lua_tostring(L, -2)); } return -1; diff --git a/lib/luavgl/src/widgets/widgets.c b/lib/luavgl/src/widgets/widgets.c index 4a7a126e..c93fb8b7 100644 --- a/lib/luavgl/src/widgets/widgets.c +++ b/lib/luavgl/src/widgets/widgets.c @@ -5,7 +5,7 @@ #include "bar.c" #endif -#if LV_USE_BTN +#if LV_USE_BUTTON #include "btn.c" #endif @@ -21,7 +21,7 @@ #include "dropdown.c" #endif -#if LV_USE_IMG +#if LV_USE_IMAGE #include "img.c" #endif @@ -66,7 +66,7 @@ static const luaL_Reg widget_create_methods[] = { {"Bar", luavgl_bar_create}, #endif -#if LV_USE_BTN +#if LV_USE_BUTTON {"Button", luavgl_btn_create}, #endif @@ -82,7 +82,7 @@ static const luaL_Reg widget_create_methods[] = { {"Dropdown", luavgl_dropdown_create}, #endif -#if LV_USE_IMG +#if LV_USE_IMAGE {"Image", luavgl_img_create }, #endif @@ -122,7 +122,7 @@ static const luaL_Reg widget_create_methods[] = { static void luavgl_widgets_init(lua_State *L) { -#if LV_USE_IMG +#if LV_USE_IMAGE luavgl_img_init(L); #endif @@ -162,7 +162,7 @@ static void luavgl_widgets_init(lua_State *L) luavgl_dropdown_init(L); #endif -#if LV_USE_BTN +#if LV_USE_BUTTON luavgl_btn_init(L); #endif |
