diff --git a/.github/workflows/build_micropython.yml b/.github/workflows/build_micropython.yml index bbc33f7b5..2c187075c 100644 --- a/.github/workflows/build_micropython.yml +++ b/.github/workflows/build_micropython.yml @@ -18,7 +18,9 @@ jobs: sudo apt-get update -y -qq sudo apt-get install libsdl2-dev - name: Clone lv_micropython - run: git clone https://github.com/lvgl/lv_micropython.git . + run: | + git clone https://github.com/lvgl/lv_micropython.git . + git checkout dev-8.0 - name: Update submodules run: git submodule update --init --recursive - name: Checkout LVGL submodule diff --git a/.github/workflows/compile_docs.yml b/.github/workflows/compile_docs.yml new file mode 100644 index 000000000..1b3dcdb5a --- /dev/null +++ b/.github/workflows/compile_docs.yml @@ -0,0 +1,43 @@ +name: Build docs +on: + push: + branches: + - master +jobs: + build-and-deploy: + if: github.repository == 'lvgl/lvgl' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install Doxygen + run: sudo apt-get install doxygen + - name: Install requirements + run: | + pip install --upgrade --upgrade-strategy eager sphinx recommonmark commonmark breathe sphinx-rtd-theme sphinx-markdown-tables sphinx-sitemap + - name: Build docs + run: docs/build.py + - name: Remove .doctrees + run: rm -rf out_html/.doctrees + - name: Retrieve version + run: | + echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)" + id: version + - name: Deploy + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }} + REPOSITORY_NAME: lvgl/docs_compiled + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: out_html # The folder the action should deploy. + TARGET_FOLDER: ${{ steps.version.outputs.VERSION_NAME }} + PRESERVE: true + SINGLE_COMMIT: true diff --git a/.gitignore b/.gitignore index 07070a949..6ffdc9de5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -scripts/release/__pycache__ **/*.o **/*bin **/*.swp @@ -7,3 +6,7 @@ tags docs/api_doc scripts/cppcheck_res.txt scripts/built_in_font/lv_font_* +docs/doxygen_html +docs/xml +out_html +__pycache__ diff --git a/CHANGELOG.md b/CHANGELOG.md index c519906ed..d0c7a3de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## v7.11.0 (Planned for 19.02.2021) +## v7.11.0 ### New features - Add better screen orientation management with software rotation support diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index a606894f9..0e76517db 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -5,10 +5,10 @@ This is a summary for thenew fatures of the major releases and a collection of i This list indicates only the current intention and can be changed. ## v8 -Planned to November/December 2020 -- Create an `lv_components` repository for compley widgets +Planned to May 2021 +- Create an `extra` folder for complex widgets - It makes the core LVGL leaner - - In `lv_components` we can have a lot and specific widgets + - In `extra` we can have a lot and specific widgets - Good place for contribution - New scrolling: - See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue. @@ -27,7 +27,7 @@ Planned to November/December 2020 - Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier - Work in progress - Remove the align parameter from `lv_canvas_draw_text` -- Make the copy parameter obsolate in create functions +- Remove the copy parameter from create functions - Optimize and simplifie styles [#1832](https://github.com/lvgl/lvgl/issues/1832) - Use a more generic inheritenace [#1919](https://github.com/lvgl/lvgl/issues/1919) @@ -37,17 +37,21 @@ Planned to November/December 2020 - Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660) - chart: pre-delete `X` pint after the lastly set - chart: autoscroll to the right - +- `lv_snapshot`: buffer a widget and all of its children into an image. he source widget can be on a different screen too. The result image can be transformed. +- 9-patch support for `lv_imgbtn`. +- Handle stride. See [#1858](https://github.com/lvgl/lvgl/issues/1858) +- Rework animation to something like [GSAP](https://greensock.com/gsap/) + - Add scroll trigger inspired by [GSAP scrolltrigger](https://greensock.com/scrolltrigger/) + - Add FLIP inspired by [GSAP FLIP](https://greensock.com/docs/v3/Plugins/Flip/) + ## v9 - Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3). - Consider direct binary font format support - Optimize line and circle drawing and masking - Reconsider color format management for run time color format setting, and custom color format usage. (Also [RGB888](https://github.com/lvgl/lvgl/issues/1722)) -- 9-patch support for `lv_imgbtn`. -- Handle stride. See [#1858](https://github.com/lvgl/lvgl/issues/1858) +- Switch to RGBA colors in styles - Make gradients more versatile - Make image transformations more versatile -- Allow snapshoting object to tranfrom them to images ## Ideas - Use [generate-changelog](https://github.com/lob/generate-changelog) to automatically generate changelog @@ -55,7 +59,6 @@ Planned to November/December 2020 - Text node. See [#1701](https://github.com/lvgl/lvgl/issues/1701#issuecomment-699479408) - CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736) - Optimize font decompression -- Switch to RGBA colors in styles - Need coverage report for tests - Need static analyze (via coverity.io or somehing else) - Support dot_begin and dot_middle long modes for labels diff --git a/docs/_ext/lv_example.py b/docs/_ext/lv_example.py new file mode 100644 index 000000000..9e0cde96a --- /dev/null +++ b/docs/_ext/lv_example.py @@ -0,0 +1,45 @@ +from docutils.parsers.rst import Directive +from docutils import nodes +from docutils.parsers.rst.directives.images import Image +from sphinx.directives.code import LiteralInclude +import os + +class LvExample(Directive): + required_arguments = 3 + def run(self): + example_path = self.arguments[0] + example_name = os.path.split(example_path)[1] + node_list = [] + + env = self.state.document.settings.env + + if self.arguments[2] == 'py': + paragraph_node = nodes.raw(text=f"Click to try in the simulator!
{example_name}", format='html') + else: + paragraph_node = nodes.raw(text=f"", format='html') + toggle = nodes.container('', literal_block=False, classes=['toggle']) + header = nodes.container('', literal_block=False, classes=['header']) + toggle.append(header) + example_file = os.path.abspath("lv_examples/src/" + example_path + "." + self.arguments[2]) + + with open(example_file) as f: + contents = f.read() + literal_list = nodes.literal_block(contents, contents) + literal_list['language'] = self.arguments[2] + toggle.append(literal_list) + header.append(nodes.paragraph(text="code")) + if env.app.tags.has('html'): + node_list.append(paragraph_node) + node_list.append(toggle) + return node_list + +def setup(app): + app.add_directive("lv_example", LvExample) + app.add_config_value("example_commit_hash", "", "env") + app.add_config_value("built_example_commit_hash", "", "env") + + return { + 'version': '0.1', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css new file mode 100644 index 000000000..6a0240402 --- /dev/null +++ b/docs/_static/css/custom.css @@ -0,0 +1,58 @@ +table, th, td { + border: 1px solid #bbb; + padding: 10px; +} + +td { + text-align:center; +} + +.toggle .header { + display: block; + clear: both; + cursor: pointer; + font-weight: bold; +} + +.toggle .header:before { + font-family: FontAwesome, "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif; + content: "\f0da \00a0 Show "; + display: inline-block; + font-size: 1.1em; +} + +.toggle .header.open:before { + content: "\f0d7 \00a0 Hide "; +} + +.header p { + display: inline-block; + font-size: 1.1em; + margin-bottom: 8px; +} + +.wy-side-nav-search { + background-color: #f5f5f5; +} +.wy-side-nav-search>div.version { + color: #333; +} + + +.home-img { + width:32%; + transition: transform .3s ease-out; +} + +.home-img:hover { + transform: translate(0, -10px); +} + +.lv-example { + border: none; + outline: none; + padding: none; + display: block; + width: 320px; + height: 240px; +} diff --git a/docs/_static/css/fontawesome.min.css b/docs/_static/css/fontawesome.min.css new file mode 100644 index 000000000..deb5b4a59 --- /dev/null +++ b/docs/_static/css/fontawesome.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.9.0 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-balance-scale:before{content:"\f24e"}.fa-balance-scale-left:before{content:"\f515"}.fa-balance-scale-right:before{content:"\f516"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-biking:before{content:"\f84a"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fan:before{content:"\f863"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-wizard:before{content:"\f6e8"}.fa-haykal:before{content:"\f666"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-square-alt:before{content:"\f87b"}.fa-phone-volume:before{content:"\f2a0"}.fa-photo-video:before{content:"\f87c"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-remove-format:before{content:"\f87d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-down-alt:before{content:"\f884"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-amount-up-alt:before{content:"\f885"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto} \ No newline at end of file diff --git a/docs/_static/img/home_1.png b/docs/_static/img/home_1.png new file mode 100644 index 000000000..608acfe09 Binary files /dev/null and b/docs/_static/img/home_1.png differ diff --git a/docs/_static/img/home_2.png b/docs/_static/img/home_2.png new file mode 100644 index 000000000..d61ee512c Binary files /dev/null and b/docs/_static/img/home_2.png differ diff --git a/docs/_static/img/home_3.png b/docs/_static/img/home_3.png new file mode 100644 index 000000000..da0c2b888 Binary files /dev/null and b/docs/_static/img/home_3.png differ diff --git a/docs/_static/img/home_4.png b/docs/_static/img/home_4.png new file mode 100644 index 000000000..b059da7e2 Binary files /dev/null and b/docs/_static/img/home_4.png differ diff --git a/docs/_static/img/home_5.png b/docs/_static/img/home_5.png new file mode 100644 index 000000000..1d002ea19 Binary files /dev/null and b/docs/_static/img/home_5.png differ diff --git a/docs/_static/img/home_6.png b/docs/_static/img/home_6.png new file mode 100644 index 000000000..c95b466b1 Binary files /dev/null and b/docs/_static/img/home_6.png differ diff --git a/docs/_static/img/home_banner.jpg b/docs/_static/img/home_banner.jpg new file mode 100644 index 000000000..099cd901c Binary files /dev/null and b/docs/_static/img/home_banner.jpg differ diff --git a/docs/build.py b/docs/build.py new file mode 100755 index 000000000..3919be80c --- /dev/null +++ b/docs/build.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + +import sys +import os +import subprocess +import re + +langs = ['en'] + +# Change to script directory for consistency +abspath = os.path.abspath(__file__) +dname = os.path.dirname(abspath) +os.chdir(dname) + +def cmd(s): + print("") + print(s) + print("-------------------------------------") + r = os.system(s) + if r != 0: + print("Exit build due to previous error") + exit(-1) + +# Get the current branch name +status, br = subprocess.getstatusoutput("git branch | grep '*'") +br = re.sub('\* ', '', br) +urlpath = re.sub('release/', '', br) + +# Be sure the github links point to the right branch +f = open("header.rst", "w") +f.write(".. |github_link_base| replace:: https://github.com/lvgl/docs/blob/" + br) +f.close() + +base_html = "html_baseurl = 'https://docs.lvgl.io/" + urlpath + "/en/html/'" + +os.system("sed -i \"s|html_baseurl = .*|" + base_html +"|\" conf.py") + +clean = 0 +trans = 0 +args = sys.argv[1:] +if len(args) >= 1: + if "clean" in args: clean = 1 + +lang = "en" +print("") +print("****************") +print("Building") +print("****************") +if clean: + cmd("rm -rf " + lang) + cmd("mkdir " + lang) + + +print("Running doxygen") +cmd("cd ../scripts && doxygen Doxyfile") +# BUILD PDF + +# Silly workarond to include the more or less correct PDF download link in the PDF +#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true") +#cmd("sphinx-build -b latex . en/latex") + +# Generat PDF +#cmd("cd " + lang + "/latex && xelatex -interaction=batchmode *.tex") +# Copy the result PDF to the main diractory to make it avaiable for the HTML build +#cmd("cd " + lang + "/latex && cp -f LVGL.pdf ../../LVGL.pdf") + +# BULD HTML +cmd("sphinx-build -b html . ../out_html") + diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..e8bda51ee --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,257 @@ +#!/usr/bin/env python3.7 +# -*- coding: utf-8 -*- +# +# LVGL documentation build configuration file, created by +# sphinx-quickstart on Wed Jun 12 16:38:40 2019. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +import subprocess +sys.path.insert(0, os.path.abspath('./_ext')) + +import recommonmark +from recommonmark.transform import AutoStructify +from sphinx.builders.html import StandaloneHTMLBuilder +from subprocess import Popen, PIPE + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'recommonmark', + 'sphinx_markdown_tables', + 'breathe', + 'sphinx_sitemap', + #'lv_example' + ] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The default language to highlight source code in. The default is 'python'. +# The value should be a valid Pygments lexer name, see Showing code examples for more details. + + +highlight_language = 'c' + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +source_suffix = ['.rst', '.md'] + + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'LVGL' +copyright = '2020, LVGL LLC' +author = 'The community of LVGL' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +# embeddedt: extract using scripts/find_version.sh + +version = subprocess.run(["../scripts/find_version.sh"], capture_output=True).stdout.decode("utf-8").strip() + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'doxygen_html', 'Thumbs.db', '.DS_Store', + 'README.md', 'lv_examples', 'out_html' ] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + 'collapse_navigation' : False, + 'logo_only': True, +} +# For site map generation +html_baseurl = 'https://docs.lvgl.io/master/en/html/' +sitemap_url_scheme = "{link}" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + ] +} + +html_favicon = 'favicon.png' +html_logo = 'logo_lvgl.png' + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'LVGLdoc' + +html_last_updated_fmt = '' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', + + 'inputenc': '', + 'utf8extra': '', + 'classoptions': ',openany,oneside', + 'preamble': r''' +\usepackage{fontspec} +\setmonofont{DejaVu Sans Mono} +\usepackage{xeCJK} +\setCJKmainfont{SimSun} +\usepackage{silence} +\WarningsOff* +''', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'LVGL.tex', 'LVGL Documentation ' + version, + 'Contributors of LVGL', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'lvgl', 'LVGL Documentation ' + version, + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'LVGL', 'LVGL Documentation ' + version, + author, 'Contributors of LVGL', 'One line description of project.', + 'Miscellaneous'), +] + + +breathe_projects = { + "lvgl":"xml/", +} + +StandaloneHTMLBuilder.supported_image_types = [ + 'image/svg+xml', + 'image/gif', #prefer gif over png + 'image/png', + 'image/jpeg' +] + +smartquotes = False + +# Example configuration for intersphinx: refer to the Python standard library. + +def setup(app): + app.add_config_value('recommonmark_config', { + 'enable_eval_rst': True, + 'enable_auto_toc_tree': 'True', + }, True) + app.add_transform(AutoStructify) + app.add_stylesheet('css/custom.css') + app.add_stylesheet('css/fontawesome.min.css') + +# Attempt to checkout _static/built_lv_examples + + +""" +if not os.path.exists('_static/built_lv_examples'): + os.system('git clone https://github.com/lvgl/lv_examples.git _static/built_lv_examples') + +os.system('git -C _static/built_lv_examples fetch origin') + +out = subprocess.Popen(["git", "-C", "lv_examples", "rev-parse", "HEAD"], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) +stdout,stderr = out.communicate() +example_commit_hash = stdout.decode("utf-8").strip() + +search_command = ["git", "-C", "_static/built_lv_examples", "--no-pager", "log", "--pretty=format:'%H'", "--all", "-n", "1", f"--grep='Deploying to gh-pages from @ {example_commit_hash}'"] +log_output = subprocess.check_output(' '.join(search_command), shell=True).strip().decode("utf-8") +if len(log_output) == 0: + raise ValueError('lv_examples: cannot find corresponding deployed commit: ' + example_commit_hash) + +built_example_commit_hash = log_output +os.system('git -C _static/built_lv_examples reset --hard') +os.system('git -C _static/built_lv_examples checkout ' + log_output) + """ diff --git a/docs/favicon.png b/docs/favicon.png new file mode 100644 index 000000000..9f65ea560 Binary files /dev/null and b/docs/favicon.png differ diff --git a/docs/get-started/quick-overview.md b/docs/get-started/quick-overview.md index 4425ca97d..032656043 100644 --- a/docs/get-started/quick-overview.md +++ b/docs/get-started/quick-overview.md @@ -117,7 +117,7 @@ lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to t void btn_event_cb(lv_obj_t * btn, lv_event_t event) { - if(event == LV_EVENT_CLICKED) { + if(code == LV_EVENT_CLICKED) { printf("Clicked\n"); } } @@ -172,36 +172,9 @@ You can select the theme to use in `lv_conf.h`. ## Examples -### Button with label - ```eval_rst -.. image:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_1.* - :alt: Simple button with label with LVGL -.. literalinclude:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_1.c - :language: c -``` - - -### Styling buttons - -```eval_rst -.. image:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.* - :alt: Styling buttons with LVGL - -.. literalinclude:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.c - :language: c -``` - - -### Slider and alignment - -```eval_rst -.. image:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_3.* - :alt: Create a slider with LVGL - -.. literalinclude:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_3.c - :language: c +.. include:: ../../examples/get_started/index.rst ``` ## Micropython diff --git a/docs/header.rst b/docs/header.rst new file mode 100644 index 000000000..fc4dc7d15 --- /dev/null +++ b/docs/header.rst @@ -0,0 +1 @@ +.. |github_link_base| replace:: https://github.com/lvgl/docs/blob/master \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..820530dd8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,33 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/index.md +``` + +# Welcome to the documentation of LVGL! + + + + +
+ Get familiar with the LVGL project + Learn the basic of LVGL and its usage on various platforms + See how to port LVGL to any platform + Learn the how LVGL works in more detail + Take a look at the description of the available widgets + Be part of the development of LVGL +
+ + +```eval_rst +.. toctree:: + :maxdepth: 2 + + intro/index + get-started/index + porting/index + overview/index + widgets/index + layouts/index + contributing/index + +``` diff --git a/docs/layouts/flex.md b/docs/layouts/flex.md new file mode 100644 index 000000000..5e4915b3b --- /dev/null +++ b/docs/layouts/flex.md @@ -0,0 +1,6 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/layouts/flex.md +``` + +# Flex diff --git a/docs/layouts/grid.md b/docs/layouts/grid.md new file mode 100644 index 000000000..8a61a4ca5 --- /dev/null +++ b/docs/layouts/grid.md @@ -0,0 +1,6 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/layouts/grid.md +``` + +# Grid diff --git a/docs/layouts/index.md b/docs/layouts/index.md new file mode 100644 index 000000000..32b0a2e78 --- /dev/null +++ b/docs/layouts/index.md @@ -0,0 +1,15 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/layouts/index.md +``` + +# Layouts + + +```eval_rst +.. toctree:: + :maxdepth: 2 + + flex + grid +``` diff --git a/docs/logo_lvgl.png b/docs/logo_lvgl.png new file mode 100644 index 000000000..26e5a48a0 Binary files /dev/null and b/docs/logo_lvgl.png differ diff --git a/docs/misc/boxmodel.png b/docs/misc/boxmodel.png new file mode 100644 index 000000000..0bb244216 Binary files /dev/null and b/docs/misc/boxmodel.png differ diff --git a/docs/misc/list_theme_example.gif b/docs/misc/list_theme_example.gif deleted file mode 100644 index c07479c15..000000000 Binary files a/docs/misc/list_theme_example.gif and /dev/null differ diff --git a/docs/misc/list_theme_example.png b/docs/misc/list_theme_example.png deleted file mode 100644 index 17fa4e43e..000000000 Binary files a/docs/misc/list_theme_example.png and /dev/null differ diff --git a/docs/misc/lv_theme_intro.png b/docs/misc/lv_theme_intro.png deleted file mode 100644 index 088cd6cb6..000000000 Binary files a/docs/misc/lv_theme_intro.png and /dev/null differ diff --git a/docs/misc/slider_example.gif b/docs/misc/slider_example.gif deleted file mode 100644 index 6dd6c3667..000000000 Binary files a/docs/misc/slider_example.gif and /dev/null differ diff --git a/docs/misc/slider_example.png b/docs/misc/slider_example.png deleted file mode 100644 index dc636ba81..000000000 Binary files a/docs/misc/slider_example.png and /dev/null differ diff --git a/docs/misc/style-built-in.png b/docs/misc/style-built-in.png deleted file mode 100644 index d07aa9380..000000000 Binary files a/docs/misc/style-built-in.png and /dev/null differ diff --git a/docs/misc/style-example.png b/docs/misc/style-example.png deleted file mode 100644 index 1a24a0553..000000000 Binary files a/docs/misc/style-example.png and /dev/null differ diff --git a/docs/misc/theme-example.png b/docs/misc/theme-example.png deleted file mode 100644 index b8b2cfa8a..000000000 Binary files a/docs/misc/theme-example.png and /dev/null differ diff --git a/docs/overview/coords.md b/docs/overview/coords.md new file mode 100644 index 000000000..ca4cfea92 --- /dev/null +++ b/docs/overview/coords.md @@ -0,0 +1,379 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/overview/coords.md +``` +# Positions, sizes, and layouts + +## Overview +Similarly to many other parts of LVGL, the concept of setting the coordinates were inspired by CSS. It doesn't mean a perfect copy of the standard but parts that are reasonable were adopted in LVGL. +It shorts it means: +- the set coordinates (size, position, layouts, etc) are stored in styles +- support min-width, max-width, min-height, max-height +- have pixel, percentage, and "content" units +- a subset of flexbox and grid layouts are supported by default + +### Units +- pixel: Simply a position in pixels. A simple integer always mean pixel. E.g. `lv_obj_set_x(btn, 10)` +- percentage: The percentage of the size of the object or its parent (depending on the property). The `lv_pct(value)` converts a value to percentage. E.g. `lv_obj_set_width(btn, lv_pct(50))` +- `LV_SIZE_CONTENT`: Special value to set the width/height of an object to involve all the children. Its similar to `auto` in CSS. E.g. `lv_obj_set_width(btn, LV_SIZE_CONTENT)`. + +### Boxing model +An object's "box" is built from the following parts: +- bounding box: the width/height of the elements. +- padding: space between the sides of the object and its children. +- content: the content area which size if the bounding box reduced by the size of the paddings. + +![The box models of LVGL: The content area is smaller then the bounding box with the padding](/misc/boxmodel.png) + +The border is drawn inside the bounding box and doesn't take an extra space. (It's different from CSS in which increasing the border width makes the object larger.) + +The outline is drawn outside of the bounding box. + +### Important notes +This section describes special cases in which LVGL's behavior might look unexpected. + +#### Postponed coordinate calculation +LVGL doesn't recalculate all the coordinate changes immediately to improve performance. +Instead, the object's are marked as "dirty" and before redrawing the screen LVGL checks if there are any "dirty" objects. If so it refreshes their position, size and layout. + +The following functions set size/position immediately: +- `lv_obj_set_pos/x/y` +- `lv_obj_set_size/width/height` +- `lv_obj_set_content_width/height` +- `lv_obj_align` +- `lv_obj_set_align` +- `lv_obj_align_to` + +So if you don't use any complex feature (e.g. layouts) you don't have to worry about postponed layout recalculation. + +However, if the coordinates are set by a style or layout the recalculation will be delayed. + +In some special cases even if the coordinates are set the by the above listed functions they can be incorrect. +For example if the width of an object is set in the percentage of parent width (e.g. `lv_pct(80)`) and the parent's size is set by a layout the child size might use non-updated size from the parent. +It will be recalculated automatically before the next screen redraw but if you need the final coordinates immediately after changing the coordinates and see incorrect values you need to use +```c +lv_obj_unpdate_layout(obj); +``` + +As the it can be seen form the above example the sizes and positions might depends on each other, therefore `lv_obj_unpdate_layout(obj)` recalculates the coordinates of all objects on the screen of `obj`. + +#### Removing styles +As it's described in the [Using styles](#using-styles) section the coordinates can be set via style properties too. +To be more precise under the hood every style coordinate related property is stored as style a property. If you use `lv_obj_set_x(obj, 20)` LVGL saves `x=20` in the local style of the object. + +It's an internal mechanism and doesn't matter much as you use LVGL. However, there is one case in which you need to aware of that. If the style(s) of an object are removed by +```c +lv_obj_remove_style_all(obj) +˙`` +or +```c +lv_obj_remove_style(obj, NULL, LV_PART_MAIN); +``` +The earlier set coordinates will be removed as well. + +For example: +```c +/*The size of obj1 will be set back to the default in the end*/ +lv_obj_set_size(obj1, 200, 100); /*Now obj1 has 200;100 size*/ +lv_obj_remove_style_all(obj1); /*It removes the set sizes*/ + + +/*obj2 will have 200;100 size in the end */ +lv_obj_remove_style_all(obj2); +lv_obj_set_size(obj2, 200, 100); +``` + +## Position + +### Simple way +To simple set the x and y coordinates of an object use +```c +lv_obj_set_x(obj, 10); +lv_obj_set_y(obj, 20); +lv_obj_set_pos(obj, 10, 20); //Or in one function +``` + +By default the the x and y coordinates are measured from the top left corner of the parent's content area. +For example if the parent has 5 pixel padding on every side, the above code will place `obj` to (15, 25) because the content area starts after the padding. + +If percentage values are calculated from the parents content area size. +```c +lv_obj_set_x(btn, lv_pct(10)); //x = 10 % of parant content area width +``` + +### Align +In some cases it's convenient to change the origin of the positioning from the the default top left. If the the orogin is changed e.g. to bottom-right, the (0,0) position means: align to the bottom-right corner. +To change the origin use: +```c +lv_obj_set_align(obj, align); +``` + +To change the alignment and set new coordinates: +```c +lv_obj_align(obj, align, x, y); +``` + +The following alignment options can be used: +- `LV_ALIGN_TOP_LEFT` +- `LV_ALIGN_TOP_MID` +- `LV_ALIGN_TOP_RIGHT` +- `LV_ALIGN_BOTTOM_LEFT` +- `LV_ALIGN_BOTTOM_MID` +- `LV_ALIGN_BOTTOM_RIGHT` +- `LV_ALIGN_LEFT_MID` +- `LV_ALIGN_RIGHT_MID` +- `LV_ALIGN_CENTER` + +It quite common to align a children to the center of its parent, there fore is a dedicated function for it: +```c +lv_obj_center(obj); + +//Has the same effect +lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); +``` + +If the parent's size changes the set alignment and position of the children is applied again automatically. + +The functions introduced above aligns the object to its parent. However it's also possible to align an object to an arbitrary object. +```c +lv_obj_align_to(obj_to_align, reference_obj, align, x, y); +``` + +Besides the alignments options above the following can be used to align the object outside of the reference object: + +- `LV_ALIGN_OUT_TOP_LEFT` +- `LV_ALIGN_OUT_TOP_MID` +- `LV_ALIGN_OUT_TOP_RIGHT` +- `LV_ALIGN_OUT_BOTTOM_LEFT` +- `LV_ALIGN_OUT_BOTTOM_MID` +- `LV_ALIGN_OUT_BOTTOM_RIGHT` +- `LV_ALIGN_OUT_LEFT_TOP` +- `LV_ALIGN_OUT_LEFT_MID` +- `LV_ALIGN_OUT_LEFT_BOTTOM` +- `LV_ALIGN_OUT_RIGHT_TOP` +- `LV_ALIGN_OUT_RIGHT_MID` +- `LV_ALIGN_OUT_RIGHT_BOTTOM` + +For example to align a label above a button and center the label is horizontally: +```c +lv_obj_align_to(label, btn, LV_ALIGN_OUT_TOP_MID, 0, -10); +``` + +Not that - unlike with `lv_obj_align()` - `lv_obj_align_to()` can not realign the object if its coordinates or the reference object's coordinates changes. + +## Size + +### Simple way +The width and the height of an object can be set easily as well: +```c +lv_obj_set_width(obj, 200); +lv_obj_set_height(obj, 100); +lv_obj_set_size(obj, 200, 100); //Or in one function +``` + +Percentage values aer calculated based on the parent's content area size. For example to set the object's height to the screen height: +```c +lv_obj_set_height(obj, lv_pct(100)); +``` + +Size setting supports a value: `LV_SIZE_CONTENT`. It means the object's size in the respective direction will be set to involve its the children. +Note that only children on the right and bottom will be considered and children o nthe top and left remains cropped. This limitation makes the behavior more predictable. + +Object with `LV_OBJ_FLAG_HIDDEN` or `LV_OBJ_FLAG_FLOATING` will be ignored by `LV_SIZE_CONTENT` calculation. + +The above functions set the size of the bounding box of the object but the size of the content area can be set as well. It means the object's bounding box will be larger with the paddings than the set size. +```c +lv_obj_set_content_width(obj, 50); //The actual width: padding left + 50 + padding right +lv_obj_set_content_height(obj, 30); //The actual width: padding top + 30 + padding bottom +``` + +The size of the bounding box and the content area can be get with the following functions: +```c +lv_coord_t w = lv_obj_get_width(obj); +lv_coord_t h = lv_obj_get_height(obj); +lv_coord_t content_w = lv_obj_get_content_width(obj); +lv_coord_t content_h = lv_obj_get_content_height(obj); +``` + +## Using styles +Under the hood the position, size and alignment properties are style properties. +The above described "simple functions" hide the style related code for the sake of simplicity and set the position, size, and alignment properties in the local styles of the obejct. + +However, using styles as to set the coordinates has some great advantages: +- It makes easy to set the width/height/etc for several object together with ease. E.g. all make all the sliders 100x10 pixels sized. +- It also makes possible to modify the values in one place. +- The values can be overwritten by other styles. For example `style_btn` makes the object `100x50` by default but adding `style_full_width` overwrites only the width of the object. +- The object can have different position or size in different state. E.g. 100 px wide in `LV_STATE_DEFAULT` but 120 px in `LV_STATE_PRESSED`. +- Style transitions can be used to make the coordinate changes smooth. + + +Here are some examples to set an object's size using a style: +```c +static lv_style_t style; +lv_style_init(&style); +lv_style_set_width(&style, 100); + +lv_obj_t * btn = lv_btn_create(lv_scr_act()); +lv_obj_add_style(btn, &style, LV_PART_MAIN); +``` + +As you will see below there are some other great features of size and position setting. +However, to keep the LVGL's API lean only the most common coordinate setting features have a "simple" version and the more complex features can be used via styles. + +## Translation + +Let's say the there are 3 buttons next to each other. Their position is set as described above. +Now you want to move a buttons up a little when it's pressed. + +One way to achieve this is setting a new Y coordinate for pressed state: +```c +static lv_style_t style_normal; +lv_style_init(&style_normal); +lv_style_set_y(&style_normal, 100); + +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_y(&style_pressed, 80); + +lv_obj_add_style(btn1, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn1, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn2, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn2, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn3, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); +``` + +It works but it's not really flexible because the pressed coordinate is hard-coded. If the buttons are not at y=100 `style_pressed` won't work as expected. To solve this translations can be used: +```c +static lv_style_t style_normal; +lv_style_init(&style_normal); +lv_style_set_y(&style_normal, 100); + +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_translate_y(&style_pressed, -20); + +lv_obj_add_style(btn1, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn1, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn2, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn2, &style_pressed, LV_STATE_PRESSED); + +lv_obj_add_style(btn3, &style_normal, LV_STATE_DEFAULT); +lv_obj_add_style(btn3, &style_pressed, LV_STATE_PRESSED); +``` + +Translation is applied from the current position of the object. + +Percentage values can be used in translations as well. The percentage is relative to the size of the object (and not to the size of the parent). For example `lv_pct(50)` will move the object with half of its width/height. + +The translations is applied after the layouts are calculated. Therefore, even the layouted objects' position can be translated. + +The translation actually moves the object. It means it makes the scrollbars and `LV_SIZE_CONTENT` sized objects react on the position change. + + +## Transformation +Similarly to the position the size can be changed relative to the current size as well. +The transformed width and height is added on both sides of the object. That is 10 px transformed width makes the object 2x10 pixel wider. + +Unlike position translation, the size transformation doesn't make the object "really" larger. In other words scrollbars, layouts, `LV_SIZE_CONTENT` will not consider the transformed size. +Hence size transformation if "only" a visual effect. + +This code makes the a button larger when it's pressed: +```c +static lv_style_t style_pressed; +lv_style_init(&style_pressed); +lv_style_set_transform_width(&style_pressed, 10); +lv_style_set_transform_height(&style_pressed, 10); + +lv_obj_add_style(btn, &style_pressed, LV_STATE_PRESSED); +``` + +### Min and Max size +Similarly to CSS, LVGL also support `min-width`, `max-width`, `min-height` and `max-height`. These are limits preventing an object's size to be smaller/larger then these values. +They are especially useful if the size is set by percentage or `LV_SIZE_CONTENT`. +```c +static lv_style_t style_max_height; +lv_style_init(&style_max_height); +lv_style_set_y(&style_max_height, 200); + +lv_obj_set_height(obj, lv_pct(100)); +lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit the height to 200 px +``` + +Percentage values can be used as well which are relative to the size of the parent's content area size. +```c +static lv_style_t style_max_height; +lv_style_init(&style_max_height); +lv_style_set_y(&style_max_height, lv_pct(50)); + +lv_obj_set_height(obj, lv_pct(100)); +lv_obj_add_style(obj, &style_max_height, LV_STATE_DEFAULT); //Limit the height to half parent height +``` + +## Layout + +### Overview +Layouts can update the position and size of an object's children. They can be used to automatically arrange the children into a line or column, or in much more complicated forms. + +The position and size set by the layout overwrites the "normal" x, y, width, and height settings. + +There is only one function that is the same for every layout: `lv_obj_set_layout(obj, )` sets the layout on an object. +For the further settings of the parent and children see the documentations of the given layout. + +### Built-in layout +LVGL comes with two very powerful layouts: +- Flexbox +- Grid + +Both are heavily inspired by the CSS layouts with the same name. + +### Flags +There are some flags that can be used on object to affect how they behave with layouts: +- `LV_OBJ_FLAG_HIDDEN` Hidden object are ignored from layout calculations. +- `LV_OBJ_FLAG_IGNORE_LAYOUT` The object is simply ignored by the layouts. Its coordinates can be set as usual. +- `LV_OBJ_FLAG_FLOATING` Same as `LV_OBJ_FLAG_IGNORE_LAYOUT` but the object with `LV_OBJ_FLAG_FLOATING` will be ignored from `LV_SIZE_CONTENT` calculations. + +These flags can be added/removed with `lv_obj_add/clear_flag(obj, FLAG);` + +### Adding new layouts + +LVGL can be freely extended by a custom layouts like this: +```c +uint32_t MY_LAYOUT; + +... + +MY_LAYOUT = lv_layout_register(my_layout_update, &user_data); + +... + +void my_layout_update(lv_obj_t * obj, void * user_data) +{ + /*Will be called automatically if required to reposition/resize the children of "obj" */ +} +``` + +Custom style properties can be added too that can be get and used in the update callback. For example: +```c +uint32_t MY_PROP; +... + +LV_STYLE_MY_PROP = lv_style_register_prop(); + +... +static inline void lv_style_set_my_prop(lv_style_t * style, uint32_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_MY_PROP, v); +} + +``` + +## Examples + + diff --git a/docs/overview/event.md b/docs/overview/event.md index 8b560dce8..5b942e983 100644 --- a/docs/overview/event.md +++ b/docs/overview/event.md @@ -12,58 +12,34 @@ Events are triggered in LVGL when something happens which might be interesting t ## Add events to the object -The user can assign callback functions to an object to see these events. In practice, it looks like this: +The user can assign callback functions to an object to see its events. In practice, it looks like this: ```c lv_obj_t * btn = lv_btn_create(lv_scr_act()); -lv_obj_add_event_cb(btn, my_event_cb, NULL); /*Assign an event callback*/ +lv_obj_add_event_cb(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/ ... -static void my_event_cb(lv_obj_t * obj, lv_event_t event) +static void my_event_cb(lv_event_t * event) { - switch(event) { - case LV_EVENT_PRESSED: - printf("Pressed\n"); - break; - - case LV_EVENT_SHORT_CLICKED: - printf("Short clicked\n"); - break; - - case LV_EVENT_CLICKED: - printf("Clicked\n"); - break; - - case LV_EVENT_LONG_PRESSED: - printf("Long press\n"); - break; - - case LV_EVENT_LONG_PRESSED_REPEAT: - printf("Long press repeat\n"); - break; - - case LV_EVENT_RELEASED: - printf("Released\n"); - break; - } - - /*Etc.*/ + printf("Clicked\n"); } ``` +In the example `LV_EVENT_CLICKED` means that only the click event will call `my_event_cb`. See the [list of event codes](#event-codes) for all the options. +`LV_EVENT_ALL` can be used to receive all the events. The last parameter of `lv_obj_add_event_cb` is a pointer to any custom data that will be available in the event. It will be described later in more detail. More events can be added to an object, like this: ```c -lv_obj_add_event_cb(obj, my_event_cb_1, NULL); -lv_obj_add_event_cb(obj, my_event_cb_2, NULL); -lv_obj_add_event_cb(obj, my_event_cb_3, NULL); +lv_obj_add_event_cb(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL); +lv_obj_add_event_cb(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL); +lv_obj_add_event_cb(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/ ``` Even the same event callback can be used on an object with different `user_data`. For example: ```c -lv_obj_add_event_cb(obj, increment_on_click, &num1); -lv_obj_add_event_cb(obj, increment_on_click, &num2); +lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num1); +lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num2); ``` The events will be called in the order as they were added. @@ -74,7 +50,7 @@ More objects can use the same *event callback*. ## Remove event(s) from an object -Events can be removed fro man object with the `lv_obj_remove_event_cb(obj, event_cb, user_data)` function. If `user_data = NULL` the first matching `event_cb` will be removed regardless its `user_data`. +Events can be removed from an object with the `lv_obj_remove_event_cb(obj, event_cb)` function or `lv_obj_remove_event_dsc(obj, event_dsc)`. `event_dsc` is a pointer returned by `lv_obj_add_event_cb`. ## Event codes @@ -87,11 +63,11 @@ The event codes can be grouped into these categories: All objects (such as Buttons/Labels/Sliders etc.) regardless their type receive the *Input device*, *Drawing* and *Other* events. -However the *Special events* are specific to a particular object type. See the [widgets' documentation](/widgets/index) to learn when they are sent, +However the *Special events* are specific to a particular widget type. See the [widgets' documentation](/widgets/index) to learn when they are sent, -*Custom events* are added by the user and therefore these are never sent by LVGL +*Custom events* are added by the user and therefore these are never sent by LVGL. -The following event types exist: +The following event codes exist: ### Input device events - `LV_EVENT_PRESSED` The object has been pressed @@ -122,8 +98,8 @@ The following event types exist: - `LV_EVENT_DRAW_POST_BEGIN` Starting the post draw phase (when all children are drawn) - `LV_EVENT_DRAW_POST` Perform the post draw phase (when all children are drawn) - `LV_EVENT_DRAW_POST_END` Finishing the post draw phase (when all children are drawn) -- `LV_EVENT_DRAW_PART_BEGIN` Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. -- `LV_EVENT_DRAW_PART_END` Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. +- `LV_EVENT_DRAW_PART_BEGIN` Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. Learn more [here](/overview/drawing). +- `LV_EVENT_DRAW_PART_END` Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. Learn more [here](/overview/drawing). ### Other events - `LV_EVENT_DELETE` Object is being deleted @@ -142,18 +118,13 @@ The following event types exist: ### Custom events -Any custom event can be added from `_LV_EVENT_LAST`. For example: -```c -#define MY_EVENT_1 (_LV_EVENT_LAST + 0) -#define MY_EVENT_2 (_LV_EVENT_LAST + 1) -#define MY_EVENT_3 (_LV_EVENT_LAST + 2) -``` +Any custom event codes can be registered by `uint32_t MY_EVENT_1 = lv_event_register_id();` And can be sent to any object with `lv_event_send(obj, MY_EVENT_1, &some_data)` ## Sending events -To manually send events to an object, use `lv_event_send(obj, LV_EVENT_..., &some_data)`. +To manually send events to an object, use `lv_event_send(obj, &some_data)`. For example, it can be used to manually close a message box by simulating a button press (although there are simpler ways of doing this): ```c @@ -170,19 +141,19 @@ lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id); - enable a button if some conditions are met (e.g. the correct PIN is entered) - add/remove styles to/from an object if a limit is exceeded, etc +## Fields of lv_event_t -## User data and event parameter -There are 2 custom pointer that are available in the events: -- `user_data`: set when the event is registered. -- `event_param`: set when the event is sent in `lv_event_send` - -In any event callback these pointer can be get with `lv_event_get_user_data()` and `lv_event_get_param()`. +`lv_event_t` is the only parameter passed to event callback and it contains all the data about the event. The following values can be get from it: +- `lv_event_get_code(e)` get the event code +- `lv_event_get_target(e)` get the object to which the event is sent +- `lv_event_get_original_target(e)` get the object to which the event is sent originally sent (different from `lv_event_get_target` if [event bubbling](event-bubbling) is enabled) +- `lv_event_get_user_data(e)` get the pointer passed as the last parameter of `lv_obj_add_event_cb`. +- `lv_event_get_param(e)` get the parameter passed as the last parameter of `lv_event_send` ## Event bubbling If `lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE)` is enabled all events will be sent to the object's parent too. If the parent also has `LV_OBJ_FLAG_EVENT_BUBBLE` enabled the event will be sent to its parent too, and so on. -The `lv_obj_t * obj` argument of the event handler is always the current target object, not the original object. To get the original target call `lv_event_get_original_target()` in the event handler. - +The *target* parameter of the event is always the current target object, not the original object. To get the original target call `lv_event_get_original_target(e)` in the event handler. diff --git a/docs/overview/image.md b/docs/overview/image.md index b4cb23ad8..52d2eec75 100644 --- a/docs/overview/image.md +++ b/docs/overview/image.md @@ -319,24 +319,6 @@ To do this, use `lv_img_cache_invalidate_src(&my_png)`. If `NULL` is passed as a ## API -### Image decoder - -```eval_rst - -.. doxygenfile:: lv_img_decoder.h - :project: lvgl - -``` - - -### Image cache - -```eval_rst - -.. doxygenfile:: lv_img_cache.h - :project: lvgl - -``` ### Image buffer @@ -346,12 +328,3 @@ To do this, use `lv_img_cache_invalidate_src(&my_png)`. If `NULL` is passed as a :project: lvgl ``` - -### Image draw - -```eval_rst - -.. doxygenfile:: lv_draw_img.h - :project: lvgl - -``` diff --git a/docs/overview/indev.md b/docs/overview/indev.md index 6ca3ca645..cb6b99ce1 100644 --- a/docs/overview/indev.md +++ b/docs/overview/indev.md @@ -40,8 +40,8 @@ You can fully control the user interface without touchpad or mouse using a keypa The objects, you want to control with keypad or encoder, needs to be added to a *Group*. In every group, there is exactly one focused object which receives the pressed keys or the encoder actions. -For example, if a [Text area](/widgets/textarea) is focused and you press some letter on a keyboard, the keys will be sent and inserted into the text area. -Similarly, if a [Slider](/widgets/slider) is focused and you press the left or right arrows, the slider's value will be changed. +For example, if a [Text area](/widgets/core/textarea) is focused and you press some letter on a keyboard, the keys will be sent and inserted into the text area. +Similarly, if a [Slider](/widgets/core/slider) is focused and you press the left or right arrows, the slider's value will be changed. You need to associate an input device with a group. An input device can send the keys to only one group but, a group can receive data from more than one input device too. @@ -58,11 +58,11 @@ There are some predefined keys which have special meaning: - **LV_KEY_DOWN** Decrease value or move downwards - **LV_KEY_RIGHT** Increase value or move the the right - **LV_KEY_LEFT** Decrease value or move the the left -- **LV_KEY_ESC** Close or exit (E.g. close a [Drop down list](/widgets/dropdown)) -- **LV_KEY_DEL** Delete (E.g. a character on the right in a [Text area](/widgets/textarea)) -- **LV_KEY_BACKSPACE** Delete a character on the left (E.g. in a [Text area](/widgets/textarea)) -- **LV_KEY_HOME** Go to the beginning/top (E.g. in a [Text area](/widgets/textarea)) -- **LV_KEY_END** Go to the end (E.g. in a [Text area](/widgets/textarea))) +- **LV_KEY_ESC** Close or exit (E.g. close a [Drop down list](/widgets/core/dropdown)) +- **LV_KEY_DEL** Delete (E.g. a character on the right in a [Text area](/widgets/core/textarea)) +- **LV_KEY_BACKSPACE** Delete a character on the left (E.g. in a [Text area](/widgets/core/textarea)) +- **LV_KEY_HOME** Go to the beginning/top (E.g. in a [Text area](/widgets/core/textarea)) +- **LV_KEY_END** Go to the end (E.g. in a [Text area](/widgets/core/textarea))) The most important special keys are `LV_KEY_NEXT/PREV`, `LV_KEY_ENTER` and `LV_KEY_UP/DOWN/LEFT/RIGHT`. In your `read_cb` function, you should translate some of your keys to these special keys to navigate in the group and interact with the selected object. @@ -80,7 +80,7 @@ Pressing `LV_KEY_ENTER` will change to *Edit* mode. In *Edit* mode, `LV_KEY_NEXT/PREV` is usually used to edit the object. Depending on the object's type, a short or long press of `LV_KEY_ENTER` changes back to *Navigate* mode. -Usually, an object which can not be pressed (like a [Slider](/widgets/slider)) leaves *Edit* mode on short click. But with objects where short click has meaning (e.g. [Button](/widgets/btn)), a long press is required. +Usually, an object which can not be pressed (like a [Slider](/widgets/core/slider)) leaves *Edit* mode on short click. But with objects where short click has meaning (e.g. [Button](/widgets/core/btn)), a long press is required. ### Styling diff --git a/docs/overview/index.md b/docs/overview/index.md index a8f0c66f0..313b6a94b 100644 --- a/docs/overview/index.md +++ b/docs/overview/index.md @@ -12,16 +12,19 @@ :maxdepth: 2 object + coords + style + scroll layer event - style indev display font image file-system animation - task + timer drawing + new_widget ``` diff --git a/docs/overview/new_widget.md b/docs/overview/new_widget.md new file mode 100644 index 000000000..94960c240 --- /dev/null +++ b/docs/overview/new_widget.md @@ -0,0 +1,7 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/overview/new_widget.md +``` + +# New widget + diff --git a/docs/overview/object.md b/docs/overview/object.md index 4fedafab7..c85162f58 100644 --- a/docs/overview/object.md +++ b/docs/overview/object.md @@ -5,10 +5,12 @@ # Objects In the LVGL the **basic building blocks** of a user interface are the objects, also called *Widgets*. -For example a [Button](/widgets/btn), [Label](/widgets/label), [Image](/widgets/img), [List](/widgets/list), [Chart](/widgets/chart) or [Text area](/widgets/textarea). +For example a [Button](/widgets/core/btn), [Label](/widgets/core/label), [Image](/widgets/core/img), [List](/widgets/core/list), [Chart](/widgets/extra/chart) or [Text area](/widgets/core/textarea). Check all the [Object types](/widgets/index) here. +All objects are referenced using an `lv_obj_t` pointer as a handle. This pointer can later be used to set or get the attributes of the object. + ## Attributes ### Basic attributes @@ -17,59 +19,56 @@ All object types share some basic attributes: - Position - Size - Parent -- Drag enable -- Click enable etc. +- Styles +- Event handlers +- Etc You can set/get these attributes with `lv_obj_set_...` and `lv_obj_get_...` functions. For example: ```c /*Set basic object attributes*/ -lv_obj_set_size(btn1, 100, 50); /*Button size*/ -lv_obj_set_pos(btn1, 20,30); /*Button position*/ +lv_obj_set_size(btn1, 100, 50); /*Set a button's size*/ +lv_obj_set_pos(btn1, 20,30); /*Set a button's position*/ ``` -To see all the available functions visit the Base object's [documentation](/widgets/obj). +To see all the available functions visit the [Base object's documentation](/widgets/obj). ### Specific attributes The object types have special attributes too. For example, a slider has -- Min. max. values +- Minimum and maximum values - Current value -- Custom styles For these attributes, every object type have unique API functions. For example for a slider: ```c /*Set slider specific attributes*/ -lv_slider_set_range(slider1, 0, 100); /*Set min. and max. values*/ -lv_slider_set_value(slider1, 40, LV_ANIM_ON); /*Set the current value (position)*/ -lv_slider_set_action(slider1, my_action); /*Set a callback function*/ +lv_slider_set_range(slider1, 0, 100); /*Set the min. and max. values*/ +lv_slider_set_value(slider1, 40, LV_ANIM_ON); /*Set the current value (position)*/ ``` -The API of the object types are described in their [Documentation](/widgets/index) but you can also check the respective header files (e.g. *lv_objx/lv_slider.h*) +The API of the widgets is described in their [Documentation](/widgets/index) but you can also check the respective header files (e.g. *widgets/lv_slider.h*) ## Working mechanisms ### Parent-child structure -A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have an unlimited number of children. +A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have any number of children. There is no limitation for the type of the parent but, there are typical parent (e.g. button) and typical child (e.g. label) objects. ### Moving together -If the position of the parent is changed the children will move with the parent. +If the position of the parent changes the children will move with the parent. Therefore all positions are relative to the parent. -The (0;0) coordinates mean the objects will remain in the top left-hand corner of the parent independently from the position of the parent. - ![](/misc/par_child1.png "Objects are moving together 1") ```c -lv_obj_t * par = lv_obj_create(lv_scr_act(), NULL); /*Create a parent object on the current screen*/ -lv_obj_set_size(par, 100, 80); /*Set the size of the parent*/ +lv_obj_t * parent = lv_obj_create(lv_scr_act()); /*Create a parent object on the current screen*/ +lv_obj_set_size(parent, 100, 80); /*Set the size of the parent*/ -lv_obj_t * obj1 = lv_obj_create(par, NULL); /*Create an object on the previously created parent object*/ -lv_obj_set_pos(obj1, 10, 10); /*Set the position of the new object*/ +lv_obj_t * obj1 = lv_obj_create(parent); /*Create an object on the previously created parent object*/ +lv_obj_set_pos(obj1, 10, 10); /*Set the position of the new object*/ ``` Modify the position of the parent: @@ -77,7 +76,7 @@ Modify the position of the parent: ![](/misc/par_child2.png "Graphical objects are moving together 2") ```c -lv_obj_set_pos(par, 50, 50); /*Move the parent. The child will move with it.*/ +lv_obj_set_pos(parent, 50, 50); /*Move the parent. The child will move with it.*/ ``` (For simplicity the adjusting of colors of the objects is not shown in the example.) @@ -89,28 +88,27 @@ If a child is partially or fully out of its parent then the parts outside will n ![](/misc/par_child3.png "A graphical object is visible on its parent") ```c -lv_obj_set_x(obj1, -30); /*Move the child a little bit of the parent*/ +lv_obj_set_x(obj1, -30); /*Move the child a little bit off the parent*/ ``` -### Create - delete objects +### Create and delete objects -In LVGL objects can be created and deleted dynamically in run-time. -It means only the currently created objects consume RAM. -For example, if you need a chart, you can create it when required and delete it when it is not visible or necessary. +In LVGL objects can be created and deleted dynamically in run time. It means only the currently created (existing) objects consume RAM. -Every object type has its own **create** function with a unified prototype. -It needs two parameters: -- A pointer to the *parent* object. To create a screen give *NULL* as parent. -- Optionally, a pointer to *copy* object with the same type to copy it. This *copy* object can be *NULL* to avoid the copy operation. - -All objects are referenced in C code using an `lv_obj_t` pointer as a handle. This pointer can later be used to set or get the attributes of the object. - -The create functions look like this: +It allows to create a screen just when a button is clicked to open it. A delete the screen when a new screen is loaded. +Or the UI can be created based on the current environment of the device. For example create meter, charts, bars, slider etc according to the currently attached sensors. + +Every widget has its own **create** function with a prototype like this: ```c -lv_obj_t * lv_ _create(lv_obj_t * parent, lv_obj_t * copy); +lv_obj_t * lv__create(lv_obj_t * parent, ); ``` +In most of the cases the create functions have only a *parent* parameter that tells on which object create the new widget. + +The return value is a pointer to the created object with `lv_obj_t *` type. + + There is a common **delete** function for all object types. It deletes the object and all of its children. ```c @@ -118,27 +116,24 @@ void lv_obj_del(lv_obj_t * obj); ``` `lv_obj_del` will delete the object immediately. -If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)`. +If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)` that will perefome the deletion on hte next call of `lv_timer_handler()`. It is useful e.g. if you want to delete the parent of an object in the child's `LV_EVENT_DELETE` signal. -You can remove all the children of an object (but not the object itself) using `lv_obj_clean`: +You can remove all the children of an object (but not the object itself) using `lv_obj_clean(obj)`. -```c -void lv_obj_clean(lv_obj_t * obj); -``` ## Screens ### Create screens The screens are special objects which have no parent object. So they can be created like: ```c -lv_obj_t * scr1 = lv_obj_create(NULL, NULL); +lv_obj_t * scr1 = lv_obj_create(NULL); ``` Screens can be created with any object type. For example, a [Base object](/widgets/obj) or an image to make a wallpaper. ### Get the active screen -There is always an active screen on each display. By default, the library creates and loads a "Base object" as a screen for each display. +There is always an active screen on each display. By default, the library creates and loads a "Base object" as a screen for each display. To get the currently active screen use the `lv_scr_act()` function. @@ -146,12 +141,25 @@ To get the currently active screen use the `lv_scr_act()` function. To load a new screen, use `lv_scr_load(scr1)`. +### Layers +There are two automatically generated layers: +- top layer +- system layer + +They are independent of the screens and they will be shown on every screen. The *top layer* is above every object on the screen and the *system layer* is above the *top layer* too. +You can add any pop-up windows to the *top layer* freely. But, the *system layer* is restricted to system-level things (e.g. mouse cursor will be placed here in `lv_indev_set_cursor()`). + +The `lv_layer_top()` and `lv_layer_sys()` functions gives a pointer to the top or system layer. + +Read the [Layer overview](/overview/layer) section to learn more about layers. + + #### Load screen with animation A new screen can be loaded with animation too using `lv_scr_load_anim(scr, transition_type, time, delay, auto_del)`. The following transition types exist: -- `LV_SCR_LOAD_ANIM_NONE`: switch immediately after `delay` ms -- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` move the new screen over the other towards the given direction -- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` move both the old and new screens towards the given direction +- `LV_SCR_LOAD_ANIM_NONE`: switch immediately after `delay` milliseconds +- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` move the new screen over the current towards the given direction +- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` move both the current and new screens towards the given direction - `LV_SCR_LOAD_ANIM_FADE_ON` fade the new screen over the old screen Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished. @@ -168,28 +176,43 @@ Visit [Multi-display support](/overview/display) to learn more. ## Parts -The widgets can have multiple parts. For example a [Button](/widgets/btn) has only a main part but a [Slider](/widgets/slider) is built from a background, an indicator and a knob. +The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main and scroll bar parts but a [Slider](/widgets/core/slider) uses the main, the indicator and the knob parts. +Parts are similar to *pseudo elements* in CSS. -The name of the parts is constructed like `LV_ + _PART_ `. For example `LV_BTN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. The parts are usually used when styles are add to the objects. -Using parts different styles can be assigned to the different parts of the objects. - -To learn more about the parts read the related section of the [Style overview](/overview/style#parts). +The following predefined parts exist in LVGL: +- `LV_PART_MAIN` A background like rectangle*/ +- `LV_PART_SCROLLBAR` The scrollbar(s) +- `LV_PART_INDICATOR` Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox +- `LV_PART_KNOB` Like a handle to grab to adjust the value*/ +- `LV_PART_SELECTED` Indicate the currently selected option or section +- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. tabel cells)*/ +- `LV_PART_TICKS` Ticks on scales e.g. for a chart or meter +- `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor +- `LV_PART_CUSTOM_FIRST` Custom parts can be added from here. +The main purpose of parts to allow styling the "components" of the widgets. +Therefore the parts are described in more detail in the [Style overview](/overview/style) section. ## States The object can be in a combinations of the following states: -- **LV_STATE_DEFAULT** Normal, released -- **LV_STATE_CHECKED** Toggled or checked -- **LV_STATE_FOCUSED** Focused via keypad or encoder or clicked via touchpad/mouse -- **LV_STATE_EDITED**  Edit by an encoder -- **LV_STATE_HOVERED** Hovered by mouse (not supported now) -- **LV_STATE_PRESSED** Pressed -- **LV_STATE_DISABLED** Disabled or inactive +- `LV_STATE_DEFAULT` Normal, released state +- `LV_STATE_CHECKED` Toggled or checked state +- `LV_STATE_FOCUSED` Focused via keypad or encoder or clicked via touchpad/mouse +- `LV_STATE_FOCUS_KEY` Focused via keypad or encoder but not via touchpad/mouse +- `LV_STATE_EDITED` Edit by an encoder +- `LV_STATE_HOVERED` Hovered by mouse (not supported now) +- `LV_STATE_PRESSED` Being pressed +- `LV_STATE_SCROLLED` Being scrolled +- `LV_STATE_DISABLED` Disabled state +- `LV_STATE_USER_1` Custom state +- `LV_STATE_USER_2` Custom state +- `LV_STATE_USER_3` Custom state +- `LV_STATE_USER_4` Custom state The states are usually automatically changed by the library as the user presses, releases, focuses etc an object. -However, the states can be changed manually too. To completely overwrite the current state use `lv_obj_set_state(obj, part, LV_STATE...)`. -To set or clear given state (but leave to other states untouched) use `lv_obj_add/clear_state(obj, part, LV_STATE_...)` -In both cases ORed state values can be used as well. E.g. `lv_obj_set_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`. +However, the states can be changed manually too. +To set or clear given state (but leave the other states untouched) use `lv_obj_add/clear_state(obj, LV_STATE_...)` +In both cases ORed state values can be used as well. E.g. `lv_obj_add_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`. -To learn more about the states read the related section of the [Style overview](/overview/style#states). +To learn more about the states read the related section of the [Style overview](/overview/style). diff --git a/docs/overview/scroll.md b/docs/overview/scroll.md new file mode 100644 index 000000000..ea99bc7ea --- /dev/null +++ b/docs/overview/scroll.md @@ -0,0 +1,163 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/overview/scroll.md +``` +# Scroll + +## Overview +In LVGL scrolling works very intuitively: if an object is out of its parent content area (the size without paddings), the parent becomes scrollable and scrollbar(s) will appear. That's it. + +Any object can be scrollable including `lv_obj_t`, `lv_img`, `lv_btn`, `lv_meter`, etc + +The obejct can be scrolled either horizontally or vertically at a time, that is diagonal scrolling is not possible. + +### Scrollbar + +#### Mode +The scrollbars are displayed according to the set `mode`. The following `mode`s exist: +- `LV_SCROLLBAR_MODE_OFF` Never show the scrollbars +- `LV_SCROLLBAR_MODE_ON` Always show the scrollbars +- `LV_SCROLLBAR_MODE_ACTIVE` Show scroll bars while object is being scrolled +- `LV_SCROLLBAR_MODE_AUTO` Show scroll bars when the content is large enough to be scrolled + +`lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_...)` set the scrollbar mode on an object. + + +#### Styling +The scrollbars have its own dedicated part, called `LV_PART_SCROLLBAR`. For example a scrollbar can turned to red like this: +```c +static lv_style_t style_red; +lv_style_init(&style_red); +lv_style_set_bg_color(&style_red, lv_color_red()); + +... + +lv_obj_add_style(obj, &style_red, LV_PART_SCROLLBAR); +``` + +The object goes to `LV_STATE_SCROLLED` state while it's being scrolled. It allows adding different style to the scrollbar or the object itself when scrolled. +This code makes the scrollbar blue when the object is scrolled: +```c +static lv_style_t style_blue; +lv_style_init(&style_blue); +lv_style_set_bg_color(&style_red, lv_color_blue()); + +... + +lv_obj_add_style(obj, &style_blue, LV_STATE_SCROLLED | LV_PART_SCROLLBAR); +``` + +### Events +The following events are related to scrolling: +- `LV_EVENT_SCROLL_BEGIN` Scrolling begins +- `LV_EVENT_SCROLL_END` Scrolling ends +- `LV_EVENT_SCROLL` Scroll happened. Triggered on every position change. +Scroll events + +## Basic example +TODO + +## Features of scrolling + +Besides managing "normal" scrolling there are many interesting and useful additional features too. + + +### Scrollable + +It's possible to make an object non-scrollable with `lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE)`. + +Non-scrollable object can still propagate the scrolling (chain) to the parents. + +The direction in which scrolling can happen can be controlled by `lv_obj_set_scroll_dir(obj, LV_DIR_...)`. +The following values are possible for the direction: +- `LV_DIR_TOP` only scroll up +- `LV_DIR_LEFT` only scroll left +- `LV_DIR_BOTTOM` only scroll down +- `LV_DIR_RIGHT` only scroll right +- `LV_DIR_HOR` only scroll horizontally +- `LV_DIR_TOP` only scroll vertically +- `LV_DIR_ALL` scroll any directions + +OR-ed values are also possible. E.g. `LV_DIR_TOP | LV_DIR_LEFT`. + + +### Scroll chain +If an object can't be scrolled further (e.g. it's content has reached the bottom most position) the scrolling is propagated to it's parent. If the parent an be scrolled in that direction than it will be scrolled instead. +It goes to the grad parent and grand grandparents too. + +The propagation on scrolling in called "scroll chaining" and it can be enabled/disabled with the `LV_OBJ_FLAG_SCROLL_CHAIN` flag. +If chaining is disabled the propagation stops on the object and the parent(s) won't be scrolled. + +### Scroll momentum +When the user scrolls an object and releases it LVGL can emulate a momentum for the scrolling. It's like to object were thrown and the scrolling slows down smoothly. + +The scroll momentum can be enabled/disabled with the `LV_OBJ_FLAG_SCROLL_MOMENTUM` flag. + +### Elastic scroll +Normally the content can't be scrolled inside the object. That is the top side of the content can't be below the top side of the object. + +However, with `LV_OBJ_FLAG_SCROLL_ELASTIC` a fancy effect can be added when the user "over-scrolls" the content. The scrolling slows down, and the content can be scrolled inside the object. +When the object is releases the content is scrolled in it will be animated back to the valid position. + +### Snaping +The children of an object can be snapped according to specific rules when scrolling ends. Children can be made snapable individually with the `LV_OBJ_FLAG_SNAPABLE` flag. +The object can align the snapped children in 4 ways: +- `LV_SCROLL_SNAP_NONE` Snapping is disabled. (default) +- `LV_SCROLL_SNAP_START` Align the children to the left/top side of the scrolled object +- `LV_SCROLL_SNAP_END` Align the children to the right/bottom side of the scrolled object +- `LV_SCROLL_SNAP_CENTER` Align the children to the center of the scrolled object + +The alignment can be set with `lv_obj_set_scroll_snap_x/y(obj, LV_SCROLL_SNAP_...)`: + +Under the hood the followings happen +1. User scrolls an object and releases the screen +2. LVGL calculates where would the scroll end considering scroll momentum +3. LVGL finds the nearest scroll point +4. LVGL scrolls the snap point with an animation + +### Scroll one +The "scroll one" feature tells LVGL to allow scrolling only one snapable children at a time. +So it requires to make the children snapable and and set a scroll snap alignment different from `LV_SCROLL_SNAP_NONE`. + +This feature can be enabled by the `LV_OBJ_FLAG_SCROLL_ONE` flag. + +### Scroll on focus +Imagine that there a lot of objects in a group that are on scrollable object. Pressing the "Tab" button focuses the next object but it might be out of the visible area of the scrollable object. +If the "scroll on focus" features is enabled LVGL will automatically scroll to the objects to bring the children into the view. +The scrolling happens recursively therefore even nested scrollable object are handled properly. +The object will be scrolled to the view even if it's on a different page of a tabview. + +## Scroll manually +The following API functions allow to manually scroll objects: +- `lv_obj_scroll_by(obj, x, y, LV_ANIM_ON/OFF)` scroll by `x` and `y` values +- `lv_obj_scroll_to(obj, x, y, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the top left corner +- `lv_obj_scroll_to_x(obj, x, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the left side +- `lv_obj_scroll_to_y(obj, y, LV_ANIM_ON/OFF)` scroll to bring the given coordinate to the left side + +## Self size + +Self size is a property of an object. Normally, the user shouldn't use this parameter but if a custom widget is created it might be useful. + +In short, self size tell the size of the content. To understand it better take the example of a table. +Let's say it has 10 rows each with 50 px height. So the total height of the content is 500 px. In other words the "self height" is 500 px. +If the user sets only 200 px height for the table LVGL will see that the self size is larger and make the table scrollable. + +It means not only the children can make an object scrollable but a larger self size too. + +LVGL uses the `LV_EVENT_GET_SELF_SIZE` event to get the self size of an object. Here is an example to see how to handle the event +```c +if(event_code == LV_EVENT_GET_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); + + //If x or y < 0 then it doesn't neesd to be calculated now + if(p->x >= 0) { + p->x = 200; //Set or calculate the self width + } + + if(p->x >= 0) { + p->y = 50; //Set or calculate the self height + } +} +``` + +## Examples diff --git a/docs/overview/style.md b/docs/overview/style.md index 18030825b..4a715c278 100644 --- a/docs/overview/style.md +++ b/docs/overview/style.md @@ -4,34 +4,41 @@ ``` # Styles - *Styles* are used to set the appearance of the objects. Styles in lvgl are heavily inspired by CSS. The concept in nutshell is the following: -- A style is an `lv_style_t` variable which can hold properties, for example border width, text color and so on. It's similar to `class` in CSS. -- Not all properties have to be specified. Unspecified properties will use a default value. -- Styles can be assigned to objects to change their appearance. -- A style can be used by any number of objects. -- Styles can be cascaded which means multiple styles can be assigned to an object and each style can have different properties.   +- A style is an `lv_style_t` variable which can hold properties, for example border width, text color and so on. It's similar to a `class` in CSS. +- Styles can be assigned to objects to change their appearance. During the assignment the target part (*pseudo element* in CSS) and target state (*pseudo class*) can be specified. +For example add `style_blue` to the knob of a slider when it's in pressed state. +- The same style can be used by any number of objects. +- Styles can be cascaded which means multiple styles can be assigned to an object and each style can have different properties. +Therefore not all properties have to be specified in style. LVLG will look for a property until a style defines it or use a default if it's not spefied by any of the styles. For example `style_btn` can result in a default gray button and `style_btn_red` can add only a `background-color=red` to overwrite the background color. - Later added styles have higher precedence. It means if a property is specified in two styles the later added will be used. - Some properties (e.g. text color) can be inherited from the parent(s) if it's not specified in the object. - Objects can have local styles that have higher precedence than "normal" styles. -- Unlike CSS (where pseudo-classes describes different states, e.g. `:hover`), in lvgl a property is assigned to a given state. (I.e. not the "class" is related to state but every single property has a state) +- Unlike CSS (where pseudo-classes describe different states, e.g. `:focus`), in LVGL a property is assigned to a given state. - Transitions can be applied when the object changes state. ## States -The objects can be in the following states: -- **LV_STATE_DEFAULT** (0x00): Normal, released -- **LV_STATE_CHECKED** (0x01): Toggled or checked -- **LV_STATE_FOCUSED** (0x02): Focused via keypad or encoder or clicked via touchpad/mouse -- **LV_STATE_EDITED**  (0x04): Edit by an encoder -- **LV_STATE_HOVERED** (0x08): Hovered by mouse (not supported now) -- **LV_STATE_PRESSED** (0x10): Pressed -- **LV_STATE_DISABLED** (0x20): Disabled or inactive +The objects can be in the combination of the following states: +- `LV_STATE_DEFAULT` (0x0000) Normal, released state +- `LV_STATE_CHECKED` (0x0001) Toggled or checked state +- `LV_STATE_FOCUSED` (0x0002) Focused via keypad or encoder or clicked via touchpad/mouse +- `LV_STATE_FOCUS_KEY` (0x0004) Focused via keypad or encoder but not via touchpad/mouse +- `LV_STATE_EDITED` (0x0008) Edit by an encoder +- `LV_STATE_HOVERED` (0x0010) Hovered by mouse (not supported now) +- `LV_STATE_PRESSED` (0x0020) Being pressed +- `LV_STATE_SCROLLED` (0x0040) Being scrolled +- `LV_STATE_DISABLED` (0x0080) Disabled state +- `LV_STATE_USER_1` (0x1000) Custom state +- `LV_STATE_USER_2` (0x2000) Custom state +- `LV_STATE_USER_3` (0x4000) Custom state +- `LV_STATE_USER_4` (0x8000) Custom state -Combination of states is also possible, for example `LV_STATE_FOCUSED | LV_STATE_PRESSED`. +The combination states the object can be focused and pressed at the same time. It represented as `LV_STATE_FOCUSED | LV_STATE_PRESSED`. -The style properties can be defined in every state and state combination. For example, setting a different background color for default and pressed state. +The style can be added to any state and state combination. +For example, setting a different background color for default and pressed state. If a property is not defined in a state the best matching state's property will be used. Typically it means the property with `LV_STATE_DEFAULT` state.˛ If the property is not set even for the default state the default value will be used. (See later) @@ -42,16 +49,18 @@ To determine which state's property to use let's use an example. Let's see the b - `LV_STATE_PRESSED`: gray - `LV_STATE_FOCUSED`: red -1. By the default the object is in default state, so it's a simple case: the property is perfectly defined in the object's current state as white +1. By the default the object is in default state, so it's a simple case: the property is perfectly defined in the object's current state as white. 2. When the object is pressed there are 2 related properties: default with white (default is related to every state) and pressed with gray. -The pressed state has 0x10 precedence which is higher than the default state's 0x00 precedence, so gray color will be used. +The pressed state has 0x0020 precedence which is higher than the default state's 0x0000 precedence, so gray color will be used. 3. When the object is focused the same thing happens as in pressed state and red color will be used. (Focused state has higher precedence than default state). 4. When the object is focused and pressed both gray and red would work, but the pressed state has higher precedence than focused so gray color will be used. 5. It's possible to set e.g rose color for `LV_STATE_PRESSED | LV_STATE_FOCUSED`. -In this case, this combined state has 0x02 + 0x10 = 0x12 precedence, which higher than the pressed states precedence so rose color would be used. -6. When the object is checked there is no property to set the background color for this state. So in lack of a better option, the object remains white from the default state's property. +In this case, this combined state has 0x0020 + 0x0002 = 0x0022 precedence, which higher than the pressed states precedence so rose color would be used. +6. When the object is in checked state there is no property to set the background color for this state. So in lack of a better option, the object remains white from the default state's property. Some practical notes: +- The precedence (value) of states is quite intuitive and it's something the user would expect naturally. E.g. if an object is focused, the user still want to see if it's pressed, therefore pressed state has a higher precedence. +If the focused state had higher precedence it would overwrite the pressed color. - If you want to set a property for all state (e.g. red background color) just set it for the default state. If the object can't find a property for its current state it will fall back to the default state's property. - Use ORed states to describe the properties for complex cases. (E.g. pressed + checked + focused) - It might be a good idea to use different style elements for different states. @@ -59,7 +68,7 @@ For example, finding background colors for released, pressed, checked + pressed, Instead, for example, use the background color for pressed and checked states and indicate the focused state with a different border color. ## Cascading styles -It's not required to set all the properties in one style. It's possible to add more styles to an object and let the later added style to modify or extend the properties in the other styles. +It's not required to set all the properties in one style. It's possible to add more styles to an object and let the later added style to modify or extend appearance. For example, create a general gray button style and create a new for red buttons where only the new background color is set. It's the same concept when in CSS all the used classes are listed like `
`. @@ -74,107 +83,153 @@ In this case, when the button is released (it's in default state) it will be red When the button is pressed the light-gray color is a better match because it describes the current state perfectly, so the button will be light-gray. ## Inheritance -Some properties (typically that are related to texts) can be inherited from the parent object's styles. Inheritance is applied only if the given property is not set in the object's styles (even in default state). -In this case, if the property is inheritable, the property's value will be searched in the parent too until a part can tell a value for the property. The parents will use their own state to tell the value. -So is button is pressed, and text color comes from here, the pressed text color will be used. +Some properties (typically that are related to texts) can be inherited from the parent object's styles. +Inheritance is applied only if the given property is not set in the object's styles (even in default state). +In this case, if the property is inheritable, the property's value will be searched in the parents too until an object can tell a value for the property. The parents will use their own state to tell the value. +So if a button is pressed, and the text color comes from here, the pressed text color will be used. ## Parts -Objects can have *parts* which can have their own style. For example a [page](/widgets/page) has four parts: +Objects can have *parts* which can have their own styles. + +The following predefined parts exist in LVGL: +- `LV_PART_MAIN` A background like rectangle*/ +- `LV_PART_SCROLLBAR` The scrollbar(s) +- `LV_PART_INDICATOR` Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox +- `LV_PART_KNOB` Like a handle to grab to adjust the value*/ +- `LV_PART_SELECTED` Indicate the currently selected option or section +- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. tabel cells)*/ +- `LV_PART_TICKS` Ticks on scales e.g. for a chart or meter +- `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor +- `LV_PART_CUSTOM_FIRST` Custom parts can be added from here. + + +For example a [Slider](/widgets/slider) has three parts: - Background -- Scrollable -- Scrollbar -- Edge flash +- Indiactor +- Knob -There is three types of object parts **main**, **virtual** and **real**. - -The main part is usually the background and largest part of the object. Some object has only a main part. For example, a button has only a background. - -The virtual parts are additional parts just drawn on the fly to the main part. There is no "real" object behind them. -For example, the page's scrollbar is not a real object, it's just drawn when the page's background is drawn. -The virtual parts always have the same state as the main part. -If the property can be inherited, the main part will be also considered before going to the parent. - -The real parts are real objects created and managed by the main object. For example, the page's scrollable part is real object. -Real parts can be in different state than the main part. - -To see which parts an object has visit their documentation page. +It means the all three parts of teh slider can have their own styles. See later how to add style styles to objects and parts. ## Initialize styles and set/get properties -Styles are stored in `lv_style_t` variables. Style variables should be `static`, global or dynamically allocated. In other words they can not be local variables in functions which are destroyed when the function exists. +Styles are stored in `lv_style_t` variables. Style variables should be `static`, global or dynamically allocated. +In other words they can not be local variables in functions which are destroyed when the function exists. Before using a style it should be initialized with `lv_style_init(&my_style)`. After initializing the style properties can be set or added to it. -Property set functions looks like this: `lv_style_set_(&style, , );` -For example the [above mentioned](#states) example looks like this: -```c -static lv_style_t style1; -lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_WHITE); -lv_style_set_bg_color(&style1, LV_STATE_PRESSED, LV_COLOR_GRAY); -lv_style_set_bg_color(&style1, LV_STATE_FOCUSED, LV_COLOR_RED); -lv_style_set_bg_color(&style1, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_hex(0xf88)); -``` -It's possible to copy a style with `lv_style_copy(&style_destination, &style_source)`. After copy properties still can be added freely. +Property set functions looks like this: `lv_style_set_(&style, );` For example: +```c +static lv_style_t style_btn; +lv_style_init(&style_btn); +lv_style_set_bg_color(&style_btn, lv_color_grey()); +lv_style_set_bg_opa(&style_btn, LV_OPA_50); +lv_style_set_border_width(&style_btn, 2); +lv_style_set_border_color(&style_btn, lv_color_black()); + +static lv_style_t style_btn_red; +lv_style_init(&style_btn_red); +lv_style_set_bg_color(&style_btn_red, lv_color_red()); +lv_style_set_bg_opa(&style_btn_red, LV_OPA_COVER); +``` To remove a property use: ```c -lv_style_remove_prop(&style, LV_STYLE_BG_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)); +lv_style_remove_prop(&style, LV_STYLE_BG_COLOR); ``` -To get the value from style in a given state functions with the following prototype are available: `_lv_style_get_color/int/opa/ptr(&style, , );`. -The best matching property will be selected and it's precedence will be returned. `-1` will be returned if the property is not found. - -The form of the function (`...color/int/opa/ptr`) should be used according to the type of ``. - -For example: - +To get a properties value from style: ```c -lv_color_t color; -int16_t res; -res = _lv_style_get_color(&style1, LV_STYLE_BG_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS), &color); -if(res >= 0) { - //the bg_color is loaded into `color` +lv_style_value_t v; +lv_res_t res = lv_style_rget_prop(&style, LV_STYLE_BG_COLOR, &v); +if(res == LV_RES_OK) { /*Found*/ + do_something(v.color); } ``` -To reset a style (free all it's data) use +`lv_style_value_t` has 3 fields: +- `num` for integer, boolean and opacity properties +- `color` for color properties +- `ptr` for pointer properties + +To reset a style (free all its data) use ```c lv_style_reset(&style); ``` -## Managing style list +## Add and remove styles to a widget A style on its own not that useful. It should be assigned to an object to take its effect. -Every part of the objects stores a *style list* which is the list of assigned styles. -To add a style to an object use `lv_obj_add_style(obj, , &style)` -For example: +### Add styles +To add a style to an object use `lv_obj_add_style(obj, &style, )`. `` is an OR-ed value of parts and state to which the style should be added. Some examples: +- `LV_PART_MAIN | LV_STATE_DEFAULT` +- `LV_STATE_PRESSED`: The main part in pressed state. `LV_PART_MAIN` can be omitted +- `LV_PART_SCROLLBAR`: The scrollbar part in the default state. `LV_STATE_DEFAULT` can be omitted. +- `LV_PART_SCROLLBAR | LV_STATE_SCROLLED`: The scrollbar part when the object is being scrolled +- `0` Same as `LV_PART_MAIN | LV_STATE_DEFAULT`. +- `LV_PART_INDICATOR | LV_STATE_PRESSED | LV_STATE_CHECKED` The indicator part when the object is pressed and checked at the same time. + +Using `lv_obj_add_style`: ```c -lv_obj_add_style(btn, LV_BTN_PART_MAIN, &btn); /*Default button style*/ -lv_obj_add_style(btn, LV_BTN_PART_MAIN, &btn_red);  /*Overwrite only a some colors to red*/ +lv_obj_add_style(btn, &style_btn, 0); /*Default button style*/ +lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED);  /*Overwrite only a some colors to red when pressed*/ ``` -An objects style list can be reset with `lv_obj_reset_style_list(obj, )` +### Remove styles +To remove all styles from an object use `lv_obj_reove_style_all(obj)`. -If a style which is already assigned to an object changes (i.e. one of it's property is set to a new value) the objects using that style should be notified with `lv_obj_refresh_style(obj, part, property)`. To refresh all parts and proeprties use `lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL)`. +To remove specific styles use `lv_obj_remoev_style(obj, style, selector)`. This function will remove `style` only if the `selector` matches with the `selector` used in `lv_obj_add_style`. +`style` can be `NULL` to check only the `selector` and remove all matching styles. The `selector` can use the `LV_STATE_ANY` and `LV_PART_ANY` values to remove the style with any state or part. -To get a final value of property, including cascading, inheritance, local styles and transitions (see below), get functions like this can be used: `lv_obj_get_style_(obj, )`. + +### Report style changes +If a style - which is already assigned to object - changes (i.e. one of it's property is set to a new value) the objects using that style should be notified. There are 3 options to do this: +1. If you know that the changed properties can be applied by a simple (e.g. color or opacity changes) redraw just call `lv_obj_invalidate(obj)`, `lv_obj_invalideate(lv_scr_act())`. +2. If something more complex change happened on a style and you know which object(s) are affected by that style call `lv_obj_refresh_style(obj, part, property)`. +To refresh all parts and properties use `lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY)`. +3. No make LVGL check all object whether thy use the style and refresh them use `lv_obj_report_style_change(&style)`. If `style` is `NULL` all object's will be notified. + +### Get a property's value on an object +To get a final value of property - considering cascading, inheritance, local styles and transitions (see below) - get functions like this can be used: +`lv_obj_get_style_(obj, )`. These functions uses the object's current state and if no better candidate returns a default value.   For example: ```c -lv_color_t color = lv_obj_get_style_bg_color(btn, LV_BTN_PART_MAIN); +lv_color_t color = lv_obj_get_style_bg_color(btn, LV_PART_MAIN); ``` ## Local styles -In the object's style lists, so-called local properties can be stored as well. It's the same concept than CSS's `
`. -The local style is the same as a normal style, but it belongs only to a given object and can not be shared with other objects. -To set a local property use functions like `lv_obj_set_style_local_(obj, , , );`   +Besides "normal" styles, the objects can store local styles too. This concept is similar to inline styles in CSS (e.g. `
`) with some modification. + +So local styles are like normal styles but they can't be shared among other objects. If used, local styles are allocated automatically, and freed when the object is deleted. +They are usuful to add local customization to the object. + +Unlike in CSS, in LVGL local styles can be assigned to states (*pseudo-classes*) and parts (pseudo-elements). + +To set a local property use functions like `lv_obj_set_style_local_(obj, , );`   For example: ```c -lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); +lv_obj_set_style_local_bg_color(slider, lv_color_red(), LV_PART_INDICATOR | LV_STATE_FOCUSED); ``` + +## Properties + +TODO include properties generated by style_api_gen.py + + +### Typical background properties +In the documentation of the widgets you will see sentences like "The widget use the typical background properties". The "typical background properties" are the ones related to: +- Background +- Border +- Outline +- Shadow +- Padding +- Width and height transformation +- X and Y translation + + ## Transitions By default, when an object changes state (e.g. it's pressed) the new properties from the new state are set immediately. However, with transitions it's possible to play an animation on state change. For example, on pressing a button its background color can be animated to the pressed color over 300 ms. @@ -182,328 +237,111 @@ For example, on pressing a button its background color can be animated to the pr The parameters of the transitions are stored in the styles. It's possible to set - the time of the transition - the delay before starting the transition -- the animation path (also known as timing function) +- the animation path (also known as timing or easing function) - the properties to animate -The transition properties can be defined for each state. -For example, setting 500 ms transition time in default state will mean that when the object goes to default state 500 ms transition time will be applied. +The transition properties can be defined for each state. For example, setting 500 ms transition time in default state will mean that when the object goes to default state 500 ms transition time will be applied. Setting 100 ms transition time in the pressed state will mean a 100 ms transition time when going to presses state. So this example configuration will result in fast going to presses state and slow going back to default. -## Properties +To describe a transition an `lv_transition_dsc_t` variable needs to initialized and added to a style: +```c +/*Only its pointer is saved so must static, global or dynamically allocated */ +static const lv_style_prop_t trans_props[] = { + LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, + 0, /*End marker*/ +}; -The following properties can be used in the styles. +static lv_style_transition_dsc_t trans1; +lv_style_transition_dsc_init(&trans1, trans_props, lv_anim_path_ease_out, duration_ms, delay_ms); -### Mixed properties -- **radius** (`lv_style_int_t`): Set the radius of the background. 0: no radius, `LV_RADIUS_CIRCLE`: maximal radius. Default value: 0. -- **clip_corner** (`bool`): `true`: enable to clip the overflowed content on the rounded (radius > 0) corners. Default value: `false`. -- **size** (`lv_style_int_t`): Size of internal elements of the widgets. See the documentation of the widgets if this property is used or not. Default value: `LV_DPI / 20`. -- **transform_width**  (`lv_style_int_t`): Make the object wider on both sides with this value. Default value: 0. -- **transform_height**  (`lv_style_int_t`) Make the object higher on both sides with this value. Default value: 0. -- **transform_angle**  (`lv_style_int_t`): Rotate the image-like objects. It's uinit is 0.1 deg, for 45 deg use 450. Default value: 0. -- **transform_zoom**  (`lv_style_int_t`) Zoom image-like objects. 256 (or `LV_IMG_ZOOM_NONE`) for normal size, 128 half size, 512 double size, ans so on. Default value: `LV_IMG_ZOOM_NONE`. -- **opa_scale** (`lv_style_int_t`): Inherited. Scale down all opacity values of the object by this factor. As it's inherited the children objects will be affected too. Default value: `LV_OPA_COVER`. - -### Padding and margin properties -*Padding* sets the space on the inner sides of the edges. It means "I don't want my children too close to my sides, so keep this space". -*Padding inner* set the "gap" between the children. -*Margin* sets the space on the outer side of the edges. It means "I want this space around me". - -These properties are typically used by [Container](/widgets/cont) object if [layout](/widgets/cont#layout) or -[auto fit](/widgets/cont#auto-fit) is enabled. -However other widgets also use them to set spacing. See the documentation of the widgets for the details. -- **pad_top** (`lv_style_int_t`): Set the padding on the top. Default value: 0. -- **pad_bottom** (`lv_style_int_t`): Set the padding on the bottom. Default value: 0. -- **pad_left** (`lv_style_int_t`): Set the padding on the left. Default value: 0. -- **pad_right** (`lv_style_int_t`): Set the padding on the right. Default value: 0. -- **pad_inner** (`lv_style_int_t`): Set the padding inside the object between children. Default value: 0. -- **margin_top** (`lv_style_int_t`): Set the margin on the top. Default value: 0. -- **margin_bottom** (`lv_style_int_t`): Set the margin on the bottom. Default value: 0. -- **margin_left** (`lv_style_int_t`): Set the margin on the left. Default value: 0. -- **margin_right** (`lv_style_int_t`): Set the margin on the right. Default value: 0. - -### Background properties -The background is a simple rectangle which can have gradient and `radius` rounding. -- **bg_color** (`lv_color_t`) Specifies the color of the background. Default value: `LV_COLOR_WHITE`. -- **bg_opa** (`lv_opa_t`) Specifies opacity of the background. Default value: `LV_OPA_TRANSP`. -- **bg_grad_color** (`lv_color_t`) Specifies the color of the background's gradient. The color on the right or bottom is `bg_grad_dir != LV_GRAD_DIR_NONE`. Default value: `LV_COLOR_WHITE`. -- **bg_main_stop** (`uint8_t`): Specifies where should the gradient start. 0: at left/top most position, 255: at right/bottom most position. Default value: 0. -- **bg_grad_stop** (`uint8_t`): Specifies where should the gradient stop. 0: at left/top most position, 255: at right/bottom most position. Default value: 255. -- **bg_grad_dir** (`lv_grad_dir_t`) Specifies the direction of the gradient. Can be `LV_GRAD_DIR_NONE/HOR/VER`. Default value: `LV_GRAD_DIR_NONE`. -- **bg_blend_mode** (`lv_blend_mode_t`): Set the blend mode the background. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_1.* - :alt: Styling the background in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_1.c - :language: c +lv_style_set_transition(&style1, &trans1); ``` -### Border properties -The border is drawn on top of the *background*. It has `radius` rounding. -- **border_color** (`lv_color_t`) Specifies the color of the border. Default value: `LV_COLOR_BLACK`. -- **border_opa** (`lv_opa_t`) Specifies opacity of the border. Default value: `LV_OPA_COVER`. -- **border_width** (`lv_style_int_t`): Set the width of the border. Default value: 0. -- **border_side** (`lv_border_side_t`) Specifies which sides of the border to draw. Can be `LV_BORDER_SIDE_NONE/LEFT/RIGHT/TOP/BOTTOM/FULL`. ORed values are also possible. Default value: `LV_BORDER_SIDE_FULL`. -- **border_post** (`bool`): If `true` the border will be drawn after all children have been drawn. Default value: `false`. -- **border_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the border. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. +## Color filter +TODO -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_2.* - :alt: Styling the border in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_2.c - :language: c -``` - -### Outline properties -The outline is similar to *border* but is drawn outside of the object. -- **outline_color** (`lv_color_t`) Specifies the color of the outline. Default value: `LV_COLOR_BLACK`. -- **outline_opa** (`lv_opa_t`) Specifies opacity of the outline. Default value: `LV_OPA_COVER`. -- **outline_width** (`lv_style_int_t`): Set the width of the outline. Default value: 0. -- **outline_pad** (`lv_style_int_t`) Set the space between the object and the outline. Default value: 0. -- **outline_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the outline. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_3.* - :alt: Styling the outline in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_3.c - :language: c -``` - -### Shadow properties -The shadow is a blurred area under the object. -- **shadow_color** (`lv_color_t`) Specifies the color of the shadow. Default value: `LV_COLOR_BLACK`. -- **shadow_opa** (`lv_opa_t`) Specifies opacity of the shadow. Default value: `LV_OPA_TRANSP`. -- **shadow_width** (`lv_style_int_t`): Set the width (blur size) of the outline. Default value: 0. -- **shadow_ofs_x** (`lv_style_int_t`): Set the an X offset for the shadow. Default value: 0. -- **shadow_ofs_y** (`lv_style_int_t`): Set the an Y offset for the shadow. Default value: 0. -- **shadow_spread** (`lv_style_int_t`): make the shadow larger than the background in every direction by this value. Default value: 0. -- **shadow_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the shadow. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_4.* - :alt: Styling the shadow in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_4.c - :language: c -``` - -### Pattern properties -The pattern is an image (or symbol) drawn in the middle of the background or repeated to fill the whole background. -- **pattern_image** (`const void *`): Pointer to an `lv_img_dsc_t` variable, a path to an image file or a symbol. Default value: `NULL`. -- **pattern_opa** (`lv_opa_t`): Specifies opacity of the pattern. Default value: `LV_OPA_COVER`. -- **pattern_recolor** (`lv_color_t`): Mix this color to the pattern image. In case of symbols (texts) it will be the text color. Default value: `LV_COLOR_BLACK`. -- **pattern_recolor_opa** (`lv_opa_t`): Intensity of recoloring. Default value: `LV_OPA_TRANSP` (no recoloring). -- **pattern_repeat** (`bool`): `true`: the pattern will be repeated as a mosaic. `false`: place the pattern in the middle of the background. Default value: `false`. -- **pattern_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the pattern. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_5.* - :alt: Styling the shadow in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_5.c - :language: c -``` - -### Value properties -Value is an arbitrary text drawn to the background. It can be a lightweighted replacement of creating label objects. - -- **value_str** (`const char *`): Pointer to text to display. Only the pointer is saved! (Don't use local variable with lv_style_set_value_str, instead use static, global or dynamically allocated data). Default value: `NULL`. -- **value_color** (`lv_color_t`): Color of the text. Default value: `LV_COLOR_BLACK`. -- **value_opa** (`lv_opa_t`): Opacity of the text. Default value: `LV_OPA_COVER`. -- **value_font** (`const lv_font_t *`): Pointer to font of the text. Default value: `NULL`. -- **value_letter_space** (`lv_style_int_t`): Letter space of the text. Default value: 0. -- **value_line_space** (`lv_style_int_t`): Line space of the text. Default value: 0. -- **value_align** (`lv_align_t`): Alignment of the text. Can be `LV_ALIGN_...`. Default value: `LV_ALIGN_CENTER`. -- **value_ofs_x** (`lv_style_int_t`): X offset from the original position of the alignment. Default value: 0. -- **value_ofs_y** (`lv_style_int_t`): Y offset from the original position of the alignment. Default value: 0. -- **value_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the text. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_6.* - :alt: Styling the value text in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_6.c - :language: c -``` - -### Text properties -Properties for textual object. -- **text_color** (`lv_color_t`): Color of the text. Default value: `LV_COLOR_BLACK`. -- **text_opa** (`lv_opa_t`): Opacity of the text. Default value: `LV_OPA_COVER`. -- **text_font** (`const lv_font_t *`): Pointer to font of the text. Default value: `NULL`. -- **text_letter_space** (`lv_style_int_t`): Letter space of the text. Default value: 0. -- **text_line_space** (`lv_style_int_t`): Line space of the text. Default value: 0. -- **text_decor** (`lv_text_decor_t`): Add text decoration. Can be `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. Default value: `LV_TEXT_DECOR_NONE`. -- **text_sel_color** (`lv_color_t`): Set color of the text selection. Default value: `LV_COLOR_BLACK` -- **text_sel_bg_color** (`lv_color_t`): Set background color of text selection. Default value: `LV_COLOR_BLUE` -- **text_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the text. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_7.* - :alt: Styling a text in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_7.c - :language: c -``` - -### Line properties -Properties of lines. -- **line_color** (`lv_color_t`): Color of the line. Default value: `LV_COLOR_BLACK` -- **line_opa** (`lv_opa_t`): Opacity of the line. Default value: `LV_OPA_COVER` -- **line_width** (`lv_style_int_t`): Width of the line. Default value: 0. -- **line_dash_width** (`lv_style_int_t`): Width of dash. Dashing is drawn only for horizontal or vertical lines. 0: disable dash. Default value: 0. -- **line_dash_gap** (`lv_style_int_t`): Gap between two dash line. Dashing is drawn only for horizontal or vertical lines. 0: disable dash. Default value: 0. -- **line_rounded** (`bool`): `true`: draw rounded line endings. Default value: `false`. -- **line_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the line. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_8.* - :alt: Styling a line in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_8.c - :language: c -``` - -### Image properties -Properties of image. -- **image_recolor** (`lv_color_t`):  Mix this color to the pattern image. In case of symbols (texts) it will be the text color. Default value: `LV_COLOR_BLACK` -- **image_recolor_opa** (`lv_opa_t`): Intensity of recoloring. Default value: `LV_OPA_TRANSP` (no recoloring). Default value: `LV_OPA_TRANSP` -- **image_opa** (`lv_opa_t`): Opacity of the image. Default value: `LV_OPA_COVER` -- **image_blend_mode** (`lv_blend_mode_t`): Set the blend mode of the image. Can be `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`). Default value: `LV_BLEND_MODE_NORMAL`. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_9.* - :alt: Styling an image in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_9.c - :language: c -``` - -### Transition properties -Properties to describe state change animations. -- **transition_time** (`lv_style_int_t`): Time of the transition. Default value: 0. -- **transition_delay** (`lv_style_int_t`): Delay before the transition. Default value: 0. -- **transition_prop_1** (`property name`): A property on which transition should be applied. Use the property name with upper case with `LV_STYLE_` prefix, e.g. `LV_STYLE_BG_COLOR`. Default value: 0 (none). -- **transition_prop_2** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_3** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_4** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_5** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_prop_6** (`property name`): Same as *transition_1* just for another property. Default value: 0 (none). -- **transition_path** (`lv_anim_path_t`): An animation path for the transition. (Needs to be static or global variable because only its pointer is saved). -Default value: `lv_anim_path_def` (linear path). -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_10.* - :alt: Styling an transitions in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_10.c - :language: c -``` - -### Scale properties -Auxiliary properties for scale-like elements. Scales have a normal and end region. -As the name implies the end region is the end of the scale where can be critical values or inactive values. The normal region is before the end region. -Both regions could have different properties. -- **scale_grad_color** (`lv_color_t`):  In normal region make gradient to this color on the scale lines. Default value: `LV_COLOR_BLACK`. -- **scale_end_color** (`lv_color_t`):  Color of the scale lines in the end region. Default value: `LV_COLOR_BLACK`. -- **scale_width** (`lv_style_int_t`): Width of the scale. Default value: `LV_DPI / 8`. Default value: `LV_DPI / 8`. -- **scale_border_width** (`lv_style_int_t`): Width of a border drawn on the outer side of the scale in the normal region. Default value: 0. -- **scale_end_border_width** (`lv_style_int_t`): Width of a border drawn on the outer side of the scale in the end region. Default value: 0. -- **scale_end_line_width** (`lv_style_int_t`): Width of a scale lines in the end region. Default value: 0. - -```eval_rst -.. image:: /lv_examples/src/lv_ex_style/lv_ex_style_11.* - :alt: Styling a scale in lvgl - -.. literalinclude:: /lv_examples/src/lv_ex_style/lv_ex_style_11.c - :language: c -``` - -In the documentation of the widgets you will see sentences like "The widget use the typical background properties". The "typical background" properties are: -- Background -- Border -- Outline -- Shadow -- Pattern -- Value ## Themes -Themes are a collection of styles. There is always an active theme whose styles are automatically applied when an object is created. +Themes are a collection of styles. If there is an active theme LVGL applies it on the every created widget. It gives a default appearance to UI which can be modified by adding further styles. -The default theme is set in `lv_conf.h` with `LV_THEME_...` defines. Every theme has the following properties -- primary color -- secondary color -- small font -- normal font -- subtitle font -- title font -- flags (specific to the given theme) +Every display can have a different theme. For example a colorful theme on a TFT and monochrome theme on a secondary monochrome display. -It up to the theme how to use these properties. +To set a theme for a display 2 steps are required: +1. Initialize a theme +2. Assign the initialized theme to a display. -There are 3 built-in themes: -- empty: no default styles are added -- material: an impressive, modern theme - mono: simple black and white theme for monochrome displays -- template: a very simple theme which can be copied to create a custom theme  +Theme initialization functions can have different prototype. This example shows how to set the "default" theme: +```c +lv_theme_t * th = lv_theme_default_init(display, /*Use the DPI, size, etc from this display*/ + LV_COLOR_PALETTE_BLUE, LV_COLOR_PALETTE_CYAN, /*Primary and secondary palette*/ + false, /*Light or dark mode*/ + &lv_font_montserrat_10, &lv_font_montserrat_14, &lv_font_montserrat_18); /*Small, normal, large fonts*/ + +lv_disp_set_theme(display, th); /*Assign the theme to the display*/ +``` + + +The themes can be enabled in `lv_conf.h`. If the default theme is enabled by `LV_USE_THEME_DEFAULT 1` LVGL automatically initializes and sets it when a display is created. ### Extending themes -Built-in themes can be extended by custom theme. If a custom theme is created a "base theme" can be selected. The base theme's styles will be added before the custom theme. Any number of themes can be chained this was. E.g. material theme -> custom theme -> dark theme. +Built-in themes can be extended. +If a custom theme is created a parent theme can be selected. The parent theme's styles will be added before the custom theme's styles. +Any number of themes can be chained this way. E.g. default theme -> custom theme -> dark theme. -Here is an example about how to create a custom theme based on the currently active built-in theme. +Here is an example about creating a custom theme based on the currently active theme. ```c - /*Get the current theme (e.g. material). It will be the base of the custom theme.*/ -lv_theme_t * base_theme = lv_theme_get_act(); +/*Declare the style used in the theme*/ +static lv_style_t style_btn; +... -/*Initialize a custom theme*/ -static lv_theme_t custom_theme; /*Declare a theme*/ -lv_theme_copy(&custom_theme, base_theme); /*Initialize the custom theme from the base theme*/ -lv_theme_set_apply_cb(&custom_theme, custom_apply_cb); /*Set a custom theme apply callback*/ -lv_theme_set_base(custom_theme, base_theme); /*Set the base theme of the csutom theme*/ +/*Initialize the styles*/ +lv_style_init(&style_btn); +lv_style_set_bg_color(&style_btn, lv_color_green()); -/*Initialize styles for the new theme*/ -static lv_style_t style1; -lv_style_init(&style1); -lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, custom_theme.color_primary); +/*Initialize the new theme from the current theme*/ +lv_theme_t * th_act = lv_disp_get_theme(NULL); +static lv_theme_t th_new; +th_new = *th_act; + +/*Set the parent theme ans the style applay callback for the new theme*/ +lv_theme_set_parent(&th_new, th_act); +lv_theme_set_apply_cb(&th_new, new_theme_apply_cb); + +/*Assign the new theme the the current display*/ +lv_disp_set_theme(NULL, &th_new); ... -/*Add a custom apply callback*/ -static void custom_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) +/*Will be called when the styles of the base theme are already added + to add new styles*/ +void new_theme_apply_cb(lv_theme_t * th, lv_obj_t * obj) { - lv_style_list_t * list; - - switch(name) { - case LV_THEME_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &my_style); - break; + if(lv_obj_check_type(obj, &lv_btn_class)) { + lv_obj_add_style(obj, &style_btn, 0); } } ``` +## Examples -## Example - -### Styling a button -```eval_rst -.. image:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.* - :alt: Styling a button in LVGL - -.. literalinclude:: /lv_examples/src/lv_ex_get_started/lv_ex_get_started_2.c - :language: c -``` - ## API ```eval_rst +.. doxygenfile:: lv_obj_style.h + :project: lvgl + +.. doxygenfile:: lv_obj_style_dec.h + :project: lvgl + .. doxygenfile:: lv_style.h :project: lvgl + +.. doxygenfile:: lv_style_dec.h + :project: lvgl .. doxygenfile:: lv_theme.h :project: lvgl diff --git a/docs/widgets/arc.md b/docs/widgets/arc.md deleted file mode 100644 index 2e24f8e24..000000000 --- a/docs/widgets/arc.md +++ /dev/null @@ -1,79 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/arc.md -``` -# Arc (lv_arc) - -## Overview - -The Arc are consists of a background and a foreground arc. Both can have start and end angles and thickness. - -## Parts and Styles -The Arc's main part is called `LV_ARC_PART_MAIN`. It draws a background using the typical background style properties and an arc using the *line* style properties. -The arc's size and position will respect the *padding* style properties. - -`LV_ARC_PART_INDIC` is virtual part and it draws an other arc using the *line* style properties. It's padding values are interpreted relative to the background arc. -The radius of the indicator arc will be modified according to the greatest padding value. - -`LV_ARC_PART_KNOB` is virtual part and it draws on the end of the arc indicator. It uses all background properties and padding values. With zero padding the knob size is the same as the indicator's width. -Larger padding makes it larger, smaller padding makes it smaller. - -## Usage - -### Angles - -To set the angles of the background, use the `lv_arc_set_bg_angles(arc, start_angle, end_angle)` function or `lv_arc_set_bg_start/end_angle(arc, start_angle)`. -Zero degree is at the middle right (3 o'clock) of the object and the degrees are increasing in a clockwise direction. -The angles should be in [0;360] range. - -Similarly, `lv_arc_set_angles(arc, start_angle, end_angle)` function or `lv_arc_set_start/end_angle(arc, start_angle)` sets the angles of the indicator arc. - -### Rotation - -An offset to the 0 degree position can added with `lv_arc_set_rotation(arc, deg)`. - - -### Range and values - -Besides setting angles manually the arc can have a range and a value. To set the range use `lv_arc_set_range(arc, min, max)` and to set a value use `lv_arc_set_value(arc, value)`. -Using range and value the angle of the indicator will be mapped between background angles. - -Note that, settings angles and values are independent. You should use either value and angle settings. Mixing the two might result unintended behavior. - -### Type - -The arc can have the different "types". They are set with `lv_arc_set_type`. -The following types exist: -- `LV_ARC_TYPE_NORMAL` indicator arc drawn clockwise (min to current) -- `LV_ARC_TYPE_REVERSE` indicator arc drawn counter clockwise (max to current) -- `LV_ARC_TYPE_SYMMETRIC` indicator arc drawn from the middle point to the current value. - - -## Events -Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the arcs: - - **LV_EVENT_VALUE_CHANGED** sent when the arc is pressed/dragged to set a new value. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_arc/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_arc.h - :project: lvgl - -``` diff --git a/docs/widgets/bar.md b/docs/widgets/bar.md deleted file mode 100644 index f441e8a13..000000000 --- a/docs/widgets/bar.md +++ /dev/null @@ -1,64 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/bar.md -``` -# Bar (lv_bar) - -## Overview - -The bar object has a background and an indicator on it. The width of the indicator is set according to the current value of the bar. - -Vertical bars can be created if the width of the object is smaller than its height. - -Not only end, but the start value of the bar can be set which changes the start position of the indicator. - - -## Parts and Styles -The Bar's main part is called `LV_BAR_PART_BG` and it uses the typical background style properties. - -`LV_BAR_PART_INDIC` is a virtual part which also uses all the typical background properties. -By default the indicator maximal size is the same as the background's size but setting positive padding values in `LV_BAR_PART_BG` will make the indicator smaller. (negative values will make it larger) -If the *value* style property is used on the indicator the alignment will be calculated based on the current size of the indicator. -For example a center aligned value is always shown in the middle of the indicator regardless it's current size. - -## Usage - -### Value and range -A new value can be set by `lv_bar_set_value(bar, new_value, LV_ANIM_ON/OFF)`. -The value is interpreted in a range (minimum and maximum values) which can be modified with `lv_bar_set_range(bar, min, max)`. -The default range is 1..100. - -The new value in `lv_bar_set_value` can be set with or without an animation depending on the last parameter (`LV_ANIM_ON/OFF`). -The time of the animation can be adjusted by `lv_bar_set_anim_time(bar, 100)`. The time is in milliseconds unit. - -It's also possible to set the start value of the bar using `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)` - -### Modes -The bar can be drawn symmetrical to zero (drawn from zero, left to right), if it's enabled with `lv_bar_set_type(bar, LV_BAR_TYPE_SYMMETRICAL)`. - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_bar/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_bar.h - :project: lvgl - -``` diff --git a/docs/widgets/btn.md b/docs/widgets/btn.md deleted file mode 100644 index 9acbd6320..000000000 --- a/docs/widgets/btn.md +++ /dev/null @@ -1,82 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/btn.md -``` -# Button (lv_btn) - -## Overview - -Buttons are simple rectangle-like objects. They are derived from [Containers](/widgets/cont) so [layout](/widgets/cont#layout) and [fit](/widgets/cont#fit) are also available. -Besides, it can be enabled to automatically go to checked state on click. - - -## Parts and Styles -The buttons has only a main style called `LV_BTN_PART_MAIN` and it can use all the properties from the following groups: -- background -- border -- outline -- shadow -- value -- pattern -- transitions - -It also uses the *padding* properties when *layout* or *fit* is enabled. - -## Usage - -### States -To make buttons usage simpler the button's state can be get with `lv_btn_get_state(btn)`. It returns one of the following values: -- **LV_BTN_STATE_RELEASED** -- **LV_BTN_STATE_PRESSED** -- **LV_BTN_STATE_CHECKED_RELEASED** -- **LV_BTN_STATE_CHECKED_PRESSED** -- **LV_BTN_STATE_DISABLED** -- **LV_BTN_STATE_CHECKED_DISABLED** - -With `lv_btn_set_state(btn, LV_BTN_STATE_...)` the buttons state can be changed manually. - -If a more precise description of the state is required (e.g. focused) the general `lv_obj_get_state(btn)` can be used. - - -### Checkable -You can configure the buttons as *toggle button* with `lv_btn_set_checkable(btn, true)`. In this case, on click, the button goes to `LV_STATE_CHECKED` state automatically, or back when clicked again. - - -### Layout and Fit -Similarly to [Containers](/widgets/cont), buttons also have layout and fit attributes. -- `lv_btn_set_layout(btn, LV_LAYOUT_...) `set a layout. The default is `LV_LAYOUT_CENTER`. -So, if you add a label, then it will be automatically aligned to the middle and can't be moved with `lv_obj_set_pos()`. -You can disable the layout with `lv_btn_set_layout(btn, LV_LAYOUT_OFF)`. -- `lv_btn_set_fit/fit2/fit4(btn, LV_FIT_..)` enables to set the button width and/or height automatically according to the children, parent, and fit type. - - -## Events -Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the buttons: - - **LV_EVENT_VALUE_CHANGED** - sent when the button is toggled. - -Learn more about [Events](/overview/event). - -## Keys -The following *Keys* are processed by the Buttons: -- **LV_KEY_RIGHT/UP** - Go to toggled state if toggling is enabled. -- **LV_KEY_LEFT/DOWN** - Go to non-toggled state if toggling is enabled. - -Note that, the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc. - -Learn more about [Keys](/overview/indev). - -## Example -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_btn/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_btn.h - :project: lvgl - -``` diff --git a/docs/widgets/btnmatrix.md b/docs/widgets/btnmatrix.md deleted file mode 100644 index ca2c9eed0..000000000 --- a/docs/widgets/btnmatrix.md +++ /dev/null @@ -1,103 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/btnmatrix.md -``` -# Button matrix (lv_btnmatrix) - -## Overview - -The Button Matrix objects can display **multiple buttons** in rows and columns. - -The main reasons for wanting to use a button matrix instead of a container and individual button objects are: -- The button matrix is simpler to use for grid-based button layouts. -- The button matrix consumes a lot less memory per button. - - -## Parts and Styles -The Button matrix's main part is called `LV_BTNMATRIX_PART_BG`. It draws a background using the typical background style properties. - -`LV_BTNMATRIX_PART_BTN` is virtual part and it refers to the buttons on the button matrix. It also uses all the typical background properties. - -The top/bottom/left/right padding values from the background are used to keep some space on the sides. Inner padding is applied between the buttons. - -## Usage - -### Button's text -There is a text on each button. To specify them a descriptor string array, called *map*, needs to be used. -The map can be set with `lv_btnmatrix_set_map(btnm, my_map)`. -The declaration of a map should look like `const char * map[] = {"btn1", "btn2", "btn3", ""}`. -Note that **the last element has to be an empty string**! - -Use `"\n"` in the map to make **line break**. E.g. `{"btn1", "btn2", "\n", "btn3", ""}`. Each line's buttons have their width calculated automatically. - -### Control buttons -The **buttons width** can be set relative to the other button in the same line with `lv_btnmatrix_set_btn_width(btnm, btn_id, width)` -E.g. in a line with two buttons: *btnA, width = 1* and *btnB, width = 2*, *btnA* will have 33 % width and *btnB* will have 66 % width. -It's similar to how the [`flex-grow`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) property works in CSS. - -In addition to width, each button can be customized with the following parameters: -- **LV_BTNMATRIX_CTRL_HIDDEN** - make a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable) -- **LV_BTNMATRIX_CTRL_NO_REPEAT** - disable repeating when the button is long pressed -- **LV_BTNMATRIX_CTRL_DISABLED** - make a button disabled -- **LV_BTNMATRIX_CTRL_CHECKABLE** - enable toggling of a button -- **LV_BTNMATRIX_CTRL_CHECK_STATE** - set the toggle state -- **LV_BTNMATRIX_CTRL_CLICK_TRIG** - if 0, the button will react on press, if 1, will react on release - -The set or clear a button's control attribute, use `lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)` and -`lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)` respectively. More `LV_BTNM_CTRL_...` values can be *Or*ed - -The set/clear the same control attribute for all buttons of a button matrix, use `lv_btnmatrix_set_btn_ctrl_all(btnm, btn_id, LV_BTNM_CTRL_...)` and -`lv_btnmatrix_clear_btn_ctrl_all(btnm, btn_id, LV_BTNM_CTRL_...)`. - -The set a control map for a button matrix (similarly to the map for the text), use `lv_btnmatrix_set_ctrl_map(btnm, ctrl_map)`. -An element of `ctrl_map` should look like `ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_TGL_ENABLE`. -The number of elements should be equal to the number of buttons (excluding newlines characters). - -### One check -The "One check" feature can be enabled with `lv_btnmatrix_set_one_check(btnm, true)` to allow only one button to be checked (toggled) at once. - -### Recolor -The **texts** on the button can be **recolored** similarly to the recolor feature for [Label](/widgets/label) object. To enable it, use `lv_btnmatrix_set_recolor(btnm, true)`. -After that a button with `#FF0000 Red#` text will be red. - -### Aligning the button's text -To align the text on the buttons, use `lv_btnmatrix_set_align(roller, LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)`. -All text items in the button matrix will conform to the alignment proprty as it is set. - -### Notes -The Button matrix object is very light weighted because the buttons are not created just virtually drawn on the fly. -This way, 1 button use only 8 extra bytes instead of the ~100-150 byte size of a normal [Button](/widgets/btn) object (plus the size of its container and a label for each button). - -The disadvantage of this setup is that the ability to style individual buttons to be different from others is limited (aside from the toggling feature). -If you require that ability, using individual buttons is very likely to be a better approach. - -## Events -Besides the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the button matrices: - - **LV_EVENT_VALUE_CHANGED** - sent when the button is pressed/released or repeated after long press. The event data is set to the ID of the pressed/released button. - -Learn more about [Events](/overview/event). - -## Keys - -The following *Keys* are processed by the Buttons: -- **LV_KEY_RIGHT/UP/LEFT/RIGHT** - To navigate among the buttons to select one -- **LV_KEY_ENTER** - To press/release the selected button - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_btnmatrix/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_btnmatrix.h - :project: lvgl - -``` diff --git a/docs/widgets/calendar.md b/docs/widgets/calendar.md deleted file mode 100644 index e14cb0f39..000000000 --- a/docs/widgets/calendar.md +++ /dev/null @@ -1,82 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/calendar.md -``` -# Calendar (lv_calendar) - -## Overview - -The Calendar object is a classic calendar which can: -- highlight the current day -- highlight any user-defined dates -- display the name of the days -- go the next/previous month by button click -- highlight the clicked day - - -## Parts and Styles -The calendar's main part is called `LV_CALENDAR_PART_BG`. It draws a background using the typical background style properties. - -Besides the following virtual parts exist: -- `LV_CALENDAR_PART_HEADER` The upper area where the current year and month's name is shown. It also has buttons to move the next/previous month. -It uses typical background properties plus padding to adjust its size and margin to set the distance from the top of the calendar and the day names below it. -- `LV_CALENDAR_PART_DAY_NAMES` Shows the name of the days below the header. It uses the *text* style properties padding to keep some distance from the background (left, right), header (top) and dates (bottom). -- `LV_CALENDAR_PART_DATES` Show the date numbers from 1..28/29/30/31 (depending on current month). Different "state" of the states are drawn according to the states defined in this part: - - normal dates: drawn with `LV_STATE_DEFAULT` style - - pressed date: drawn with `LV_STATE_PRESSED` style - - today: drawn with `LV_STATE_FOCUSED` style - - highlighted dates: drawn with `LV_STATE_CHECKED` style - - -## Usage - - -## Overview - -To set and get dates in the calendar, the `lv_calendar_date_t` type is used which is a structure with `year`, `month` and `day` fields. - - -### Current date -To set the current date (today), use the `lv_calendar_set_today_date(calendar, &today_date)` function. - -### Shown date -To set the shown date, use `lv_calendar_set_shown_date(calendar, &shown_date)`; - -### Highlighted days -The list of highlighted dates should be stored in a `lv_calendar_date_t` array loaded by `lv_calendar_set_highlighted_dates(calendar, &highlighted_dates)`. -Only the arrays pointer will be saved so the array should be a static or global variable. - -### Name of the days -The name of the days can be adjusted with `lv_calendar_set_day_names(calendar, day_names)` where `day_names` looks like `const char * day_names[7] = {"Su", "Mo", ...};` - -### Name of the months -Similarly to `day_names`, the name of the month can be set with `lv_calendar_set_month_names(calendar, month_names_array)`. - -## Events -Besides the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the calendars: -**LV_EVENT_VALUE_CHANGED** is sent when the current month has changed. - -In *Input device related* events, `lv_calendar_get_pressed_date(calendar)` tells which day is currently being pressed or return `NULL` if no date is pressed. - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_calendar/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_calendar.h - :project: lvgl - -``` diff --git a/docs/widgets/checkbox.md b/docs/widgets/checkbox.md deleted file mode 100644 index 59e29f430..000000000 --- a/docs/widgets/checkbox.md +++ /dev/null @@ -1,81 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/checkbox.md -``` -# Checkbox (lv_cb) - - -## Overview - -The Checkbox objects are built from a [Button](/widgets/btn) background which contains an also Button *bullet* and a [Label](/widgets/label) to realize a classical checkbox. - -## Parts and Styles -The Check box's main part is called `LV_CHECKBOX_PART_BG`. It's a container for a "bullet" and a text next to it. The background uses all the typical background style properties. - -The bullet is real [lv_obj](/widgets/obj) object and can be referred with `LV_CHECKBOX_PART_BULLET`. -The bullet automatically inherits the state of the background. So the background is pressed the bullet goes to pressed state as well. -The bullet also uses all the typical background style properties. - -There is not dedicated part for the label. Its styles can be set in the background's styles because the *text* styles properties are always inherited. - - -## Usage - - -### Text -The text can be modified by the `lv_checkbox_set_text(cb, "New text")` function. It will dynamically allocate the text. - -To set a static text, use `lv_checkbox_set_static_text(cb, txt)`. This way, only a pointer of `txt` will be stored and it shouldn't be deallocated while the checkbox exists. - -### Check/Uncheck -You can manually check / un-check the Checkbox via `lv_checkbox_set_checked(cb, true/false)`. Setting `true` will check the checkbox and `false` will un-check the checkbox. - -### Disabled -To make the Checkbox disabled, use `lv_checkbox_set_disabled(cb, true)`. - -### Get/Set Checkbox State -You can get the current state of the Checkbox with the `lv_checkbox_get_state(cb)` function which returns the current state. -You can set the current state of the Checkbox with the `lv_checkbox_set_state(cb, state)`. -The available states as defined by the enum `lv_btn_state_t` are: -- **LV_BTN_STATE_RELEASED** -- **LV_BTN_STATE_PRESSED** -- **LV_BTN_STATE_DISABLED** -- **LV_BTN_STATE_CHECKED_RELEASED** -- **LV_BTN_STATE_CHECKED_PRESSED** -- **LV_BTN_STATE_CHECKED_DISABLED** - -## Events -Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the Checkboxes: - - **LV_EVENT_VALUE_CHANGED** - sent when the checkbox is toggled. - -Note that, the generic input device-related events (like `LV_EVENT_PRESSED`) are sent in the inactive state too. You need to check the state with `lv_cb_is_inactive(cb)` to ignore the events from inactive Checkboxes. - -Learn more about [Events](/overview/event). - - -## Keys -The following *Keys* are processed by the 'Buttons': -- **LV_KEY_RIGHT/UP** - Go to toggled state if toggling is enabled -- **LV_KEY_LEFT/DOWN** - Go to non-toggled state if toggling is enabled - -Note that, as usual, the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc. - -Learn more about [Keys](/overview/indev). - - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_checkbox/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_checkbox.h - :project: lvgl - -``` diff --git a/docs/widgets/cont.md b/docs/widgets/cont.md deleted file mode 100644 index 27b43110b..000000000 --- a/docs/widgets/cont.md +++ /dev/null @@ -1,72 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/cont.md -``` -# Container (lv_cont) - -## Overview - -The containers are essentially a **basic object** with layout and automatic sizing features features. - - -## Parts and Styles -The containers has only a main style called `LV_CONT_PART_MAIN` and it can use all the typicaly bacground properties properties and padding for layout auto sizing. - -## Usage - - -### Layout -You can apply a layout on the containers to automatically order their children. The layout spacing comes from the style's `pad` properties. The possible layout options: - -- **LV_LAYOUT_OFF** - Do not align the children. -- **LV_LAYOUT_CENTER** - Align children to the center in column and keep `pad_inner` space between them. -- **LV_LAYOUT_COLUMN_LEFT** - Align children in a left-justified column. Keep `pad_left` space on the left, `pad_top` space on the top and `pad_inner` space between the children. -- **LV_LAYOUT_COLUMN_MID** - Align children in centered column. Keep `pad_top` space on the top and `pad_inner` space between the children. -- **LV_LAYOUT_COLUMN_RIGHT** - Align children in a right-justified column. Keep `pad_right` space on the right, `pad_top` space on the top and `pad_inner` space between the children. -- **LV_LAYOUT_ROW_TOP** - Align children in a top justified row. Keep `pad_left` space on the left, `pad_top` space on the top and `pad_inner` space between the children. -- **LV_LAYOUT_ROW_MID** - Align children in centered row. Keep `pad_left` space on the left and `pad_inner` space between the children. -- **LV_LAYOUT_ROW_BOTTOM** - Align children in a bottom justified row. Keep `pad_left` space on the left, `pad_bottom` space on the bottom and `pad_inner` space between the children. -- **LV_LAYOUT_PRETTY_TOP** - Put as many objects as possible in a row (with at least `pad_inner` space and `pad_left/right` space on the sides). Divide the space in each line equally between the children. -If here are children with different height in a row align their top edge. -- **LV_LAYOUT_PRETTY_MID** - Same as `LV_LAYOUT_PRETTY_TOP` but if here are children with different height in a row align their middle line. -- **LV_LAYOUT_PRETTY_BOTTOM** - Same as `LV_LAYOUT_PRETTY_TOP` but if here are children with different height in a row align their bottom line. -- **LV_LAYOUT_GRID** - Similar to `LV_LAYOUT_PRETTY` but not divide horizontal space equally just let `pad_left/right` on the edges and `pad_inner` space between the elements. - -### Autofit -Container have an autofit feature which can automatically change the size of the container according to its children and/or its parent. The following options exist: -- **LV_FIT_NONE** - Do not change the size automatically. -- **LV_FIT_TIGHT** - Shrink-wrap the container around all of its children, while keeping `pad_top/bottom/left/right` space on the edges. -- **LV_FIT_PARENT** - Set the size to the parent's size minus `pad_top/bottom/left/right` (from the parent's style) space. -- **LV_FIT_MAX** - Use `LV_FIT_PARENT` while smaller than the parent and `LV_FIT_TIGHT` when larger. It will ensure that the container is, at minimum, the size of its parent. - -To set the auto fit mode for all directions, use `lv_cont_set_fit(cont, LV_FIT_...)`. -To use different auto fit horizontally and vertically, use `lv_cont_set_fit2(cont, hor_fit_type, ver_fit_type)`. -To use different auto fit in all 4 directions, use `lv_cont_set_fit4(cont, left_fit_type, right_fit_type, top_fit_type, bottom_fit_type)`. - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_cont/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_cont.h - :project: lvgl - -``` diff --git a/docs/widgets/core/arc.md b/docs/widgets/core/arc.md new file mode 100644 index 000000000..63818c92d --- /dev/null +++ b/docs/widgets/core/arc.md @@ -0,0 +1,94 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/arc.md +``` +# Arc (lv_arc) + +## Overview + +The Arc are consists of a background and a foreground arc. The foregrond (indicator) arc can be adjusted by finger. + +## Parts and Styles +- `LV_PART_MAIN` It draws a background using the typical background style properties and an arc using the arc style properties. The arc's size and position will respect the *padding* style properties. +- `LV_PART_INDICATOR` It draws an other arc using the *arc* style properties. It's padding values are interpreted relative to the background arc. +- `LV_PART_KNOB`It draws a handle on the end of the indicator. It uses all background properties and padding values. With zero padding the knob size is the same as the indicator's width. +Larger padding makes it larger, smaller padding makes it smaller. + +## Usage + +### Value and range + +A new value can be set by `lv_arc_set_value(arc, new_value)`. +The value is interpreted in a range (minimum and maximum values) which can be modified with `lv_arc_set_range(arc, min, max)`. +The default range is 1..100. + +The indicator arc is drawn on the main part's arc. That is if the vale is set to maximum the indicator arc will cover the entire "background" arc. +To set the start and end angl of the background arc use the `lv_arc_set_bg_angles(arc, start_angle, end_angle)` function or `lv_arc_set_bg_start/end_angle(arc, start_angle)`. + +Zero degree is at the middle right (3 o'clock) of the object and the degrees are increasing in clockwise direction. +The angles should be in [0;360] range. + +### Rotation + +An offset to the 0 degree position can added with `lv_arc_set_rotation(arc, deg)`. + +### Mode + +The arc can be one of the following modes: +- `LV_ARC_MODE_NORMAL` The indicator arc is drawn from the minimimum value to the current. +- `LV_ARC_MODE_REVERSE` The indicator arc is drawn counter clockwise from the maximum value to the current. +- `LV_ARC_MODE_SYMMETRICAL` The indicator arc is drawn from the middle point to the current value. + +The mode can be set by `lv_arc_set_mode(arc, LV_ARC_MODE_...)` and used only if the the angle is set by `lv_arc_set_value()` or the arc is adjusted by finger. + +### Change rate +If the the arc is pressed the current value will set with a limited speed according to the set *change rate*. +The change rate is defined in degree/second unit and can be set with `lv_arc_set_change_rage(arc, rate)` + + +### Setting the indicator manually +It also possible to set the angles o the indicator arc directly with `lv_arc_set_angles(arc, start_angle, end_angle)` function or `lv_arc_set_start/end_angle(arc, start_angle)` sets the angles of the indicator arc. +In this case the set "value" and "mode" is ignored. + +In other words, settings angles and values are independent. You should use either value and angle settings. Mixing the two might result unintended behavior. + +To make the arc non-adjutabe remove the style of the knob and make the object non-clickable: +```c +lv_obj_remove_style(arc, NULL, LV_PART_KNOB); +lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); +``` + +## Events +- `LV_EVENT_VALUE_CHANGED` sent when the arc is pressed/dragged to set a new value. +- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for the background rectangle, the background arc, the foreground arc and the knob to allow hooking the drawing. +For more detail on the backround rectangle part see the [Base object](/widgets/obj#events)'s documentation. The fields of `lv_obj_draw_dsc_t` is set like the followings: + - For both arcs: `clip_area`, `p1` (center of the arc), `radius`, `arc_dsc`, `part`. + - For the knob: `clip_area`, `draw_area`, `rect_dsc`, `part`. + + +Learn more about [Events](/overview/event). + +## Keys +- `LV_KEY_RIGHT/UP` Increases the value by one. +- `LV_KEY_LEFT/DOWN` Decreases the value by one. + + +Learn more about [Keys](/overview/indev). + + +## Example + +```eval_rst + +.. include:: ../../../examples/widgets/arc/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_arc.h + :project: lvgl + +``` diff --git a/docs/widgets/core/bar.md b/docs/widgets/core/bar.md new file mode 100644 index 000000000..e74d3e12d --- /dev/null +++ b/docs/widgets/core/bar.md @@ -0,0 +1,62 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/bar.md +``` +# Bar (lv_bar) + +## Overview + +The bar object has a background and an indicator on it. The width of the indicator is set according to the current value of the bar. + +Vertical bars can be created if the width of the object is smaller than its height. + +Not only the end, but the start value of the bar can be set which changes the start position of the indicator. + + +## Parts and Styles +- `LV_PART_MAIN` The background of the bar and it uses the typical background style properties. Adding padding makes the indicator smaller or larger. The `anim_time` style property sets the animation time if the values set with `LV_ANIM_ON`. +- `LV_PART_INDICATOR` The indicator and it also also uses all the typical background properties. + +## Usage + +### Value and range +A new value can be set by `lv_bar_set_value(bar, new_value, LV_ANIM_ON/OFF)`. +The value is interpreted in a range (minimum and maximum values) which can be modified with `lv_bar_set_range(bar, min, max)`. +The default range is 1..100. + +The new value in `lv_bar_set_value` can be set with or without an animation depending on the last parameter (`LV_ANIM_ON/OFF`). + +### Modes +The bar can be one the following modes: +- `LV_BAR_MODE_NORMAL` A normal bar as described above +- `LV_BAR_SYMMETRICAL` Draw the indicator form the zero value to current value. Requires negaitve minimum range and positive maximum range. +- `LV_BAR_RANGE` Allows setting the setar value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value has to be always smaller than the end value. + +## Events +- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing. +The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation. +For the indicator the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `part`. + +Learn more about [Events](/overview/event). + +## Keys +No *Keys* are processed by the object type. + +Learn more about [Keys](/overview/indev). + +## Example + +```eval_rst + +.. include:: ../../../examples/widgets/bar/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_bar.h + :project: lvgl + +``` diff --git a/docs/widgets/core/btn.md b/docs/widgets/core/btn.md new file mode 100644 index 000000000..42f8fc21b --- /dev/null +++ b/docs/widgets/core/btn.md @@ -0,0 +1,50 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/btn.md +``` +# Button (lv_btn) + +## Overview + +Buttons has no new features compared to the [Base object](/widgets/obj). It usufule for semantic purposes and has slightly different default settings. + +Buttons differ from Base object in the following points by default: +- Not scrollable +- Added to the default group +- Its default height and width is `LV_SIZE_CONTENT` + +## Parts and Styles +- `LV_PART_MAIN` The background of the button. It uses the typical background style properties. + +## Usage + +There are no new features compared to [Base object](/widgets/obj). + +## Events +- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the obejct clicked (on transition to/from the checked state) + + +Learn more about [Events](/overview/event). + +## Keys +If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` makes the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` makes it unchecked. + +Note that, the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc. + +Learn more about [Keys](/overview/indev). + +## Example +```eval_rst + +.. include:: ../../../examples/widgets/btn/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_btn.h + :project: lvgl + +``` diff --git a/docs/widgets/core/btnmatrix.md b/docs/widgets/core/btnmatrix.md new file mode 100644 index 000000000..598a8ad8c --- /dev/null +++ b/docs/widgets/core/btnmatrix.md @@ -0,0 +1,96 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/btnmatrix.md +``` +# Button matrix (lv_btnmatrix) + +## Overview + +The Button Matrix objects can display multiple buttons in rows and columns. + +The Button matrix object is very light weighted because the buttons are not created just virtually drawn on the fly. +This way, 1 button use only 8 extra bytes instead of the ~100-150 byte size of a normal [Button](/widgets/core/btn) object and other ~100 byte for the size of the [Label](/widgets/core/label) object. + +The Button matrix is added to the deafult group (if it is set). Besides the Button matrix is an editable object to allow selecting and clicing the buttons with encoder navigation too. + +## Parts and Styles +- `LV_PART_MAIN` The bacground of the button matrix. It uses the typical background style properties. `pad_row` and `pad_column` sets the space between the buttons. +- `LV_PART_ITEMS` The buttons and they all use the text and typical background style properties expect translations and transformations. + +## Usage + +### Button's text +There is a text on each button. To specify them a descriptor string array, called *map*, needs to be used. +The map can be set with `lv_btnmatrix_set_map(btnm, my_map)`. +The declaration of a map should look like `const char * map[] = {"btn1", "btn2", "btn3", NULL}`. +Note that, the last element has to be `NULL` or an empty string (`""`)! + +Use `"\n"` in the map to make **line break**. E.g. `{"btn1", "btn2", "\n", "btn3", ""}`. Each line's buttons have their width calculated automatically. +So in the example the first row will have 2 buttons each with 50% width and a second row with 1 button having 100% width. + +### Control buttons +The buttons' width can be set relative to the other button in the same row with `lv_btnmatrix_set_btn_width(btnm, btn_id, width)` +E.g. in a line with two buttons: *btnA, width = 1* and *btnB, width = 2*, *btnA* will have 33 % width and *btnB* will have 66 % width. +It's similar to how the [`flex-grow`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) property works in CSS. +The width's value mus be in the \[1..7\] range and the deafult width is 1. + +In addition to the width, each button can be customized with the following parameters: +- `LV_BTNMATRIX_CTRL_HIDDEN` Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable) +- `LV_BTNMATRIX_CTRL_NO_REPEAT` Disable repeating when the button is long pressed +- `LV_BTNMATRIX_CTRL_DISABLED` Makes a button disabled Like `LV_STATE_DISABLED` on normal objects +- `LV_BTNMATRIX_CTRL_CHECKABLE` Enable toggling of a button. I.e. `LV_STATE_CHECHED` will be added/removed as the button is clicked +- `LV_BTNMATRIX_CTRL_CHECKED` MAke the button checked. It will use the `LV_STATE_CHECHKED` styles. +- `LV_BTNMATRIX_CTRL_CLICK_TRIG` Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send LV_EVENT_VALUE_CHANGE on PRESS*/ +- `LV_BTNMATRIX_CTRL_RECOLOR` Enable recoloring of button texts with `#`. E.g. `"It's #ff0000 red#"` +- `LV_BTNMATRIX_CTRL_CUSTOM_1` Custom free to use flag +- `LV_BTNMATRIX_CTRL_CUSTOM_2` Custom free to use flag + +By deafult all flags are disabled. + +To set or clear a button's control attribute, use `lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)` and +`lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNMATRIX_CTRL_...)` respectively. More `LV_BTNM_CTRL_...` values can be OR-ed + +To set/clear the same control attribute for all buttons of a button matrix, use `lv_btnmatrix_set_btn_ctrl_all(btnm, btn_id, LV_BTNM_CTRL_...)` and +`lv_btnmatrix_clear_btn_ctrl_all(btnm, btn_id, LV_BTNMATRIX_CTRL_...)`. + +The set a control map for a button matrix (similarly to the map for the text), use `lv_btnmatrix_set_ctrl_map(btnm, ctrl_map)`. +An element of `ctrl_map` should look like `ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_CHECHKABLE`. +The number of elements should be equal to the number of buttons (excluding newlines characters). + +### One check +The "One check" feature can be enabled with `lv_btnmatrix_set_one_check(btnm, true)` to allow only one button to be checked at once. + +## Events +- `LV_EVENT_VALUE_CHANGED` Sent when a button is pressed/released or repeated after long press. The event paramter is set to the ID of the pressed/released button. +- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both the main and the items (buttons) parts to allow hooking the drawing. +The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation. +For the buttons the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `rect_dsc`, `part`, `id` (index of the button being drawn). + +`lv_btnmatrix_get_selected_btn(btnm)` returns the index of the lastly pressed, released or focused button or `LV_BTNMATRIX_BTN_NONE` if no such button. + +`lv_btnmatrix_get_btn_text(btnm, btn_id)` returns a pointer to the text of `btn_id`th button. + +Learn more about [Events](/overview/event). + +## Keys +- `LV_KEY_RIGHT/UP/LEFT/RIGHT` To navigate among the buttons to select one +- `LV_KEY_ENTER` To press/release the selected button + +Learn more about [Keys](/overview/indev). + +## Example + +```eval_rst + +.. include:: ../../../examples/widgets/btnmatrix/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_btnmatrix.h + :project: lvgl + +``` diff --git a/docs/widgets/canvas.md b/docs/widgets/core/canvas.md similarity index 65% rename from docs/widgets/canvas.md rename to docs/widgets/core/canvas.md index f4081c1b5..ad9d6b3a8 100644 --- a/docs/widgets/canvas.md +++ b/docs/widgets/core/canvas.md @@ -7,12 +7,13 @@ ## Overview -A Canvas inherites from [Image](/widgets/img) where the user can draw anything. Rectangles, texts, images, lines arcs can be drawn here using lvgl's drawing engine. +A Canvas inherites from [Image](/widgets/core/img) where the user can draw anything. +Rectangles, texts, images, lines, arcs can be drawn here using lvgl's drawing engine. Besides some "effects" can be applied as well like rotation, zoom and blur. ## Parts and Styles -The Canvas has on one main part called `LV_CANVAS_PART_MAIN` and only the *image_recolor* property is used to give a color to `LV_IMG_CF_ALPHA_1/2/4/8BIT` images. +`LV_PART_MAIN` Uses the typical rectangle style properties and image style properties. ## Usage @@ -21,38 +22,42 @@ The Canvas needs a buffer which stores the drawn image. To assign a buffer to a Canvas, use `lv_canvas_set_buffer(canvas, buffer, width, height, LV_IMG_CF_...)`. Where `buffer` is a static buffer (not just a local variable) to hold the image of the canvas. For example, -`static lv_color_t buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(width, height)]`. `LV_CANVAS_BUF_SIZE_...` macros help to determine the size of the buffer with different color formats. +`static lv_color_t buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(width, height)]`. +`LV_CANVAS_BUF_SIZE_...` macros help to determine the size of the buffer with different color formats. The canvas supports all the built-in color formats like `LV_IMG_CF_TRUE_COLOR` or `LV_IMG_CF_INDEXED_2BIT`. See the full list in the [Color formats](/overview/image.html#color-formats) section. -### Palette -For `LV_IMG_CF_INDEXED_...` color formats, a palette needs to be initialized with `lv_canvas_set_palette(canvas, 3, LV_COLOR_RED)`. It sets pixels with *index=3* to red. - +### Indexed colors +For `LV_IMG_CF_INDEXED_1/2/4/8` color formats a palette needs to be +initialized with `lv_canvas_set_palette(canvas, 3, LV_COLOR_RED)`. It sets pixels with *index=3* to red. ### Drawing To set a pixel on the canvas, use `lv_canvas_set_px(canvas, x, y, LV_COLOR_RED)`. -With `LV_IMG_CF_INDEXED_...` or `LV_IMG_CF_ALPHA_...`, the index of the color or the alpha value needs to be passed as color. E.g. `lv_color_t c; c.full = 3;` +With `LV_IMG_CF_INDEXED_...` or `LV_IMG_CF_ALPHA_...`, the index of the color or the alpha value needs to be passed as color. +E.g. `lv_color_t c; c.full = 3;` -`lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)` fills the whole canvas to blue with 50% opacity. Note that, if the current color format doesn't support colors (e.g. `LV_IMG_CF_ALPHA_2BIT`) teh color will be ignored. +`lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)` fills the whole canvas to blue with 50% opacity. Note that, if the current color format doesn't support colors (e.g. `LV_IMG_CF_ALPHA_2BIT`) the color will be ignored. Similarly, if opacity is not supported (e.g. `LV_IMG_CF_TRUE_COLOR`) it will be ignored. -An array of pixels can be copied to the canvas with `lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)`. The color format of the buffer and the canvas need to match. +An array of pixels can be copied to the canvas with `lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)`. +The color format of the buffer and the canvas need to match. To draw something to the canvas use - `lv_canvas_draw_rect(canvas, x, y, width, heigth, &draw_dsc)` -- `lv_canvas_draw_text(canvas, x, y, max_width, &draw_dsc, txt, LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)` +- `lv_canvas_draw_text(canvas, x, y, max_width, &draw_dsc, txt)` - `lv_canvas_draw_img(canvas, x, y, &img_src, &draw_dsc)` - `lv_canvas_draw_line(canvas, point_array, point_cnt, &draw_dsc)` - `lv_canvas_draw_polygon(canvas, points_array, point_cnt, &draw_dsc)` - `lv_canvas_draw_arc(canvas, x, y, radius, start_angle, end_angle, &draw_dsc)` -`draw_dsc` is a `lv_draw_rect/label/img/line_dsc_t` variable which should be first initialized with `lv_draw_rect/label/img/line_dsc_init()` function and then it's filed should be modified with the desired colors and other values. +`draw_dsc` is a `lv_draw_rect/label/img/line/arc_dsc_t` variable which should be first initialized with `lv_draw_rect/label/img/line/arc_dsc_init()` function and then it's filed should be modified with the desired colors and other values. -The draw function can draw to any color format. For example, it's possible to draw a text to an `LV_IMG_VF_ALPHA_8BIT` canvas and use the result image as a mask in [lv_objmask](/widgets/objmask) later. +The draw function can draw to any color format. For example, it's possible to draw a text to an `LV_IMG_VF_ALPHA_8BIT` canvas and use the result image as a [draw mask](/overview/drawing) later. ### Transformations -`lv_canvas_transform()` can be used to rotate and/or scale the image of an image and store the result on the canvas. The function needs the following parameters: +`lv_canvas_transform()` can be used to rotate and/or scale the image of an image and store the result on the canvas. +The function needs the following parameters: - `canvas` pointer to a canvas object to store the result of the transformation. - `img pointer` to an image descriptor to transform. Can be the image descriptor of an other canvas too (`lv_canvas_get_img()`). - `angle` the angle of rotation (0..3600), 0.1 deg resolution @@ -65,14 +70,12 @@ The draw function can draw to any color format. For example, it's possible to dr Note that a canvas can't be rotated on itself. You need a source and destination canvas or image. -## Blur -A given area of the canvas can be blurred horizontally with `lv_canvas_blur_hor(canvas, &area, r)` to vertically with `lv_canvas_blur_ver(canvas, &area, r)`. +### Blur +A given area of the canvas can be blurred horizontally with `lv_canvas_blur_hor(canvas, &area, r)` or vertically with `lv_canvas_blur_ver(canvas, &area, r)`. `r` is the radius of the blur (greater value means more intensive burring). `area` is the area where the blur should be applied (interpreted relative to the canvas) ## Events -As default the clicking of a canvas is disabled (inherited by [Image](/widgets/img)) and therefore no events are generated. - -If clicking is enabled (`lv_obj_set_click(canvas, true)`) only the [Generic events](../overview/event.html#generic-events) are sent by the object type. +The same events are sent than for the [Images](/widgets/core/img). Learn more about [Events](/overview/event). @@ -84,7 +87,7 @@ Learn more about [Keys](/overview/indev). ## Example ```eval_rst -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_canvas/index.rst +.. include:: ../../../examples/widgets/canvas/index.rst ``` diff --git a/docs/widgets/core/checkbox.md b/docs/widgets/core/checkbox.md new file mode 100644 index 000000000..6ff68c83f --- /dev/null +++ b/docs/widgets/core/checkbox.md @@ -0,0 +1,74 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/checkbox.md +``` +# Checkbox (lv_checkbox) + + +## Overview + +The Checkbox object is created from a "tick box" and a label. +When the Chackbox is clicked the tick box is toggled. + +## Parts and Styles +- `LV_PART_MAIN` The is the background of the Checkbox and it uses the text and all the typical backround style properties. +`pad_column` adjusts the spacing between the tickbox and the label +- `LV_PART_INDICATOR` The "tick box" is a square the uses all the typical backround style properties. +By deafult its size is equal to the height of the main part's font. Padding properties makes the tick boy larger in the respectiev directions. + +The Checkbox is added to the deafult group (if it is set). + +## Usage + + +### Text +The text can be modified by the `lv_checkbox_set_text(cb, "New text")` function. +It will dynamically allocate the text. + +To set a static text, +use `lv_checkbox_set_static_text(cb, txt)`. This way, only a pointer of `txt` will be stored and it shouldn't be deallocated while the checkbox exists. + +### Check, uncheck, disable +You can manually check, un-check, and disable the Checkbox by using the common state state add/clear function: +```c +lv_obj_add_state(cb, LV_STATE_CHECKED); /*Make the chekbox checked*/ +lv_obj_clear_state(cb, LV_STATE_CHECKED); /*MAke the checkbox unchecked*/ +lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); /*Make the checkbox checked and disabled*/ +``` + +## Events +- `LV_EVENT_VALUE_CHANGED` Sent when the checkbox is toggled. +- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing. +The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation. +For the indicator the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `part`. + +Learn more about [Events](/overview/event). + + +## Keys +The following *Keys* are processed by the 'Buttons': +- `LV_KEY_RIGHT/UP` Go to toggled state if toggling is enabled +- `LV_KEY_LEFT/DOWN` Go to non-toggled state if toggling is enabled +- `LV_KEY_ENTER` Clicks the checkbox and toggles it + +Note that, as usual, the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc. + +Learn more about [Keys](/overview/indev). + + +## Example + +```eval_rst + +.. include:: ../../../examples/widgets/checkbox/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_checkbox.h + :project: lvgl + +``` diff --git a/docs/widgets/core/dropdown.md b/docs/widgets/core/dropdown.md new file mode 100644 index 000000000..4d36e80f6 --- /dev/null +++ b/docs/widgets/core/dropdown.md @@ -0,0 +1,106 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/dropdown.md +``` +# Drop-down list (lv_dropdown) + + +## Overview + +The drop-down list allows the user to select one value from a list. + +The drop-down list is closed by default and displays a single value or a predefined text. +When activated (by click on the drop-down list), a list is created from which the user may select one option. +When the user selects a new value, the list is deleted. + +The Drop-down list is added to the deafult group (if it is set). Besides the Drop-down list is an editable object to allow selecting an option with encoder navigation too. + +## Parts and Styles +The Dropdown widgets is built from the elements: a "button" and a "list" (they are not realted to the butto and list widgets) + +### Button +- `LV_PART_MAIN` The background of the button. It uses the typicaly background proeprties and text proeprties for the text on it. +- `LV_PART_INDICATOR` Typically an arrow symbol that can be an image or a text (`LV_SYMBOL`). + +The button goes to `LV_STATE_CHECKED` when its opened. + +### List +- `LV_PART_MAIN` The list itself and it uses the typical background proeprties. `max_height` can be used to limit the height of the list. +- `LV_PART_SCROLLBAR` The scrollbar the background, border, shadow properties and width (for its width) and right padding for the spacing on the right. +- `LV_PART_SELECTED` Refers to the currently pressed, checked or prssed+checked option. +It also uses the typical background properties. + +As the list not exists when the drop-down list is closed it's not possible to simply add styles to it. +Instead the following should be done: +1. Ad an event handler to the button for `LV_EVENT_VALUE_CHANGED` (triggered when the list is opened/closed) +2. Use `lv_obj_t * list = lv_dropdown_get_list(dropdown)` +3. `if(list != NULL) {/*Add the styles to the list*/}` + +Alternatively the the theme can be extended with the new styles. + +## Usage + +## Overview + +### Set options +The options are passed to the drop-down list as a string with `lv_dropdown_set_options(dropdown, options)`. The options should be separated by `\n`. For example: `"First\nSecond\nThird"`. +The string will be saved in the drop-down list, so it can in local variable too. + +The `lv_dropdown_add_option(dropdown, "New option", pos)` function inserts a new option to `pos` index. + +To save memory the options can set from a static(constant) string too with `lv_dropdown_set_static_options(dropdown, options)`. +In this case the options string should be alive while the drop-down list exists and `lv_dropdown_add_option` can't be used + +You can select an option manually with `lv_dropdown_set_selected(dropdown, id)`, where `id` is the index of an option. + +### Get selected option +The get the currently selected option, use `lv_dropdown_get_selected(dropdown)`. It will return the *index* of the selected option. + +`lv_dropdown_get_selected_str(dropdown, buf, buf_size)` copies the name of the selected option to a `buf`. + +### Direction +The list can be created on any side. The default `LV_DIR_BOTTOM` can be modified by `lv_dropdown_set_dir(dropdown, LV_DIR_LEFT/RIGHT/UP/BOTTOM)` function. + +If the list would be vertically out of the screen, it will aligned to the edge. + +### Symbol +A symbol (typically an arrow) can be added to the drop down list with `lv_dropdown_set_symbol(dropdown, LV_SYMBOL_...)` + +If the direction of the drop-down list is `LV_DIR_LEFT` the symbol will be shown on the left, else on the right. + +### Show selected +The main part can either show the selected option or a static text. If a static is set with `lv_dropdown_set_text(dropdown, "Some text")` it will be shown regardless to th selected option. +Id the text text is `NULL` the selected option is displayed on the button. + +### Manually open/close +To manually open or close the drop-down list the `lv_dropdown_open/close(dropdown)` function can be used. + +## Events +Besides the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the drop-down list: +- `LV_EVENT_VALUE_CHANGED` Sent when the new option is selected or the list is opened/closed. + +Learn more about [Events](/overview/event). + +## Keys +- `LV_KEY_RIGHT/DOWN` Select the next option. +- `LV_KEY_LEFT/UP` Select the previous option. +- `LY_KEY_ENTER` Apply the selected option (Send `LV_EVENT_VALUE_CHANGED` event and close the drop-down list). + +Learn more about [Keys](/overview/indev). + +## Example + +```eval_rst + +.. include:: ../../../examples/widgets/dropdown/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_dropdown.h + :project: lvgl + +``` diff --git a/docs/widgets/img.md b/docs/widgets/core/img.md similarity index 53% rename from docs/widgets/img.md rename to docs/widgets/core/img.md index d8566c635..eeaec3622 100644 --- a/docs/widgets/img.md +++ b/docs/widgets/core/img.md @@ -7,13 +7,12 @@ ## Overview -*Images* are the basic object to display from the flash (as arrays) or externally as files. Images can display symbols (`LV_SYMBOL_...`) too. +Images are the basic object to display images from the flash (as arrays) or externally as files. Images can display symbols (`LV_SYMBOL_...`) too. Using the [Image decoder interface](/overview/image.html#image-decoder) custom image formats can be supported as well. ## Parts and Styles -The images has only a main part called `LV_IMG_PART_MAIN` which uses the typical background style propeties to draw a background rectangle and the *image* properties. -The padding values are used to make the background virtually larger. (It won't change the image's real size but the size modification is applied only during drawing) +- `LV_PART_MAIN` A background rectangle that uses the typical background style proeprties and the image itself using teh image style proeprties. ## Usage @@ -26,49 +25,49 @@ To provide maximum flexibility, the source of the image can be: To set the source of an image, use `lv_img_set_src(img, src)`. -To generate a **pixel array** from a PNG, JPG or BMP image, use the [Online image converter tool](https://lvgl.io/tools/imageconverter) and set the converted image with its pointer: `lv_img_set_src(img1, &converted_img_var);` +To generate a pixel array from a PNG, JPG or BMP image, use the [Online image converter tool](https://lvgl.io/tools/imageconverter) and set the converted image with its pointer: `lv_img_set_src(img1, &converted_img_var);` To make the variable visible in the C file, you need to declare it with `LV_IMG_DECLARE(converted_img_var)`. -To use **external files**, you also need to convert the image files using the online converter tool but now you should select the binary Output format. -You also need to use LVGL's file system module and register a driver with some functions for the basic file operation. Got to the [File system](/overview/file-system) to learn more. +To use external files, you also need to convert the image files using the online converter tool but now you should select the binary output format. +You also need to use LVGL's file system module and register a driver with some functions for the basic file operation. Go to the [File system](/overview/file-system) to learn more. To set an image sourced from a file, use `lv_img_set_src(img, "S:folder1/my_img.bin")`. - -You can set a **symbol** similarly to [Labels](/widgets/label). In this case, the image will be rendered as text according to the *font* specified in the style. It enables to use of light-weighted mono-color +You can set a symbol similarly to [Labels](/widgets/core/label). In this case, the image will be rendered as text according to the *font* specified in the style. It enables to use of light-weighted mono-color "letters" instead of real images. You can set symbol like `lv_img_set_src(img1, LV_SYMBOL_OK)`. ### Label as an image -Images and labels are sometimes used to convey the same thing. For example, to describe what a button does. Therefore, images and labels are somewhat interchangeable. -To handle these images can even display texts by using `LV_SYMBOL_DUMMY` as the prefix of the text. For example, `lv_img_set_src(img, LV_SYMBOL_DUMMY "Some text")`. +Images and labels are sometimes used to convey the same thing. For example, to describe what a button does. +Therefore, images and labels are somewhat interchangeable, that is the images can display texts by using `LV_SYMBOL_DUMMY` as the prefix of the text. For example, `lv_img_set_src(img, LV_SYMBOL_DUMMY "Some text")`. ### Transparency The internal (variable) and external images support 2 transparency handling methods: -- **Chrome keying** - Pixels with `LV_COLOR_TRANSP` (*lv_conf.h*) color will be transparent. -- **Alpha byte** - An alpha byte is added to every pixel. +- **Chrome keying** - Pixels with `LV_COLOR_CHROMA_KEY` (*lv_conf.h*) color will be transparent. +- **Alpha byte** - An alpha byte is added to every pixel that contains the pixel's opacity ### Palette and Alpha index Besides *True color* (RGB) color format, the following formats are also supported: - **Indexed** - Image has a palette. - **Alpha indexed** - Only alpha values are stored. -These options can be selected in the font converter. To learn more about the color formats, read the [Images](/overview/image) section. +These options can be selected in the image converter. To learn more about the color formats, read the [Images](/overview/image) section. ### Recolor -The images can be re-colored in run-time to any color according to the brightness of the pixels. -It is very useful to show different states (selected, inactive, pressed, etc.) of an image without storing more versions of the same image. -This feature can be enabled in the style by setting `img.intense` between `LV_OPA_TRANSP` (no recolor, value: 0) and `LV_OPA_COVER` (full recolor, value: 255). +A color can be mixed to every pixel of an image with a given intensity. +It is very useful to show different states (checked, inactive, pressed, etc.) of an image without storing more versions of the same image. +This feature can be enabled in the style by setting `img_recolor_opa` between `LV_OPA_TRANSP` (no recolor, value: 0) and `LV_OPA_COVER` (full recolor, value: 255). The default value is `LV_OPA_TRANSP` so this feature is disabled. +The color to mix is set by `img_recolor`. + ### Auto-size -It is possible to automatically set the size of the image object to the image source's width and height if enabled by the `lv_img_set_auto_size(image, true)` function. -If *auto-size* is enabled, then when a new file is set, the object size is automatically changed. Later, you can modify the size manually. The *auto-size* is enabled by default if the image is not a screen. +Is the width or height of the image object is set to `LV_SIZE_CONTENT` the obejct's size will be set according to the size of image source in the respective direction. ### Mosaic -If the object size is greater than the image size in any directions, then the image will be repeated like a mosaic. +If the object's size is greater than the image size in any directions, then the image will be repeated like a mosaic. It's a very useful feature to create a large image from only a very narrow source. -For example, you can have a *300 x 1* image with a special gradient and set it as a wallpaper using the mosaic feature. +For example, you can have a *300 x 5* image with a special gradient and set it as a wallpaper using the mosaic feature. ### Offset With `lv_img_set_offset_x(img, x_ofs)` and `lv_img_set_offset_y(img, y_ofs)`, you can add some offset to the displayed image. @@ -83,6 +82,8 @@ Fractional scale works as well. E.g. `281` for 10% enlargement. To rotate the image use `lv_img_set_angle(img, angle)`. Angle has 0.1 degree precision, so for 45.8° set 458. +The `transform_zoom` and `transform_angle` style proeprties are also used to determin the final zoom and angle. + By default, the pivot point of the rotation is the center of the image. It can be changed with `lv_img_set_pivot(img, pivot_x, pivot_y)`. `0;0` is the top left corner. The quality of the transformation can be adjusted with `lv_img_set_antialias(img, true/false)`. With enabled anti-aliasing the transformations has a higher quality but they are slower. @@ -92,12 +93,8 @@ In other words transformations work only on true color images stored as C array, Note that, the real coordinates of image object won't change during transformation. That is `lv_obj_get_width/height/x/y()` will returned the original, non-zoomed coordinates. -## Rotate -The images can be rotated with - ## Events -As by default, clicking of the image objects is disabled, only [generic](../overview/event.html#generic-events) non-input device-related events are sent. -If you want to catch all of the generic events of an image object, you should enable its clicking by using this: `lv_obj_set_click(img, true)` +No special events are sendt by the imge objects. Learn more about [Events](/overview/event). @@ -110,7 +107,7 @@ Learn more about [Keys](/overview/indev). ```eval_rst -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_img/index.rst +.. include:: ../../../examples/widgets/img/index.rst ``` diff --git a/docs/widgets/core/index.md b/docs/widgets/core/index.md new file mode 100644 index 000000000..852b02c9c --- /dev/null +++ b/docs/widgets/core/index.md @@ -0,0 +1,30 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/object-types/index.md +``` +# Core widgets + +```eval_rst + +.. toctree:: + :maxdepth: 1 + + arc + bar + btn + btnmatrix + canvas + checkbox + dropdown + img + label + line + roller + slider + switch + table + textarea + +``` + + diff --git a/docs/widgets/label.md b/docs/widgets/core/label.md similarity index 100% rename from docs/widgets/label.md rename to docs/widgets/core/label.md diff --git a/docs/widgets/line.md b/docs/widgets/core/line.md similarity index 100% rename from docs/widgets/line.md rename to docs/widgets/core/line.md diff --git a/docs/widgets/roller.md b/docs/widgets/core/roller.md similarity index 100% rename from docs/widgets/roller.md rename to docs/widgets/core/roller.md diff --git a/docs/widgets/slider.md b/docs/widgets/core/slider.md similarity index 100% rename from docs/widgets/slider.md rename to docs/widgets/core/slider.md diff --git a/docs/widgets/switch.md b/docs/widgets/core/switch.md similarity index 100% rename from docs/widgets/switch.md rename to docs/widgets/core/switch.md diff --git a/docs/widgets/table.md b/docs/widgets/core/table.md similarity index 100% rename from docs/widgets/table.md rename to docs/widgets/core/table.md diff --git a/docs/widgets/textarea.md b/docs/widgets/core/textarea.md similarity index 92% rename from docs/widgets/textarea.md rename to docs/widgets/core/textarea.md index 434fef118..8a5d10d13 100644 --- a/docs/widgets/textarea.md +++ b/docs/widgets/core/textarea.md @@ -6,13 +6,13 @@ ## Overview -The Text Area is a [Page](/widgets/page) with a [Label](/widgets/label) and a cursor on it. +The Text Area is a Page with a [Label](/widgets/core/label) and a cursor on it. Texts or characters can be added to it. Long lines are wrapped and when the text becomes long enough the Text area can be scrolled. ## Parts and Styles -The Text area has the same parts as [Page](/widgets/page). +The Text area has the same parts as Page. Expect `LV_PAGE_PART_SCRL` because it can't be referenced and it's always transparent. Refer the Page's documentation of details. @@ -100,17 +100,12 @@ Using `LV_LABEL_LONG_TXT_HINT` the scrolling and drawing will as fast as with "n A part of text can be selected if enabled with `lv_textarea_set_text_sel(textarea, true)`. It works like when you select a text on your PC with your mouse. -### Scrollbars -The scrollbars can shown according to different policies set by `lv_textarea_set_scrollbar_mode(textarea, LV_SCRLBAR_MODE_...)`. -Learn more at the [Page](/widgets/page) object. - ### Scroll propagation When the Text area is scrolled on an other scrollable object (like a Page) and the scrolling has reached the edge of the Text area, the scrolling can be propagated to the parent. In other words, when the Text area can be scrolled further, the parent will be scrolled instead. It can be enabled with `lv_ta_set_scroll_propagation(ta, true)`. -Learn more at the [Page](/widgets/page) object. ### Edge flash When the Text area is scrolled to edge a circle like flash animation can be shown if it is enabled with `lv_ta_set_edge_flash(ta, true)` @@ -133,7 +128,7 @@ Learn more about [Keys](/overview/indev). ```eval_rst -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_textarea/index.rst +.. include:: ../../../examples/widgets/textarea/index.rst ``` diff --git a/docs/widgets/dropdown.md b/docs/widgets/dropdown.md deleted file mode 100644 index e9c5693f2..000000000 --- a/docs/widgets/dropdown.md +++ /dev/null @@ -1,106 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/dropdown.md -``` -# Drop-down list (lv_dropdown) - - -## Overview - -The drop-down list allows the user to select one value from a list. - -The drop-down list is closed by default and displays a single value or a predefined text. -When activated (by click on the drop-down list), a list is created from which the user may select one option. -When the user selects a new value, the list is deleted. - -## Parts and Styles -The drop-down list's main part is called `LV_DROPDOWN_PART_MAIN` which is a simple [lv_obj](/widgets/obj) object. -It uses all the typical background properties. *Pressed*, *Focused*, *Edited* etc. stiles are also applied as usual. - -The list, which is created when the main object is clicked, is an [Page](/widgets/page). -Its background part can be referenced with `LV_DROPDOWN_PART_LIST` and uses all the typical background properties for the rectangle itself and text properties for the options. -To adjust the space between the options use the *text_line_space* style property. -Padding values can be used to make some space on the edges. - -The scrollable part of the page is hidden and its styles are always empty (so transparent with no padding). - -The scrollbar can be referenced with `LV_DROPDOWN_PART_SCRLBAR` and uses all the typical background properties. - -The selected option can be referenced with `LV_DROPDOWN_PART_SELECTED` and uses all the typical background properties. -It will used in its default state to draw a rectangle on the selected option, and in pressed state to draw a rectangle on the being pressed option. - -## Usage - -## Overview - -### Set options -The options are passed to the drop-down list as a string with `lv_dropdown_set_options(dropdown, options)`. The options should be separated by `\n`. For example: `"First\nSecond\nThird"`. -The string will be saved in the drop-down list, so it can in local variable too. - -The `lv_dropdown_add_option(dropdown, "New option", pos)` function inserts a new option to `pos` index. - -To save memory the options can set from a static(constant) string too with `lv_dropdown_set_static_options(dropdown, options)`. -In this case the options string should be alive while the drop-down list exists and `lv_dropdown_add_option` can't be used - -You can select an option manually with `lv_dropdown_set_selected(dropdown, id)`, where _id_ is the index of an option. - -### Get selected option -The get the currently selected option, use `lv_dropdown_get_selected(dropdown)`. It will return the *index* of the selected option. - -`lv_dropdown_get_selected_str(dropdown, buf, buf_size)` copies the name of the selected option to a `buf`. - -### Direction -The list can be created on any side. The default `LV_DROPDOWN_DOWN` can be modified by `lv_dropdown_set_dir(dropdown, LV_DROPDOWN_DIR_LEFT/RIGHT/UP/DOWN)` function. - -If the list would be vertically out of the screen, it will aligned to the edge. - -### Symbol -A symbol (typically an arrow) can be added to the drop down list with `lv_dropdown_set_symbol(dropdown, LV_SYMBOL_...)` - -If the direction of the drop-down list is `LV_DROPDOWN_DIR_LEFT` the symbol will be shown on the left, else on the right. - - -### Maximum height -The maximum height of drop-down list can be set via `lv_dropdown_set_max_height(dropdown, height)`. By default it's set to 3/4 vertical resolution. - -### Show selected -The main part can either show the selected option or a static text. It can controlled with `lv_dropdown_set_show_selected(sropdown, true/false)`. - -The static text can be set with `lv_dropdown_set_text(dropdown, "Text")`. Only the pointer of the text is saved. - -If you also don't want the selected option to be highlighted, a custom transparent style can be used for `LV_DROPDOWN_PART_SELECTED`. - -### Animation time -The drop-down list's open/close animation time is adjusted by `lv_dropdown_set_anim_time(ddlist, anim_time)`. Zero animation time means no animation. - -### Manually open/close -To manually open or close the drop-down list the `lv_dropdown_open/close(dropdown, LV_ANIM_ON/OFF)` function can be used. - -## Events -Besides the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the drop-down list: - - **LV_EVENT_VALUE_CHANGED** - Sent when the new option is selected. - -Learn more about [Events](/overview/event). - -## Keys -The following *Keys* are processed by the Buttons: -- **LV_KEY_RIGHT/DOWN** - Select the next option. -- **LV_KEY_LEFT/UP** - Select the previous option. -- **LY_KEY_ENTER** - Apply the selected option (Send `LV_EVENT_VALUE_CHANGED` event and close the drop-down list). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_dropdown/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_dropdown.h - :project: lvgl - -``` diff --git a/docs/widgets/extra/calendar.md b/docs/widgets/extra/calendar.md new file mode 100644 index 000000000..97c905b22 --- /dev/null +++ b/docs/widgets/extra/calendar.md @@ -0,0 +1,80 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/widgets/calendar.md +``` +# Calendar (lv_calendar) + +## Overview + +The Calendar object is a classic calendar which can: +- can show the days of any month in a 7x7 matrix +- Show the name of the days +- highlight the current day +- highlight any user-defined dates + +The Calendar is added to the deafult group (if it is set). Besides the Calendar is an editable object to allow selecting and clicing the dates with encoder navigation too. + +To make the Calendar flexible, by default it doesn't show the curent year or month. Instead, there external "headers" that can be attached to the calendar. + +## Parts and Styles +The calendar object uses the [Button matrix](/widgets/btnmatrix) object under the hood to arrange the days into a matrix. +- `LV_PART_MAIN` +- `LV_PART_ITEMS` Refers to the dates and day names. Button matrix control flags are set the to differentiate the buttons and a custom drawer event modifies the properties of the buttons + - day names haev no border, no background, drawn with a grey color + - days of the previous and next month have `LV_BTNMATRIX_CTRL_DISABLED` flag + - today has a ticker border with the themes primary color + - highlighted day have 40% opacity with the themes primary color. + +## Usage + +Some funnctions uses the `lv_calendar_date_t` type is used which is a structure with `year`, `month` and `day` fields. + +### Current date +To set the current date (today), use the `lv_calendar_set_today_date(calendar, year, month, day)` function. `month` needs to be in 1..12 range and `day` in 1..31 range + +### Shown date +To set the shown date, use `lv_calendar_set_shown_date(calendar, year, month)`; + +### Highlighted days + +The list of highlighted dates should be stored in a `lv_calendar_date_t` array loaded by `lv_calendar_set_highlighted_dates(calendar, highlighted_dates, date_num)`. +Only the arrays pointer will be saved so the array should be a static or global variable. + +### Name of the days +The name of the days can be adjusted with `lv_calendar_set_day_names(calendar, day_names)` where `day_names` looks like `const char * day_names[7] = {"Su", "Mo", ...};` +Only the pointer of the day names is saved so the array should be a static, global or constant variables. + +## Headers + +### Arrow buttons + +`lv_calendar_header_arrow_create(parent, calendar, button_size)` creates a header that contains a left and right arrow on the sides and atext with the current year and month between them. + +### Dropdown +`lv_calendar_header_dropdown_create(parent, calendar)` creates a header that contains 2 drop-drown lists: one for the year and an other for the month. + +## Events +- `LV_EVENT_VALUE_CHANGED` Sent is a data is clicked. `lv_calendar_get_pressed_date(calendar, &date)` tells which day is currently being pressed. Returns `LV_RES_OK` if theres is valid pressed data, else `LV_RES_INV`. + +## Keys +- `LV_KEY_RIGHT/UP/LEFT/RIGHT` To navigate among the buttons to dates +- `LV_KEY_ENTER` To press/release the selected date + +Learn more about [Keys](/overview/indev). + +## Example + +```eval_rst + +.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_calendar/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_calendar.h + :project: lvgl + +``` diff --git a/docs/widgets/chart.md b/docs/widgets/extra/chart.md similarity index 100% rename from docs/widgets/chart.md rename to docs/widgets/extra/chart.md diff --git a/docs/widgets/cpicker.md b/docs/widgets/extra/cpicker.md similarity index 100% rename from docs/widgets/cpicker.md rename to docs/widgets/extra/cpicker.md diff --git a/docs/widgets/imgbtn.md b/docs/widgets/extra/imgbtn.md similarity index 100% rename from docs/widgets/imgbtn.md rename to docs/widgets/extra/imgbtn.md diff --git a/docs/widgets/extra/index.md b/docs/widgets/extra/index.md new file mode 100644 index 000000000..6459d5192 --- /dev/null +++ b/docs/widgets/extra/index.md @@ -0,0 +1,28 @@ +```eval_rst +.. include:: /header.rst +:github_url: |github_link_base|/object-types/index.md +``` +# Extra widgets + +```eval_rst + +.. toctree:: + :maxdepth: 1 + + calendar + chart + colorwheel + imgbtn + keyboard + led + list + meter + msgbox + spinbox + spinner + tabview + tileview + win +``` + + diff --git a/docs/widgets/keyboard.md b/docs/widgets/extra/keyboard.md similarity index 100% rename from docs/widgets/keyboard.md rename to docs/widgets/extra/keyboard.md diff --git a/docs/widgets/led.md b/docs/widgets/extra/led.md similarity index 100% rename from docs/widgets/led.md rename to docs/widgets/extra/led.md diff --git a/docs/widgets/list.md b/docs/widgets/extra/list.md similarity index 100% rename from docs/widgets/list.md rename to docs/widgets/extra/list.md diff --git a/docs/widgets/msgbox.md b/docs/widgets/extra/msgbox.md similarity index 100% rename from docs/widgets/msgbox.md rename to docs/widgets/extra/msgbox.md diff --git a/docs/widgets/spinbox.md b/docs/widgets/extra/spinbox.md similarity index 100% rename from docs/widgets/spinbox.md rename to docs/widgets/extra/spinbox.md diff --git a/docs/widgets/spinner.md b/docs/widgets/extra/spinner.md similarity index 100% rename from docs/widgets/spinner.md rename to docs/widgets/extra/spinner.md diff --git a/docs/widgets/tabview.md b/docs/widgets/extra/tabview.md similarity index 100% rename from docs/widgets/tabview.md rename to docs/widgets/extra/tabview.md diff --git a/docs/widgets/tileview.md b/docs/widgets/extra/tileview.md similarity index 100% rename from docs/widgets/tileview.md rename to docs/widgets/extra/tileview.md diff --git a/docs/widgets/win.md b/docs/widgets/extra/win.md similarity index 100% rename from docs/widgets/win.md rename to docs/widgets/extra/win.md diff --git a/docs/widgets/gauge.md b/docs/widgets/gauge.md deleted file mode 100644 index 936f47a1b..000000000 --- a/docs/widgets/gauge.md +++ /dev/null @@ -1,70 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/gauge.md -``` -# Gauge (lv_gauge) - -## Overview -The gauge is a meter with scale labels and one or more needles. - -## Parts and Styles -The Gauge's main part is called `LV_GAUGE_PART_MAIN`. It draws a background using the typical background style properties and "minor" scale lines using the *line* and *scale* style properties. -It also uses the *text* properties to set the style of the scale labels. *pad_inner* is used to set space between the scale lines and the scale labels. - -`LV_GAUGE_PART_MAJOR` is a virtual part which describes the major scale lines (where labels are added) using the *line* and *scale* style properties. - -`LV_GAUGE_PART_NEEDLE` is also virtual part and it describes the needle(s) via the *line* style properties. -The *size* and the typical background properties are used to describe a rectangle (or circle) in the pivot point of the needle(s). -*pad_inner* is used to to make the needle(s) smaller than the outer radius of the scale lines. - -## Usage - -### Set value and needles -The gauge can show more than one needle. -Use the `lv_gauge_set_needle_count(gauge, needle_num, color_array)` function to set the number of needles and an array with colors for each needle. -The array must be static or global variable because only its pointer is stored. - -You can use `lv_gauge_set_value(gauge, needle_id, value)` to set the value of a needle. - - -### Scale -You can use the `lv_gauge_set_scale(gauge, angle, line_num, label_cnt)` function to adjust the scale angle and the number of the scale lines and labels. -The default settings are 220 degrees, 6 scale labels, and 21 lines. - -The scale of the Gauge can have offset. It can be adjusted with `lv_gauge_set_angle_offset(gauge, angle)`. - -### Range -The range of the gauge can be specified by `lv_gauge_set_range(gauge, min, max)`. The default range is 0..100. - -### Needle image -An images also can be used as needles. The image should point to the right (like `==>`). To set an image use `lv_gauge_set_needle_img(gauge1, &img, pivot_x, pivot_y)`. `pivot_x` and `pivot_y` are offset of the rotation center from the top left corner. Images will be recolored to the needle's color with `image_recolor_opa` intensity coming from the styles in `LV_GAUGE_PART_NEEDLE`. - - -### Critical value -To set a critical value, use `lv_gauge_set_critical_value(gauge, value)`. The scale color will be changed to *scale_end_color* after this value. The default critical value is 80. - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_gauge/index.rst - -``` -## API - -```eval_rst - -.. doxygenfile:: lv_gauge.h - :project: lvgl - -``` diff --git a/docs/widgets/index.md b/docs/widgets/index.md index 124e71b1e..4bff9163f 100644 --- a/docs/widgets/index.md +++ b/docs/widgets/index.md @@ -10,39 +10,8 @@ :maxdepth: 1 obj - arc - bar - btn - btnmatrix - calendar - canvas - checkbox - chart - cont - cpicker - dropdown - gauge - img - imgbtn - keyboard - label - led - line - list - linemeter - msgbox - objmask - page - roller - slider - spinbox - spinner - switch - table - tabview - textarea - tileview - win + core/index + extra/index ``` diff --git a/docs/widgets/linemeter.md b/docs/widgets/linemeter.md deleted file mode 100644 index 59f647f35..000000000 --- a/docs/widgets/linemeter.md +++ /dev/null @@ -1,61 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/linemeter.md -``` -# Line meter (lv_lmeter) - - -## Overview - -The Line meter object consists of some radial lines which draw a scale. Setting a value for the Line meter will change the color of the scale lines proportionally. - -## Parts and Styles -The Line meter has only a main part, called `LV_LINEMETER_PART_MAIN`. It uses all the typical background properties the draw a rectangle-like or circle background and the *line* and *scale* properties to draw the scale lines. -The active lines (which are related to smaller values the the current value) are colored from *line_color* to *scale_grad_color*. The lines in the end (after the current value) are set to *scale_end_color* color. - -## Usage - -### Set value -When setting a new value with `lv_linemeter_set_value(linemeter, new_value)` the proportional part of the scale will be recolored. - -### Range and Angles -The `lv_linemeter_set_range(linemeter, min, max)` function sets the range of the line meter. - -You can set the angle of the scale and the number of the lines by: `lv_linemeter_set_scale(linemeter, angle, line_num)`. -The default angle is 240 and the default line number is 31. - -### Angle offset -By default the scale angle is interpreted symmetrically to the y axis. It results in "standing" line meter. With `lv_linemeter_set_angle_offset` an offset can be added the scale angle. -It can used e.g to put a quarter line meter into a corner or a half line meter to the right or left side. - -### Mirror - -By default the Line meter's lines are activated clock-wise. It can be changed using `lv_linemeter_set_mirror(linemeter, true/false)`. - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_linemeter/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_linemeter.h - :project: lvgl - -``` - diff --git a/docs/widgets/obj.md b/docs/widgets/obj.md index 2aae544e4..1b0254f55 100644 --- a/docs/widgets/obj.md +++ b/docs/widgets/obj.md @@ -10,205 +10,153 @@ The 'Base Object' implements the basic properties of widgets on a screen, such a - coordinates - parent object - children -- main style -- attributes like *Click enable*, *Drag enable*, etc. +- contains the styles +- attributes like *Clickable*, *Scrollable*, etc. -In object-oriented thinking, it is the base class from which all other objects in LVGL are inherited. This, among another things, helps reduce code duplication. +In object-oriented thinking, it is the base class from which all other objects in LVGL are inherited. The functions and functionalities of Base object can be used with other widgets too. For example `lv_obj_set_width(slider, 100)` -The Base object can be directly used as a simple widgets. It nothing else then a rectangle. +The Base object can be directly used as a simple widgets. It nothing else than a rectangle. Or from the the HTML world it's like a `
`. ### Coordinates +Here only a small subset of cooridnate settings is described. To see all the features of LVGL (padding, cooridnates in styles, layouts, etc) visit the [Coordinates](overview/coord) page. + #### Size The object size can be modified on individual axes with `lv_obj_set_width(obj, new_width)` and `lv_obj_set_height(obj, new_height)`, or both axes can be modified at the same time with `lv_obj_set_size(obj, new_width, new_height)`. -Styles can add [Margin](/overview/style/#properties) to the objects. Margin tells that "I want this space around me". -To set width or height reduced by the margin `lv_obj_set_width_margin(obj, new_width)` or `lv_obj_set_height_margin(obj, new_height)`. -In more exact way: `new_width = left_margin + object_width + right_margin`. - -To get the width or height which includes the margins use `lv_obj_get_width/height_margin(obj)`. - - -Styles can add [Padding](/overview/style/#properties) to the object as well. Padding means "I don't want my children too close to my sides, so keep this space". -To set width or height reduced by the padding `lv_obj_set_width_fit(obj, new_width)` or `lv_obj_set_height_fit(obj, new_height)`. -In a more exact way: `new_width = left_pad + object_width + right_pad` -To get the width or height which is REDUCED by padding use `lv_obj_get_width/height_fit(obj)`. It can be considered the "useful size of the object". - -Margin and padding gets important when [Layout](/widget/cont#layout) or [Auto-fit](/wisgets/cont#fit) is used by other widgets. - #### Position You can set the x and y coordinates relative to the parent with `lv_obj_set_x(obj, new_x)` and `lv_obj_set_y(obj, new_y)`, or both at the same time with `lv_obj_set_pos(obj, new_x, new_y)`. #### Alignment -You can align the object to another with `lv_obj_align(obj, obj_ref, LV_ALIGN_..., x_ofs, y_ofs)`. -- `obj` is the object to align. -- `obj_ref` is a reference object. `obj` will be aligned to it. If `obj_ref = NULL`, then the parent of `obj` will be used. -- The third argument is the *type* of alignment. These are the possible options: -![](/misc/align.png "Alignment types in LVGL") +You can align the object on it's parent with `lv_obj_set_align(obj, LV_ALIGN_...)`. After this every x and y settings will be ralitiev to the set alignment mode. +For example a this will shift the object by 10;20 px fro mthe center of its parent. +```c +lv_obj_set_align(obj, LV_ALIGN_CENTER); +lv_obj_set_pos(obj, 10, 20); - The alignment types build like `LV_ALIGN_OUT_TOP_MID`. -- The last two arguments allow you to shift the object by a specified number of pixels after aligning it. +//Or in one function +lv_obj_align(obj, LV_ALIGN_CENTER, 10, 20); +``` + +To align an object to an other use `lv_obj_align_to(obj_to_align, obj_referece, LV_ALIGN_..., x, y)` For example, to align a text below an image: `lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)`. -Or to align a text in the middle of its parent: `lv_obj_align(text, NULL, LV_ALIGN_CENTER, 0, 0)`. +The following align types exists: +![](/misc/align.png "Alignment types in LVGL") -`lv_obj_align_origo` works similarly to `lv_obj_align` but it aligns the center of the object. - -For example, `lv_obj_align_origo(btn, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 0)` will align the center of the button the bottom of the image. - -The parameters of the alignment will be saved in the object if `LV_USE_OBJ_REALIGN` is enabled in *lv_conf.h*. You can then realign the objects simply by calling `lv_obj_realign(obj)`. -It's equivalent to calling `lv_obj_align` again with the same parameters. - -If the alignment happened with `lv_obj_align_origo`, then it will be used when the object is realigned. - -The `lv_obj_align_x/y` and `lv_obj_align_origo_x/y` function can be used t align only on one axis. - -If `lv_obj_set_auto_realign(obj, true)` is used the object will be realigned automatically, if its size changes in `lv_obj_set_width/height/size()` functions. -It's very useful when size animations are applied to the object and the original position needs to be kept. - - -**Note that the coordinates of screens can't be changed. Attempting to use these functions on screens will result in undefined behavior.** ### Parents and children You can set a new parent for an object with `lv_obj_set_parent(obj, new_parent)`. To get the current parent, use `lv_obj_get_parent(obj)`. -To get the children of an object, use `lv_obj_get_child(obj, child_prev)` (from last to first) or `lv_obj_get_child_back(obj, child_prev)` (from first to last). -To get the first child, pass `NULL` as the second parameter and use the return value to iterate through the children. The function will return `NULL` if there are no more children. For example: +To get a specific children of a parent use `lv_obj_get_child(parent, idx)`. Some examples for `idx`: +- `0` get the firstly (youngest) created child +- `1` get the secondly created child +- `-1` get the lastly (youngest) craeted child +The children can be iterated lke this ```c -lv_obj_t * child = lv_obj_get_child(parent, NULL); -while(child) { - /*Do something with "child" */ - child = lv_obj_get_child(parent, child); +uint32_t i; +for(i = 0; i < lv_obj_get_child_cnt(parent); i++) { + lv_obj_t * child = lv_obj_get_child(paernt, i); + /*Do something with child*/ } ``` -`lv_obj_count_children(obj)` tells the number of children on an object. `lv_obj_count_children_recursive(obj)` also tells the number of children but counts children of children recursively. +`lv_obj_get_child_id(obj)` tells the index of the object. That is how many younger children its parent has. + +You can bring an object to the foreground or send it to the background with `lv_obj_move_foreground(obj)` and `lv_obj_move_background(obj)`. ### Screens -When you have created a screen like `lv_obj_t * screen = lv_obj_create(NULL, NULL)`, you can load it with `lv_scr_load(screen)`. The `lv_scr_act()` function gives you a pointer to the current screen. +When you have created a screen like `lv_obj_t * screen = lv_obj_create(NULL)`, you can load it with `lv_scr_load(screen)`. The `lv_scr_act()` function gives you a pointer to the current screen. If you have more display then it's important to know that these functions operate on the lastly created or the explicitly selected (with `lv_disp_set_default`) display. To get an object's screen use the `lv_obj_get_screen(obj)` function. -### Layers -There are two automatically generated layers: -- top layer -- system layer - -They are independent of the screens and they will be shown on every screen. The *top layer* is above every object on the screen and the *system layer* is above the *top layer* too. -You can add any pop-up windows to the *top layer* freely. But, the *system layer* is restricted to system-level things (e.g. mouse cursor will be placed here in `lv_indev_set_cursor()`). - -The `lv_layer_top()` and `lv_layer_sys()` functions gives a pointer to the top or system layer. - -You can bring an object to the foreground or send it to the background with `lv_obj_move_foreground(obj)` and `lv_obj_move_background(obj)`. - -Read the [Layer overview](/overview/layer) section to learn more about layers. - ### Events -To set an event callback for an object, use `lv_obj_set_event_cb(obj, event_cb)`, +To set an event callback for an object, use `lv_obj_add_event_cb(obj, event_cb, LV_EVENT_..., user_data)`, -To manually send an event to an object, use `lv_event_send(obj, LV_EVENT_..., data)` +To manually send an event to an object, use `lv_event_send(obj, LV_EVENT_..., param)` Read the [Event overview](/overview/event) to learn more about the events. -## Parts - -The widgets can have multiple parts. For example a [Button](/widgets/btn) has only a main part but a [Slider](/widgets/slider) is built from a background, an indicator and a knob. - -The name of the parts is constructed like `LV_ + _PART_ `. For example `LV_BTN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. The parts are usually used when styles are add to the objects. -Using parts different styles can be assigned to the different parts of the objects. - -To learn more about the parts read the related section of the [Style overview](/overview/style#parts). - - -### States -The object can be in a combinations of the following states: -- **LV_STATE_DEFAULT** Normal, released -- **LV_STATE_CHECKED** Toggled or checked -- **LV_STATE_FOCUSED** Focused via keypad or encoder or clicked via touchpad/mouse -- **LV_STATE_EDITED**  Edit by an encoder -- **LV_STATE_HOVERED** Hovered by mouse (not supported now) -- **LV_STATE_PRESSED** Pressed -- **LV_STATE_DISABLED** Disabled or inactive - -The states are usually automatically changed by the library as the user presses, releases, focuses etc an object. -However, the states can be changed manually too. To completely overwrite the current state use `lv_obj_set_state(obj, part, LV_STATE...)`. -To set or clear given state (but leave to other states untouched) use `lv_obj_add/clear_state(obj, part, LV_STATE_...)` -In both cases ORed state values can be used as well. E.g. `lv_obj_set_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`. - -To learn more about the states read the related section of the [Style overview](/overview/style#states). - ### Style -Be sure to read the [Style overview](/overview/style) first. +Be sure to read the [Style overview](/overview/style). Here or only the most essential functions are described. -To add a style to an object use `lv_obj_add_style(obj, part, &new_style)` function. The Base object use all the rectangle-like style properties. - -To remove all styles from an object use `lv_obj_reset_style_list(obj, part)` +A new style can be added to an object with `lv_obj_add_style(obj, part, &new_style)` function. The Base object use all the rectangle-like style properties. If you modify a style, which is already used by objects, in order to refresh the affected objects you can use either `lv_obj_refresh_style(obj)` on each object using it or -to notify all objects with a given style use `lv_obj_report_style_mod(&style)`. If the parameter of `lv_obj_report_style_mod` is `NULL`, all objects will be notified. + notify all objects with a given style use `lv_obj_report_style_change(&style)`. If the parameter of `lv_obj_report_style_change` is `NULL`, all objects will be notified. -### Attributes -There are some attributes which can be enabled/disabled by `lv_obj_set_...(obj, true/false)`: +### Flags +There are some attributes which can be enabled/disabled by `lv_obj_add/clear_flag(obj, LV_OBJ_FLAG_...)`: -- **hidden** - Hide the object. It will not be drawn and will be considered by input devices as if it doesn't exist., Its children will be hidden too. -- **click** - Allows you to click the object via input devices. If disabled, then click events are passed to the object behind this one. (E.g. [Labels](/widgets/label) are not clickable by default) -- **top** - If enabled then when this object or any of its children is clicked then this object comes to the foreground. -- **drag** - Enable dragging (moving by an input device) -- **drag_dir** - Enable dragging only in specific directions. Can be `LV_DRAG_DIR_HOR/VER/ALL`. -- **drag_throw** - Enable "throwing" with dragging as if the object would have momentum -- **drag_parent** - If enabled then the object's parent will be moved during dragging. It will look like as if the parent is dragged. Checked recursively, so can propagate to grandparents too. -- **parent_event** - Propagate the events to the parents too. Checked recursively, so can propagate to grandparents too. -- **opa_scale_enable** - Enable opacity scaling. See the [#opa-scale](Opa scale) section. +-`LV_OBJ_FLAG_HIDDEN` Make the object hidden. (Like it wasn't there at all) +-`LV_OBJ_FLAG_CLICKABLE` Make the object clickable by the input devices +-`LV_OBJ_FLAG_CLICK_FOCUSABLE` Add focused state to the object when clicked +-`LV_OBJ_FLAG_CHECKABLE` Toggle checked state when the object is clicked +-`LV_OBJ_FLAG_SCROLLABLE` Make the object scrollable +-`LV_OBJ_FLAG_SCROLL_ELASTIC` Allow scrolling inside but with slower speed +-`LV_OBJ_FLAG_SCROLL_MOMENTUM` Make the object scroll further when "thrown" +-`LV_OBJ_FLAG_SCROLL_ONE`Allow scrolling only one snapable children +-`LV_OBJ_FLAG_SCROLL_CHAIN` Allow propagating the scroll to a parent +-`LV_OBJ_FLAG_SCROLL_ON_FOCUS` Automatically scroll object to make it visible when focused +-`LV_OBJ_FLAG_SNAPABLE` If scroll snap is enabled on the parent it can snap to this object +-`LV_OBJ_FLAG_PRESS_LOCK` Keep the object pressed even if the press slid from the object +-`LV_OBJ_FLAG_EVENT_BUBBLE` Propagate the events to the parent too +-`LV_OBJ_FLAG_GESTURE_BUBBLE` Propagate the gestures to the parent +-`LV_OBJ_FLAG_ADV_HITTEST` Allow performing more accurate hit (click) test. E.g. consider rounded corners. +-`LV_OBJ_FLAG_IGNORE_LAYOUT` Make the object position-able by the layouts +-`LV_OBJ_FLAG_FLOATING` Do not scroll the object when the parent scrolls and ignore layout -### Protect -There are some specific actions which happen automatically in the library. -To prevent one or more that kind of actions, you can protect the object against them. The following protections exists: -- **LV_PROTECT_NONE** No protection -- **LV_PROTECT_POS** Prevent automatic positioning (e.g. Layout in [Containers](/widgets/cont)) -- **LV_PROTECT_FOLLOW** Prevent the object be followed (make a "line break") in automatic ordering (e.g. Layout in [Containers](/widgets/cont)) -- **LV_PROTECT_PARENT** Prevent automatic parent change. (e.g. [Page](/widgets/page) moves the children created on the background to the scrollable) -- **LV_PROTECT_PRESS_LOST** Prevent losing press when the press is slid out of the objects. (E.g. a [Button](/widgets/btn) can be released out of it if it was being pressed) -- **LV_PROTECT_CLICK_FOCUS** Prevent automatically focusing the object if it's in a *Group* and click focus is enabled. -- **LV_PROTECT_CHILD_CHG** Disable the child change signal. Used internally by the library +-`LV_OBJ_FLAG_LAYOUT_1` Custom flag, free to use by layouts +-`LV_OBJ_FLAG_LAYOUT_2` Custom flag, free to use by layouts -The `lv_obj_add/clear_protect(obj, LV_PROTECT_...)` sets/clears the protection. You can use *'OR'ed* values of protection types too. +-`LV_OBJ_FLAG_WIDGET_1` Custom flag, free to use by widget +-`LV_OBJ_FLAG_WIDGET_2` Custom flag, free to use by widget + +-`LV_OBJ_FLAG_USER_1` Custom flag, free to use by user +-`LV_OBJ_FLAG_USER_2` Custom flag, free to use by user +-`LV_OBJ_FLAG_USER_3` Custom flag, free to use by user +-`LV_OBJ_FLAG_USER_4` Custom flag, free to use by usersection. + +Some examples: +```c +/*Hide on object*/ +lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN); + +/*Make an obejct non-clickable*/ +lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE); +``` ### Groups +Read the [Input devices overview](/overview/indev) to learn more about the *Groups*. + Once, an object is added to *group* with `lv_group_add_obj(group, obj)` the object's current group can be get with `lv_obj_get_group(obj)`. `lv_obj_is_focused(obj)` tells if the object is currently focused on its group or not. If the object is not added to a group, `false` will be returned. -Read the [Input devices overview](/overview/indev) to learn more about the *Groups*. ### Extended click area -By default, the objects can be clicked only on their coordinates, however, this area can be extended with `lv_obj_set_ext_click_area(obj, left, right, top, bottom)`. -`left/right/top/bottom` describes how far the clickable area should extend past the default in each direction. - -This feature needs to enabled in *lv_conf.h* with `LV_USE_EXT_CLICK_AREA`. The possible values are: -- **LV_EXT_CLICK_AREA_FULL** store all 4 coordinates as `lv_coord_t` -- **LV_EXT_CLICK_AREA_TINY** store only horizontal and vertical coordinates (use the greater value of left/right and top/bottom) as `uint8_t` -- **LV_EXT_CLICK_AREA_OFF** Disable this feature +By default, the objects can be clicked only on their coordinates, however, this area can be extended with `lv_obj_set_ext_click_area(obj, size)`. ## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. +- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the obejct clicked (on transition to/from the checked state) Learn more about [Events](/overview/event). ## Keys -No *Keys* are processed by the object type. +If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` makes the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` makes it unchecked. + Learn more about [Keys](/overview/indev). - ## Example ```eval_rst diff --git a/docs/widgets/objmask.md b/docs/widgets/objmask.md deleted file mode 100644 index adabdf82d..000000000 --- a/docs/widgets/objmask.md +++ /dev/null @@ -1,70 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/objmask.md -``` -# Object mask (lv_objmask) - -## Overview -The *Object mask* is capable of add some mask to drawings when its children is drawn. - -## Parts and Styles -The Object mask has only a main part called `LV_OBJMASK_PART_BG` and it uses the typical background style properties. - -## Usage - -### Adding mask - -Before adding a mask to the *Object mask* the mask should be initialized: -```c - lv_draw_mask__param_t mask_param; - lv_draw_mask__init(&mask_param, ...); - lv_objmask_mask_t * mask_p = lv_objmask_add_mask(objmask, &mask_param); -``` - -Lvgl supports the following mask types: -- **line** clip the pixels on the top/bottom left/right of a line. Can be initialized from two points or a point and an angle: -- **angle** keep the pixels only between a given start and end angle -- **radius** keep the pixel only inside a rectangle which can have radius (can for a circle too). Can be inverted to keep the pixel outside of the rectangle. -- **fade** fade vertically (change the pixels opacity according to their y position) -- **map** use an alpha mask (a byte array) to describe the pixels opacity. - -The coordinates in the mask are relative to the Object. That is if the object moves the masks move with it. - -For the details of the mask *init* function see the [API](#api) documentation below. - -### Update mask -AN existing mask can be updated with `lv_objmask_update_mask(objmask, mask_p, new_param)`, where `mask_p` is return value of `lv_objmask_add_mask`. - -### Remove mask -A mask can be removed with `lv_objmask_remove_mask(objmask, mask_p)` - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -Learn more about [Events](/overview/event). - -## Keys -No *Keys* are processed by the object type. - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_objmask/index.rst - - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_objmask.h - :project: lvgl - -.. doxygenfile:: lv_draw_mask.h - :project: lvgl - -``` diff --git a/docs/widgets/page.md b/docs/widgets/page.md deleted file mode 100644 index db681eb6e..000000000 --- a/docs/widgets/page.md +++ /dev/null @@ -1,111 +0,0 @@ -```eval_rst -.. include:: /header.rst -:github_url: |github_link_base|/widgets/page.md -``` -# Page (lv_page) - -## Overview - -The Page consist of two [Containers](/widgets/cont) on each other: -- a **background** -- a top which is **scrollable**. - -## Parts and Styles - -The Page's main part is called `LV_PAGE_PART_BG` which is the background of the Page. It uses all the typical background style properties. Using padding will add space on the sides. - -The scrollable object can be referenced via the `LV_PAGE_PART_SCRL` part. It also uses all the typical background style properties and padding to add space on the sides. - - -`LV_LIST_PART_SCROLLBAR` is a virtual part of the background to draw the scroll bars. Uses all the typical background style properties, *size* to set the width of the scroll bars, and *pad_right* and *pad_bottom* to set the spacing. - -`LV_LIST_PART_EDGE_FLASH`is also a virtual part of the background to draw a semicircle on the sides when the list can not be scrolled in that direction further. Uses all the typical background properties. - -## Usage - -The background object can be referenced as the page itself like. E.g. to set the page's width: `lv_obj_set_width(page, 100)`. - -If a child is created on the page it will be automatically moved to the scrollable container. -If the scrollable container becomes larger then the background it can be scrolled by dragging (like the lists on smartphones). - -By default, the scrollable's has `LV_FIT_MAX` fit in all directions. -It means the scrollable size will be the same as the background's size (minus the padding) while the children are in the background. -But when an object is positioned out of the background the scrollable size will be increased to involve it. - -### Scrollbars - -Scrollbars can be shown according to four policies: -- `LV_SCRLBAR_MODE_OFF` Never show scroll bars -- `LV_SCRLBAR_MODE_ON` Always show scroll bars -- `LV_SCRLBAR_MODE_DRAG` Show scroll bars when the page is being dragged -- `LV_SCRLBAR_MODE_AUTO` Show scroll bars when the scrollable container is large enough to be scrolled -- `LV_SCRLBAR_MODE_HIDE` Hide the scroll bar temporally -- `LV_SCRLBAR_MODE_UNHIDE` Unhide the previously hidden scrollbar. Recover the original mode too - -The scroll bar show policy can be changed by: `lv_page_set_scrlbar_mode(page, SB_MODE)`. The default value is `LV_SCRLBAR_MODE_AUTO`. - - -### Glue object -A children can be "glued" to the page. In this case, if the page can be scrolled by dragging that object. -It can be enabled by the `lv_page_glue_obj(child, true)`. - -### Focus object -An object on a page can be focused with `lv_page_focus(page, child, LV_ANIM_ONO/FF)`. -It will move the scrollable container to show a child. The time of the animation can be set by `lv_page_set_anim_time(page, anim_time)` in milliseconds. -`child` doesn't have to be a direct child of the page. This is it works if the scrollable object is the grandparent of the object too. - -### Manual navigation -You can move the scrollable object manually using `lv_page_scroll_hor(page, dist)` and `lv_page_scroll_ver(page, dist)` - -### Edge flash -A circle-like effect can be shown if the list reached the most top/bottom/left/right position. `lv_page_set_edge_flash(list, en)` enables this feature. - -### Scroll propagation - -If the list is created on an other scrollable element (like an other page) and the Page can't be scrolled further the scrolling can be propagated to the parent to continue the scrolling on the parent. -It can be enabled with `lv_page_set_scroll_propagation(list, true)` - -## Clean the page -All the object created on the page can be clean with `lv_page_clean(page)`. Note that `lv_obj_clean(page)` doesn't work here because it would delete the scrollable object too. - -### Scrollable API -There are functions to directly set/get the scrollable's attributes: -- `lv_page_get_scrl()` -- `lv_page_set_scrl_fit/fint2/fit4()` -- `lv_page_set_scrl_width()` -- `lv_page_set_scrl_height()` -- `lv_page_set_scrl_fit_width()` -- `lv_page_set_scrl_fit_height()` -- `lv_page_set_scrl_layout()` - -## Events -Only the [Generic events](../overview/event.html#generic-events) are sent by the object type. - -The scrollable object has a default event callback which propagates the following events to the background object: -`LV_EVENT_PRESSED`, `LV_EVENT_PRESSING`, `LV_EVENT_PRESS_LOST`,`LV_EVENT_RELEASED`, `LV_EVENT_SHORT_CLICKED`, `LV_EVENT_CLICKED`, `LV_EVENT_LONG_PRESSED`, `LV_EVENT_LONG_PRESSED_REPEAT` - -Learn more about [Events](/overview/event). - -##Keys - -The following *Keys* are processed by the Page: -- **LV_KEY_RIGHT/LEFT/UP/DOWN** Scroll the page - -Learn more about [Keys](/overview/indev). - -## Example - -```eval_rst - -.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_page/index.rst - -``` - -## API - -```eval_rst - -.. doxygenfile:: lv_page.h - :project: lvgl - -``` diff --git a/examples/get_started/lv_example_get_started_1.c b/examples/get_started/lv_example_get_started_1.c index 02f7896e1..c63e94d06 100644 --- a/examples/get_started/lv_example_get_started_1.c +++ b/examples/get_started/lv_example_get_started_1.c @@ -1,9 +1,11 @@ #include "../lv_examples.h" #if LV_BUILD_EXAMPLES && LV_USE_BTN -static void btn_event_cb(lv_obj_t * btn, lv_event_t event) +static void btn_event_cb(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * btn = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { static uint8_t cnt = 0; cnt++; @@ -21,7 +23,7 @@ void lv_example_get_started_1(void) lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/ lv_obj_set_pos(btn, 10, 10); /*Set its position*/ lv_obj_set_size(btn, 120, 50); /*Set its size*/ - lv_obj_add_event_cb(btn, btn_event_cb, NULL); /*Assign a callback to the button*/ + lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/ lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/ lv_label_set_text(label, "Button"); /*Set the labels text*/ diff --git a/examples/get_started/lv_example_get_started_2.c b/examples/get_started/lv_example_get_started_2.c index 03be645a6..f66a1cf88 100644 --- a/examples/get_started/lv_example_get_started_2.c +++ b/examples/get_started/lv_example_get_started_2.c @@ -14,8 +14,8 @@ void lv_example_get_started_2(void) lv_style_init(&style_btn); lv_style_set_radius(&style_btn, 10); lv_style_set_bg_opa(&style_btn, LV_OPA_COVER); - lv_style_set_bg_color(&style_btn, lv_color_grey_lighten_3()); - lv_style_set_bg_grad_color(&style_btn, lv_color_grey()); + lv_style_set_bg_color(&style_btn, lv_palette_lighten(LV_PALETTE_GREY, 3)); + lv_style_set_bg_grad_color(&style_btn, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_bg_grad_dir(&style_btn, LV_GRAD_DIR_VER); /*Add a border*/ @@ -28,19 +28,22 @@ void lv_example_get_started_2(void) /*Create a red style. Change only some colors.*/ lv_style_init(&style_btn_red); - lv_style_set_bg_color(&style_btn_red, lv_color_light_blue()); - lv_style_set_bg_grad_color(&style_btn_red, lv_color_light_blue_darken_3()); + lv_style_set_bg_color(&style_btn_red, lv_palette_main(LV_PALETTE_RED)); + lv_style_set_bg_grad_color(&style_btn_red, lv_palette_lighten(LV_PALETTE_RED, 2)); - /*Create a style for the pressed state. Add color filter to make every color darker*/ + /*Create a style for the pressed state.*/ lv_style_init(&style_btn_pressed); - lv_style_set_bg_color(&style_btn_red, lv_color_blue()); - lv_style_set_bg_grad_color(&style_btn_red, lv_color_blue_darken_3()); + lv_style_set_bg_color(&style_btn_pressed, lv_palette_main(LV_PALETTE_BLUE)); + lv_style_set_bg_grad_color(&style_btn_pressed, lv_palette_darken(LV_PALETTE_RED, 3)); /*Create a button and use the new styles*/ - lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/ + lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/ + /* Remove the styles coming from the theme + * Note that size and position are also stored as style properties + * so lv_obj_remove_style_all will remove the set size and position too */ + lv_obj_remove_style_all(btn); lv_obj_set_pos(btn, 10, 10); /*Set its position*/ lv_obj_set_size(btn, 120, 50); /*Set its size*/ - lv_obj_remove_style_all(btn); /*Remove the styles coming from the theme*/ lv_obj_add_style(btn, &style_btn, 0); lv_obj_add_style(btn, &style_btn_pressed, LV_STATE_PRESSED); @@ -50,9 +53,9 @@ void lv_example_get_started_2(void) /*Create an other button and use the red style too*/ lv_obj_t * btn2 = lv_btn_create(lv_scr_act()); + lv_obj_remove_style_all(btn2); /*Remove the styles coming from the theme*/ lv_obj_set_pos(btn2, 10, 80); lv_obj_set_size(btn2, 120, 50); /*Set its size*/ - lv_obj_remove_style_all(btn2); /*Remove the styles coming from the theme*/ lv_obj_add_style(btn2, &style_btn, 0); lv_obj_add_style(btn2, &style_btn_red, 0); lv_obj_add_style(btn2, &style_btn_pressed, LV_STATE_PRESSED); diff --git a/examples/get_started/lv_example_get_started_3.c b/examples/get_started/lv_example_get_started_3.c index f2e8355e2..853b879c7 100644 --- a/examples/get_started/lv_example_get_started_3.c +++ b/examples/get_started/lv_example_get_started_3.c @@ -3,13 +3,13 @@ static lv_obj_t * label; -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - /*Refresh the text*/ - lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); - lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/ - } + lv_obj_t * slider = lv_event_get_target(e); + + /*Refresh the text*/ + lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider)); + lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/ } /** @@ -21,7 +21,7 @@ void lv_example_get_started_3(void) lv_obj_t * slider = lv_slider_create(lv_scr_act()); lv_obj_set_width(slider, 200); /*Set the width*/ lv_obj_center(slider); /*Align to the center of the parent (screen)*/ - lv_obj_add_event_cb(slider, slider_event_cb, NULL); /*Assign an event function*/ + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/ /*Create a label below the slider*/ label = lv_label_create(lv_scr_act()); diff --git a/examples/layouts/flex/lv_example_flex_1.c b/examples/layouts/flex/lv_example_flex_1.c index 60c157e56..f9494da7d 100644 --- a/examples/layouts/flex/lv_example_flex_1.c +++ b/examples/layouts/flex/lv_example_flex_1.c @@ -24,16 +24,16 @@ void lv_example_flex_1(void) lv_obj_t * label; /*Add items to the row*/ - obj= lv_obj_create(cont_row); - lv_obj_set_size(obj, 100, LV_SIZE_PCT(100)); + obj= lv_btn_create(cont_row); + lv_obj_set_size(obj, 100, LV_PCT(100)); label = lv_label_create(obj); lv_label_set_text_fmt(label, "Item: %d", i); lv_obj_center(label); /*Add items to the column*/ - obj = lv_obj_create(cont_col); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_CONTENT); + obj = lv_btn_create(cont_col); + lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT); label = lv_label_create(obj); lv_label_set_text_fmt(label, "Item: %d", i); diff --git a/examples/layouts/flex/lv_example_flex_2.c b/examples/layouts/flex/lv_example_flex_2.c index deb7905e0..a449df2e4 100644 --- a/examples/layouts/flex/lv_example_flex_2.c +++ b/examples/layouts/flex/lv_example_flex_2.c @@ -9,7 +9,7 @@ void lv_example_flex_2(void) static lv_style_t style; lv_style_init(&style); lv_style_set_flex_flow(&style, LV_FLEX_FLOW_ROW_WRAP); - lv_style_set_flex_main_place(&style, LV_FLEX_PLACE_SPACE_EVENLY); + lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY); lv_style_set_layout(&style, LV_LAYOUT_FLEX); lv_obj_t * cont = lv_obj_create(lv_scr_act()); diff --git a/examples/layouts/grid/lv_example_grid_1.c b/examples/layouts/grid/lv_example_grid_1.c index 05ddcb4af..f3e5c3df6 100644 --- a/examples/layouts/grid/lv_example_grid_1.c +++ b/examples/layouts/grid/lv_example_grid_1.c @@ -25,11 +25,11 @@ void lv_example_grid_1(void) uint8_t col = i % 3; uint8_t row = i / 3; - obj = lv_obj_create(cont); + obj = lv_btn_create(cont); /*Stretch the cell horizontally and vertically too *Set span to 1 to make the cell 1 column/row sized*/ - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "c%d, r%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_2.c b/examples/layouts/grid/lv_example_grid_2.c index 09cd34c79..7e13a4007 100644 --- a/examples/layouts/grid/lv_example_grid_2.c +++ b/examples/layouts/grid/lv_example_grid_2.c @@ -22,40 +22,40 @@ void lv_example_grid_2(void) /*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1, - LV_GRID_START, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 0, 1, + LV_GRID_ALIGN_START, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c0, r0"); /*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1, - LV_GRID_CENTER, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 1, 1, + LV_GRID_ALIGN_CENTER, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c1, r0"); /*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1, - LV_GRID_END, 0, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 2, 1, + LV_GRID_ALIGN_END, 0, 1); label = lv_label_create(obj); lv_label_set_text(label, "c2, r0"); /*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2, - LV_GRID_STRETCH, 1, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 1, 2, + LV_GRID_ALIGN_STRETCH, 1, 1); label = lv_label_create(obj); lv_label_set_text(label, "c1-2, r1"); /*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/ obj = lv_obj_create(cont); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1, - LV_GRID_STRETCH, 1, 2); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1, + LV_GRID_ALIGN_STRETCH, 1, 2); label = lv_label_create(obj); lv_label_set_text(label, "c0\nr1-2"); } diff --git a/examples/layouts/grid/lv_example_grid_3.c b/examples/layouts/grid/lv_example_grid_3.c index 82cf2831a..36150dabe 100644 --- a/examples/layouts/grid/lv_example_grid_3.c +++ b/examples/layouts/grid/lv_example_grid_3.c @@ -32,8 +32,8 @@ void lv_example_grid_3(void) obj = lv_obj_create(cont); /*Stretch the cell horizontally and vertically too *Set span to 1 to make the cell 1 column/row sized*/ - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_4.c b/examples/layouts/grid/lv_example_grid_4.c index 55076c492..65fdb73b9 100644 --- a/examples/layouts/grid/lv_example_grid_4.c +++ b/examples/layouts/grid/lv_example_grid_4.c @@ -14,7 +14,7 @@ void lv_example_grid_4(void) /*Create a container with grid*/ lv_obj_t * cont = lv_obj_create(lv_scr_act()); - lv_obj_set_grid_place(cont, LV_GRID_SPACE_BETWEEN, LV_GRID_END); + lv_obj_set_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END); lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc); lv_obj_set_size(cont, 300, 220); lv_obj_center(cont); @@ -29,8 +29,8 @@ void lv_example_grid_4(void) obj = lv_obj_create(cont); /*Stretch the cell horizontally and vertically too *Set span to 1 to make the cell 1 column/row sized*/ - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/layouts/grid/lv_example_grid_5.c b/examples/layouts/grid/lv_example_grid_5.c index 5623f7170..b57057d5a 100644 --- a/examples/layouts/grid/lv_example_grid_5.c +++ b/examples/layouts/grid/lv_example_grid_5.c @@ -35,8 +35,8 @@ void lv_example_grid_5(void) uint8_t row = i / 3; obj = lv_obj_create(cont); - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); lv_obj_center(label); diff --git a/examples/layouts/grid/lv_example_grid_6.c b/examples/layouts/grid/lv_example_grid_6.c index 666adb4c4..59e678dd5 100644 --- a/examples/layouts/grid/lv_example_grid_6.c +++ b/examples/layouts/grid/lv_example_grid_6.c @@ -27,8 +27,8 @@ void lv_example_grid_6(void) obj = lv_obj_create(cont); /*Stretch the cell horizontally and vertically too *Set span to 1 to make the cell 1 column/row sized*/ - lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1, - LV_GRID_STRETCH, row, 1); + lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1, + LV_GRID_ALIGN_STRETCH, row, 1); label = lv_label_create(obj); lv_label_set_text_fmt(label, "%d,%d", col, row); diff --git a/examples/scroll/lv_example_scroll_2.c b/examples/scroll/lv_example_scroll_2.c index 932c26274..c39c15c08 100644 --- a/examples/scroll/lv_example_scroll_2.c +++ b/examples/scroll/lv_example_scroll_2.c @@ -1,10 +1,13 @@ #include "../lv_examples.h" #if LV_BUILD_EXAMPLES && LV_USE_FLEX -static void sw_event_cb(lv_obj_t * sw, lv_event_t e) +static void sw_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * list = lv_event_get_user_data(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * sw = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { + lv_obj_t * list = lv_event_get_user_data(e); if(lv_obj_has_state(sw, LV_STATE_CHECKED)) lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLL_ONE); else lv_obj_clear_flag(list, LV_OBJ_FLAG_SCROLL_ONE); @@ -43,7 +46,7 @@ void lv_example_scroll_2(void) /*Switch between "One scroll" and "Normal scroll" mode*/ lv_obj_t * sw = lv_switch_create(lv_scr_act()); lv_obj_align(sw, LV_ALIGN_TOP_RIGHT, -20, 10); - lv_obj_add_event_cb(sw, sw_event_cb, panel); + lv_obj_add_event_cb(sw, sw_event_cb, LV_EVENT_ALL, panel); lv_obj_t * label = lv_label_create(lv_scr_act()); lv_label_set_text(label, "One scroll"); lv_obj_align_to(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index 98f47ac19..89a0696f3 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -3,10 +3,13 @@ static uint32_t btn_cnt = 1; -static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e) +static void float_btn_event_cb(lv_event_t * e) { - if(e == LV_EVENT_CLICKED) { - lv_obj_t * list = lv_event_get_user_data(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * float_btn = lv_event_get_target(e); + + if(code == LV_EVENT_CLICKED) { + lv_obj_t * list = lv_event_get_user_data(e); char buf[32]; lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt); lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf, NULL); @@ -37,7 +40,7 @@ void lv_example_scroll_3(void) lv_obj_set_size(float_btn, 50, 50); lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING); lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, 0, -lv_obj_get_style_pad_right(list, LV_PART_MAIN)); - lv_obj_add_event_cb(float_btn, float_btn_event_cb, list); + lv_obj_add_event_cb(float_btn, float_btn_event_cb, LV_EVENT_ALL, list); lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_bg_img_src(float_btn, LV_SYMBOL_PLUS, 0); lv_obj_set_style_text_font(float_btn, lv_theme_get_font_large(float_btn), 0); diff --git a/examples/styles/lv_example_style_1.c b/examples/styles/lv_example_style_1.c index eed41f227..108946b3f 100644 --- a/examples/styles/lv_example_style_1.c +++ b/examples/styles/lv_example_style_1.c @@ -12,8 +12,8 @@ void lv_example_style_1(void) /*Make a gradient*/ lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); - lv_style_set_bg_grad_color(&style, lv_color_blue()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); + lv_style_set_bg_grad_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); /*Shift the gradient to the bottom*/ diff --git a/examples/styles/lv_example_style_10.c b/examples/styles/lv_example_style_10.c index e46d35823..1e53bb2b8 100644 --- a/examples/styles/lv_example_style_10.c +++ b/examples/styles/lv_example_style_10.c @@ -15,7 +15,7 @@ typedef int _keep_pedantic_happy; // lv_style_set_bg_color(&style, LV_STATE_DEFAULT, lv_color_grey_lighten_3()); // // /*Set different background color in pressed state*/ -// lv_style_set_bg_color(&style, LV_STATE_PRESSED, lv_color_grey()); +// lv_style_set_bg_color(&style, LV_STATE_PRESSED, lv_palette_main(LV_PALETTE_GREY)); // // /*Set different transition time in default and pressed state // *fast press, slower revert to default*/ diff --git a/examples/styles/lv_example_style_11.c b/examples/styles/lv_example_style_11.c index b5e7c2db2..c6267c2cf 100644 --- a/examples/styles/lv_example_style_11.c +++ b/examples/styles/lv_example_style_11.c @@ -9,7 +9,7 @@ void lv_example_style_11(void) static lv_style_t style; lv_style_init(&style); - lv_style_set_arc_color(&style, lv_color_red()); + lv_style_set_arc_color(&style, lv_palette_main(LV_PALETTE_RED)); lv_style_set_arc_width(&style, 4); diff --git a/examples/styles/lv_example_style_2.c b/examples/styles/lv_example_style_2.c index e5a46c1f3..3ef34b389 100644 --- a/examples/styles/lv_example_style_2.c +++ b/examples/styles/lv_example_style_2.c @@ -12,10 +12,10 @@ void lv_example_style_2(void) /*Set a background color and a radius*/ lv_style_set_radius(&style, 10); lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); /*Add border to the bottom+right*/ - lv_style_set_border_color(&style, lv_color_blue()); + lv_style_set_border_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_border_width(&style, 5); lv_style_set_border_opa(&style, LV_OPA_50); lv_style_set_border_side(&style, LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_RIGHT); diff --git a/examples/styles/lv_example_style_3.c b/examples/styles/lv_example_style_3.c index ae7b6d125..4df900a67 100644 --- a/examples/styles/lv_example_style_3.c +++ b/examples/styles/lv_example_style_3.c @@ -12,11 +12,11 @@ void lv_example_style_3(void) /*Set a background color and a radius*/ lv_style_set_radius(&style, 5); lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); /*Add outline*/ lv_style_set_outline_width(&style, 2); - lv_style_set_outline_color(&style, lv_color_blue()); + lv_style_set_outline_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_outline_pad(&style, 8); /*Create an object with the new style*/ diff --git a/examples/styles/lv_example_style_4.c b/examples/styles/lv_example_style_4.c index 4a587229b..1a8d5451b 100644 --- a/examples/styles/lv_example_style_4.c +++ b/examples/styles/lv_example_style_4.c @@ -12,11 +12,11 @@ void lv_example_style_4(void) /*Set a background color and a radius*/ lv_style_set_radius(&style, 5); lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); /*Add a shadow*/ lv_style_set_shadow_width(&style, 8); - lv_style_set_shadow_color(&style, lv_color_blue()); + lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_shadow_ofs_x(&style, 10); lv_style_set_shadow_ofs_y(&style, 20); diff --git a/examples/styles/lv_example_style_7.c b/examples/styles/lv_example_style_7.c index c1d4260c1..97d551a47 100644 --- a/examples/styles/lv_example_style_7.c +++ b/examples/styles/lv_example_style_7.c @@ -11,12 +11,12 @@ void lv_example_style_7(void) lv_style_set_radius(&style, 5); lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); lv_style_set_border_width(&style, 2); - lv_style_set_border_color(&style, lv_color_blue()); + lv_style_set_border_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_pad_all(&style, 10); - lv_style_set_text_color(&style, lv_color_blue()); + lv_style_set_text_color(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_text_letter_space(&style, 5); lv_style_set_text_line_space(&style, 20); lv_style_set_text_decor(&style, LV_TEXT_DECOR_UNDERLINE); diff --git a/examples/styles/lv_example_style_8.c b/examples/styles/lv_example_style_8.c index bb4d2b385..5eefef9b3 100644 --- a/examples/styles/lv_example_style_8.c +++ b/examples/styles/lv_example_style_8.c @@ -9,7 +9,7 @@ void lv_example_style_8(void) static lv_style_t style; lv_style_init(&style); - lv_style_set_line_color(&style, lv_color_grey()); + lv_style_set_line_color(&style, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_line_width(&style, 6); lv_style_set_line_rounded(&style, true); diff --git a/examples/styles/lv_example_style_9.c b/examples/styles/lv_example_style_9.c index 8c1599528..40c1181c8 100644 --- a/examples/styles/lv_example_style_9.c +++ b/examples/styles/lv_example_style_9.c @@ -12,11 +12,11 @@ void lv_example_style_9(void) /*Set a background color and a radius*/ lv_style_set_radius(&style, 5); lv_style_set_bg_opa(&style, LV_OPA_COVER); - lv_style_set_bg_color(&style, lv_color_grey_lighten_3()); + lv_style_set_bg_color(&style, lv_palette_lighten(LV_PALETTE_GREY, 3)); lv_style_set_border_width(&style, 2); - lv_style_set_border_color(&style, lv_color_blue()); + lv_style_set_border_color(&style, lv_palette_main(LV_PALETTE_BLUE)); - lv_style_set_img_recolor(&style, lv_color_blue()); + lv_style_set_img_recolor(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_img_recolor_opa(&style, LV_OPA_50); lv_style_set_transform_angle(&style, 300); diff --git a/examples/widgets/bar/lv_example_bar_2.c b/examples/widgets/bar/lv_example_bar_2.c index 4e8390169..2688cc2d9 100644 --- a/examples/widgets/bar/lv_example_bar_2.c +++ b/examples/widgets/bar/lv_example_bar_2.c @@ -10,7 +10,7 @@ void lv_example_bar_2(void) static lv_style_t style_indic; lv_style_init(&style_bg); - lv_style_set_border_color(&style_bg, lv_color_blue()); + lv_style_set_border_color(&style_bg, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_border_width(&style_bg, 2); lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/ lv_style_set_radius(&style_bg, 6); @@ -18,7 +18,7 @@ void lv_example_bar_2(void) lv_style_init(&style_indic); lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); - lv_style_set_bg_color(&style_indic, lv_color_blue()); + lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_radius(&style_indic, 3); lv_obj_t * bar = lv_bar_create(lv_scr_act()); diff --git a/examples/widgets/bar/lv_example_bar_3.c b/examples/widgets/bar/lv_example_bar_3.c index 9484dc7a4..eaa8487a5 100644 --- a/examples/widgets/bar/lv_example_bar_3.c +++ b/examples/widgets/bar/lv_example_bar_3.c @@ -4,10 +4,6 @@ static void set_temp(void * bar, int32_t temp) { lv_bar_set_value(bar, temp, LV_ANIM_ON); - - static char buf[10]; /*Only the pointer t saved so must be static*/ - lv_snprintf(buf, sizeof(buf), "%d°C", temp); -// lv_obj_set_style_content_text(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, buf); } /** @@ -19,12 +15,9 @@ void lv_example_bar_3(void) lv_style_init(&style_indic); lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); - lv_style_set_bg_color(&style_indic, lv_color_red()); - lv_style_set_bg_grad_color(&style_indic, lv_color_blue()); + lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_RED)); + lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER); -// lv_style_set_content_align(&style_indic, LV_ALIGN_OUT_LEFT_TOP); -// lv_style_set_content_ofs_x(&style_indic, -3); -// lv_style_set_content_color(&style_indic, lv_color_grey()); lv_obj_t * bar = lv_bar_create(lv_scr_act()); lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR); diff --git a/examples/widgets/bar/lv_example_bar_5.c b/examples/widgets/bar/lv_example_bar_5.c index 4fdef341c..35d637ae2 100644 --- a/examples/widgets/bar/lv_example_bar_5.c +++ b/examples/widgets/bar/lv_example_bar_5.c @@ -6,20 +6,27 @@ */ void lv_example_bar_5(void) { + lv_obj_t * label; + + lv_obj_t * bar_ltr = lv_bar_create(lv_scr_act()); lv_obj_set_size(bar_ltr, 200, 20); lv_bar_set_value(bar_ltr, 70, LV_ANIM_OFF); lv_obj_align(bar_ltr, LV_ALIGN_CENTER, 0, -30); -// lv_obj_add_style(bar_ltr, &style_bg); -// lv_obj_set_style_content_text(bar_ltr, "Left to Right base direction"); + + label = lv_label_create(lv_scr_act()); + lv_label_set_text(label, "Left to Right base direction"); + lv_obj_align_to(label, bar_ltr, LV_ALIGN_OUT_TOP_MID, 0, -5); lv_obj_t * bar_rtl = lv_bar_create(lv_scr_act()); lv_obj_set_base_dir(bar_rtl, LV_BIDI_DIR_RTL); lv_obj_set_size(bar_rtl, 200, 20); lv_bar_set_value(bar_rtl, 70, LV_ANIM_OFF); lv_obj_align(bar_rtl, LV_ALIGN_CENTER, 0, 30); -// lv_obj_add_style(bar_rtl, &style_bg); -// lv_obj_set_style_content_text(bar_rtl, "Right to Left base direction"); + + label = lv_label_create(lv_scr_act()); + lv_label_set_text(label, "Right to Left base direction"); + lv_obj_align_to(label, bar_rtl, LV_ALIGN_OUT_TOP_MID, 0, -5); } #endif diff --git a/examples/widgets/bar/lv_example_bar_6.c b/examples/widgets/bar/lv_example_bar_6.c index 0d6ed7159..b79f52b13 100644 --- a/examples/widgets/bar/lv_example_bar_6.c +++ b/examples/widgets/bar/lv_example_bar_6.c @@ -1,72 +1,67 @@ #include "../../lv_examples.h" #if LV_USE_BAR && LV_BUILD_EXAMPLES -//static void set_value(void *bar, int32_t v) -//{ -// lv_bar_set_value(bar, v, LV_ANIM_OFF); -//} +static void set_value(void *bar, int32_t v) +{ + lv_bar_set_value(bar, v, LV_ANIM_OFF); +} -//static void event_cb(lv_obj_t * obj, lv_event_t e) -//{ -// if(e == LV_EVENT_DRAW_POST_END) { -// lv_bar_t * bar = (lv_bar_t *)obj; -// -// lv_draw_label_dsc_t dsc; -// lv_draw_label_dsc_init(&dsc); -// dsc.font = LV_FONT_DEFAULT; -// -// char buf[8]; -// lv_snprintf(buf, sizeof(buf), "%d", lv_bar_get_value(obj)); -// -// lv_point_t txt_size; -// lv_txt_get_size(&txt_size, buf, dsc.font, dsc.letter_space, dsc.line_space, LV_COORD_MAX, dsc.flag); -// -// lv_area_t txt_area; -// /*If the indicator is long enough put the text inside on the right*/ -// if(lv_area_get_width(&bar->indic_area) > txt_size.x + 20) { -// txt_area.x2 = bar->indic_area.x2 - 5; -// txt_area.x1 = txt_area.x2 - txt_size.x + 1; -// dsc.color = lv_color_white(); -// } -// /*If the indicator is still short put the text out of it on the right*/ -// else { -// txt_area.x1 = bar->indic_area.x2 + 5; -// txt_area.x2 = txt_area.x1 + txt_size.x - 1; -// dsc.color = lv_color_black(); -// } -// -// txt_area.y1 = bar->indic_area.y1 + (lv_area_get_height(&bar->indic_area) - txt_size.y) / 2; -// txt_area.y2 = txt_area.y1 + txt_size.y - 1; -// -// const lv_area_t * clip_area = lv_event_get_param(); -// lv_draw_label(&txt_area, clip_area, &dsc, buf, NULL); -// } -//} +static void event_cb(lv_event_t * e) +{ + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part != LV_PART_INDICATOR) return; + + lv_obj_t * obj= lv_event_get_target(e); + + lv_draw_label_dsc_t label_dsc; + lv_draw_label_dsc_init(&label_dsc); + label_dsc.font = LV_FONT_DEFAULT; + + char buf[8]; + lv_snprintf(buf, sizeof(buf), "%d", lv_bar_get_value(obj)); + + lv_point_t txt_size; + lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag); + + lv_area_t txt_area; + /*If the indicator is long enough put the text inside on the right*/ + if(lv_area_get_width(dsc->draw_area) > txt_size.x + 20) { + txt_area.x2 = dsc->draw_area->x2 - 5; + txt_area.x1 = txt_area.x2 - txt_size.x + 1; + label_dsc.color = lv_color_white(); + } + /*If the indicator is still short put the text out of it on the right*/ + else { + txt_area.x1 = dsc->draw_area->x2 + 5; + txt_area.x2 = txt_area.x1 + txt_size.x - 1; + label_dsc.color = lv_color_black(); + } + + txt_area.y1 = dsc->draw_area->y1 + (lv_area_get_height(dsc->draw_area) - txt_size.y) / 2; + txt_area.y2 = txt_area.y1 + txt_size.y - 1; + + lv_draw_label(&txt_area, dsc->clip_area, &label_dsc, buf, NULL); +} /** - * Custom drawer on bar to display the current value + * Custom drawer on the bar to display the current value */ void lv_example_bar_6(void) { -// static lv_style_t style_bg; -// lv_style_init(&style_bg); -// lv_style_set_content_ofs_y(&style_bg, -3); -// lv_style_set_content_align(&style_bg, LV_ALIGN_OUT_TOP_MID); -// -// lv_obj_t * bar = lv_bar_create(lv_scr_act()); -// lv_obj_add_event_cb(bar, event_cb, NULL); -// lv_obj_set_size(bar, 200, 20); -// lv_obj_align(bar, NULL, LV_ALIGN_CENTER, 0, 0); -// -// lv_anim_t a; -// lv_anim_init(&a); -// lv_anim_set_var(&a, bar); -// lv_anim_set_values(&a, 0, 100); -// lv_anim_set_exec_cb(&a, set_value); -// lv_anim_set_time(&a, 2000); -// lv_anim_set_playback_time(&a, 2000); -// lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); -// lv_anim_start(&a); + lv_obj_t * bar = lv_bar_create(lv_scr_act()); + lv_obj_add_event_cb(bar, event_cb, LV_EVENT_DRAW_PART_END, NULL); + lv_obj_set_size(bar, 200, 20); + lv_obj_center(bar); + + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_var(&a, bar); + lv_anim_set_values(&a, 0, 100); + lv_anim_set_exec_cb(&a, set_value); + lv_anim_set_time(&a, 2000); + lv_anim_set_playback_time(&a, 2000); + lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); + lv_anim_start(&a); } diff --git a/examples/widgets/btn/lv_example_btn_1.c b/examples/widgets/btn/lv_example_btn_1.c index d02dd18a6..1845e2094 100644 --- a/examples/widgets/btn/lv_example_btn_1.c +++ b/examples/widgets/btn/lv_example_btn_1.c @@ -1,13 +1,14 @@ #include "../../lv_examples.h" #if LV_USE_BTN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - LV_UNUSED(obj); - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Clicked"); } - else if(event == LV_EVENT_VALUE_CHANGED) { + else if(code == LV_EVENT_VALUE_CHANGED) { LV_LOG_USER("Toggled"); } } @@ -17,7 +18,7 @@ void lv_example_btn_1(void) lv_obj_t * label; lv_obj_t * btn1 = lv_btn_create(lv_scr_act()); - lv_obj_add_event_cb(btn1, event_handler, NULL); + lv_obj_add_event_cb(btn1, event_handler, LV_EVENT_ALL, NULL); lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -40); label = lv_label_create(btn1); @@ -25,7 +26,7 @@ void lv_example_btn_1(void) lv_obj_center(label); lv_obj_t * btn2 = lv_btn_create(lv_scr_act()); - lv_obj_add_event_cb(btn2, event_handler, NULL); + lv_obj_add_event_cb(btn2, event_handler, LV_EVENT_ALL, NULL); lv_obj_align(btn2, LV_ALIGN_CENTER, 0, 40); lv_obj_add_flag(btn2, LV_OBJ_FLAG_CHECKABLE); lv_obj_set_height(btn2, LV_SIZE_CONTENT); diff --git a/examples/widgets/btn/lv_example_btn_2.c b/examples/widgets/btn/lv_example_btn_2.c index eeece57d3..21e27ac82 100644 --- a/examples/widgets/btn/lv_example_btn_2.c +++ b/examples/widgets/btn/lv_example_btn_2.c @@ -1,5 +1,4 @@ #include "../../lv_examples.h" -#include #if LV_USE_BTN && LV_BUILD_EXAMPLES /** @@ -7,50 +6,53 @@ */ void lv_example_btn_2(void) { - static lv_style_transition_dsc_t trans; - static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0}; - lv_style_transition_dsc_init(&trans, props, &lv_anim_path_def, 300, 0); - + /*Init the style for the default state*/ static lv_style_t style; lv_style_init(&style); + + lv_style_set_radius(&style, 3); + + lv_style_set_bg_opa(&style, LV_OPA_100); + lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_BLUE)); + lv_style_set_bg_grad_color(&style, lv_palette_darken(LV_PALETTE_BLUE, 2)); + lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); + + lv_style_set_border_opa(&style, LV_OPA_40); + lv_style_set_border_width(&style, 2); + lv_style_set_border_color(&style, lv_palette_main(LV_PALETTE_GREY)); + + lv_style_set_shadow_width(&style, 8); + lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_GREY)); + lv_style_set_shadow_ofs_y(&style, 8); + lv_style_set_outline_opa(&style, LV_OPA_COVER); - lv_style_set_outline_color(&style, lv_color_blue()); + lv_style_set_outline_color(&style, lv_palette_main(LV_PALETTE_BLUE)); - static lv_style_t style_pr; - lv_style_init(&style_pr); - lv_style_set_outline_width(&style_pr, 30); - lv_style_set_outline_opa(&style_pr, LV_OPA_TRANSP); - lv_style_set_transition(&style_pr, &trans); - -// -// /*Init the default style*/ -// lv_style_set_radius(&style, 3); -// -// lv_style_set_bg_opa(&style, LV_OPA_100); -// lv_style_set_bg_color(&style, lv_color_blue()); -// lv_style_set_bg_grad_color(&style, lv_color_blue_darken_2()); -// lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); -// -// lv_style_set_border_opa(&style, LV_OPA_40); -// lv_style_set_border_width(&style, 2); -// lv_style_set_border_color(&style, lv_color_grey()); -// -// lv_style_set_shadow_width(&style, 8); -// lv_style_set_shadow_color(&style, lv_color_grey()); -// lv_style_set_shadow_ofs_y(&style, 8); -// -// lv_style_set_text_color(&style, lv_color_white()); -// -// lv_style_set_pad_all(&style, 10); -// lv_style_set_pad_all(&style_pr, 40); + lv_style_set_text_color(&style, lv_color_white()); + lv_style_set_pad_all(&style, 10); /*Init the pressed style*/ + static lv_style_t style_pr; + lv_style_init(&style_pr); + + /*Ad a large outline when pressed*/ + lv_style_set_outline_width(&style_pr, 30); + lv_style_set_outline_opa(&style_pr, LV_OPA_TRANSP); + + lv_style_set_translate_y(&style_pr, 5); lv_style_set_shadow_ofs_y(&style_pr, 3); - lv_style_set_bg_color(&style_pr, lv_color_blue_darken_2()); - lv_style_set_bg_grad_color(&style_pr, lv_color_blue_darken_4()); + lv_style_set_bg_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 2)); + lv_style_set_bg_grad_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 4)); + + /*Add a transition to the the outline*/ + static lv_style_transition_dsc_t trans; + static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0}; + lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, 300, 0); + + lv_style_set_transition(&style_pr, &trans); lv_obj_t * btn1 = lv_btn_create(lv_scr_act()); -// lv_obj_remove_style(btn1, LV_PART_ANY, LV_STATE_ANY, NULL); + lv_obj_remove_style_all(btn1); /*Remove the style coming from the theme*/ lv_obj_add_style(btn1, &style, 0); lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED); lv_obj_set_size(btn1, LV_SIZE_CONTENT, LV_SIZE_CONTENT); diff --git a/examples/widgets/btn/lv_example_btn_3.c b/examples/widgets/btn/lv_example_btn_3.c index 3c4485cb3..49ee2b1e3 100644 --- a/examples/widgets/btn/lv_example_btn_3.c +++ b/examples/widgets/btn/lv_example_btn_3.c @@ -1,5 +1,4 @@ #include "../../lv_examples.h" -#include #if LV_BUILD_EXAMPLES && LV_USE_BTN /** @@ -12,25 +11,15 @@ void lv_example_btn_3(void) LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0 }; - /*Define animation paths*/ - static lv_anim_path_t path_ease_in_out; - lv_anim_path_init(&path_ease_in_out); - lv_anim_path_set_cb(&path_ease_in_out, lv_anim_path_ease_in_out); - - static lv_anim_path_t path_overshoot; - lv_anim_path_init(&path_overshoot); - lv_anim_path_set_cb(&path_overshoot, lv_anim_path_overshoot); - - /*Transition descriptor when going back to the default state. *Add some delay to be sure the press transition is visible even if the press was very short*/ static lv_style_transition_dsc_t transition_dsc_def; - lv_style_transition_dsc_init(&transition_dsc_def, props, &path_overshoot, 250, 100); + lv_style_transition_dsc_init(&transition_dsc_def, props, lv_anim_path_overshoot, 250, 100); /*Transition descriptor when going to pressed state. *No delay, go to presses state immediately*/ static lv_style_transition_dsc_t transition_dsc_pr; - lv_style_transition_dsc_init(&transition_dsc_pr, props, &path_ease_in_out, 250, 0); + lv_style_transition_dsc_init(&transition_dsc_pr, props, lv_anim_path_ease_in_out, 250, 0); /*Add only the new transition to he default state*/ static lv_style_t style_def; diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c index 74e5ed7fe..3119ede17 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { uint32_t id = lv_btnmatrix_get_selected_btn(obj); const char * txt = lv_btnmatrix_get_btn_text(obj, id); @@ -24,7 +26,7 @@ void lv_example_btnmatrix_1(void) lv_btnmatrix_set_btn_ctrl(btnm1, 10, LV_BTNMATRIX_CTRL_CHECKABLE); lv_btnmatrix_set_btn_ctrl(btnm1, 11, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align(btnm1, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(btnm1, event_handler, NULL); + lv_obj_add_event_cb(btnm1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c index 8a2173fad..67cd23e44 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c @@ -2,16 +2,18 @@ #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_PART_BEGIN) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*Change the draw descriptor the 2nd button*/ if(dsc->id == 1) { dsc->rect_dsc->radius = 0; - if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3(); - else dsc->rect_dsc->bg_color = lv_color_blue(); + if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_palette_darken(LV_PALETTE_GREY, 3); + else dsc->rect_dsc->bg_color = lv_palette_main(LV_PALETTE_BLUE); dsc->rect_dsc->shadow_width = 6; dsc->rect_dsc->shadow_ofs_x = 3; @@ -21,8 +23,8 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) /*Change the draw descriptor the 3rd button*/ else if(dsc->id == 2) { dsc->rect_dsc->radius = LV_RADIUS_CIRCLE; - if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3(); - else dsc->rect_dsc->bg_color = lv_color_red(); + if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_palette_darken(LV_PALETTE_RED, 3); + else dsc->rect_dsc->bg_color = lv_palette_main(LV_PALETTE_RED); dsc->label_dsc->color = lv_color_white(); } @@ -31,8 +33,8 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) } } - if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); /*Add custom content to the 4th button when the button itself was drawn*/ if(dsc->id == 3) { @@ -63,7 +65,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) void lv_example_btnmatrix_2(void) { lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act()); - lv_obj_add_event_cb(btnm, event_cb, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_ALL, NULL); lv_obj_center(btnm); } diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c index 025b408da..242e98d7e 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c @@ -1,24 +1,23 @@ #include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - uint32_t id = lv_btnmatrix_get_selected_btn(obj); - bool prev = id == 0 ? true : false; - bool next = id == 6 ? true : false; - if(prev || next) { - /*Find the checked button*/ - uint32_t i; - for(i = 1; i < 7; i++) { - if(lv_btnmatrix_has_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED)) break; - } - - if(prev && i > 1) i--; - else if(next && i < 5) i++; - - lv_btnmatrix_set_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED); + lv_obj_t * obj = lv_event_get_target(e); + uint32_t id = lv_btnmatrix_get_selected_btn(obj); + bool prev = id == 0 ? true : false; + bool next = id == 6 ? true : false; + if(prev || next) { + /*Find the checked button*/ + uint32_t i; + for(i = 1; i < 7; i++) { + if(lv_btnmatrix_has_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED)) break; } + + if(prev && i > 1) i--; + else if(next && i < 5) i++; + + lv_btnmatrix_set_btn_ctrl(obj, i, LV_BTNMATRIX_CTRL_CHECKED); } } @@ -41,7 +40,7 @@ void lv_example_btnmatrix_3(void) lv_style_set_radius(&style_btn, 0); lv_style_set_border_width(&style_btn, 1); lv_style_set_border_opa(&style_btn, LV_OPA_50); - lv_style_set_border_color(&style_btn, lv_color_grey()); + lv_style_set_border_color(&style_btn, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_border_side(&style_btn, LV_BORDER_SIDE_INTERNAL); lv_style_set_radius(&style_btn, 0); @@ -51,7 +50,7 @@ void lv_example_btnmatrix_3(void) lv_btnmatrix_set_map(btnm, map); lv_obj_add_style(btnm, &style_bg, 0); lv_obj_add_style(btnm, &style_btn, LV_PART_ITEMS); - lv_obj_add_event_cb(btnm, event_cb, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(btnm, 225, 35); /*Allow selecting on one number at time*/ diff --git a/examples/widgets/calendar/lv_example_calendar_1.c b/examples/widgets/calendar/lv_example_calendar_1.c index da1a80481..6ccd7976c 100644 --- a/examples/widgets/calendar/lv_example_calendar_1.c +++ b/examples/widgets/calendar/lv_example_calendar_1.c @@ -1,9 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_CALENDAR && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { lv_calendar_date_t date; if(lv_calendar_get_pressed_date(obj, &date)) { LV_LOG_USER("Clicked date: %02d.%02d.%d", date.day, date.month, date.year); @@ -16,7 +19,7 @@ void lv_example_calendar_1(void) lv_obj_t * calendar = lv_calendar_create(lv_scr_act()); lv_obj_set_size(calendar, 200, 200); lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 20); - lv_obj_add_event_cb(calendar, event_handler, NULL); + lv_obj_add_event_cb(calendar, event_handler, LV_EVENT_ALL, NULL); lv_calendar_set_today_date(calendar, 2021, 02, 23); lv_calendar_set_showed_date(calendar, 2021, 02); diff --git a/examples/widgets/canvas/lv_example_canvas_1.c b/examples/widgets/canvas/lv_example_canvas_1.c index c60a16db7..1a421ac10 100644 --- a/examples/widgets/canvas/lv_example_canvas_1.c +++ b/examples/widgets/canvas/lv_example_canvas_1.c @@ -12,8 +12,8 @@ void lv_example_canvas_1(void) rect_dsc.radius = 10; rect_dsc.bg_opa = LV_OPA_COVER; rect_dsc.bg_grad_dir = LV_GRAD_DIR_HOR; - rect_dsc.bg_color = lv_color_red(); - rect_dsc.bg_grad_color = lv_color_blue(); + rect_dsc.bg_color = lv_palette_main(LV_PALETTE_RED); + rect_dsc.bg_grad_color = lv_palette_main(LV_PALETTE_BLUE); rect_dsc.border_width = 2; rect_dsc.border_opa = LV_OPA_90; rect_dsc.border_color = lv_color_white(); @@ -23,14 +23,14 @@ void lv_example_canvas_1(void) lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_init(&label_dsc); - label_dsc.color = lv_color_yellow(); + label_dsc.color = lv_palette_main(LV_PALETTE_YELLOW); static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)]; lv_obj_t * canvas = lv_canvas_create(lv_scr_act()); lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR); lv_obj_center(canvas); - lv_canvas_fill_bg(canvas, lv_color_grey_lighten_3(), LV_OPA_COVER); + lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER); lv_canvas_draw_rect(canvas, 70, 60, 100, 70, &rect_dsc); @@ -46,7 +46,7 @@ void lv_example_canvas_1(void) img.header.w = CANVAS_WIDTH; img.header.h = CANVAS_HEIGHT; - lv_canvas_fill_bg(canvas, lv_color_grey_lighten_3(), LV_OPA_COVER); + lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER); lv_canvas_transform(canvas, &img, 30, LV_IMG_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true); } diff --git a/examples/widgets/canvas/lv_example_canvas_2.c b/examples/widgets/canvas/lv_example_canvas_2.c index a25322911..e6d387879 100644 --- a/examples/widgets/canvas/lv_example_canvas_2.c +++ b/examples/widgets/canvas/lv_example_canvas_2.c @@ -19,7 +19,7 @@ void lv_example_canvas_2(void) lv_obj_t * canvas = lv_canvas_create(lv_scr_act()); lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT); lv_canvas_set_palette(canvas, 0, LV_COLOR_CHROMA_KEY); - lv_canvas_set_palette(canvas, 1, lv_color_red()); + lv_canvas_set_palette(canvas, 1, lv_palette_main(LV_PALETTE_RED)); /*Create colors with the indices of the palette*/ lv_color_t c0; diff --git a/examples/widgets/chart/lv_example_chart_1.c b/examples/widgets/chart/lv_example_chart_1.c index 96bf7d561..710698217 100644 --- a/examples/widgets/chart/lv_example_chart_1.c +++ b/examples/widgets/chart/lv_example_chart_1.c @@ -11,8 +11,8 @@ void lv_example_chart_1(void) lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green(), LV_CHART_AXIS_SECONDARY_Y); + lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_SECONDARY_Y); /*Set the next points on 'ser1'*/ lv_chart_set_next_value(chart, ser1, 10); diff --git a/examples/widgets/chart/lv_example_chart_2.c b/examples/widgets/chart/lv_example_chart_2.c index 1e32e54aa..029b5f3aa 100644 --- a/examples/widgets/chart/lv_example_chart_2.c +++ b/examples/widgets/chart/lv_example_chart_2.c @@ -5,12 +5,13 @@ static lv_obj_t * chart1; static lv_chart_series_t * ser1; static lv_chart_series_t * ser2; -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void draw_event_cb(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); + /*Add the faded area before the lines are drawn*/ - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); - if(dsc->part != LV_PART_ITEMS) return; + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_ITEMS) { if(!dsc->p1 || !dsc->p2) return; /*Add a line mask that keeps the area below the line*/ @@ -41,6 +42,44 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) lv_draw_mask_remove_id(line_mask_id); lv_draw_mask_remove_id(fade_mask_id); } + /*Hook the division lines too*/ + else if(dsc->part == LV_PART_MAIN) { + if(dsc->line_dsc == NULL) return; + + /*Vertical line*/ + if(dsc->p1->x == dsc->p2->x) { + dsc->line_dsc->color = lv_palette_lighten(LV_PALETTE_GREY, 1); + if(dsc->id == 3) { + dsc->line_dsc->width = 2; + dsc->line_dsc->dash_gap = 0; + dsc->line_dsc->dash_width = 0; + } + else { + dsc->line_dsc->width = 1; + dsc->line_dsc->dash_gap = 6; + dsc->line_dsc->dash_width = 6; + } + } + /*Horizontal line*/ + else { + if(dsc->id == 2) { + dsc->line_dsc->width = 2; + dsc->line_dsc->dash_gap = 0; + dsc->line_dsc->dash_width = 0; + } + else { + dsc->line_dsc->width = 2; + dsc->line_dsc->dash_gap = 6; + dsc->line_dsc->dash_width = 6; + } + + if(dsc->id == 1 || dsc->id == 3) { + dsc->line_dsc->color = lv_palette_main(LV_PALETTE_GREEN); + } else { + dsc->line_dsc->color = lv_palette_lighten(LV_PALETTE_GREY, 1); + } + } + } } static void add_data(lv_timer_t * timer) @@ -55,7 +94,7 @@ static void add_data(lv_timer_t * timer) } /** - * Add a faded area effect to the line chart + * Add a faded area effect to the line chart and make some division lines ticker */ void lv_example_chart_2(void) { @@ -65,12 +104,14 @@ void lv_example_chart_2(void) lv_obj_center(chart1); lv_chart_set_type(chart1, LV_CHART_TYPE_LINE); /*Show lines and points too*/ - lv_obj_add_event_cb(chart1, event_cb, NULL); + lv_chart_set_div_line_count(chart1, 5, 7); + + lv_obj_add_event_cb(chart1, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); lv_chart_set_update_mode(chart1, LV_CHART_UPDATE_MODE_CIRCULAR); /*Add two data series*/ - ser1 = lv_chart_add_series(chart1, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); - ser2 = lv_chart_add_series(chart1, lv_color_blue(), LV_CHART_AXIS_SECONDARY_Y); + ser1 = lv_chart_add_series(chart1, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); + ser2 = lv_chart_add_series(chart1, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_SECONDARY_Y); uint32_t i; for(i = 0; i < 10; i++) { diff --git a/examples/widgets/chart/lv_example_chart_3.c b/examples/widgets/chart/lv_example_chart_3.c index 08f22a28f..8dec5591b 100644 --- a/examples/widgets/chart/lv_example_chart_3.c +++ b/examples/widgets/chart/lv_example_chart_3.c @@ -1,15 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * chart, lv_event_t e) +static void draw_event_cb(lv_event_t * e) { - LV_UNUSED(chart); - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); - if(dsc->part == LV_PART_TICKS && dsc->id == LV_CHART_AXIS_X) { - const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; - lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]); - } + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_TICKS && dsc->id == LV_CHART_AXIS_X) { + const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}; + lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]); } } @@ -27,7 +24,7 @@ void lv_example_chart_3(void) lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100); lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 0, 400); lv_chart_set_point_count(chart, 12); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); /*Add ticks and label to every axis*/ lv_chart_set_axis_tick(chart, LV_CHART_AXIS_X, 10, 5, 12, 3, true, 40); @@ -38,8 +35,8 @@ void lv_example_chart_3(void) lv_chart_set_zoom_x(chart, 800); /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_green_lighten_2(), LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green_darken_2(), LV_CHART_AXIS_SECONDARY_Y); + lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_lighten(LV_PALETTE_GREEN, 2), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_darken(LV_PALETTE_GREEN, 2), LV_CHART_AXIS_SECONDARY_Y); /*Set the next points on 'ser1'*/ lv_chart_set_next_value(chart, ser1, 31); diff --git a/examples/widgets/chart/lv_example_chart_4.c b/examples/widgets/chart/lv_example_chart_4.c index cee75bd77..e1f9cf48b 100644 --- a/examples/widgets/chart/lv_example_chart_4.c +++ b/examples/widgets/chart/lv_example_chart_4.c @@ -2,16 +2,19 @@ #if LV_USE_CHART && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * chart, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * chart = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { lv_obj_invalidate(chart); } - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, 20); } - else if(e == LV_EVENT_DRAW_POST_END) { + else if(code == LV_EVENT_DRAW_POST_END) { int32_t id = lv_chart_get_pressed_point(chart); if(id == LV_CHART_POINT_NONE) return; @@ -42,7 +45,7 @@ static void event_cb(lv_obj_t * chart, lv_event_t e) a.y1 = chart->coords.y1 + p.y - 30; a.y2 = chart->coords.y1 + p.y - 10; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect(&a, clip_area, &draw_rect_dsc); ser = lv_chart_get_series_next(chart, ser); @@ -61,15 +64,15 @@ void lv_example_chart_4(void) lv_obj_set_size(chart, 200, 150); lv_obj_center(chart); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(chart); /*Zoom in a little in X*/ lv_chart_set_zoom_x(chart, 800); /*Add two data series*/ - lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); - lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green(), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_PRIMARY_Y); uint32_t i; for(i = 0; i < 10; i++) { lv_chart_set_next_value(chart, ser1, lv_rand(60,90)); diff --git a/examples/widgets/chart/lv_example_chart_5.c b/examples/widgets/chart/lv_example_chart_5.c index d4eedee7f..f384d79f0 100644 --- a/examples/widgets/chart/lv_example_chart_5.c +++ b/examples/widgets/chart/lv_example_chart_5.c @@ -46,19 +46,18 @@ static const lv_coord_t ecg_sample[] = { 70, 74, 76, 79, 82, 79, 75, 62, }; -static void slider_x_event_cb(lv_obj_t * obj, lv_event_t e) +static void slider_x_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - int32_t v = lv_slider_get_value(obj); - lv_chart_set_zoom_x(chart, v); - } + lv_obj_t * obj = lv_event_get_target(e); + int32_t v = lv_slider_get_value(obj); + lv_chart_set_zoom_x(chart, v); } -static void slider_y_event_cb(lv_obj_t * obj, lv_event_t e) +static void slider_y_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - lv_chart_set_zoom_y(chart, lv_slider_get_value(obj)); - } + lv_obj_t * obj = lv_event_get_target(e); + int32_t v = lv_slider_get_value(obj); + lv_chart_set_zoom_y(chart, v); } /** @@ -75,9 +74,9 @@ void lv_example_chart_5(void) lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, -1000, 1000); /*Do not display points on the data*/ - lv_obj_set_style_size(chart, 0, LV_PART_ITEMS); + lv_obj_set_style_size(chart, 0, LV_PART_INDICATOR); - lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); + lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); uint32_t pcnt = sizeof(ecg_sample) / sizeof(ecg_sample[0]); lv_chart_set_point_count(chart, pcnt); @@ -86,13 +85,13 @@ void lv_example_chart_5(void) lv_obj_t * slider; slider = lv_slider_create(lv_scr_act()); lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); - lv_obj_add_event_cb(slider, slider_x_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(slider, lv_obj_get_width(chart), 10); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); slider = lv_slider_create(lv_scr_act()); lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); - lv_obj_add_event_cb(slider, slider_y_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(slider, 10, lv_obj_get_height(chart)); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0); } diff --git a/examples/widgets/chart/lv_example_chart_6.c b/examples/widgets/chart/lv_example_chart_6.c index 9297164ef..a4d2dd6eb 100644 --- a/examples/widgets/chart/lv_example_chart_6.c +++ b/examples/widgets/chart/lv_example_chart_6.c @@ -5,10 +5,13 @@ static lv_obj_t * chart; static lv_chart_series_t * ser; static lv_chart_cursor_t * cursor; -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void event_cb(lv_event_t * e) { static int32_t last_id = -1; - if(e == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_VALUE_CHANGED) { last_id = lv_chart_get_pressed_point(obj); if(last_id != LV_CHART_POINT_NONE) { lv_point_t p; @@ -16,8 +19,8 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) lv_chart_set_cursor_point(obj, cursor, &p); } } - else if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); if(dsc->part == LV_PART_CURSOR && dsc->p1 && dsc->p2 && dsc->p1->y == dsc->p2->y && last_id >= 0) { lv_coord_t * data_array = lv_chart_get_array(chart, ser); lv_coord_t v = data_array[last_id]; @@ -35,7 +38,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e) lv_draw_rect_dsc_t draw_rect_dsc; lv_draw_rect_dsc_init(&draw_rect_dsc); - draw_rect_dsc.bg_color = lv_color_blue(); + draw_rect_dsc.bg_color = lv_palette_main(LV_PALETTE_BLUE); draw_rect_dsc.radius = 3; lv_draw_rect(&a, dsc->clip_area, &draw_rect_dsc); @@ -64,12 +67,12 @@ void lv_example_chart_6(void) lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 5, true, 40); lv_chart_set_axis_tick(chart, LV_CHART_AXIS_X, 10, 5, 10, 1, true, 30); - lv_obj_add_event_cb(chart, event_cb, NULL); + lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(chart); - cursor = lv_chart_add_cursor(chart, lv_color_blue(), LV_DIR_LEFT | LV_DIR_BOTTOM); + cursor = lv_chart_add_cursor(chart, lv_palette_main(LV_PALETTE_BLUE), LV_DIR_LEFT | LV_DIR_BOTTOM); - ser = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y); + ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); uint32_t i; for(i = 0; i < 10; i++) { lv_chart_set_next_value(chart, ser, lv_rand(10,90)); @@ -80,7 +83,6 @@ void lv_example_chart_6(void) lv_obj_t * label = lv_label_create(lv_scr_act()); lv_label_set_text(label, "Click on a point"); lv_obj_align_to(label, chart, LV_ALIGN_OUT_TOP_MID, 0, -5); - } #endif diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index 50cd4cca7..ff59bd99c 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -1,39 +1,43 @@ #include "../../lv_examples.h" #if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { const char * txt = lv_checkbox_get_text(obj); const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked"; - LV_LOG_USER("%s: %s\n", txt, state); + LV_LOG_USER("%s: %s", txt, state); } } void lv_example_checkbox_1(void) { lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER); + lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER); lv_obj_t * cb; cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Apple"); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Banana"); lv_obj_add_state(cb, LV_STATE_CHECKED); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_checkbox_set_text(cb, "Lemon"); lv_obj_add_state(cb, LV_STATE_DISABLED); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_scr_act()); lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_checkbox_set_text(cb, "Melon"); - lv_obj_add_event_cb(cb, event_handler, NULL); + lv_checkbox_set_text(cb, "Melon\nand a new line"); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); + + lv_obj_update_layout(cb); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_1.c b/examples/widgets/dropdown/lv_example_dropdown_1.c index 8d68569f6..f35b337d3 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_1.c +++ b/examples/widgets/dropdown/lv_example_dropdown_1.c @@ -1,14 +1,14 @@ #include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { -#if LV_USE_LOG /*To avoid warnings if LV_LOG_USER is empty*/ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Option: %s", buf); -#endif } } @@ -29,7 +29,7 @@ void lv_example_dropdown_1(void) "Nuts"); lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); - lv_obj_add_event_cb(dd, event_handler, NULL); + lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_3.c b/examples/widgets/dropdown/lv_example_dropdown_3.c index 7cd3285d9..5010f1fd1 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_3.c +++ b/examples/widgets/dropdown/lv_example_dropdown_3.c @@ -1,13 +1,12 @@ #include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * dropdown, lv_event_t e) +static void event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - char buf[64]; - lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); - LV_LOG_USER("'%s' is selected", buf); - } + lv_obj_t * dropdown = lv_event_get_target(e); + char buf[64]; + lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); + LV_LOG_USER("'%s' is selected", buf); } /** @@ -36,7 +35,7 @@ void lv_example_dropdown_3(void) /*In a menu we don't need to show the last clicked item*/ lv_dropdown_set_selected_highlight(dropdown, false); - lv_obj_add_event_cb(dropdown, event_cb, NULL); + lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL); } #endif diff --git a/examples/widgets/img/lv_example_img_2.c b/examples/widgets/img/lv_example_img_2.c index 686d7d9d5..756ef0312 100644 --- a/examples/widgets/img/lv_example_img_2.c +++ b/examples/widgets/img/lv_example_img_2.c @@ -2,7 +2,7 @@ #if LV_USE_IMG && LV_USE_SLIDER && LV_BUILD_EXAMPLES static lv_obj_t * create_slider(lv_color_t color); -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); +static void slider_event_cb(lv_event_t * e); static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider; static lv_obj_t * img1; @@ -14,10 +14,10 @@ static lv_obj_t * img1; void lv_example_img_2(void) { /*Create 4 sliders to adjust RGB color and re-color intensity*/ - red_slider = create_slider(lv_color_red()); - green_slider = create_slider(lv_color_green()); - blue_slider = create_slider(lv_color_blue()); - intense_slider = create_slider(lv_color_grey()); + red_slider = create_slider(lv_palette_main(LV_PALETTE_RED)); + green_slider = create_slider(lv_palette_main(LV_PALETTE_GREEN)); + blue_slider = create_slider(lv_palette_main(LV_PALETTE_BLUE)); + intense_slider = create_slider(lv_palette_main(LV_PALETTE_GREY)); lv_slider_set_value(red_slider, LV_OPA_20, LV_ANIM_OFF); lv_slider_set_value(green_slider, LV_OPA_90, LV_ANIM_OFF); @@ -38,17 +38,15 @@ void lv_example_img_2(void) lv_event_send(intense_slider, LV_EVENT_VALUE_CHANGED, NULL); } -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - LV_UNUSED(slider); + LV_UNUSED(e); - if(event == LV_EVENT_VALUE_CHANGED) { - /*Recolor the image based on the sliders' values*/ - lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); - lv_opa_t intense = lv_slider_get_value(intense_slider); - lv_obj_set_style_img_recolor_opa(img1, intense, 0); - lv_obj_set_style_img_recolor(img1, color, 0); - } + /*Recolor the image based on the sliders' values*/ + lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider)); + lv_opa_t intense = lv_slider_get_value(intense_slider); + lv_obj_set_style_img_recolor_opa(img1, intense, 0); + lv_obj_set_style_img_recolor(img1, color, 0); } static lv_obj_t * create_slider(lv_color_t color) @@ -58,7 +56,7 @@ static lv_obj_t * create_slider(lv_color_t color) lv_obj_set_size(slider, 10, 200); lv_obj_set_style_bg_color(slider, color, LV_PART_KNOB); lv_obj_set_style_bg_color(slider, lv_color_darken(color, LV_OPA_40), LV_PART_INDICATOR); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); return slider; } diff --git a/examples/widgets/img/lv_example_img_4.c b/examples/widgets/img/lv_example_img_4.c index 38f9ab05f..3abc021f2 100644 --- a/examples/widgets/img/lv_example_img_4.c +++ b/examples/widgets/img/lv_example_img_4.c @@ -15,7 +15,7 @@ void lv_example_img_4(void) static lv_style_t style; lv_style_init(&style); - lv_style_set_bg_color(&style, lv_color_yellow()); + lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_YELLOW)); lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_img_recolor_opa(&style, LV_OPA_COVER); lv_style_set_img_recolor(&style, lv_color_black()); diff --git a/examples/widgets/imgbtn/lv_example_imgbtn_1.c b/examples/widgets/imgbtn/lv_example_imgbtn_1.c index 9ac3358d0..ef51b3f5c 100644 --- a/examples/widgets/imgbtn/lv_example_imgbtn_1.c +++ b/examples/widgets/imgbtn/lv_example_imgbtn_1.c @@ -10,7 +10,7 @@ void lv_example_imgbtn_1(void) /*Create a transition animation on width transformation and recolor.*/ static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0}; static lv_style_transition_dsc_t tr; - lv_style_transition_dsc_init(&tr, tr_prop, &lv_anim_path_def, 200, 0); + lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 200, 0); static lv_style_t style_def; lv_style_init(&style_def); diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.c b/examples/widgets/keyboard/lv_example_keyboard_1.c index a19424757..dbcdecea5 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.c +++ b/examples/widgets/keyboard/lv_example_keyboard_1.c @@ -1,15 +1,17 @@ #include "../../lv_examples.h" #if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t e) +static void ta_event_cb(lv_event_t * e) { - lv_obj_t * kb = lv_event_get_user_data(); - if(e == LV_EVENT_FOCUSED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * ta = lv_event_get_target(e); + lv_obj_t * kb = lv_event_get_user_data(e); + if(code == LV_EVENT_FOCUSED) { lv_keyboard_set_textarea(kb, ta); lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN); } - if(e == LV_EVENT_DEFOCUSED) { + if(code == LV_EVENT_DEFOCUSED) { lv_keyboard_set_textarea(kb, NULL); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); } @@ -24,12 +26,12 @@ void lv_example_keyboard_1(void) lv_obj_t * ta; ta = lv_textarea_create(lv_scr_act()); lv_obj_align(ta, LV_ALIGN_TOP_LEFT, 10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_textarea_set_placeholder_text(ta, "Hello"); ta = lv_textarea_create(lv_scr_act()); lv_obj_align(ta, LV_ALIGN_TOP_RIGHT, -10, 10); - lv_obj_add_event_cb(ta, ta_event_cb, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_keyboard_set_textarea(kb, ta); } diff --git a/examples/widgets/led/lv_example_led_1.c b/examples/widgets/led/lv_example_led_1.c index 183c48ce1..f06f31ef2 100644 --- a/examples/widgets/led/lv_example_led_1.c +++ b/examples/widgets/led/lv_example_led_1.c @@ -15,7 +15,7 @@ void lv_example_led_1(void) lv_obj_t * led2 = lv_led_create(lv_scr_act()); lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0); lv_led_set_brightness(led2, 150); - lv_led_set_color(led2, lv_color_red()); + lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED)); /*Copy the previous LED and switch it ON*/ lv_obj_t * led3 = lv_led_create(lv_scr_act()); diff --git a/examples/widgets/line/lv_example_line_1.c b/examples/widgets/line/lv_example_line_1.c index 07057349e..9c120a293 100644 --- a/examples/widgets/line/lv_example_line_1.c +++ b/examples/widgets/line/lv_example_line_1.c @@ -10,7 +10,7 @@ void lv_example_line_1(void) static lv_style_t style_line; lv_style_init(&style_line); lv_style_set_line_width(&style_line, 8); - lv_style_set_line_color(&style_line, lv_color_blue()); + lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_line_rounded(&style_line, true); /*Create a line and apply the new style*/ diff --git a/examples/widgets/list/lv_example_list_1.c b/examples/widgets/list/lv_example_list_1.c index b7cea3d26..5ad51a298 100644 --- a/examples/widgets/list/lv_example_list_1.c +++ b/examples/widgets/list/lv_example_list_1.c @@ -2,9 +2,11 @@ #if LV_USE_LIST && LV_BUILD_EXAMPLES static lv_obj_t * list1; -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Clicked: %s", lv_list_get_btn_text(list1, obj)); } } diff --git a/examples/widgets/meter/lv_example_meter_1.c b/examples/widgets/meter/lv_example_meter_1.c index 61f79b50c..9f47538a4 100644 --- a/examples/widgets/meter/lv_example_meter_1.c +++ b/examples/widgets/meter/lv_example_meter_1.c @@ -15,36 +15,37 @@ void lv_example_meter_1(void) { meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); + lv_obj_set_size(meter, 200, 200); /*Add a scale first*/ lv_meter_scale_t * scale = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale, 51, 2, 10, lv_color_grey()); + lv_meter_set_scale_ticks(meter, scale, 51, 2, 10, lv_palette_main(LV_PALETTE_GREY)); lv_meter_set_scale_major_ticks(meter, scale, 10, 4, 15, lv_color_black(), 10); lv_meter_indicator_t * indic; /*Add a blue arc to the start*/ - indic = lv_meter_add_arc(meter, scale, 3, lv_color_blue(), 0); + indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_BLUE), 0); lv_meter_set_indicator_start_value(meter, indic, 0); lv_meter_set_indicator_end_value(meter, indic, 20); /*Make the tick lines blue at the start of the scale*/ - indic = lv_meter_add_scale_lines(meter, scale, lv_color_blue(), lv_color_blue(), false, 0); + indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_BLUE), false, 0); lv_meter_set_indicator_start_value(meter, indic, 0); lv_meter_set_indicator_end_value(meter, indic, 20); /*Add a red arc to the end*/ - indic = lv_meter_add_arc(meter, scale, 3, lv_color_red(), 0); + indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_RED), 0); lv_meter_set_indicator_start_value(meter, indic, 80); lv_meter_set_indicator_end_value(meter, indic, 100); /*Make the tick lines red at the end of the scale*/ - indic = lv_meter_add_scale_lines(meter, scale, lv_color_red(), lv_color_red(), false, 0); + indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_RED), lv_palette_main(LV_PALETTE_RED), false, 0); lv_meter_set_indicator_start_value(meter, indic, 80); lv_meter_set_indicator_end_value(meter, indic, 100); /*Add a needle line indicator*/ - indic = lv_meter_add_needle_line(meter, scale, 4, lv_color_grey(), -10); + indic = lv_meter_add_needle_line(meter, scale, 4, lv_palette_main(LV_PALETTE_GREY), -10); /*Create an animation to set the value*/ lv_anim_t a; diff --git a/examples/widgets/meter/lv_example_meter_2.c b/examples/widgets/meter/lv_example_meter_2.c index 1be0e639f..1caf68759 100644 --- a/examples/widgets/meter/lv_example_meter_2.c +++ b/examples/widgets/meter/lv_example_meter_2.c @@ -16,20 +16,21 @@ void lv_example_meter_2(void) { meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); + lv_obj_set_size(meter, 200, 200); /*Remove the circle from the middle*/ lv_obj_remove_style(meter, NULL, LV_PART_INDICATOR); /*Add a scale first*/ lv_meter_scale_t * scale = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, lv_color_grey()); + lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, lv_palette_main(LV_PALETTE_GREY)); lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10); lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90); /*Add a three arc indicator*/ - lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_color_red(), 0); - lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_color_green(), -10); - lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_color_blue(), -20); + lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_RED), 0); + lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_GREEN), -10); + lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_BLUE), -20); /*Create an animation to set the value*/ lv_anim_t a; diff --git a/examples/widgets/meter/lv_example_meter_3.c b/examples/widgets/meter/lv_example_meter_3.c index 10e965bc1..b41058280 100644 --- a/examples/widgets/meter/lv_example_meter_3.c +++ b/examples/widgets/meter/lv_example_meter_3.c @@ -8,24 +8,24 @@ static void set_value(void * indic, int32_t v) lv_meter_set_indicator_end_value(meter, indic, v); } - /** * A clock from a meter */ void lv_example_meter_3(void) { meter = lv_meter_create(lv_scr_act()); + lv_obj_set_size(meter, 220, 220); lv_obj_center(meter); /*Create a scale for the minutes*/ /*61 ticks in a 360 degrees range (the last and the first line overlaps)*/ lv_meter_scale_t * scale_min = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, lv_color_grey()); + lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, lv_palette_main(LV_PALETTE_GREY)); lv_meter_set_scale_range(meter, scale_min, 0, 60, 360, 270); /*Create an other scale for the hours. It's only visual and contains only major ticks*/ lv_meter_scale_t * scale_hour = lv_meter_add_scale(meter); - lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, lv_color_grey()); /*12 ticks*/ + lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, lv_palette_main(LV_PALETTE_GREY)); /*12 ticks*/ lv_meter_set_scale_major_ticks(meter, scale_hour, 1, 2, 20, lv_color_black(), 10); /*Every tick is major*/ lv_meter_set_scale_range(meter, scale_hour, 1, 12, 330, 300); /*[1..12] values in an almost full circle*/ diff --git a/examples/widgets/meter/lv_example_meter_4.c b/examples/widgets/meter/lv_example_meter_4.c index 15543ced9..03b841e15 100644 --- a/examples/widgets/meter/lv_example_meter_4.c +++ b/examples/widgets/meter/lv_example_meter_4.c @@ -7,12 +7,14 @@ void lv_example_meter_4(void) { lv_obj_t * meter = lv_meter_create(lv_scr_act()); - lv_obj_center(meter); /*Remove the background and the circle from the middle*/ lv_obj_remove_style(meter, NULL, LV_PART_MAIN); lv_obj_remove_style(meter, NULL, LV_PART_INDICATOR); + lv_obj_set_size(meter, 200, 200); + lv_obj_center(meter); + /*Add a scale first with no ticks.*/ lv_meter_scale_t * scale = lv_meter_add_scale(meter); lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black()); @@ -20,15 +22,15 @@ void lv_example_meter_4(void) /*Add a three arc indicator*/ lv_coord_t indic_w = lv_obj_get_width(meter) / 2; - lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_color_orange(), 0); + lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w,lv_palette_main(LV_PALETTE_ORANGE), 0); lv_meter_set_indicator_start_value(meter, indic1, 0); lv_meter_set_indicator_end_value(meter, indic1, 40); - lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, lv_color_yellow(), 0); + lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, lv_palette_main(LV_PALETTE_YELLOW), 0); lv_meter_set_indicator_start_value(meter, indic2, 40); /*Start from the previous*/ lv_meter_set_indicator_end_value(meter, indic2, 80); - lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, lv_color_deep_orange(), 0); + lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, lv_palette_main(LV_PALETTE_DEEP_ORANGE), 0); lv_meter_set_indicator_start_value(meter, indic3, 80); /*Start from the previous*/ lv_meter_set_indicator_end_value(meter, indic3, 100); } diff --git a/examples/widgets/msgbox/lv_example_msgbox_1.c b/examples/widgets/msgbox/lv_example_msgbox_1.c index 15ec5adab..e3674a6e8 100644 --- a/examples/widgets/msgbox/lv_example_msgbox_1.c +++ b/examples/widgets/msgbox/lv_example_msgbox_1.c @@ -1,19 +1,18 @@ #include "../../lv_examples.h" #if LV_USE_MSGBOX && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t event) +static void event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); - } + lv_obj_t * obj = lv_event_get_current_target(e); + LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); } void lv_example_msgbox_1(void) { static const char * btns[] ={"Apply", "Close", ""}; - lv_obj_t * mbox1 = lv_msgbox_create("Hello", "This is a message box with two buttons.", btns, true); - lv_obj_add_event_cb(mbox1, event_cb, NULL); + lv_obj_t * mbox1 = lv_msgbox_create(NULL, "Hello", "This is a message box with two buttons.", btns, true); + lv_obj_add_event_cb(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_center(mbox1); } diff --git a/examples/widgets/obj/lv_example_obj_1.c b/examples/widgets/obj/lv_example_obj_1.c index 133718871..5cc7571da 100644 --- a/examples/widgets/obj/lv_example_obj_1.c +++ b/examples/widgets/obj/lv_example_obj_1.c @@ -12,7 +12,7 @@ void lv_example_obj_1(void) lv_style_init(&style_shadow); lv_style_set_shadow_width(&style_shadow, 10); lv_style_set_shadow_spread(&style_shadow, 5); - lv_style_set_shadow_color(&style_shadow, lv_color_blue()); + lv_style_set_shadow_color(&style_shadow, lv_palette_main(LV_PALETTE_BLUE)); lv_obj_t * obj3; obj3 = lv_obj_create(lv_scr_act()); diff --git a/examples/widgets/roller/lv_example_roller_1.c b/examples/widgets/roller/lv_example_roller_1.c index fb00d746e..2aa3523a8 100644 --- a/examples/widgets/roller/lv_example_roller_1.c +++ b/examples/widgets/roller/lv_example_roller_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_ROLLER && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Selected month: %s\n", buf); @@ -33,7 +35,7 @@ void lv_example_roller_1(void) lv_roller_set_visible_row_count(roller1, 4); lv_obj_center(roller1); - lv_obj_add_event_cb(roller1, event_handler, NULL); + lv_obj_add_event_cb(roller1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/roller/lv_example_roller_2.c b/examples/widgets/roller/lv_example_roller_2.c index 2c1d2457b..55712b754 100644 --- a/examples/widgets/roller/lv_example_roller_2.c +++ b/examples/widgets/roller/lv_example_roller_2.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_ROLLER && LV_FONT_MONTSERRAT_22 && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_selected_str(obj, buf, sizeof(buf)); LV_LOG_USER("Selected value: %s\n", buf); @@ -31,7 +33,7 @@ void lv_example_roller_2(void) lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_LEFT, 0); lv_obj_align(roller, LV_ALIGN_LEFT_MID, 10, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 2, LV_ANIM_OFF); /*A roller on the middle with center aligned text, and auto (default) width*/ @@ -40,7 +42,7 @@ void lv_example_roller_2(void) lv_roller_set_visible_row_count(roller, 3); lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_align(roller, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 5, LV_ANIM_OFF); /*A roller on the right with right aligned text, and custom width*/ @@ -51,7 +53,7 @@ void lv_example_roller_2(void) lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_align(roller, LV_ALIGN_RIGHT_MID, -10, 0); - lv_obj_add_event_cb(roller, event_handler, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 8, LV_ANIM_OFF); } diff --git a/examples/widgets/slider/lv_example_slider_1.c b/examples/widgets/slider/lv_example_slider_1.c index 0b9a5d4a5..b8f661bbf 100644 --- a/examples/widgets/slider/lv_example_slider_1.c +++ b/examples/widgets/slider/lv_example_slider_1.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_SLIDER && LV_BUILD_EXAMPLES -static void slider_event_cb(lv_obj_t * slider, lv_event_t event); +static void slider_event_cb(lv_event_t * e); static lv_obj_t * slider_label; /** @@ -12,7 +12,7 @@ void lv_example_slider_1(void) /*Create a slider in the center of the display*/ lv_obj_t * slider = lv_slider_create(lv_scr_act()); lv_obj_center(slider); - lv_obj_add_event_cb(slider, slider_event_cb, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Create a label below the slider*/ slider_label = lv_label_create(lv_scr_act()); @@ -21,14 +21,13 @@ void lv_example_slider_1(void) lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } -static void slider_event_cb(lv_obj_t * slider, lv_event_t event) +static void slider_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - char buf[8]; - lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); - lv_label_set_text(slider_label, buf); - lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - } + lv_obj_t * slider = lv_event_get_target(e); + char buf[8]; + lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider)); + lv_label_set_text(slider_label, buf); + lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } #endif diff --git a/examples/widgets/slider/lv_example_slider_2.c b/examples/widgets/slider/lv_example_slider_2.c index 6dc750050..183ca3b56 100644 --- a/examples/widgets/slider/lv_example_slider_2.c +++ b/examples/widgets/slider/lv_example_slider_2.c @@ -1,41 +1,57 @@ #include "../../lv_examples.h" -//#if LV_USE_SLIDER && LV_BUILD_EXAMPLES -// -//static void slider_event_cb(lv_obj_t * slider, lv_event_t event); -// -//static lv_style_t style_pr; -//static lv_style_t style_def; -// -///** -// * Show the current value when the slider if pressed using a fancy style transition. -// */ +#if LV_USE_SLIDER && LV_BUILD_EXAMPLES + + + +/** + * Show how to style a slider. + */ void lv_example_slider_2(void) { -// lv_style_init(&style_def); -// lv_style_set_content_opa(&style_def, LV_OPA_TRANSP); -// lv_style_set_content_align(&style_def, LV_ALIGN_OUT_TOP_MID); -// -// lv_style_init(&style_pr); -// lv_style_set_content_opa(&style_pr, LV_OPA_COVER); -// lv_style_set_content_ofs_y(&style_pr, -15); -// -// /*Create a slider in the center of the display*/ -// lv_obj_t * slider; -// slider = lv_slider_create(lv_scr_act()); -// lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_add_event_cb(slider, slider_event_cb, NULL); -// -// lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_DEFAULT, &style_def); -// lv_obj_add_style(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style_pr); + /*Create a transition*/ + static const lv_style_prop_t props[] = {LV_STYLE_BG_COLOR, 0}; + static lv_style_transition_dsc_t transition_dsc; + lv_style_transition_dsc_init(&transition_dsc, props, lv_anim_path_linear, 300, 0); + + static lv_style_t style_main; + static lv_style_t style_indicator; + static lv_style_t style_knob; + static lv_style_t style_pressed_color; + lv_style_init(&style_main); + lv_style_set_bg_opa(&style_main, LV_OPA_COVER); + lv_style_set_bg_color(&style_main, lv_color_hex3(0xbbb)); + lv_style_set_radius(&style_main, LV_RADIUS_CIRCLE); + lv_style_set_pad_ver(&style_main, -2); /*Makes the indicator larger*/ + + lv_style_init(&style_indicator); + lv_style_set_bg_opa(&style_indicator, LV_OPA_COVER); + lv_style_set_bg_color(&style_indicator, lv_palette_main(LV_PALETTE_CYAN)); + lv_style_set_radius(&style_indicator, LV_RADIUS_CIRCLE); + lv_style_set_transition(&style_indicator, &transition_dsc); + + lv_style_init(&style_knob); + lv_style_set_bg_opa(&style_knob, LV_OPA_COVER); + lv_style_set_bg_color(&style_knob, lv_palette_main(LV_PALETTE_CYAN)); + lv_style_set_border_color(&style_knob, lv_palette_darken(LV_PALETTE_CYAN, 3)); + lv_style_set_border_width(&style_knob, 2); + lv_style_set_radius(&style_knob, LV_RADIUS_CIRCLE); + lv_style_set_pad_all(&style_knob, 6); /*Makes the knob larger*/ + lv_style_set_transition(&style_knob, &transition_dsc); + + lv_style_init(&style_pressed_color); + lv_style_set_bg_color(&style_pressed_color, lv_palette_darken(LV_PALETTE_CYAN, 2)); + + /*Create a slider and add the style*/ + lv_obj_t * slider = lv_slider_create(lv_scr_act()); + lv_obj_remove_style_all(slider); /*Remove the styles coming from the theme*/ + + lv_obj_add_style(slider, &style_main, LV_PART_MAIN); + lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR); + lv_obj_add_style(slider, &style_pressed_color, LV_PART_INDICATOR | LV_STATE_PRESSED); + lv_obj_add_style(slider, &style_knob, LV_PART_KNOB); + lv_obj_add_style(slider, &style_pressed_color, LV_PART_KNOB | LV_STATE_PRESSED); + + lv_obj_center(slider); } -// -//static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -//{ -// if(event == LV_EVENT_VALUE_CHANGED) { -// static char buf[8]; -// lv_snprintf(buf, sizeof(buf), "%u", lv_slider_get_value(slider)); -// lv_obj_set_style_content_text(slider, LV_PART_KNOB, LV_STATE_DEFAULT, buf); -// } -//} -// -//#endif + +#endif diff --git a/examples/widgets/slider/lv_example_slider_3.c b/examples/widgets/slider/lv_example_slider_3.c index fbf1facaf..cb854c4fe 100644 --- a/examples/widgets/slider/lv_example_slider_3.c +++ b/examples/widgets/slider/lv_example_slider_3.c @@ -1,39 +1,57 @@ #include "../../lv_examples.h" -//#if LV_USE_SLIDER && LV_BUILD_EXAMPLES -// -//static void slider_event_cb(lv_obj_t * slider, lv_event_t event); -// -///** -// * Show the current value when the slider if pressed (using only styles). -// * -// */ +#if LV_USE_SLIDER && LV_BUILD_EXAMPLES + +static void slider_event_cb(lv_event_t * e); + +/** + * Show the current value when the slider if pressed by extending the drawer + * + */ void lv_example_slider_3(void) { -// /*Create a slider in the center of the display*/ -// lv_obj_t * slider; -// slider = lv_slider_create(lv_scr_act()); -// lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); -// lv_obj_add_event_cb(slider, slider_event_cb, NULL); -// lv_slider_set_mode(slider, LV_SLIDER_MODE_RANGE); -// -// lv_slider_set_value(slider, 70, LV_ANIM_OFF); -// lv_slider_set_left_value(slider, 20, LV_ANIM_OFF); -// -// /*Now use only a local style.*/ -// lv_obj_set_style_content_ofs_y(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, -20); -// lv_obj_set_style_content_color(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, lv_color_grey_darken_3()); -// -// /*To update the value text*/ -// lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL); + /*Create a slider in the center of the display*/ + lv_obj_t * slider; + slider = lv_slider_create(lv_scr_act()); + lv_obj_center(slider); + + lv_slider_set_mode(slider, LV_SLIDER_MODE_RANGE); + lv_slider_set_value(slider, 70, LV_ANIM_OFF); + lv_slider_set_left_value(slider, 20, LV_ANIM_OFF); + + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_ALL, NULL); + lv_obj_refresh_ext_draw_size(slider); } -// -//static void slider_event_cb(lv_obj_t * slider, lv_event_t event) -//{ -// if(event == LV_EVENT_VALUE_CHANGED) { -// static char buf[8]; -// lv_snprintf(buf, sizeof(buf), "%d - %d", lv_slider_get_value(slider), lv_slider_get_left_value(slider)); -// lv_obj_set_style_content_text(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, buf); -// } -//} -// -//#endif + +static void slider_event_cb(lv_event_t * e) +{ + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + /*Provide some extra space for the value*/ + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * size = lv_event_get_param(e); + *size = LV_MAX(*size, 50); + } + else if(code == LV_EVENT_DRAW_PART_END) { + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_INDICATOR) { + char buf[16]; + lv_snprintf(buf, sizeof(buf), "%d - %d", lv_slider_get_left_value(obj), lv_slider_get_value(obj)); + + lv_point_t label_size; + lv_txt_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0); + lv_area_t label_area; + label_area.x1 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2 - label_size.x / 2; + label_area.x2 = label_area.x1 + label_size.x; + label_area.y2 = dsc->draw_area->y1 - 10; + label_area.y1 = label_area.y2 - label_size.y; + + lv_draw_label_dsc_t label_draw_dsc; + lv_draw_label_dsc_init(&label_draw_dsc); + + lv_draw_label(&label_area, dsc->clip_area, &label_draw_dsc, buf, NULL); + } + } +} + +#endif diff --git a/examples/widgets/spinbox/lv_example_spinbox_1.c b/examples/widgets/spinbox/lv_example_spinbox_1.c index 69a212873..2395aa4e0 100644 --- a/examples/widgets/spinbox/lv_example_spinbox_1.c +++ b/examples/widgets/spinbox/lv_example_spinbox_1.c @@ -4,18 +4,18 @@ static lv_obj_t * spinbox; -static void lv_spinbox_increment_event_cb(lv_obj_t * btn, lv_event_t e) +static void lv_spinbox_increment_event_cb(lv_event_t * e) { - LV_UNUSED(btn); - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_SHORT_CLICKED || code == LV_EVENT_LONG_PRESSED_REPEAT) { lv_spinbox_increment(spinbox); } } -static void lv_spinbox_decrement_event_cb(lv_obj_t * btn, lv_event_t e) +static void lv_spinbox_decrement_event_cb(lv_event_t * e) { - LV_UNUSED(btn); - if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_event_code_t code = lv_event_get_code(e); + if(code == LV_EVENT_SHORT_CLICKED || code == LV_EVENT_LONG_PRESSED_REPEAT) { lv_spinbox_decrement(spinbox); } } @@ -36,13 +36,13 @@ void lv_example_spinbox_1(void) lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_RIGHT_MID, 5, 0); lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_PLUS, 0); - lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, LV_EVENT_ALL, NULL); btn = lv_btn_create(lv_scr_act()); lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_LEFT_MID, -5, 0); lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_MINUS, 0); - lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index 30eb8d09e..f496a901e 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -1,9 +1,11 @@ #include "../../lv_examples.h" #if LV_USE_SWITCH && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_VALUE_CHANGED) { LV_LOG_USER("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off"); } } @@ -11,24 +13,24 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) void lv_example_switch_1(void) { lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_place(lv_scr_act(), LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER); + lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t * sw; sw = lv_switch_create(lv_scr_act()); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_CHECKED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_DISABLED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_scr_act()); lv_obj_add_state(sw, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_obj_add_event_cb(sw, event_handler, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/table/lv_example_table_1.c b/examples/widgets/table/lv_example_table_1.c index 8efbd53c9..3c32ad34f 100644 --- a/examples/widgets/table/lv_example_table_1.c +++ b/examples/widgets/table/lv_example_table_1.c @@ -1,31 +1,30 @@ #include "../../lv_examples.h" #if LV_USE_TABLE && LV_BUILD_EXAMPLES -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void draw_part_event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); - /*If the cells are drawn...*/ - if(dsc->part == LV_PART_ITEMS) { - uint32_t row = dsc->id / lv_table_get_col_cnt(obj); - uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj); + lv_obj_t * obj = lv_event_get_target(e); + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + /*If the cells are drawn...*/ + if(dsc->part == LV_PART_ITEMS) { + uint32_t row = dsc->id / lv_table_get_col_cnt(obj); + uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj); - /*Make the texts in the first cell center aligned*/ - if(row == 0) { - dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; - dsc->rect_dsc->bg_color = lv_color_mix(lv_color_blue(), dsc->rect_dsc->bg_color, LV_OPA_20); - dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } - /*In the first column align the texts to the right*/ - else if(col == 0) { - dsc->label_dsc->flag = LV_TEXT_ALIGN_RIGHT; - } + /*Make the texts in the first cell center aligned*/ + if(row == 0) { + dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; + dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), dsc->rect_dsc->bg_color, LV_OPA_20); + dsc->rect_dsc->bg_opa = LV_OPA_COVER; + } + /*In the first column align the texts to the right*/ + else if(col == 0) { + dsc->label_dsc->flag = LV_TEXT_ALIGN_RIGHT; + } - /*MAke every 2nd row grayish*/ - if((row != 0 && row % 2) == 0) { - dsc->rect_dsc->bg_color = lv_color_mix(lv_color_grey(), dsc->rect_dsc->bg_color, LV_OPA_10); - dsc->rect_dsc->bg_opa = LV_OPA_COVER; - } + /*MAke every 2nd row grayish*/ + if((row != 0 && row % 2) == 0) { + dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_GREY), dsc->rect_dsc->bg_color, LV_OPA_10); + dsc->rect_dsc->bg_opa = LV_OPA_COVER; } } } @@ -60,7 +59,7 @@ void lv_example_table_1(void) lv_obj_center(table); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, event_cb, NULL); + lv_obj_add_event_cb(table, draw_part_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); } #endif diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index a3edc115e..bb44600e2 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -3,47 +3,49 @@ #define ITEM_CNT 200 -static void event_cb(lv_obj_t * obj, lv_event_t e) +static void draw_event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_END) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); - /*If the cells are drawn...*/ - if(dsc->part == LV_PART_ITEMS) { - bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + lv_obj_t * obj = lv_event_get_target(e); + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + /*If the cells are drawn...*/ + if(dsc->part == LV_PART_ITEMS) { + bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - lv_draw_rect_dsc_t rect_dsc; - lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.bg_color = chk ? lv_theme_get_color_primary(obj) : lv_color_grey_lighten_2(); - rect_dsc.radius = LV_RADIUS_CIRCLE; + lv_draw_rect_dsc_t rect_dsc; + lv_draw_rect_dsc_init(&rect_dsc); + rect_dsc.bg_color = chk ? lv_theme_get_color_primary(obj) : lv_palette_lighten(LV_PALETTE_GREY, 2); + rect_dsc.radius = LV_RADIUS_CIRCLE; - lv_area_t sw_area; - sw_area.x1 = dsc->draw_area->x2 - 50; - sw_area.x2 = sw_area.x1 + 40; - sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10; - sw_area.y2 = sw_area.y1 + 20; - lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); + lv_area_t sw_area; + sw_area.x1 = dsc->draw_area->x2 - 50; + sw_area.x2 = sw_area.x1 + 40; + sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10; + sw_area.y2 = sw_area.y1 + 20; + lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); - rect_dsc.bg_color = lv_color_white(); - if(chk) { - sw_area.x2 -= 2; - sw_area.x1 = sw_area.x2 - 16; - } else { - sw_area.x1 += 2; - sw_area.x2 = sw_area.x1 + 16; - } - sw_area.y1 += 2; - sw_area.y2 -= 2; - lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); + rect_dsc.bg_color = lv_color_white(); + if(chk) { + sw_area.x2 -= 2; + sw_area.x1 = sw_area.x2 - 16; + } else { + sw_area.x1 += 2; + sw_area.x2 = sw_area.x1 + 16; } + sw_area.y1 += 2; + sw_area.y2 -= 2; + lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc); } - else if(e == LV_EVENT_VALUE_CHANGED) { - uint16_t col; - uint16_t row; - lv_table_get_selected_cell(obj, &row, &col); - bool chk = lv_table_has_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - if(chk) lv_table_clear_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - else lv_table_add_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); - } +} + +static void change_event_cb(lv_event_t * e) +{ + lv_obj_t * obj = lv_event_get_target(e); + uint16_t col; + uint16_t row; + lv_table_get_selected_cell(obj, &row, &col); + bool chk = lv_table_has_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + if(chk) lv_table_clear_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); + else lv_table_add_cell_ctrl(obj, row, 0, LV_TABLE_CELL_CTRL_CUSTOM_1); } @@ -78,7 +80,8 @@ void lv_example_table_2(void) lv_obj_align(table, LV_ALIGN_CENTER, 0, -20); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event_cb(table, event_cb, NULL); + lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_PART_END, NULL); + lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_mem_monitor_t mon2; lv_mem_monitor(&mon2); @@ -88,9 +91,9 @@ void lv_example_table_2(void) uint32_t elaps = lv_tick_elaps(t); lv_obj_t * label = lv_label_create(lv_scr_act()); - lv_label_set_text_fmt(label, "%d bytes are used by the table\n" - "and %d items were added in %d ms", - mem_used, ITEM_CNT, elaps); + lv_label_set_text_fmt(label, "%d items were created in %d ms\n" + "using %d bytes of memory", + ITEM_CNT, elaps, mem_used); lv_obj_align(label, LV_ALIGN_BOTTOM_MID, 0, -10); diff --git a/examples/widgets/textarea/lv_example_textarea_1.c b/examples/widgets/textarea/lv_example_textarea_1.c index 2d69fd729..f5939790a 100644 --- a/examples/widgets/textarea/lv_example_textarea_1.c +++ b/examples/widgets/textarea/lv_example_textarea_1.c @@ -2,17 +2,16 @@ #if LV_USE_TEXTAREA && LV_BUILD_EXAMPLES -static void btnm_event_handler(lv_obj_t * obj, lv_event_t event) +static void btnm_event_handler(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * ta = lv_event_get_user_data(); - const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); + lv_obj_t * obj = lv_event_get_target(e); + lv_obj_t * ta = lv_event_get_user_data(e); + const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); - if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta); - else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_textarea_add_char(ta, '\n'); - else lv_textarea_add_text(ta, txt); + if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta); + else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_textarea_add_char(ta, '\n'); + else lv_textarea_add_text(ta, txt); - } } void lv_example_textarea_1(void) @@ -30,7 +29,7 @@ void lv_example_textarea_1(void) lv_obj_t * btnm = lv_btnmatrix_create(lv_scr_act()); lv_obj_set_size(btnm, 200, 150); lv_obj_align(btnm, LV_ALIGN_BOTTOM_MID, 0, -10); - lv_obj_add_event_cb(btnm, btnm_event_handler, ta); + lv_obj_add_event_cb(btnm, btnm_event_handler, LV_EVENT_VALUE_CHANGED, ta); lv_obj_clear_flag(btnm, LV_OBJ_FLAG_CLICK_FOCUSABLE); /*To keep the text area focused on button clicks*/ lv_btnmatrix_set_map(btnm, btnm_map); } diff --git a/examples/widgets/textarea/lv_example_textarea_2.c b/examples/widgets/textarea/lv_example_textarea_2.c index c1c2052a8..44749fa41 100644 --- a/examples/widgets/textarea/lv_example_textarea_2.c +++ b/examples/widgets/textarea/lv_example_textarea_2.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_TEXTAREA && LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t event); +static void ta_event_cb(lv_event_t * e); static lv_obj_t * kb; @@ -14,7 +14,7 @@ void lv_example_textarea_2(void) lv_textarea_set_one_line(pwd_ta, true); lv_obj_set_width(pwd_ta, LV_HOR_RES / 2 - 20); lv_obj_set_pos(pwd_ta, 5, 20); - lv_obj_add_event_cb(pwd_ta, ta_event_cb, NULL); + lv_obj_add_event_cb(pwd_ta, ta_event_cb, LV_EVENT_ALL, NULL); /*Create a label and position it above the text box*/ lv_obj_t * pwd_label = lv_label_create(lv_scr_act()); @@ -39,16 +39,18 @@ void lv_example_textarea_2(void) lv_keyboard_set_textarea(kb, pwd_ta); /*Focus it on one of the text areas to start*/ } -static void ta_event_cb(lv_obj_t * ta, lv_event_t event) +static void ta_event_cb(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * ta = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { /*Focus on the clicked text area*/ if(kb != NULL) lv_keyboard_set_textarea(kb, ta); } - else if(event == LV_EVENT_INSERT) { - const char * str = lv_event_get_param(); + else if(code == LV_EVENT_INSERT) { + const char * str = lv_event_get_param(e); if(str[0] == '\n') { LV_LOG_USER("Ready\n"); } diff --git a/examples/widgets/textarea/lv_example_textarea_3.c b/examples/widgets/textarea/lv_example_textarea_3.c index 9c9d91adf..21cb31bb1 100644 --- a/examples/widgets/textarea/lv_example_textarea_3.c +++ b/examples/widgets/textarea/lv_example_textarea_3.c @@ -1,7 +1,7 @@ #include "../../lv_examples.h" #if LV_USE_TEXTAREA && LV_USE_KEYBOARD && LV_BUILD_EXAMPLES -static void ta_event_cb(lv_obj_t * ta, lv_event_t event); +static void ta_event_cb(lv_event_t * e); static lv_obj_t * kb; @@ -13,7 +13,7 @@ void lv_example_textarea_3(void) { /*Create the text area*/ lv_obj_t * ta = lv_textarea_create(lv_scr_act()); - lv_obj_add_event_cb(ta, ta_event_cb, NULL); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_textarea_set_accepted_chars(ta, "0123456789:"); lv_textarea_set_max_length(ta, 5); lv_textarea_set_one_line(ta, true); @@ -26,17 +26,16 @@ void lv_example_textarea_3(void) lv_keyboard_set_textarea(kb, ta); } -static void ta_event_cb(lv_obj_t * ta, lv_event_t event) +static void ta_event_cb(lv_event_t * e) { - if(event == LV_EVENT_VALUE_CHANGED) { - const char * txt = lv_textarea_get_text(ta); - if(txt[0] >= '0' && txt[0] <= '9' && - txt[1] >= '0' && txt[1] <= '9' && - txt[2] != ':') - { - lv_textarea_set_cursor_pos(ta, 2); - lv_textarea_add_char(ta, ':'); - } + lv_obj_t * ta = lv_event_get_target(e); + const char * txt = lv_textarea_get_text(ta); + if(txt[0] >= '0' && txt[0] <= '9' && + txt[1] >= '0' && txt[1] <= '9' && + txt[2] != ':') + { + lv_textarea_set_cursor_pos(ta, 2); + lv_textarea_add_char(ta, ':'); } } diff --git a/examples/widgets/tileview/lv_example_tileview_1.c b/examples/widgets/tileview/lv_example_tileview_1.c index 9d562efb8..e36d54246 100644 --- a/examples/widgets/tileview/lv_example_tileview_1.c +++ b/examples/widgets/tileview/lv_example_tileview_1.c @@ -31,7 +31,7 @@ void lv_example_tileview_1(void) /*Tile3: a list*/ lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT); lv_obj_t * list = lv_list_create(tile3); - lv_obj_set_size(list, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(list, LV_PCT(100), LV_PCT(100)); lv_list_add_btn(list, NULL, "One", NULL); lv_list_add_btn(list, NULL, "Two", NULL); diff --git a/examples/widgets/win/lv_example_win_1.c b/examples/widgets/win/lv_example_win_1.c index f3bb32f10..f91fdc502 100644 --- a/examples/widgets/win/lv_example_win_1.c +++ b/examples/widgets/win/lv_example_win_1.c @@ -2,9 +2,11 @@ #if LV_USE_WIN && LV_BUILD_EXAMPLES -static void event_handler(lv_obj_t * obj, lv_event_t event) +static void event_handler(lv_event_t * e) { - if(event == LV_EVENT_CLICKED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Button %d clicked", lv_obj_get_child_id(obj)); } } diff --git a/lv_conf_template.h b/lv_conf_template.h index 6d116edea..ff1b5a391 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -381,7 +381,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #define LV_USE_CHECKBOX 1 -#define LV_USE_CHART 1 #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ @@ -395,8 +394,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #define LV_USE_LINE 1 -#define LV_USE_METER 1 - #define LV_USE_ROLLER 1 /*Requires: lv_label*/ #if LV_USE_ROLLER # define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ @@ -434,6 +431,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ # define LV_USE_CALENDAR_HEADER_DROPDOWN 1 #endif /*LV_USE_CALENDAR*/ +#define LV_USE_CHART 1 + #define LV_USE_COLORWHEEL 1 #define LV_USE_IMGBTN 1 @@ -444,6 +443,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #define LV_USE_LIST 1 +#define LV_USE_METER 1 + #define LV_USE_MSGBOX 1 #define LV_USE_SPINBOX 1 @@ -463,8 +464,8 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #define LV_USE_THEME_DEFAULT 1 #if LV_USE_THEME_DEFAULT -/*1: Light mode; 0: Dark mode*/ -# define LV_THEME_DEFAULT_PALETTE_LIGHT 1 +/*0: Light mode; 1: Dark mode*/ +# define LV_THEME_DEFAULT_DARK 0 /*1: Enable grow on press*/ # define LV_THEME_DEFAULT_GROW 1 diff --git a/lvgl.h b/lvgl.h index 5cf72e160..668a5c589 100644 --- a/lvgl.h +++ b/lvgl.h @@ -47,7 +47,6 @@ extern "C" { #include "src/widgets/lv_img.h" #include "src/widgets/lv_label.h" #include "src/widgets/lv_line.h" -#include "src/widgets/lv_chart.h" #include "src/widgets/lv_table.h" #include "src/widgets/lv_checkbox.h" #include "src/widgets/lv_bar.h" @@ -57,7 +56,6 @@ extern "C" { #include "src/widgets/lv_roller.h" #include "src/widgets/lv_textarea.h" #include "src/widgets/lv_canvas.h" -#include "src/widgets/lv_meter.h" #include "src/widgets/lv_switch.h" #include "src/draw/lv_img_cache.h" diff --git a/scripts/Doxyfile b/scripts/Doxyfile index 7120f5d27..ce88aac43 100644 --- a/scripts/Doxyfile +++ b/scripts/Doxyfile @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ../docs/api_doc +OUTPUT_DIRECTORY = ../docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -1091,7 +1091,7 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = html +HTML_OUTPUT = doxygen_html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). diff --git a/scripts/built_in_font/built_in_font_gen.py b/scripts/built_in_font/built_in_font_gen.py index fd913cdc9..ca9565d79 100755 --- a/scripts/built_in_font/built_in_font_gen.py +++ b/scripts/built_in_font/built_in_font_gen.py @@ -52,7 +52,7 @@ if len(args.symbols[0]) != 0: args.symbols[0] = "--symbols " + args.symbols[0] #Built in symbols -syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650" +syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650" #Run the command (Add degree and bbullet symbol) cmd = "lv_font_conv {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output) diff --git a/scripts/find_version.sh b/scripts/find_version.sh new file mode 100755 index 000000000..c58bbc41c --- /dev/null +++ b/scripts/find_version.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Credit: https://stackoverflow.com/a/4774063 +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +TMPENVFILE=$(mktemp /tmp/lvgl.script.XXXXXX) +cat $SCRIPTPATH/../lvgl.h | grep "#define LVGL_VERSION_" | sed 's/#define //g' | sed -r 's/\s+/=/' > $TMPENVFILE +. $TMPENVFILE +rm $TMPENVFILE +echo $LVGL_VERSION_MAJOR.$LVGL_VERSION_MINOR diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_internal_gen.py similarity index 91% rename from scripts/lv_conf_checker.py rename to scripts/lv_conf_internal_gen.py index d7cdaa2a4..db080dd94 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_internal_gen.py @@ -59,6 +59,10 @@ fout.write( # endif #endif + +/*---------------------------------- + * Start parsing lv_conf_template.h + -----------------------------------*/ ''' ) @@ -106,14 +110,15 @@ for i in fin.read().splitlines(): fout.write( ''' +/*---------------------------------- + * End of parsing lv_conf_template.h + -----------------------------------*/ + +LV_EXPORT_CONST_INT(LV_DPI_DEF); + /*If running without lv_conf.h add typdesf with default value*/ #if defined(LV_CONF_SKIP) - -# if LV_USE_USER_DATA - typedef void * lv_obj_user_data_t; -# endif - # if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ # define _CRT_SECURE_NO_WARNINGS # endif diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 0bb883180..541f3e8ac 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -3,92 +3,346 @@ import sys, os props = [ -{'name': 'RADIUS', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'CLIP_CORNER', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'TRANSFORM_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_ZOOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TRANSFORM_ANGLE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'COLOR_FILTER_DSC', 'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *' }, -{'name': 'COLOR_FILTER_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ANIM_TIME', 'style_type': 'num', 'var_type': 'uint32_t' }, -{'name': 'TRANSITION', 'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' }, -{'name': 'SIZE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BLEND_MODE', 'style_type': 'num', 'var_type': 'lv_blend_mode_t' }, -{'name': 'PAD_TOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_BOTTOM', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_LEFT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_RIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_ROW', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'PAD_COLUMN', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MIN_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MAX_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MIN_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'MAX_HEIGHT', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ALIGN', 'style_type': 'num', 'var_type': 'lv_align_t' }, -{'name': 'LAYOUT', 'style_type': 'num', 'var_type': 'uint16_t' }, -{'name': 'BG_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_GRAD_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_GRAD_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_GRAD_DIR', 'style_type': 'num', 'var_type': 'lv_grad_dir_t' }, -{'name': 'BG_MAIN_STOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BG_GRAD_STOP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BG_IMG_SRC', 'style_type': 'ptr', 'var_type': 'const void *' }, -{'name': 'BG_IMG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_IMG_RECOLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_IMG_RECOLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BG_IMG_RECOLOR_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BG_IMG_TILED', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'BORDER_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BORDER_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'BORDER_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'BORDER_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'BORDER_SIDE', 'style_type': 'num', 'var_type': 'lv_border_side_t' }, -{'name': 'BORDER_POST', 'style_type': 'num', 'var_type': 'bool' }, -{'name': 'TEXT_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'TEXT_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'TEXT_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'TEXT_FONT', 'style_type': 'ptr', 'var_type': 'const lv_font_t *' }, -{'name': 'TEXT_LETTER_SPACE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TEXT_LINE_SPACE', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'TEXT_DECOR', 'style_type': 'num', 'var_type': 'lv_text_decor_t' }, -{'name': 'TEXT_ALIGN', 'style_type': 'num', 'var_type': 'lv_text_align_t' }, -{'name': 'IMG_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'IMG_RECOLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'IMG_RECOLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'IMG_RECOLOR_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'OUTLINE_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'OUTLINE_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'OUTLINE_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'OUTLINE_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'OUTLINE_PAD', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_OFS_X', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_OFS_Y', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_SPREAD', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'SHADOW_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'SHADOW_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'SHADOW_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'LINE_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_DASH_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_DASH_GAP', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_ROUNDED', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'LINE_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'LINE_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'LINE_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ARC_WIDTH', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ARC_ROUNDED', 'style_type': 'num', 'var_type': 'lv_coord_t' }, -{'name': 'ARC_COLOR', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'ARC_COLOR_FILTERED', 'style_type': 'color', 'var_type': 'lv_color_t' }, -{'name': 'ARC_OPA', 'style_type': 'num', 'var_type': 'lv_opa_t' }, -{'name': 'ARC_IMG_SRC', 'style_type': 'ptr', 'var_type': 'const void *' }, +{'name': 'RADIUS', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"}, + +{'name': 'CLIP_CORNER', + 'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`." }, + +{'name': 'TRANSFORM_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." }, + +{'name': 'TRANSFORM_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." }, + +{'name': 'TRANSLATE_X', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Move the object with this value in X direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." }, + +{'name': 'TRANSLATE_Y', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." }, + +{'name': 'TRANSFORM_ZOOM', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Zoom image-like objects. Multiplied with the zoom set on the object. The value 256 (or `LV_IMG_ZOOM_NONE`) maens normal size, 128 half size, 512 double size, and so on" }, + +{'name': 'TRANSFORM_ANGLE', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': " Rotate image-like objects. Added to the rotation set on the object. The value is interpreted in 0.1 degree unit. E.g. 45 deg. = 450 " }, + +{'name': 'OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." }, + +{'name': 'COLOR_FILTER_DSC', + 'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Mix a color to all colors of the object." }, + +{'name': 'COLOR_FILTER_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "The intensity of mixing of color filter."}, + +{'name': 'ANIM_TIME', + 'style_type': 'num', 'var_type': 'uint32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "The animation time in milliseconds. It's meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more."}, + +{'name': 'ANIM_SPEED', + 'style_type': 'num', 'var_type': 'uint32_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "The animation speed in pixel/sec. It's meaning is widget specific. E.g. scroll speed of label. See the widgets' documentation to learn more."}, + +{'name': 'TRANSITION', + 'style_type': 'ptr', 'var_type': 'const lv_style_transition_dsc_t *' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "An initialized `lv_style_transition_dsc_t` to describe a transition."}, + +{'name': 'BLEND_MODE', + 'style_type': 'num', 'var_type': 'lv_blend_mode_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Describes how to blend the colors to the background. The possibel values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE`"}, + +{'name': 'PAD_TOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the top. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_BOTTOM', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the bottom. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_LEFT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the left. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_RIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding on the right. It makes the content arae smaller in this direction."}, + +{'name': 'PAD_ROW', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding between the rows. Used by the layouts."}, + +{'name': 'PAD_COLUMN', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the padding between the columns. Used by the layouts."}, + +{'name': 'WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MIN_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MAX_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'MIN_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'MAX_HEIGHT', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'X', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."}, + +{'name': 'Y', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."}, + +{'name': 'ALIGN', + 'style_type': 'num', 'var_type': 'lv_align_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the alignment whcih tells from which point of teh aprent the X and Y coordinates should be interptreted. The possibel values are: `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`"}, + +{'name': 'LAYOUT', + 'style_type': 'num', 'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."}, + +{'name': 'BG_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the background color of the object."}, + +{'name': 'BG_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, +{'name': 'BG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the bacground. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BG_GRAD_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the gradien color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"}, + +{'name': 'BG_GRAD_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'BG_GRAD_DIR', + 'style_type': 'num', 'var_type': 'lv_grad_dir_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."}, + +{'name': 'BG_MAIN_STOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the point from which the backround color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"}, + +{'name': 'BG_GRAD_STOP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the point from which the backround's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"}, + +{'name': 'BG_IMG_SRC', + 'style_type': 'ptr', 'var_type': 'const void *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...`"}, + +{'name': 'BG_IMG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BG_IMG_RECOLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set a color to mix to the background image."}, + +{'name': 'BG_IMG_RECOLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'BG_IMG_RECOLOR_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 256, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportinally."}, + +{'name': 'BG_IMG_TILED', + 'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "If enbaled the background image will be tiled. The possible values are `ture` or `false`."}, + +{'name': 'BORDER_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the border"}, + +{'name': 'BORDER_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'BORDER_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opcitiy of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'BORDER_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set hte width of the border. Only pixel values can be used."}, + +{'name': 'BORDER_SIDE', + 'style_type': 'num', 'var_type': 'lv_border_side_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set ony which side(s) the border should be drawn. The possible values are `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed calues an be used as well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`."}, + +{'name': 'BORDER_POST', +'style_type': 'num', 'var_type': 'bool' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets wheter the the border should be drawn before or after the children ar drawn. `true`: after children, `false`: before children"}, + +{'name': 'TEXT_COLOR', +'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Sets the color of the text."}, + +{'name': 'TEXT_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'TEXT_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opícity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'TEXT_FONT', + 'style_type': 'ptr', 'var_type': 'const lv_font_t *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the font of the text (a pointer `lv_font_t *`). "}, + +{'name': 'TEXT_LETTER_SPACE', +'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the letter space in pixels"}, + +{'name': 'TEXT_LINE_SPACE', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the line space in pixels."}, + +{'name': 'TEXT_DECOR', + 'style_type': 'num', 'var_type': 'lv_text_decor_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set decoration for the text. The possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well." }, + +{'name': 'TEXT_ALIGN', +'style_type': 'num', 'var_type': 'lv_text_align_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set how to align the lines of the text. Note that it doesn't align the object itself, only the lines inside the obejct. The possibel values are `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base direction and uses left or right alignment accordingly"}, + +{'name': 'IMG_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'IMG_RECOLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set color to mixt to the image."}, + +{'name': 'IMG_RECOLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'IMG_RECOLOR_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'OUTLINE_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the outline in pixels. "}, + +{'name': 'OUTLINE_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the outline."}, + +{'name': 'OUTLINE_COLOR_FILTERED', +'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'OUTLINE_OPA', +'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'OUTLINE_PAD', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the padding of the outline, i.e. the gap between object and the outline."}, + +{'name': 'SHADOW_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the shadow in pixels. The value should be >= 0."}, + +{'name': 'SHADOW_OFS_X', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an offset on the shadow in pixels in X direction. "}, + +{'name': 'SHADOW_OFS_Y', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an offset on the shadow in pixels in Y direction. "}, + +{'name': 'SHADOW_SPREAD', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the shadow calcuation to use a larger or smaller rectangle as base. The value can be in pixel t make the area larger/smaller"}, + +{'name': 'SHADOW_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the shadow"}, + +{'name': 'SHADOW_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'SHADOW_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."}, + +{'name': 'LINE_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of the lines in pixel."}, + +{'name': 'LINE_DASH_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines"}, + +{'name': 'LINE_DASH_GAP', + 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines"}, + +{'name': 'LINE_ROUNDED', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the end points of the lines rounded. `true`: rounded, `false`: perpadicular line ending "}, + +{'name': 'LINE_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color fo the lines."}, + +{'name': 'LINE_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t'}, + +{'name': 'LINE_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the lines."}, + +{'name': 'ARC_WIDTH', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the width (ticjkness) of the arcs in pixel."}, + +{'name': 'ARC_ROUNDED', + 'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Make the end points of the arcs rounded. `true`: rounded, `false`: perpadicular line ending "}, + +{'name': 'ARC_COLOR', + 'style_type': 'color', 'var_type': 'lv_color_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the color of the arc."}, + +{'name': 'ARC_COLOR_FILTERED', + 'style_type': 'color', 'var_type': 'lv_color_t' }, + +{'name': 'ARC_OPA', + 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set the opacity of the arcs."}, + +{'name': 'ARC_IMG_SRC', + 'style_type': 'ptr', 'var_type': 'const void *', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, + 'dsc': "Set an image from which the arc will be masked out. It's useful to display complex exxects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file"}, ] def style_get_cast(style_type, var_type): @@ -134,6 +388,46 @@ def local_style_set(p): print("}") print("") +def style_const_set(p): + cast = style_set_cast(p['style_type']) + print("#define LV_STYLE_CONST_" + p['name'] + "(val) \\") + print(" { \\") + print(" .prop = LV_STYLE_" + p['name'] + ", \\") + print(" .value = { \\") + print(" ." + p['style_type'] +" = " + cast + "val \\") + print(" } \\") + print(" }") + print("") + + + +def docs(p): + if "dsc" not in p: return + + d = str(p["default"]) + + i = "No" + if p["inherited"]: i = "Yes" + + l = "No" + if p["layout"]: l = "Yes" + + e = "No" + if p["ext_draw"]: e = "Yes" + + li_style = "style='display:inline; margin-right: 20px" + + print("

" + p["name"].lower() + "

") + print(p["dsc"]) + + print("
    ") + print("
  • Default " + d + "
  • ") + print("
  • Inherited " + i + "
  • ") + print("
  • Layout " + l + "
  • ") + print("
  • Ext. draw " + e + "
  • ") + print("
") + print("") + base_dir = os.path.abspath(os.path.dirname(__file__)) sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w') @@ -147,3 +441,12 @@ sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w') for p in props: style_set(p) + style_const_set(p) + +sys.stdout = open(base_dir + '/style_props.md', 'w') + +for p in props: + docs(p) + + + diff --git a/scripts/style_props.md b/scripts/style_props.md new file mode 100644 index 000000000..6dda7629b --- /dev/null +++ b/scripts/style_props.md @@ -0,0 +1,702 @@ +

radius

+Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

clip_corner

+Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

transform_width

+Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

transform_height

+Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

translate_x

+Move the object with this value in X direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

translate_y

+Move the object with this value in Y direction. Applied after layouts, aligns and other positionings. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

transform_zoom

+Zoom image-like objects. Multiplied with the zoom set on the object. The value 256 (or `LV_IMG_ZOOM_NONE`) maens normal size, 128 half size, 512 double size, and so on +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

transform_angle

+ Rotate image-like objects. Added to the rotation set on the object. The value is interpreted in 0.1 degree unit. E.g. 45 deg. = 450 +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

opa

+Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

color_filter_dsc

+Mix a color to all colors of the object. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

color_filter_opa

+The intensity of mixing of color filter. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

anim_time

+The animation time in milliseconds. It's meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

anim_speed

+The animation speed in pixel/sec. It's meaning is widget specific. E.g. scroll speed of label. See the widgets' documentation to learn more. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

transition

+An initialized `lv_style_transition_dsc_t` to describe a transition. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

blend_mode

+Describes how to blend the colors to the background. The possibel values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE` +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_top

+Sets the padding on the top. It makes the content arae smaller in this direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_bottom

+Sets the padding on the bottom. It makes the content arae smaller in this direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_left

+Sets the padding on the left. It makes the content arae smaller in this direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_right

+Sets the padding on the right. It makes the content arae smaller in this direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_row

+Sets the padding between the rows. Used by the layouts. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

pad_column

+Sets the padding between the columns. Used by the layouts. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

width

+Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

min_width

+Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

max_width

+Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

height

+Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

min_height

+Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

max_height

+Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

x

+Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

y

+Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

align

+Set the alignment whcih tells from which point of teh aprent the X and Y coordinates should be interptreted. The possibel values are: `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER` +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

layout

+Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_color

+Set the background color of the object. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_opa

+Set the opacity of the bacground. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_grad_color

+Set the gradien color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE` +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_grad_dir

+Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_main_stop

+Set the point from which the backround color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_grad_stop

+Set the point from which the backround's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_img_src

+Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...` +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_img_opa

+Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_img_recolor

+Set a color to mix to the background image. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_img_recolor_opa

+Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 256, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportinally. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

bg_img_tiled

+If enbaled the background image will be tiled. The possible values are `ture` or `false`. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

border_color

+Set the color of the border +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

border_opa

+Set the opcitiy of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

border_width

+Set hte width of the border. Only pixel values can be used. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

border_side

+Set ony which side(s) the border should be drawn. The possible values are `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed calues an be used as well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

border_post

+Sets wheter the the border should be drawn before or after the children ar drawn. `true`: after children, `false`: before children +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_color

+Sets the color of the text. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_opa

+Set the opícity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_font

+Set the font of the text (a pointer `lv_font_t *`). +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_letter_space

+Set the letter space in pixels +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_line_space

+Set the line space in pixels. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_decor

+Set decoration for the text. The possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

text_align

+Set how to align the lines of the text. Note that it doesn't align the object itself, only the lines inside the obejct. The possibel values are `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base direction and uses left or right alignment accordingly +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

img_opa

+Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

img_recolor

+Set color to mixt to the image. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

img_recolor_opa

+Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

outline_width

+Set the width of the outline in pixels. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

outline_color

+Set the color of the outline. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

outline_opa

+Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

outline_pad

+Set the padding of the outline, i.e. the gap between object and the outline. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_width

+Set the width of the shadow in pixels. The value should be >= 0. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_ofs_x

+Set an offset on the shadow in pixels in X direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_ofs_y

+Set an offset on the shadow in pixels in Y direction. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_spread

+Make the shadow calcuation to use a larger or smaller rectangle as base. The value can be in pixel t make the area larger/smaller +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_color

+Set the color of the shadow +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

shadow_opa

+Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 256, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_width

+Set the width of the lines in pixel. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_dash_width

+Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_dash_gap

+Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_rounded

+Make the end points of the lines rounded. `true`: rounded, `false`: perpadicular line ending +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_color

+Set the color fo the lines. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

line_opa

+Set the opacity of the lines. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

arc_width

+Set the width (ticjkness) of the arcs in pixel. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

arc_rounded

+Make the end points of the arcs rounded. `true`: rounded, `false`: perpadicular line ending +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

arc_color

+Set the color of the arc. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

arc_opa

+Set the opacity of the arcs. +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ +

arc_img_src

+Set an image from which the arc will be masked out. It's useful to display complex exxects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file +
    +
  • Default 0
  • +
  • Inherited No
  • +
  • Layout No
  • +
  • Ext. draw No
  • +
+ diff --git a/src/core/lv_core.mk b/src/core/lv_core.mk index 9d5e075eb..f08df8107 100644 --- a/src/core/lv_core.mk +++ b/src/core/lv_core.mk @@ -9,6 +9,7 @@ CSRCS += lv_obj_pos.c CSRCS += lv_obj_scroll.c CSRCS += lv_obj_style.c CSRCS += lv_obj_tree.c +CSRCS += lv_event.c CSRCS += lv_refr.c CSRCS += lv_theme.c diff --git a/src/core/lv_disp.c b/src/core/lv_disp.c index 37aaa8e1d..d8d9d9ae9 100644 --- a/src/core/lv_disp.c +++ b/src/core/lv_disp.c @@ -127,6 +127,7 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp) */ void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th) { + if(disp == NULL) disp = lv_disp_get_default(); disp->theme = th; if(disp->screen_cnt == 3 && @@ -144,6 +145,7 @@ void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th) */ lv_theme_t * lv_disp_get_theme(lv_disp_t * disp) { + if(disp == NULL) disp = lv_disp_get_default(); return disp->theme; } diff --git a/src/core/lv_event.c b/src/core/lv_event.c new file mode 100644 index 000000000..d42ac0c79 --- /dev/null +++ b/src/core/lv_event.c @@ -0,0 +1,293 @@ +/** + * @file lv_event.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_obj.h" +#include "lv_indev.h" + +/********************* + * DEFINES + *********************/ +#define MY_CLASS &lv_obj_class + +/********************** + * TYPEDEFS + **********************/ + +typedef struct _lv_event_dsc_t{ + lv_event_cb_t cb; + void * user_data; + lv_event_code_t filter :8; +}lv_event_dsc_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static lv_event_dsc_t * lv_obj_get_event_dsc(const lv_obj_t * obj, uint32_t id); +static lv_res_t event_send_core(lv_event_t * e); +static bool event_is_bubbled(lv_event_code_t e); + +/********************** + * STATIC VARIABLES + **********************/ +static lv_event_t * event_head; + +/********************** + * MACROS + **********************/ +#if LV_LOG_TRACE_EVENT +# define EVENT_TRACE(...) LV_LOG_TRACE( __VA_ARGS__) +#else +# define EVENT_TRACE(...) +#endif + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param) +{ + if(obj == NULL) return LV_RES_OK; + + LV_ASSERT_OBJ(obj, MY_CLASS); + + lv_event_t e; + e.target = obj; + e.current_target = obj; + e.code = event_code; + e.user_data = NULL; + e.param = param; + e.deleted = 0; + + + /*Build a simple linked list from the objects used in the events + *It's important to know if an this object was deleted by a nested event + *called from this `event_cb`.*/ + e.prev = event_head; + event_head = &e; + + /*Send the event*/ + lv_res_t res = event_send_core(&e); + + /*Remove this element from the list*/ + event_head = e.prev; + + return res; +} + + +lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e) +{ + const lv_obj_class_t * base; + if(class_p == NULL) base = e->current_target->class_p; + else base = class_p->base_class; + + /*Find a base in which Call the ancestor's event handler_cb is set*/ + while(base && base->event_cb == NULL) base = base->base_class; + + if(base == NULL) return LV_RES_OK; + if(base->event_cb == NULL) return LV_RES_OK; + + /*Call the actual event callback*/ + e->user_data = NULL; + base->event_cb(base, e); + + lv_res_t res = LV_RES_OK; + /*Stop if the object is deleted*/ + if(e->deleted) res = LV_RES_INV; + + return res; +} + + +lv_obj_t * lv_event_get_target(lv_event_t * e) +{ + return e->target; +} + +lv_obj_t * lv_event_get_current_target(lv_event_t * e) +{ + return e->current_target; +} + +lv_event_code_t lv_event_get_code(lv_event_t * e) +{ + return e->code; +} + +void * lv_event_get_param(lv_event_t * e) +{ + return e->param; +} + +void * lv_event_get_user_data(lv_event_t * e) +{ + return e->user_data; +} + + +uint32_t lv_event_register_id(void) +{ + static uint32_t last_id = _LV_EVENT_LAST; + last_id ++; + return last_id; +} + +void _lv_event_mark_deleted(lv_obj_t * obj) +{ + lv_event_t * e = event_head; + + while(e) { + if(e->current_target == obj || e->target == obj) e->deleted = 1; + e = e->prev; + } +} + + +struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_obj_allocate_spec_attr(obj); + + obj->spec_attr->event_dsc_cnt++; + obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); + LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); + + obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb; + obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].filter = filter; + obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].user_data = user_data; + + return &obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1]; +} + +bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + if(obj->spec_attr == NULL) return false; + + int32_t i = 0; + for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) { + if(obj->spec_attr->event_dsc[i].cb == event_cb) { + /*Shift the remaining event handlers forward*/ + for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { + obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; + obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; + } + obj->spec_attr->event_dsc_cnt--; + obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); + LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); + return true; + } + } + + /*No event handler found*/ + return false; +} + +bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + if(obj->spec_attr == NULL) return false; + + int32_t i = 0; + for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) { + if(&obj->spec_attr->event_dsc[i] == event_dsc) { + /*Shift the remaining event handlers forward*/ + for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { + obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; + obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; + } + obj->spec_attr->event_dsc_cnt--; + obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); + LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); + return true; + } + } + + /*No event handler found*/ + return false; +} + + +/********************** + * STATIC FUNCTIONS + **********************/ + +static lv_event_dsc_t * lv_obj_get_event_dsc(const lv_obj_t * obj, uint32_t id) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + + if(!obj->spec_attr) return NULL; + if(id >= obj->spec_attr->event_dsc_cnt) return NULL; + + return &obj->spec_attr->event_dsc[id]; +} + +static lv_res_t event_send_core(lv_event_t * e) +{ + EVENT_TRACE("Sending event %d to %p with %p param", e->code, e->current_target, e->param); + + /*Call the input device's feedback callback if set*/ + lv_indev_t * indev_act = lv_indev_get_act(); + if(indev_act) { + if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, e->code); + } + + lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(e->current_target, 0); + lv_res_t res = LV_RES_OK; + res = lv_obj_event_base(NULL, e); + + uint32_t i = 0; + while(event_dsc && res == LV_RES_OK) { + if(event_dsc->cb && (event_dsc->filter == LV_EVENT_ALL || event_dsc->filter == e->code)) { + e->user_data = event_dsc->user_data; + event_dsc->cb(e); + + /*Stop if the object is deleted*/ + if(e->deleted) return LV_RES_INV; + } + + i++; + event_dsc = lv_obj_get_event_dsc(e->current_target, i); + } + + if(res == LV_RES_OK && event_is_bubbled(e->code)) { + if(lv_obj_has_flag(e->current_target, LV_OBJ_FLAG_EVENT_BUBBLE) && e->current_target->parent) { + e->current_target = e->current_target->parent; + res = event_send_core(e); + if(res != LV_RES_OK) return LV_RES_INV; + } + } + + return res; +} + +static bool event_is_bubbled(lv_event_code_t e) +{ + switch(e) { + case LV_EVENT_HIT_TEST: + case LV_EVENT_COVER_CHECK: + case LV_EVENT_REFR_EXT_DRAW_SIZE: + case LV_EVENT_DRAW_MAIN_BEGIN: + case LV_EVENT_DRAW_MAIN: + case LV_EVENT_DRAW_MAIN_END: + case LV_EVENT_DRAW_POST_BEGIN: + case LV_EVENT_DRAW_POST: + case LV_EVENT_DRAW_POST_END: + case LV_EVENT_DRAW_PART_BEGIN: + case LV_EVENT_DRAW_PART_END: + case LV_EVENT_REFRESH: + case LV_EVENT_DELETE: + case LV_EVENT_CHILD_CHANGED: + case LV_EVENT_SIZE_CHANGED: + case LV_EVENT_STYLE_CHANGED: + case LV_EVENT_REFR_SELF_SIZE: + return false; + default: + return true; + } +} diff --git a/src/core/lv_event.h b/src/core/lv_event.h new file mode 100644 index 000000000..efc319d11 --- /dev/null +++ b/src/core/lv_event.h @@ -0,0 +1,217 @@ +/** + * @file lv_templ.h + * + */ + +#ifndef LV_EVENT_H +#define LV_EVENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct _lv_obj_t; +struct _lv_event_dsc_t; + +/** + * Type of event being sent to the object. + */ +typedef enum { + LV_EVENT_ALL = 0, + + /** Input device events*/ + LV_EVENT_PRESSED, /**< The object has been pressed*/ + LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/ + LV_EVENT_PRESS_LOST, /**< The object is still being pressed but slid cursor/finger off of the object */ + LV_EVENT_SHORT_CLICKED, /**< The object was pressed for a short period of time, then released it. Not called if scrolled.*/ + LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not called if scrolled.*/ + LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.*/ + LV_EVENT_CLICKED, /**< Called on release if not scrolled (regardless to long press)*/ + LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/ + LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins*/ + LV_EVENT_SCROLL_END, /**< Scrolling ends*/ + LV_EVENT_SCROLL, /**< Scrolling*/ + LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());` */ + LV_EVENT_KEY, /**< A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_get_act());`*/ + LV_EVENT_FOCUSED, /**< The object is focused*/ + LV_EVENT_DEFOCUSED, /**< The object is defocused*/ + LV_EVENT_LEAVE, /**< The object is defocused but still selected*/ + LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing*/ + + /** Drawing events*/ + LV_EVENT_COVER_CHECK, /**< Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.*/ + LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow). The event parameter is `lv_coord_t *` to store the size.*/ + LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase*/ + LV_EVENT_DRAW_MAIN, /**< Perform the main drawing*/ + LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase*/ + LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/ + LV_EVENT_DRAW_PART_BEGIN, /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */ + LV_EVENT_DRAW_PART_END, /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */ + + /** Special events*/ + LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/ + LV_EVENT_INSERT, /**< A text is inserted to the object. The event data is `char *` being inserted.*/ + LV_EVENT_REFRESH, /**< Notify the object to refresh something on it (for the user)*/ + LV_EVENT_READY, /**< A process has finished*/ + LV_EVENT_CANCEL, /**< A process has been cancelled */ + + /** Other events*/ + LV_EVENT_DELETE, /**< Object is being deleted*/ + LV_EVENT_CHILD_CHANGED, /**< Child was removed/added*/ + LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed*/ + LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/ + LV_EVENT_BASE_DIR_CHANGED, /**< The base dir has changed*/ + LV_EVENT_REFR_SELF_SIZE, /**< Get the internal size of a widget*/ + + _LV_EVENT_LAST /** Number of default events*/ +}lv_event_code_t; + + +typedef struct _lv_event_t { + struct _lv_obj_t * target; + struct _lv_obj_t * current_target; + lv_event_code_t code; + void * user_data; + void * param; + struct _lv_event_t * prev; + uint8_t deleted :1; +}lv_event_t; + +/** + * @brief Event callback. + * Events are used to notify the user of some action being taken on the object. + * For details, see ::lv_event_t. + */ +typedef void (*lv_event_cb_t)(lv_event_t * e); + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Send an event to the object + * @param obj pointer to an object + * @param event_code the type of the event from `lv_event_t` + * @param param arbitrary data depending on the widget type and the event. (Usually `NULL`) + * @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event_code + */ +lv_res_t lv_event_send(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param); + +/** + * Used by the widgets internally to call the ancestor widget types's event handler + * @param class_p pointer to the class of the widget (NOT the ancestor class) + * @param e pointer to the event descriptor + * @return LV_RES_OK: the taget object was not deleted in the event; LV_RES_INV: it was deleted in the event_code + */ +lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e); + +/** + * Get the object originally targeted by the event. It's the same even if the event is bubbled. + * @param e pointer to the event descriptor + * @return the target of the event_code + */ +struct _lv_obj_t * lv_event_get_target(lv_event_t * e); + +/** + * Get the current target of the event. It's the object which event handler being called. + * If the event is not bubbled it's the same as "normal" target. + * @param e pointer to the event descriptor + * @return pointer to the current target of the event_code + */ +struct _lv_obj_t * lv_event_get_current_target(lv_event_t * e); + +/** + * Get the event code of an event + * @param e pointer to the event descriptor + * @return the event code. (E.g. `LV_EVENT_CLICKED`, `LV_EVENT_FOCUSED`, etc) + */ +lv_event_code_t lv_event_get_code(lv_event_t * e); + +/** + * Get the parameter passed when the event was sent + * @param e pointer to the event descriptor + * @return pointer to the parameter + */ +void * lv_event_get_param(lv_event_t * e); + +/** + * Get the user_data passed when the event was registered on the object + * @param e pointer to the event descriptor + * @return pointer to the user_data + */ +void * lv_event_get_user_data(lv_event_t * e); + + +/** + * Register a new, custom event ID. + * It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events + * @return the new event id + * @example + * uint32_t LV_EVENT_MINE = 0; + * ... + * e = lv_event_register_id(); + * ... + * lv_event_send(obj, LV_EVENT_MINE, &some_data); + */ +uint32_t lv_event_register_id(void); + +/** + * Nested events can be called and one of them might belong to an object that is being deleted. + * Mark this object's `event_temp_data` deleted to know that it's `lv_event_send` should return `LV_RES_INV` + * @param obj pointer to an obejct to mark as deleted + */ +void _lv_event_mark_deleted(struct _lv_obj_t * obj); + + +/** + * Add an event handler function for an object. + * Used by the user to react on event which happens with the object. + * An object can have multiple event handler. They will be called in the same order as they were added. + * @param obj pointer to an object + * @param filter and event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be sued the receive all the events. + * @param event_cb the new event function + * @param user_data custom data data will be available in `event_cb` + * @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc + */ +struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); + +/** + * Remove an event handler function for an object. + * @param obj pointer to an object + * @param event_cb the event function to remove + * @return true if any event handlers were removed + */ +bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb); + +/** + * Remove an event handler function for an object. + * @param obj pointer to an object + * @param event_dsc pointer to an event descriptor to remove (returned by ::lv_obj_add_event_cb) + * @return true if any event handlers were removed + */ +bool lv_obj_remove_event_dsc(struct _lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_EVENT_H*/ diff --git a/src/core/lv_group.c b/src/core/lv_group.c index e9f976e77..e5c9252d8 100644 --- a/src/core/lv_group.c +++ b/src/core/lv_group.c @@ -11,6 +11,7 @@ #include "lv_group.h" #include "../misc/lv_gc.h" #include "../core/lv_obj.h" +#include "../core/lv_indev.h" /********************* * DEFINES @@ -26,6 +27,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *)); static void lv_group_refocus(lv_group_t * g); +static lv_indev_t * get_indev(const lv_group_t * g); /********************** * STATIC VARIABLES @@ -70,7 +72,7 @@ void lv_group_del(lv_group_t * group) { /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { - lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL); + lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group)); lv_obj_invalidate(*group->obj_focus); } @@ -145,12 +147,12 @@ void lv_group_remove_obj(lv_obj_t * obj) LV_LOG_TRACE("begin"); /*Focus on the next object*/ - if(*g->obj_focus == obj) { + if(g->obj_focus && *g->obj_focus == obj) { if(g->frozen) g->frozen = 0; /*If this is the only object in the group then focus to nothing.*/ if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { - lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, NULL); + lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g)); } /*If there more objects in the group then focus to the next/prev object*/ else { @@ -161,7 +163,7 @@ void lv_group_remove_obj(lv_obj_t * obj) /*If the focuses object is still the same then it was the only object in the group but it will *be deleted. Set the `obj_focus` to NULL to get back to the initial state of the group with *zero objects*/ - if(*g->obj_focus == obj) { + if(g->obj_focus && *g->obj_focus == obj) { g->obj_focus = NULL; } @@ -182,7 +184,7 @@ void lv_group_remove_all_objs(lv_group_t * group) { /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { - lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL); + lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group)); lv_obj_invalidate(*group->obj_focus); group->obj_focus = NULL; } @@ -213,7 +215,7 @@ void lv_group_focus_obj(lv_obj_t * obj) _LV_LL_READ(&g->obj_ll, i) { if(*i == obj) { if(g->obj_focus != NULL) { - lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, NULL); + lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g)); if(res != LV_RES_OK) return; lv_obj_invalidate(*g->obj_focus); } @@ -222,7 +224,7 @@ void lv_group_focus_obj(lv_obj_t * obj) if(g->obj_focus != NULL) { if(g->focus_cb) g->focus_cb(g); - lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_FOCUSED, NULL); + lv_res_t res = lv_event_send(*g->obj_focus, LV_EVENT_FOCUSED, get_indev(g)); if(res != LV_RES_OK) return; lv_obj_invalidate(*g->obj_focus); } @@ -243,10 +245,8 @@ void lv_group_focus_prev(lv_group_t * group) void lv_group_focus_freeze(lv_group_t * group, bool en) { - if(en == false) - group->frozen = 0; - else - group->frozen = 1; + if(en == false) group->frozen = 0; + else group->frozen = 1; } lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c) @@ -278,7 +278,7 @@ void lv_group_set_editing(lv_group_t * group, bool edit) lv_obj_t * focused = lv_group_get_focused(group); if(focused) { - lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL); + lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group)); if(res != LV_RES_OK) return; lv_obj_invalidate(focused); @@ -387,14 +387,14 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) if(obj_next == group->obj_focus) return; /*There's only one visible object and it's already focused*/ if(group->obj_focus) { - lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, NULL); + lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group)); if(res != LV_RES_OK) return; lv_obj_invalidate(*group->obj_focus); } group->obj_focus = obj_next; - lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL); + lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group)); if(res != LV_RES_OK) return; lv_obj_invalidate(*group->obj_focus); @@ -402,3 +402,33 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) if(group->focus_cb) group->focus_cb(group); } +/** + * Find an indev preferably with KEYPAD or ENCOEDR type that uses the given group. + * In other words, find an indev, that is related to the given group. + * In the worst case simply return the latest indev + * @param g a group the find in the indevs + * @return the suggested indev + */ +static lv_indev_t * get_indev(const lv_group_t * g) +{ + lv_indev_t * indev_encoder = NULL; + lv_indev_t * indev_group = NULL; + lv_indev_t * indev = lv_indev_get_next(NULL); + while(indev) { + lv_indev_type_t indev_type = lv_indev_get_type(indev); + if(indev->group == g) { + /*Prefer KEYPAD*/ + if(indev_type == LV_INDEV_TYPE_KEYPAD) return indev; + if(indev_type == LV_INDEV_TYPE_ENCODER) indev_encoder = indev; + indev_group = indev; + } + indev = lv_indev_get_next(indev); + } + + if(indev_encoder) return indev_encoder; + if(indev_group) return indev_group; + + /*In lack of a better option use the first input device. (It can be NULL if there is no input device)*/ + return lv_indev_get_next(NULL); +} + diff --git a/src/core/lv_indev.c b/src/core/lv_indev.c index 34a176ccd..058c55ea5 100644 --- a/src/core/lv_indev.c +++ b/src/core/lv_indev.c @@ -972,7 +972,7 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev) static void indev_click_focus(lv_indev_proc_t * proc) { /*Handle click focus*/ - lv_obj_t * obj_to_focus = lv_obj_get_focused_obj(indev_obj_act); + lv_obj_t * obj_to_focus = indev_obj_act; if(lv_obj_has_flag(obj_to_focus, LV_OBJ_FLAG_CLICK_FOCUSABLE) && proc->types.pointer.last_pressed != obj_to_focus) { lv_group_t * g_act = lv_obj_get_group(obj_to_focus); diff --git a/src/core/lv_indev_scroll.c b/src/core/lv_indev_scroll.c index 6e5c9c915..97b1f6802 100644 --- a/src/core/lv_indev_scroll.c +++ b/src/core/lv_indev_scroll.c @@ -437,6 +437,9 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo case LV_SCROLL_SNAP_CENTER: x_child = child->coords.x1 + lv_area_get_width(&child->coords) / 2; x_parent = obj->coords.x1 + pad_left + (lv_area_get_width(&obj->coords) - pad_left - pad_right) / 2; + break; + default: + continue; } x_child += ofs; @@ -487,6 +490,9 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo case LV_SCROLL_SNAP_CENTER: y_child = child->coords.y1 + lv_area_get_height(&child->coords) / 2; y_parent = obj->coords.y1 + pad_top + (lv_area_get_height(&obj->coords) - pad_top - pad_bottom) / 2; + break; + default: + continue; } y_child += ofs; diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 4a51bae05..c27f67bb9 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -42,52 +42,28 @@ /********************** * TYPEDEFS **********************/ -typedef struct _lv_event_temp_data { - lv_obj_t * obj; - bool deleted; - struct _lv_event_temp_data * prev; -} lv_event_temp_data_t; - -typedef struct { - uint16_t time; - uint16_t delay; - lv_style_selector_t selector; - lv_style_prop_t prop; - const lv_anim_path_t * path; -}trans_set_t; - -typedef struct _lv_event_dsc_t{ - lv_event_cb_t cb; - void * user_data; -}lv_event_dsc_t; /********************** * STATIC PROTOTYPES **********************/ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_obj_draw(lv_obj_t * obj, lv_event_t e); -static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e); +static void lv_obj_draw(lv_event_t * e); +static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area); static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc); static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); -static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param); static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state); static void base_dir_refr_children(lv_obj_t * obj); -static bool event_is_bubbled(lv_event_t e); /********************** * STATIC VARIABLES **********************/ static bool lv_initialized = false; -static lv_event_temp_data_t * event_temp_data_head; -static void * event_act_param; -static void * event_act_user_data_cb; -static lv_obj_t * event_original_target; const lv_obj_class_t lv_obj_class = { .constructor_cb = lv_obj_constructor, .destructor_cb = lv_obj_destructor, - .event_cb = lv_obj_event_cb, + .event_cb = lv_obj_event, .width_def = LV_DPI_DEF, .height_def = LV_DPI_DEF, .editable = LV_OBJ_CLASS_EDITABLE_FALSE, @@ -99,11 +75,6 @@ const lv_obj_class_t lv_obj_class = { /********************** * MACROS **********************/ -#if LV_LOG_TRACE_EVENT -# define EVENT_TRACE(...) LV_LOG_TRACE( __VA_ARGS__) -#else -# define EVENT_TRACE(...) -#endif /********************** * GLOBAL FUNCTIONS @@ -154,6 +125,16 @@ void lv_init(void) LV_LOG_WARN("The strings has no UTF-8 encoding. Non-ASCII characters won't be displayed.") } + uint32_t endianess_test = 0x11223344; + uint8_t * endianess_test_p = (uint8_t*) &endianess_test; + bool big_endian = endianess_test_p[0] == 0x11 ? true : false; + + if(big_endian) { + LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 1, "It's a big endian system but LV_BIG_ENDIAN_SYSTEM is not enabled in lv_conf.h"); + } else { + LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 0, "It's a little endian system but LV_BIG_ENDIAN_SYSTEM is enabled in lv_conf.h"); + } + #if LV_USE_ASSERT_MEM_INTEGRITY LV_LOG_WARN("Memory integrity checks are enabled via LV_USE_ASSERT_MEM_INTEGRITY which makes LVGL much slower") #endif @@ -193,103 +174,7 @@ void lv_deinit(void) lv_obj_t * lv_obj_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_obj_class, parent); -} - -/*--------------------- - * Event/Signal sending - *---------------------*/ - -lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param) -{ - if(obj == NULL) return LV_RES_OK; - - LV_ASSERT_OBJ(obj, MY_CLASS); - - /*Save the original target first in tmp variable because nested `lv_event_send` calls can overwrite it*/ - lv_obj_t * event_original_target_tmp = event_original_target; - event_original_target = obj; - - /*Send the event*/ - lv_res_t res = event_send_core(obj, event, param); - - /*Restore the original target*/ - event_original_target = event_original_target_tmp; - - return res; -} - - -lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e) -{ - const lv_obj_class_t * base; - if(class_p == NULL) base = obj->class_p; - else base = class_p->base_class; - - /*Find a base in which Call the ancestor's event handler_cb is set*/ - while(base && base->event_cb == NULL) base = base->base_class; - - if(base == NULL) return LV_RES_OK; - if(base->event_cb == NULL) return LV_RES_OK; - - - /* Build a simple linked list from the objects used in the events - * It's important to know if an this object was deleted by a nested event - * called from this `event_cb`. */ - lv_event_temp_data_t event_temp_data; - event_temp_data.obj = obj; - event_temp_data.deleted = false; - event_temp_data.prev = NULL; - - if(event_temp_data_head) { - event_temp_data.prev = event_temp_data_head; - } - event_temp_data_head = &event_temp_data; - - /*Call the actual event callback*/ - base->event_cb(obj, e); - - lv_res_t res = LV_RES_OK; - /*Stop if the object is deleted*/ - if(event_temp_data.deleted) res = LV_RES_INV; - - /*Remove this element from the list*/ - event_temp_data_head = event_temp_data_head->prev; - - return res; -} - - -void * lv_event_get_param(void) -{ - return event_act_param; -} - -void * lv_event_get_user_data(void) -{ - return event_act_user_data_cb; -} - -lv_obj_t * lv_event_get_original_target(void) -{ - return event_original_target; -} - -uint32_t lv_event_register_id(void) -{ - static uint32_t last_id = _LV_EVENT_LAST; - last_id ++; - return last_id; -} - -void _lv_event_mark_deleted(lv_obj_t * obj) -{ - lv_event_temp_data_t * t = event_temp_data_head; - - while(t) { - if(t->obj == obj) t->deleted = true; - t = t->prev; - } + return lv_obj_class_create_obj(&lv_obj_class, parent, NULL); } /*===================== @@ -359,50 +244,6 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state) } } -void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - lv_obj_allocate_spec_attr(obj); - - obj->spec_attr->event_dsc_cnt++; - obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); - LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); - - obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb; - obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].user_data = user_data; -} - -bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - if(obj->spec_attr == NULL) return false; - - int32_t i = 0; - for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) { - if(obj->spec_attr->event_dsc[i].cb == event_cb) { - /*Check if user_data matches or if the requested user_data is NULL*/ - if(user_data == NULL || obj->spec_attr->event_dsc[i].user_data == user_data) { - /*Found*/ - break; - } - } - } - if(i >= obj->spec_attr->event_dsc_cnt) { - /*No event handler found*/ - return false; - } - - /*Shift the remaining event handlers forward*/ - for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) { - obj->spec_attr->event_dsc[i].cb = obj->spec_attr->event_dsc[i+1].cb; - obj->spec_attr->event_dsc[i].user_data = obj->spec_attr->event_dsc[i+1].user_data; - } - obj->spec_attr->event_dsc_cnt--; - obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t)); - LV_ASSERT_MALLOC(obj->spec_attr->event_dsc); - return true; -} - void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir) { if(dir != LV_BIDI_DIR_LTR && dir != LV_BIDI_DIR_RTL && @@ -479,16 +320,6 @@ bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state) return obj->state & state ? true : false; } -lv_event_dsc_t * lv_obj_get_event_dsc(const lv_obj_t * obj, uint32_t id) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - - if(!obj->spec_attr) return NULL; - if(id >= obj->spec_attr->event_dsc_cnt) return NULL; - - return &obj->spec_attr->event_dsc[id]; -} - void * lv_obj_get_group(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -521,17 +352,6 @@ void lv_obj_allocate_spec_attr(lv_obj_t * obj) } } -lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj) -{ - if(obj == NULL) return NULL; - const lv_obj_t * focus_obj = obj; - while(lv_obj_has_flag(focus_obj, LV_OBJ_FLAG_FOCUS_BUBBLE) != false && focus_obj != NULL) { - focus_obj = lv_obj_get_parent(focus_obj); - } - - return (lv_obj_t *)focus_obj; -} - bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p) { if(obj == NULL) return false; @@ -625,10 +445,12 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } -static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) +static void lv_obj_draw(lv_event_t * e) { - if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res == LV_DRAW_RES_MASKED) return; if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) { info->res = LV_DRAW_RES_MASKED; @@ -670,8 +492,8 @@ static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) info->res = LV_DRAW_RES_COVER; } - else if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_init(&draw_dsc); /*If the border is drawn later disable loading its properties*/ @@ -702,8 +524,8 @@ static void lv_obj_draw(lv_obj_t * obj, lv_event_t e) } #endif } - else if(e == LV_EVENT_DRAW_POST) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_POST) { + const lv_area_t * clip_area = lv_event_get_param(e); draw_scrollbar(obj, clip_area); #if LV_DRAW_COMPLEX @@ -795,42 +617,44 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc #endif } -#include "lvgl/lvgl.h" - -static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) +static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) { - if(e == LV_EVENT_PRESSED) { + LV_UNUSED(class_p); + + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_PRESSED) { lv_obj_add_state(obj, LV_STATE_PRESSED); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_obj_clear_state(obj, LV_STATE_PRESSED); - void * param = lv_event_get_param(); + void * param = lv_event_get_param(e); /*Go the checked state if enabled*/ if(lv_indev_get_scroll_obj(param) == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) { if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED); else lv_obj_clear_state(obj, LV_STATE_CHECKED); - } - } - else if(e == LV_EVENT_PRESS_LOST) { - lv_obj_clear_state(obj, LV_STATE_PRESSED); - } - else if(e == LV_EVENT_KEY) { - if(lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) { - uint32_t state = 0; - char c = *((char *)lv_event_get_param()); - if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { - lv_obj_add_state(obj, LV_STATE_CHECKED); - state = 1; - } - else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) { - lv_obj_clear_state(obj, LV_STATE_CHECKED); - state = 0; - } - lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &state); + + lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_PRESS_LOST) { + lv_obj_clear_state(obj, LV_STATE_PRESSED); + } + else if(code == LV_EVENT_KEY) { + if(lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) { + char c = *((char *)lv_event_get_param(e)); + if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { + lv_obj_add_state(obj, LV_STATE_CHECKED); + } + else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) { + lv_obj_clear_state(obj, LV_STATE_CHECKED); + } + lv_res_t res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); + if(res != LV_RES_OK) return; + } + } + else if(code == LV_EVENT_FOCUSED) { if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS)) { lv_obj_scroll_to_view_recursive(obj, LV_ANIM_ON); } @@ -838,37 +662,29 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) bool editing = false; editing = lv_group_get_editing(lv_obj_get_group(obj)); lv_state_t state = LV_STATE_FOCUSED; - lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); + + lv_indev_t * indev = lv_indev_get_act(); + lv_indev_type_t indev_type = lv_indev_get_type(indev); if(indev_type == LV_INDEV_TYPE_KEYPAD || indev_type == LV_INDEV_TYPE_ENCODER) state |= LV_STATE_FOCUS_KEY; if(editing) { state |= LV_STATE_EDITED; - - /*if using focus mode, change target to parent*/ - obj = lv_obj_get_focused_obj(obj); - lv_obj_add_state(obj, state); } else { - /*if using focus mode, change target to parent*/ - obj = lv_obj_get_focused_obj(obj); - lv_obj_add_state(obj, state); lv_obj_clear_state(obj, LV_STATE_EDITED); } } - else if(e == LV_EVENT_SCROLL_BEGIN) { + else if(code == LV_EVENT_SCROLL_BEGIN) { lv_obj_add_state(obj, LV_STATE_SCROLLED); } - else if(e == LV_EVENT_SCROLL_END) { + else if(code == LV_EVENT_SCROLL_END) { lv_obj_clear_state(obj, LV_STATE_SCROLLED); } - else if(e == LV_EVENT_DEFOCUSED) { - /*if using focus mode, change target to parent*/ - obj = lv_obj_get_focused_obj(obj); - + else if(code == LV_EVENT_DEFOCUSED) { lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED | LV_STATE_FOCUS_KEY); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { lv_obj_t * child = lv_obj_get_child(obj, i); @@ -883,7 +699,7 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_mark_layout_as_dirty(obj); } } - else if(e == LV_EVENT_CHILD_CHANGED) { + else if(code == LV_EVENT_CHILD_CHANGED) { lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN); lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_MAIN); lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); @@ -892,22 +708,22 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_mark_layout_as_dirty(obj); } } - else if(e == LV_EVENT_BASE_DIR_CHANGED) { + else if(code == LV_EVENT_BASE_DIR_CHANGED) { /*The layout might depend on the base dir. *E.g. the first is element is on the left or right*/ lv_obj_mark_layout_as_dirty(obj); } - else if(e == LV_EVENT_SCROLL_END) { + else if(code == LV_EVENT_SCROLL_END) { if(lv_obj_get_scrollbar_mode(obj) == LV_SCROLLBAR_MODE_ACTIVE) { lv_obj_invalidate(obj); } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); *s = LV_MAX(*s, d); } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { /*Padding might have changed so the layout should be recalculated*/ uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { @@ -921,8 +737,8 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_refresh_ext_draw_size(obj); } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST || e == LV_EVENT_COVER_CHECK) { - lv_obj_draw(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) { + lv_obj_draw(e); } } @@ -945,13 +761,14 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) /*If there is no difference in styles there is nothing else to do*/ if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return; - trans_set_t * ts = lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX); - lv_memset_00(ts, sizeof(trans_set_t) * STYLE_TRANSITION_MAX); + _lv_obj_style_transition_dsc_t * ts = lv_mem_buf_get(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); + lv_memset_00(ts, sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); uint32_t tsi = 0; uint32_t i; for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) { lv_obj_style_t * obj_style = &obj->styles[i]; lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector); + lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); if(state_act & (~new_state)) continue; /*Skip unrelated styles*/ if(obj_style->is_trans) continue; @@ -959,21 +776,26 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) if(lv_style_get_prop_inlined(obj_style->style, LV_STYLE_TRANSITION, &v) == false) continue; const lv_style_transition_dsc_t * tr = v.ptr; - /*Add the props t the set is not added yet or added but with smaller weight*/ + /*Add the props t the set if not added yet or added but with smaller weight*/ uint32_t j; for(j = 0; tr->props[j] != 0 && tsi < STYLE_TRANSITION_MAX; j++) { uint32_t t; for(t = 0; t < tsi; t++) { - lv_state_t state_tr = lv_obj_style_get_selector_state(ts[t].selector); - if(ts[t].prop == tr->props[j] && state_tr >= state_act) break; + lv_style_selector_t selector = lv_obj_style_get_selector_state(ts[t].selector); + lv_state_t state_ts = lv_obj_style_get_selector_state(selector); + lv_part_t part_ts = lv_obj_style_get_selector_part(selector); + if(ts[t].prop == tr->props[j] && part_ts == part_act && state_ts >= state_act) break; } /*If not found add it*/ if(t == tsi) { ts[tsi].time = tr->time; ts[tsi].delay = tr->delay; - ts[tsi].path = tr->path; + ts[tsi].path_cb = tr->path_xcb; ts[tsi].prop = tr->props[j]; +#if LV_USE_USER_DATA + ts[tsi].user_data = tr->user_data; +#endif ts[tsi].selector = obj_style->selector; tsi++; } @@ -982,15 +804,17 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) for(i = 0;i < tsi; i++) { lv_part_t part_act = lv_obj_style_get_selector_part(ts[i].selector); - _lv_obj_style_create_transition(obj, ts[i].prop, part_act, prev_state, new_state, ts[i].time, ts[i].delay, ts[i].path); + _lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]); } lv_mem_buf_release(ts); - lv_obj_invalidate(obj); + if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN) { + lv_obj_invalidate(obj); + } if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) { - lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); } else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) { lv_obj_refresh_ext_draw_size(obj); @@ -1010,7 +834,6 @@ static void base_dir_refr_children(lv_obj_t * obj) } } - static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find) { @@ -1032,99 +855,3 @@ static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_fin } return false; } - -static lv_res_t event_send_core(lv_obj_t * obj, lv_event_t event, void * param) -{ - EVENT_TRACE("Sending event %d to %p with %p param", event, obj, param); - - /*Build a simple linked list from the objects used in the events - *It's important to know if an this object was deleted by a nested event - *called from this `event_cb`.*/ - lv_event_temp_data_t event_temp_data; - event_temp_data.obj = obj; - event_temp_data.deleted = false; - event_temp_data.prev = NULL; - - if(event_temp_data_head) { - event_temp_data.prev = event_temp_data_head; - } - event_temp_data_head = &event_temp_data; - - /*There could be nested event sending with different param. - *It needs to be saved for the current event context because `lv_event_get_data` returns a global param.*/ - void * event_act_param_save = event_act_param; - event_act_param = param; - - /*Call the input device's feedback callback if set*/ - lv_indev_t * indev_act = lv_indev_get_act(); - if(indev_act) { - if(indev_act->driver->feedback_cb) indev_act->driver->feedback_cb(indev_act->driver, event); - } - - lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0); - lv_res_t res = LV_RES_OK; - res = lv_obj_event_base(NULL, obj, event); - - uint32_t i = 0; - while(event_dsc && res == LV_RES_OK) { - if(event_dsc->cb) { - void * event_act_user_data_cb_save = event_act_user_data_cb; - event_act_user_data_cb = event_dsc->user_data; - - event_dsc->cb(obj, event); - - event_act_user_data_cb = event_act_user_data_cb_save; - - /*Stop if the object is deleted*/ - if(event_temp_data.deleted) { - res = LV_RES_INV; - break; - } - } - - i++; - event_dsc = lv_obj_get_event_dsc(obj, i); - } - - /*Restore the event param*/ - event_act_param = event_act_param_save; - - /*Remove this element from the list*/ - event_temp_data_head = event_temp_data_head->prev; - - if(res == LV_RES_OK && event_is_bubbled(event)) { - if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) { - res = event_send_core(obj->parent, event, param); - if(res != LV_RES_OK) return LV_RES_INV; - } - } - - return LV_RES_OK; -} - -static bool event_is_bubbled(lv_event_t e) -{ - switch(e) { - case LV_EVENT_HIT_TEST: - case LV_EVENT_COVER_CHECK: - case LV_EVENT_REFR_EXT_DRAW_SIZE: - case LV_EVENT_DRAW_MAIN_BEGIN: - case LV_EVENT_DRAW_MAIN: - case LV_EVENT_DRAW_MAIN_END: - case LV_EVENT_DRAW_POST_BEGIN: - case LV_EVENT_DRAW_POST: - case LV_EVENT_DRAW_POST_END: - case LV_EVENT_DRAW_PART_BEGIN: - case LV_EVENT_DRAW_PART_END: - case LV_EVENT_REFRESH: - case LV_EVENT_DELETE: - case LV_EVENT_CHILD_CHANGED: - case LV_EVENT_SIZE_CHANGED: - case LV_EVENT_STYLE_CHANGED: - case LV_EVENT_GET_SELF_SIZE: - return false; - default: - return true; - } -} - diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 015113e11..c326f3b2d 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -27,82 +27,12 @@ extern "C" { /********************* * DEFINES *********************/ -#define _LV_EVENT_FLAG_BUBBLED 0x80 /********************** * TYPEDEFS **********************/ struct _lv_obj_t; -struct _lv_event_dsc_t; - -/*--------------------- - * EVENTS - *---------------------*/ - -/** - * Type of event being sent to the object. - */ -typedef enum { - /** Input device events*/ - LV_EVENT_PRESSED, /**< The object has been pressed*/ - LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/ - LV_EVENT_PRESS_LOST, /**< The object is still being pressed but slid cursor/finger off of the object */ - LV_EVENT_SHORT_CLICKED, /**< The object was pressed for a short period of time, then released it. Not called if scrolled.*/ - LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not called if scrolled.*/ - LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.*/ - LV_EVENT_CLICKED, /**< Called on release if not scrolled (regardless to long press)*/ - LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/ - LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins*/ - LV_EVENT_SCROLL_END, /**< Scrolling ends*/ - LV_EVENT_SCROLL, /**< Scrolling*/ - LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());` */ - LV_EVENT_KEY, /**< A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_get_act());`*/ - LV_EVENT_FOCUSED, /**< The object is focused*/ - LV_EVENT_DEFOCUSED, /**< The object is defocused*/ - LV_EVENT_LEAVE, /**< The object is defocused but still selected*/ - LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing*/ - - /** Drawing events*/ - LV_EVENT_COVER_CHECK, /**< Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.*/ - LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow). The event parameter is `lv_coord_t *` to store the size.*/ - LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase*/ - LV_EVENT_DRAW_MAIN, /**< Perform the main drawing*/ - LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase*/ - LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/ - LV_EVENT_DRAW_PART_BEGIN, /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */ - LV_EVENT_DRAW_PART_END, /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */ - - /** Special events*/ - LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/ - LV_EVENT_INSERT, /**< A text is inserted to the object. The event data is `char *` being inserted.*/ - LV_EVENT_REFRESH, /**< Notify the object to refresh something on it (for the user)*/ - LV_EVENT_READY, /**< A process has finished*/ - LV_EVENT_CANCEL, /**< A process has been cancelled */ - - /** Other events*/ - LV_EVENT_DELETE, /**< Object is being deleted*/ - LV_EVENT_CHILD_CHANGED, /**< Child was removed/added*/ - LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed*/ - LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/ - LV_EVENT_BASE_DIR_CHANGED, /**< The base dir has changed*/ - LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/ - - _LV_EVENT_LAST /** Number of default events*/ -}lv_event_t; - -/** - * @brief Event callback. - * Events are used to notify the user of some action being taken on the object. - * For details, see ::lv_event_t. - */ -typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event); - -/*--------------------- - * EVENTS - *---------------------*/ /** * Possible states of a widget. @@ -171,10 +101,9 @@ enum { LV_OBJ_FLAG_PRESS_LOCK = (1 << 11), /**< Keep the object pressed even if the press slid from the object*/ LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12), /**< Propagate the events to the parent too*/ LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13), /**< Propagate the gestures to the parent*/ - LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14), /**< Propagate the focus to the parent*/ - LV_OBJ_FLAG_ADV_HITTEST = (1 << 15), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/ - LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 16), /**< Make the object position-able by the layouts*/ - LV_OBJ_FLAG_FLOATING = (1 << 17), /**< Do not scroll the object when the parent scrolls and ignore layout*/ + LV_OBJ_FLAG_ADV_HITTEST = (1 << 14), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/ + LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 15), /**< Make the object position-able by the layouts*/ + LV_OBJ_FLAG_FLOATING = (1 << 16), /**< Do not scroll the object when the parent scrolls and ignore layout*/ LV_OBJ_FLAG_LAYOUT_1 = (1 << 23), /** Custom flag, free to use by layouts*/ LV_OBJ_FLAG_LAYOUT_2 = (1 << 24), /** Custom flag, free to use by layouts*/ @@ -195,6 +124,7 @@ typedef uint32_t lv_obj_flag_t; #include "lv_obj_style.h" #include "lv_obj_draw.h" #include "lv_obj_class.h" +#include "lv_event.h" #include "lv_group.h" /** @@ -214,7 +144,7 @@ typedef struct { struct _lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array*/ lv_point_t scroll; /**< The current X/Y scroll offset*/ - uint8_t ext_click_pad; /**< Extra click padding in all direction*/ + lv_coord_t ext_click_pad; /**< Extra click padding in all direction*/ lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ lv_scrollbar_mode_t scrollbar_mode :2; /**< How to display scrollbars*/ @@ -234,9 +164,11 @@ typedef struct _lv_obj_t { void * user_data; #endif lv_area_t coords; + lv_point_t self_size; lv_obj_flag_t flags; lv_state_t state; uint16_t layout_inv :1; + uint16_t scr_layout_inv :1; uint16_t skip_trans :1; uint16_t style_cnt :6; uint16_t h_layout :1; @@ -290,59 +222,6 @@ void lv_deinit(void); lv_obj_t * lv_obj_create(lv_obj_t * parent); -/*--------------------- - * Event/Signal sending - *---------------------*/ - -/** - * Send an event to the object - * @param obj pointer to an object - * @param event the type of the event from `lv_event_t` - * @param param arbitrary data depending on the object type and the event. (Usually `NULL`) - * @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event - */ -lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param); - -lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, struct _lv_obj_t * obj, lv_event_t e); - -/** - * Get the `param` parameter of the current event - * @return the `param` parameter - */ -void * lv_event_get_param(void); - -/** - * Get the user data of the event callback. (Set when the callback is registered) - * @return the user data parameter - */ -void * lv_event_get_user_data(void); - -/** - * Get the original target of the event. It's different than the "normal" target if the event is bubbled. - * @return pointer to the object the originally received the event before bubbling it to the parents - */ -lv_obj_t * lv_event_get_original_target(void); - -/** - * Register a new, custom event ID. - * It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events - * @return the new event id - * @example - * uint32_t LV_EVENT_MINE = 0; - * ... - * e = lv_event_register_id(); - * ... - * lv_event_send(obj, LV_EVENT_MINE, &some_data); - */ -uint32_t lv_event_register_id(void); - -/** - * Nested events can be called and one of them might belong to an object that is being deleted. - * Mark this object's `event_temp_data` deleted to know that it's `lv_event_send` should return `LV_RES_INV` - * @param obj pointer to an obejct to mark as deleted - */ -void _lv_event_mark_deleted(lv_obj_t * obj); - /*===================== * Setter functions *====================*/ @@ -378,27 +257,6 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state); */ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state); -/** - * Add an event handler function for an object. - * Used by the user to react on event which happens with the object. - * An object can have multiple event handler. They will be called in the same order as they were added. - * @param obj pointer to an object - * @param event_cb the new event function - * @param user_data custom data data will be available in `event_cb` - */ -void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); - -/** - * Remove an event handler function for an object. - * Used by the user to react on event which happens with the object. - * An object can have multiple event handler. They will be called in the same order as they were added. - * @param obj pointer to an object - * @param event_cb the event function to remove - * @param user_data if NULL, remove the first event handler with the same cb, otherwise remove the first event handler with the same cb and user_data - * @return true if any event handlers were removed - */ -bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data); - /** * Set the base direction of the object * @param obj pointer to an object @@ -406,6 +264,17 @@ bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_ */ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir); +/** + * Set the user_data field of the object + * @param obj pointer to an object + * @param user_data pointer to the new user_data. + */ +#if LV_USE_USER_DATA +static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data) +{ + obj->user_data = user_data; +} +#endif /*======================= * Getter functions @@ -450,14 +319,6 @@ lv_state_t lv_obj_get_state(const lv_obj_t * obj); */ bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state); -/** - * Get the event function of an object - * @param obj pointer to an object - * @param id the index of the event callback. 0: the firstly added - * @return the event descriptor - */ -struct _lv_event_dsc_t * lv_obj_get_event_dsc(const lv_obj_t * obj, uint32_t id); - /** * Get the group of the object * @param obj pointer to an object @@ -465,6 +326,18 @@ struct _lv_event_dsc_t * lv_obj_get_event_dsc(const lv_obj_t * obj, uint32_t id) */ void * lv_obj_get_group(const lv_obj_t * obj); +/** + * Get the user_data field of the object + * @param obj pointer to an object + * @return the pointer to the user_data of the object + */ +#if LV_USE_USER_DATA +static inline void * lv_obj_get_user_data(lv_obj_t * obj) +{ + return obj->user_data; +} +#endif + /*======================= * Other functions *======================*/ @@ -475,13 +348,6 @@ void * lv_obj_get_group(const lv_obj_t * obj); */ void lv_obj_allocate_spec_attr(lv_obj_t * obj); -/** - * Get the focused object by taking `LV_OBJ_FLAG_FOCUS_BUBBLE` into account. - * @param obj the start object - * @return the object to to really focus - */ -lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj); - /** * Get object's and its ancestors type. Put their name in `type_buf` starting with the current type. * E.g. buf.type[0]="lv_btn", buf.type[1]="lv_cont", buf.type[2]="lv_obj" diff --git a/src/core/lv_obj_class.c b/src/core/lv_obj_class.c index 6824e4397..98491c60f 100644 --- a/src/core/lv_obj_class.c +++ b/src/core/lv_obj_class.c @@ -40,7 +40,7 @@ static uint32_t get_instance_size(const lv_obj_class_t * class_p); * GLOBAL FUNCTIONS **********************/ -lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * parent) +lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * parent, void * user_data) { LV_TRACE_OBJ_CREATE("Creating object with %p class on %p parent", class_p, parent); uint32_t s = get_instance_size(class_p); @@ -49,6 +49,11 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p lv_memset_00(obj, s); obj->class_p = class_p; obj->parent = parent; +#if LV_USE_USER_DATA + obj->user_data = user_data; +#else + LV_UNUSED(user_data); +#endif /*Create a screen*/ if(parent == NULL) { @@ -94,9 +99,17 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p } } + lv_obj_mark_layout_as_dirty(obj); + lv_obj_enable_style_refresh(false); lv_theme_apply(obj); lv_obj_construct(obj); + + lv_obj_enable_style_refresh(true); + lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); + + lv_obj_refresh_self_size(obj); + lv_group_t * def_group = lv_group_get_default(); if(def_group && lv_obj_is_group_def(obj)) { diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index 9c232b160..7b42b7b40 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -26,6 +26,8 @@ extern "C" { **********************/ struct _lv_obj_t; +struct _lv_obj_class_t; +struct _lv_event_t; typedef enum { LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/ @@ -39,6 +41,8 @@ typedef enum { LV_OBJ_CLASS_GROUP_DEF_FALSE, }lv_obj_class_group_def_t; + +typedef void (*lv_obj_class_event_cb_t)(struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /** * Describe the common methods of every object. * Similar to a C++ class. @@ -50,11 +54,11 @@ typedef struct _lv_obj_class_t { #if LV_USE_USER_DATA void * user_data; #endif - lv_event_cb_t event_cb; /**< Object type specific event function*/ + void (*event_cb)(const struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /**< Widget type specific event function*/ lv_coord_t width_def; lv_coord_t height_def; - uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/ - uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/ + uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/ + uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/ uint32_t instance_size : 16; }lv_obj_class_t; @@ -64,11 +68,13 @@ typedef struct _lv_obj_class_t { /** * Create an object form a class descriptor - * @param class_p pointer to a class - * @param parent pointer to an object where the new object should be created - * @return pointer to the created object + * @param class_p pointer to a class + * @param parent pointer to an object where the new object should be created + * @param user_data a custom user_data to set in `obj->user_data` in creation time. Requires `LV_USE_USER_DATA 1` + * As some event fire during creation it's useful make user_data available for those events too. + * @return pointer to the created object */ -struct _lv_obj_t * lv_obj_create_from_class(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * parent); +struct _lv_obj_t * lv_obj_class_create_obj(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * parent, void * user_data); void _lv_obj_destructor(struct _lv_obj_t * obj); diff --git a/src/core/lv_obj_draw.h b/src/core/lv_obj_draw.h index 4dccb7bf6..27310b8a2 100644 --- a/src/core/lv_obj_draw.h +++ b/src/core/lv_obj_draw.h @@ -43,7 +43,7 @@ typedef struct lv_draw_arc_dsc_t * arc_dsc; const lv_point_t * p1; const lv_point_t * p2; - const lv_coord_t * radius; + lv_coord_t radius; char text[16]; int32_t value; uint32_t id; diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 4d57c3bd1..468b63847 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -9,6 +9,7 @@ #include "lv_obj.h" #include "lv_disp.h" #include "lv_refr.h" +#include "../misc/lv_gc.h" /********************* * DEFINES @@ -28,7 +29,6 @@ static void layout_update_core(lv_obj_t * obj); /********************** * STATIC VARIABLES **********************/ -static lv_layout_update_cb_t * layouts; static uint32_t layout_cnt; /********************** @@ -85,53 +85,66 @@ void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y) lv_obj_refr_pos(obj); } -void lv_obj_refr_size(lv_obj_t * obj) +bool lv_obj_refr_size(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); /*If the width or height is set by a layout do not modify them*/ - if(obj->w_layout && obj->h_layout) return; + if(obj->w_layout && obj->h_layout) return false; lv_obj_t * parent = lv_obj_get_parent(obj); - if(parent == NULL) return; + if(parent == NULL) return false; lv_coord_t w; - lv_coord_t h; - if(obj->w_layout) w = lv_obj_get_width(obj); - else w = lv_obj_get_style_width(obj, LV_PART_MAIN); - if(obj->h_layout) h = lv_obj_get_height(obj); - else h = lv_obj_get_style_height(obj, LV_PART_MAIN); - - /*Calculate the required auto sizes*/ - bool w_content = w == LV_SIZE_CONTENT ? true : false; - bool h_content = h == LV_SIZE_CONTENT ? true : false; - - /*Be sure the object is not scrolled when it has auto size*/ lv_coord_t sl_ori = lv_obj_get_scroll_left(obj); - if(w_content) lv_obj_scroll_to_x(obj, 0, LV_ANIM_OFF); + bool w_content = false; + if(obj->w_layout) { + w = lv_obj_get_width(obj); + } else { + w = lv_obj_get_style_width(obj, LV_PART_MAIN); + w_content = w == LV_SIZE_CONTENT ? true : false; + + /*Be sure the object is not scrolled when it has auto size*/ + if(w_content) { + lv_obj_scroll_to_x(obj, 0, LV_ANIM_OFF); + calc_auto_size(obj, &w, NULL); + } + + /*Calculate the sizes in percentage*/ + bool pct_w = LV_COORD_IS_PCT(w) ? true : false; + + lv_coord_t parent_w = lv_obj_get_content_width(parent); + if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; + + lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); + lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); + w = lv_clamp_width(w, minw, maxw, parent_w); + } + + lv_coord_t h; lv_coord_t st_ori = lv_obj_get_scroll_top(obj); - if(h_content) lv_obj_scroll_to_y(obj, 0, LV_ANIM_OFF); + bool h_content = false; + if(obj->h_layout) { + h = lv_obj_get_height(obj); + } else { + h = lv_obj_get_style_height(obj, LV_PART_MAIN); + h_content = h == LV_SIZE_CONTENT ? true : false; - if(w_content && h_content) calc_auto_size(obj, &w, &h); - else if(w_content) calc_auto_size(obj, &w, NULL); - else if(h_content) calc_auto_size(obj, NULL, &h); + /*Be sure the object is not scrolled when it has auto size*/ + if(h_content) { + lv_obj_scroll_to_y(obj, 0, LV_ANIM_OFF); + calc_auto_size(obj, NULL, &h); + } - /*Calculate the required auto sizes*/ - bool pct_w = LV_COORD_IS_PCT(w) ? true : false; - bool pct_h = LV_COORD_IS_PCT(h) ? true : false; + /*Calculate the sizes in percentage*/ + bool pct_h = LV_COORD_IS_PCT(h) ? true : false; + lv_coord_t parent_h = lv_obj_get_content_height(parent); + if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; - lv_coord_t parent_w = lv_obj_get_width_fit(parent); - lv_coord_t parent_h = lv_obj_get_height_fit(parent); - if(pct_w) w = (LV_COORD_GET_PCT(w) * parent_w) / 100; - if(pct_h) h = (LV_COORD_GET_PCT(h) * parent_h) / 100; - - lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); - lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); - w = lv_clamp_width(w, minw, maxw, parent_w); - - lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); - lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); - h = lv_clamp_width(h, minh, maxh, parent_h); + lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); + lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); + h = lv_clamp_width(h, minh, maxh, parent_h); + } /*calc_auto_size set the scroll x/y to 0 so revert the original value*/ if(w_content || h_content) { @@ -140,7 +153,7 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Do nothing if the size is not changed*/ /*It is very important else recursive resizing can occur without size change*/ - if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) return; + if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) return false; /*Invalidate the original area*/ lv_obj_invalidate(obj); @@ -151,7 +164,7 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Check if the object inside the parent or not*/ lv_area_t parent_fit_area; - lv_obj_get_coords_fit(parent, &parent_fit_area); + lv_obj_get_content_coords(parent, &parent_fit_area); /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ @@ -177,10 +190,46 @@ void lv_obj_refr_size(lv_obj_t * obj) /*Invalidate the new area*/ lv_obj_invalidate(obj); + + /*Be sure the bottom side is not remains scrolled in*/ + /*With snapping the content can't be scrolled in*/ + if(lv_obj_get_scroll_snap_y(obj) == LV_SCROLL_SNAP_NONE) { + lv_coord_t st = lv_obj_get_scroll_top(obj); + lv_coord_t sb = lv_obj_get_scroll_bottom(obj); + if(sb < 0 && st > 0) { + sb = LV_MIN(st, -sb); + lv_obj_scroll_by(obj, 0, sb, LV_ANIM_OFF); + } + } + + if(lv_obj_get_scroll_snap_x(obj) == LV_SCROLL_SNAP_NONE) { + lv_coord_t sl = lv_obj_get_scroll_left(obj); + lv_coord_t sr = lv_obj_get_scroll_right(obj); + if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) { + /*Be sure the left side is not remains scrolled in*/ + if(sr < 0 && sl > 0) { + sr = LV_MIN(sl, -sr); + lv_obj_scroll_by(obj, sr, 0, LV_ANIM_OFF); + } + } else { + /*Be sure the right side is not remains scrolled in*/ + if(sl < 0 && sr > 0) { + sr = LV_MIN(sr, -sl); + lv_obj_scroll_by(obj, sl, 0, LV_ANIM_OFF); + } + } + } + /*If the object was out of the parent invalidate the new scrollbar area too. *If it wasn't out of the parent but out now, also invalidate the srollbars*/ bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0); if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent); + + + + + + return true; } void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) @@ -264,11 +313,11 @@ void lv_obj_mark_layout_as_dirty(lv_obj_t * obj) /*Mark the screen as dirty too to mark that there is an something to do on this screen*/ lv_obj_t * scr = lv_obj_get_screen(obj); - scr->layout_inv = 1; + scr->scr_layout_inv = 1; /*Make the display refreshing*/ lv_disp_t * disp = lv_obj_get_disp(scr); - lv_timer_pause(disp->refr_timer, false); + lv_timer_resume(disp->refr_timer); } void lv_obj_update_layout(const lv_obj_t * obj) @@ -283,26 +332,32 @@ void lv_obj_update_layout(const lv_obj_t * obj) lv_obj_t * scr = lv_obj_get_screen(obj); /*Repeat until there where layout invalidations*/ - while(scr->layout_inv) { - LV_LOG_INFO("Start layout update") - scr->layout_inv = 0; + while(scr->scr_layout_inv) { + LV_LOG_INFO("Layout update begin") + scr->scr_layout_inv = 0; layout_update_core(scr); - LV_LOG_TRACE("Layout update finished") + LV_LOG_TRACE("Layout update end") } mutex = false; } -uint32_t lv_layout_register(lv_layout_update_cb_t cb) +uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data) { layout_cnt++; - layouts = lv_mem_realloc(layouts, layout_cnt * sizeof(lv_layout_update_cb_t)); - LV_ASSERT_MALLOC(layouts); + LV_GC_ROOT(_lv_layout_list) = lv_mem_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_dsc_t)); + LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_layout_list)); - layouts[layout_cnt - 1] = cb; + LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].cb = cb; + LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].user_data = user_data; return layout_cnt; /*No -1 to skip 0th index*/ } +void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align) +{ + lv_obj_set_style_align(obj, align, 0); +} + void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) { lv_obj_set_style_align(obj, align, 0); @@ -325,45 +380,45 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv lv_coord_t ptop = lv_obj_get_style_pad_top(parent, LV_PART_MAIN); switch(align) { case LV_ALIGN_CENTER: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_TOP_LEFT: x = 0; y = 0; break; case LV_ALIGN_TOP_MID: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; y = 0; break; case LV_ALIGN_TOP_RIGHT: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); y = 0; break; case LV_ALIGN_BOTTOM_LEFT: x = 0; - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_BOTTOM_MID: - x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2; - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2; + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_BOTTOM_RIGHT: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); - y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj); + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); + y = lv_obj_get_content_height(base) - lv_obj_get_height(obj); break; case LV_ALIGN_LEFT_MID: x = 0; - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_RIGHT_MID: - x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); - y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2; + x = lv_obj_get_content_width(base) - lv_obj_get_width(obj); + y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2; break; case LV_ALIGN_OUT_TOP_LEFT: @@ -503,7 +558,7 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj) return lv_area_get_height(&obj->coords); } -lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) +lv_coord_t lv_obj_get_content_width(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -513,7 +568,7 @@ lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) return lv_obj_get_width(obj) - left - right; } -lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) +lv_coord_t lv_obj_get_content_height(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -523,7 +578,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) return lv_obj_get_height(obj) - top - bottom; } -void lv_obj_get_coords_fit(const lv_obj_t * obj, lv_area_t * area) +void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -535,53 +590,22 @@ void lv_obj_get_coords_fit(const lv_obj_t * obj, lv_area_t * area) } -lv_coord_t lv_obj_get_height_visible(const lv_obj_t * obj) -{ - lv_obj_update_layout(obj); - - lv_coord_t h = LV_COORD_MAX; - lv_obj_t * parent = lv_obj_get_parent(obj); - while(parent) { - h = LV_MIN(lv_obj_get_height_fit(parent), h); - parent = lv_obj_get_parent(parent); - } - - return h == LV_COORD_MAX ? LV_DPI_DEF : h; -} - -lv_coord_t lv_obj_get_width_visible(const lv_obj_t * obj) -{ - lv_obj_update_layout(obj); - - lv_coord_t w = LV_COORD_MAX; - lv_obj_t * parent = lv_obj_get_parent(obj); - while(parent) { - w = LV_MIN(lv_obj_get_width_fit(parent), w); - parent = lv_obj_get_parent(parent); - } - - return w == LV_COORD_MAX ? LV_DPI_DEF : w; -} - lv_coord_t lv_obj_get_self_width(struct _lv_obj_t * obj) { - lv_point_t p = {0, LV_COORD_MIN}; - lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p); - return p.x; + return obj->self_size.x; } lv_coord_t lv_obj_get_self_height(struct _lv_obj_t * obj) { - lv_point_t p = {LV_COORD_MIN, 0}; - lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p); - return p.y; + return obj->self_size.y; } -bool lv_obj_handle_self_size_chg(struct _lv_obj_t * obj) +bool lv_obj_refresh_self_size(struct _lv_obj_t * obj) { - lv_coord_t w_set = lv_obj_get_style_width(obj, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(obj, LV_PART_MAIN); - if(w_set != LV_SIZE_CONTENT && h_set == LV_SIZE_CONTENT) return false; + lv_obj_update_layout(obj); + obj->self_size.x = 0; + obj->self_size.y = 0; + lv_event_send(obj, LV_EVENT_REFR_SELF_SIZE, &obj->self_size); lv_obj_refr_size(obj); return true; @@ -589,23 +613,40 @@ bool lv_obj_handle_self_size_chg(struct _lv_obj_t * obj) void lv_obj_refr_pos(lv_obj_t * obj) { + if(lv_obj_is_layout_positioned(obj)) return; + lv_obj_t * parent = lv_obj_get_parent(obj); lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN); lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN); + if(parent == NULL) { lv_obj_move_to(obj, x, y); return; } + /*Handle percentage value*/ + lv_coord_t pw = lv_obj_get_content_width(parent); + lv_coord_t ph = lv_obj_get_content_height(parent); + if(LV_COORD_IS_PCT(x)) x = (pw * LV_COORD_GET_PCT(x)) / 100; + if(LV_COORD_IS_PCT(y)) y = (ph * LV_COORD_GET_PCT(y)) / 100; + + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(obj); + lv_coord_t h = lv_obj_get_height(obj); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + /*Use the translation*/ + x += tr_x; + y += tr_y; + lv_align_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); if(align == LV_ALIGN_TOP_LEFT) { lv_obj_move_to(obj, x, y); } else { - lv_coord_t pw = lv_obj_get_width_fit(parent); - lv_coord_t ph = lv_obj_get_height_fit(parent); - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); switch(align) { case LV_ALIGN_TOP_MID: @@ -645,8 +686,6 @@ void lv_obj_refr_pos(lv_obj_t * obj) void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) { - if(lv_obj_is_layout_positioned(obj)) return; - /*Convert x and y to absolute coordinates*/ lv_obj_t * parent = obj->parent; @@ -684,7 +723,7 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_area_t parent_fit_area; bool on1 = false; if(parent) { - lv_obj_get_coords_fit(parent, &parent_fit_area); + lv_obj_get_content_coords(parent, &parent_fit_area); /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ @@ -910,34 +949,11 @@ static void layout_update_core(lv_obj_t * obj) lv_obj_refr_size(obj); lv_obj_refr_pos(obj); - /*Be sure the bottom side is not remains scrolled in*/ - lv_coord_t st = lv_obj_get_scroll_top(obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(obj); - if(sb < 0 && st > 0) { - sb = LV_MIN(st, -sb); - lv_obj_scroll_by(obj, 0, sb, LV_ANIM_OFF); - } - - lv_coord_t sl = lv_obj_get_scroll_left(obj); - lv_coord_t sr = lv_obj_get_scroll_right(obj); - if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) { - /*Be sure the left side is not remains scrolled in*/ - if(sr < 0 && sl > 0) { - sr = LV_MIN(sl, -sr); - lv_obj_scroll_by(obj, 0, sr, LV_ANIM_OFF); - } - } else { - /*Be sure the right side is not remains scrolled in*/ - if(sl < 0 && sr > 0) { - sr = LV_MIN(sr, -sl); - lv_obj_scroll_by(obj, 0, sl, LV_ANIM_OFF); - } - } - if(lv_obj_get_child_cnt(obj) > 0) { uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout_id > 0 && layout_id <= layout_cnt) { - layouts[layout_id -1](obj); + void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id -1].user_data; + LV_GC_ROOT(_lv_layout_list)[layout_id -1].cb(obj, user_data); } } } diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index ab171bcf0..09bce23cf 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -23,7 +23,11 @@ extern "C" { * TYPEDEFS **********************/ struct _lv_obj_t; -typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *); +typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data); +typedef struct { + lv_layout_update_cb_t cb; + void * user_data; +}lv_layout_dsc_t; /********************** * GLOBAL PROTOTYPES @@ -64,7 +68,12 @@ void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y); */ void lv_obj_set_size(struct _lv_obj_t * obj, lv_coord_t w, lv_coord_t h); -void lv_obj_refr_size(struct _lv_obj_t * obj); +/** + * Recalculate the size of the object + * @param obj pointer to an object + * @return true: the size has been changed + */ +bool lv_obj_refr_size(struct _lv_obj_t * obj); /** * Set the width of an object @@ -73,7 +82,7 @@ void lv_obj_refr_size(struct _lv_obj_t * obj); * @note possible values are: * pixel simple set the size accordingly * LV_SIZE_CONTENT set the size to involve all children in the given direction - * LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings). + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); @@ -85,7 +94,7 @@ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); * @note possible values are: * pixel simple set the size accordingly * LV_SIZE_CONTENT set the size to involve all children in the given direction - * LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings). + * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h); @@ -133,12 +142,23 @@ void lv_obj_update_layout(const struct _lv_obj_t * obj); /** * Regsiter a new layout * @param cb the layout update callback + * @param user_data custom data that will be passed to `cb` * @return the ID of the new layout */ -uint32_t lv_layout_register(lv_layout_update_cb_t cb); +uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); /** - * Align an object to an other object. + * Change the alignment of an object. + * @param obj pointer to an object to align + * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. + */ +void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align); + +/** + * Change the alignment of an object and set new coordinates. + * Equivalent to: + * lv_obj_set_align(obj, align); + * lv_obj_set_pos(obj, x_ofs, y_ofs); * @param obj pointer to an object to align * @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used. * @param x_ofs x coordinate offset after alignment @@ -234,39 +254,21 @@ lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj); * @param obj pointer to an object * @return the width which still fits into its parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_width_fit(const struct _lv_obj_t * obj); +lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj); /** * Get the height reduced by the top an bottom padding. * @param obj pointer to an object * @return the height which still fits into the parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_height_fit(const struct _lv_obj_t * obj); +lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj); /** * Get the area reduced by the paddings. * @param obj pointer to an object * @param area the area which still fits into the parent without causing overflow (making the parent scrollable) */ -void lv_obj_get_coords_fit(const struct _lv_obj_t * obj, lv_area_t * area); - -/** - * Get the height which is visible on the the given object without causing overflow. - * If there are smaller grand parents than their height will be considered. - * Useful on nested scrollable objects to get a height that fills the entire visible height. - * @param obj pointer to an object - * @return the visible height - */ -lv_coord_t lv_obj_get_height_visible(const struct _lv_obj_t * obj); - -/** - * Get the widht which is visible on the the given object without causing overflow. - * If there are smaller grand parents than their width will be considered. - * Useful on nested scrollable objects to get a width that fills the entire visible width. - * @param obj pointer to an object - * @return the visible width - */ -lv_coord_t lv_obj_get_width_visible(const struct _lv_obj_t * obj); +void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area); /** * Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table. @@ -291,7 +293,7 @@ lv_coord_t lv_obj_get_self_height(struct _lv_obj_t * obj); * @param obj pointer to an object * @return false: nothing happened; true: refresh happened */ -bool lv_obj_handle_self_size_chg(struct _lv_obj_t * obj); +bool lv_obj_refresh_self_size(struct _lv_obj_t * obj); void lv_obj_refr_pos(struct _lv_obj_t * obj); diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index 295c1ac22..e39637b47 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -248,10 +248,6 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_anim_set_var(&a, obj); lv_anim_set_ready_cb(&a, scroll_anim_ready_cb); - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_out); - if(x) { lv_res_t res; res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, NULL); @@ -264,7 +260,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_coord_t sx = lv_obj_get_scroll_x(obj); lv_anim_set_values(&a, -sx, -sx + x); lv_anim_set_exec_cb(&a, scroll_x_anim); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } @@ -280,7 +276,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable lv_coord_t sy = lv_obj_get_scroll_y(obj); lv_anim_set_values(&a, -sy, -sy + y); lv_anim_set_exec_cb(&a, scroll_y_anim); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } } else { @@ -303,10 +299,12 @@ void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en) /*Don't let scroll more then naturally possible by the size of the content*/ if(x < 0) x = 0; - lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); - if(scroll_max < 0) scroll_max = 0; + if(x > 0) { + lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); + if(scroll_max < 0) scroll_max = 0; - if(x > scroll_max) x = scroll_max; + if(x > scroll_max) x = scroll_max; + } lv_coord_t scroll_x = lv_obj_get_scroll_x(obj); lv_coord_t diff = -x + scroll_x; @@ -320,9 +318,11 @@ void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en) /*Don't let scroll more then naturally possible by the size of the content*/ if(y < 0) y = 0; - lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); - if(scroll_max < 0) scroll_max = 0; - if(y > scroll_max) y = scroll_max; + if(y > 0) { + lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); + if(scroll_max < 0) scroll_max = 0; + if(y > scroll_max) y = scroll_max; + } lv_coord_t scroll_y = lv_obj_get_scroll_y(obj); lv_coord_t diff = -y + scroll_y; @@ -420,7 +420,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * lv_coord_t end_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR); lv_coord_t side_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR); - lv_coord_t tickness = lv_obj_get_style_size(obj, LV_PART_SCROLLBAR); + lv_coord_t tickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR); lv_coord_t obj_h = lv_obj_get_height(obj); lv_coord_t obj_w = lv_obj_get_width(obj); @@ -429,45 +429,43 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * lv_coord_t hor_req_space = hor_draw ? tickness + side_space : 0; lv_coord_t rem; - if(lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN && lv_obj_get_style_border_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN) { return; } - /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ lv_coord_t content_h = obj_h + st + sb; if(ver_draw && content_h) { - hor_area->y1 = obj->coords.y1; - hor_area->y2 = obj->coords.y2; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness; + ver_area->y1 = obj->coords.y1; + ver_area->y2 = obj->coords.y2; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness; lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h; sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE); rem = (obj_h - end_space * 2 - hor_req_space) - sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/ if(scroll_h <= 0) { - hor_area->y1 = obj->coords.y1 + end_space; - hor_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness + 1; + ver_area->y1 = obj->coords.y1 + end_space; + ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness + 1; } else { lv_coord_t sb_y = (rem * sb) / scroll_h; sb_y = rem - sb_y; - hor_area->y1 = obj->coords.y1 + sb_y + end_space; - hor_area->y2 = hor_area->y1 + sb_h - 1; - hor_area->x2 = obj->coords.x2 - side_space; - hor_area->x1 = hor_area->x2 - tickness; - if(hor_area->y1 < obj->coords.y1 + end_space) { - hor_area->y1 = obj->coords.y1 + end_space; - if(hor_area->y1 + SCROLLBAR_MIN_SIZE > hor_area->y2) hor_area->y2 = hor_area->y1 + SCROLLBAR_MIN_SIZE; + ver_area->y1 = obj->coords.y1 + sb_y + end_space; + ver_area->y2 =ver_area->y1 + sb_h - 1; + ver_area->x2 = obj->coords.x2 - side_space; + ver_area->x1 =ver_area->x2 - tickness; + if(ver_area->y1 < obj->coords.y1 + end_space) { + ver_area->y1 = obj->coords.y1 + end_space; + if(ver_area->y1 + SCROLLBAR_MIN_SIZE >ver_area->y2)ver_area->y2 =ver_area->y1 + SCROLLBAR_MIN_SIZE; } - if(hor_area->y2 > obj->coords.y2 - hor_req_space - end_space) { - hor_area->y2 = obj->coords.y2 - hor_req_space - end_space; - if(hor_area->y2 - SCROLLBAR_MIN_SIZE < hor_area->y1) hor_area->y1 = hor_area->y2 - SCROLLBAR_MIN_SIZE; + if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) { + ver_area->y2 = obj->coords.y2 - hor_req_space - end_space; + if(ver_area->y2 - SCROLLBAR_MIN_SIZE y1)ver_area->y1 =ver_area->y2 - SCROLLBAR_MIN_SIZE; } } } @@ -475,35 +473,35 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ lv_coord_t content_w = obj_w + sl + sr; if(hor_draw && content_w) { - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness; - ver_area->x1 = obj->coords.x1; - ver_area->x2 = obj->coords.x2; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness; + hor_area->x1 = obj->coords.x1; + hor_area->x2 = obj->coords.x2; lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w; sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE); rem = (obj_w - end_space * 2 - ver_reg_space) - sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/ if(scroll_w <= 0) { - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness + 1; - ver_area->x1 = obj->coords.x1 + end_space; - ver_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness + 1; + hor_area->x1 = obj->coords.x1 + end_space; + hor_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1; } else { lv_coord_t sb_x = (rem * sr) / scroll_w; sb_x = rem - sb_x; - ver_area->x1 = obj->coords.x1 + sb_x + end_space; - ver_area->x2 = ver_area->x1 + sb_w - 1; - ver_area->y2 = obj->coords.y2 - side_space; - ver_area->y1 = ver_area->y2 - tickness; - if(ver_area->x1 < obj->coords.x1 + end_space) { - ver_area->x1 = obj->coords.x1 + end_space; - if(ver_area->x1 + SCROLLBAR_MIN_SIZE > ver_area->x2) ver_area->x2 = ver_area->x1 + SCROLLBAR_MIN_SIZE; + hor_area->x1 = obj->coords.x1 + sb_x + end_space; + hor_area->x2 = hor_area->x1 + sb_w - 1; + hor_area->y2 = obj->coords.y2 - side_space; + hor_area->y1 = hor_area->y2 - tickness; + if(hor_area->x1 < obj->coords.x1 + end_space) { + hor_area->x1 = obj->coords.x1 + end_space; + if(hor_area->x1 + SCROLLBAR_MIN_SIZE > hor_area->x2) hor_area->x2 = hor_area->x1 + SCROLLBAR_MIN_SIZE; } - if(ver_area->x2 > obj->coords.x2 - ver_reg_space - end_space) { - ver_area->x2 = obj->coords.x2 - ver_reg_space - end_space; - if(ver_area->x2 - SCROLLBAR_MIN_SIZE < ver_area->x1) ver_area->x1 = ver_area->x2 - SCROLLBAR_MIN_SIZE; + if(hor_area->x2 > obj->coords.x2 - ver_reg_space - end_space) { + hor_area->x2 = obj->coords.x2 - ver_reg_space - end_space; + if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE; } } } diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index a91f472e8..a7c739724 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -75,7 +75,7 @@ void _lv_obj_style_init(void) void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) { - trans_del(obj, selector, LV_STYLE_PROP_ALL, NULL); + trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL); uint32_t i; /*Go after the transition and local styles*/ @@ -100,7 +100,7 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec obj->styles[i].style = style; obj->styles[i].selector = selector; - lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY); } void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) @@ -121,7 +121,7 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t } if(obj->styles[i].is_trans) { - trans_del(obj, part, LV_STYLE_PROP_ALL, NULL); + trans_del(obj, part, LV_STYLE_PROP_ANY, NULL); } if(obj->styles[i].is_local || obj->styles[i].is_trans) { @@ -144,7 +144,7 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t *Therefore it doesn't needs to be incremented*/ } if(deleted) { - lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ANY); } } @@ -172,14 +172,20 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style lv_part_t part = lv_obj_style_get_selector_part(selector); - if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { + if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_LAYOUT_REFR))) { lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL); /*To update layout*/ - } else if(prop & LV_STYLE_PROP_EXT_DRAW) { + if(obj->parent) obj->parent->layout_inv = 1; + } + if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) { + lv_obj_t * parent = lv_obj_get_parent(obj); + if(parent) lv_obj_mark_layout_as_dirty(parent); + } + else if(prop & LV_STYLE_PROP_EXT_DRAW) { lv_obj_refresh_ext_draw_size(obj); } lv_obj_invalidate(obj); - if(prop == LV_STYLE_PROP_ALL || + if(prop == LV_STYLE_PROP_ANY || ((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) { if(part != LV_PART_SCROLLBAR) { @@ -279,28 +285,27 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty return lv_style_remove_prop(obj->styles[i].style, prop); } -void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_part_t part, lv_state_t prev_state, - lv_state_t new_state, uint32_t time, uint32_t delay, const lv_anim_path_t * path) +void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr_dsc) { trans_t * tr; /*Get the previous and current values*/ obj->skip_trans = 1; obj->state = prev_state; - lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, prop); + lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->state = new_state; - lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, prop); + lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->skip_trans = 0; if(v1.ptr == v2.ptr && v1.num == v2.num && v1.color.full == v2.color.full) return; obj->state = prev_state; - v1 = lv_obj_get_style_prop(obj, part, prop); + v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->state = new_state; lv_obj_style_t * style_trans = get_trans_style(obj, part); - lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value*/ + lv_style_set_prop(style_trans->style, tr_dsc->prop, v1); /*Be sure `trans_style` has a valid value*/ - if(prop == LV_STYLE_RADIUS) { + if(tr_dsc->prop == LV_STYLE_RADIUS) { if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) { lv_coord_t whalf = lv_obj_get_width(obj) / 2; lv_coord_t hhalf = lv_obj_get_width(obj) / 2; @@ -317,7 +322,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_pa if(tr) { tr->obj = obj; - tr->prop = prop; + tr->prop = tr_dsc->prop; tr->selector = part; lv_anim_t a; @@ -327,10 +332,13 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, lv_pa lv_anim_set_start_cb(&a, trans_anim_start_cb); lv_anim_set_ready_cb(&a, trans_anim_ready_cb); lv_anim_set_values(&a, 0x00, 0xFF); - lv_anim_set_time(&a, time); - lv_anim_set_delay(&a, delay); - lv_anim_set_path(&a, path); - a.early_apply = 0; + lv_anim_set_time(&a, tr_dsc->time); + lv_anim_set_delay(&a, tr_dsc->delay); + lv_anim_set_path_cb(&a, tr_dsc->path_cb); + lv_anim_set_early_apply(&a, false); +#if LV_USE_USER_DATA + a.user_data = tr_dsc->user_data; +#endif lv_anim_start(&a); } } @@ -361,6 +369,8 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta else if(lv_style_get_prop(style, LV_STYLE_PAD_COLUMN, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_PAD_ROW, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_LAYOUT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; + else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_X, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; + else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_Y, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_HEIGHT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_MIN_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; @@ -383,6 +393,7 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ZOOM, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFS_X, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; @@ -392,7 +403,9 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta else { if(res != _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) { if((part_act == LV_PART_MAIN || part_act == LV_PART_SCROLLBAR)) { - res = _LV_STYLE_STATE_CMP_DIFF_REDRAW; + res = _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN; + } else if(res != _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN) { + res = _LV_STYLE_STATE_CMP_DIFF_REDRAW_PART; } } } @@ -596,7 +609,7 @@ static void report_style_change_core(void * style, lv_obj_t * obj) uint32_t i; for(i = 0; i < obj->style_cnt; i++) { if(style == NULL || obj->styles[i].style == style) { - lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL); + lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); break; } } @@ -645,7 +658,7 @@ static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, tran /*'tr' might be deleted, so get the next object while 'tr' is valid*/ tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); - if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ALL)) { + if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ANY)) { /*Remove the transitioned property from trans. style *to allow changing it by normal styles*/ uint32_t i; diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index b15488d75..b82ce504b 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -28,7 +28,8 @@ struct _lv_obj_t; typedef enum { _LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/ - _LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/ + _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN, /*The differences can be shown with a simple redraw*/ + _LV_STYLE_STATE_CMP_DIFF_REDRAW_PART, /*The differences can be shown with a simple redraw*/ _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/ _LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/ } _lv_style_state_cmp_t; @@ -42,6 +43,17 @@ typedef struct { uint32_t is_trans :1; }lv_obj_style_t; +typedef struct { + uint16_t time; + uint16_t delay; + lv_style_selector_t selector; + lv_style_prop_t prop; + lv_anim_path_cb_t path_cb; +#if LV_USE_USER_DATA + void * user_data; +#endif +}_lv_obj_style_transition_dsc_t; + /********************** * GLOBAL PROTOTYPES **********************/ @@ -65,9 +77,8 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec /** * Add a style to an object. * @param obj pointer to an object - * @param part a part of the object from which the style should be removed E.g. `LV_PART_MAIN` or `LV_PART_KNOB` - * @param state a state or combination of states from which the style should be removed - * @param style pointer to a style to remove + * @param style pointer to a style to remove. Can be NULL to check only the selector + * @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, &style); //Remove a specific style * @example lv_obj_remove_style(obj, LV_PART_MAIN, LV_STATE_ANY, &style); //Remove all styles from the main part * @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL); //Remove all styles @@ -94,7 +105,7 @@ void lv_obj_report_style_change(lv_style_t * style); * Notify an object and its children about its style is modified. * @param obj pointer to an object * @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN` - * @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. + * @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property. * It is used to optimize what needs to be refreshed. * `LV_STYLE_PROP_INV` to perform only a style cache update */ @@ -144,16 +155,12 @@ bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop /** * Used internally to create a style tarnsition * @param obj - * @param prop * @param part * @param prev_state * @param new_state - * @param time - * @param delay - * @param path + * @param tr */ -void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_part_t part, lv_state_t prev_state, - lv_state_t new_state, uint32_t time, uint32_t delay, const lv_anim_path_t * path); +void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr); /** * Used internally to compare the appearance of an object in 2 states @@ -208,6 +215,11 @@ static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t lv_obj_set_style_pad_column(obj, value, selector); } +static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { + lv_obj_set_style_width(obj, value, selector); + lv_obj_set_style_height(obj, value, selector); +} + /********************** * MACROS **********************/ diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 3bd67450d..bf4838ddd 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -22,6 +22,18 @@ static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_ return (lv_coord_t)v.num; } +static inline lv_coord_t lv_obj_get_style_translate_x(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); + return (lv_coord_t)v.num; +} + +static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); + return (lv_coord_t)v.num; +} + static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); @@ -58,18 +70,18 @@ static inline uint32_t lv_obj_get_style_anim_time(const struct _lv_obj_t * obj, return (uint32_t)v.num; } +static inline uint32_t lv_obj_get_style_anim_speed(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_SPEED); + return (uint32_t)v.num; +} + static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION); return (const lv_style_transition_dsc_t *)v.ptr; } -static inline lv_coord_t lv_obj_get_style_size(const struct _lv_obj_t * obj, uint32_t part) -{ - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SIZE); - return (lv_coord_t)v.num; -} - static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE); @@ -546,6 +558,22 @@ static inline void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_HEIGHT, v, selector); } +static inline void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_X, v, selector); +} + +static inline void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_Y, v, selector); +} + static inline void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { @@ -594,6 +622,14 @@ static inline void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t v lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_TIME, v, selector); } +static inline void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector); +} + static inline void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector) { lv_style_value_t v = { @@ -602,14 +638,6 @@ static inline void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSITION, v, selector); } -static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) -{ - lv_style_value_t v = { - .num = (int32_t)value - }; - lv_obj_set_local_style_prop(obj, LV_STYLE_SIZE, v, selector); -} - static inline void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector) { lv_style_value_t v = { diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 883c784ee..90507bf45 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -131,7 +131,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p) if(disp->driver->full_refresh) { disp->inv_areas[0] = scr_area; disp->inv_p = 1; - lv_timer_pause(disp->refr_timer, false); + lv_timer_resume(disp->refr_timer); return; } @@ -152,7 +152,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p) lv_area_copy(&disp->inv_areas[disp->inv_p], &scr_area); } disp->inv_p++; - lv_timer_pause(disp->refr_timer, false); + lv_timer_resume(disp->refr_timer); } /** @@ -188,12 +188,12 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) disp_refr = tmr->user_data; -#if LV_USE_PERF_MONITOR == 0 +#if LV_USE_PERF_MONITOR == 0 && LV_USE_MEM_MONITOR == 0 /** * Ensure the timer does not run again automatically. * This is done before refreshing in case refreshing invalidates something else. */ - lv_timer_pause(tmr, true); + lv_timer_pause(tmr); #endif /*Refresh the screen's layout if required*/ diff --git a/src/core/lv_theme.c b/src/core/lv_theme.c index 4117c2425..f8a0f50ae 100644 --- a/src/core/lv_theme.c +++ b/src/core/lv_theme.c @@ -95,28 +95,16 @@ const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj) return th ? th->font_large : LV_FONT_DEFAULT; } -lv_color_palette_t lv_theme_get_palette_primary(lv_obj_t * obj) -{ - lv_theme_t * th = lv_theme_get_from_obj(obj); - return th ? th->palette_primary : LV_COLOR_PALETTE_BLUE_GREY; -} - -lv_color_palette_t lv_theme_get_palette_secondary(lv_obj_t * obj) -{ - lv_theme_t * th = lv_theme_get_from_obj(obj); - return th ? th->palette_secondary : LV_COLOR_PALETTE_BLUE; -} - lv_color_t lv_theme_get_color_primary(lv_obj_t * obj) { lv_theme_t * th = lv_theme_get_from_obj(obj); - return th ? th->color_primary : lv_color_blue_grey(); + return th ? th->color_primary : lv_palette_main(LV_PALETTE_BLUE_GREY); } lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj) { lv_theme_t * th = lv_theme_get_from_obj(obj); - return th ? th->color_secondary : lv_color_blue(); + return th ? th->color_secondary : lv_palette_main(LV_PALETTE_BLUE); } /********************** diff --git a/src/core/lv_theme.h b/src/core/lv_theme.h index c46617db1..f287a2c61 100644 --- a/src/core/lv_theme.h +++ b/src/core/lv_theme.h @@ -33,13 +33,12 @@ typedef struct _lv_theme_t { struct _lv_theme_t * parent; /**< Apply the current theme's style on top of this theme.*/ void * user_data; struct _lv_disp_t * disp; - lv_color_palette_t palette_primary; - lv_color_palette_t palette_secondary; lv_color_t color_primary; lv_color_t color_secondary; const lv_font_t * font_small; const lv_font_t * font_normal; const lv_font_t * font_large; + uint32_t flags; /*Any custom flag used by the theme*/ } lv_theme_t; /********************** @@ -93,10 +92,6 @@ const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj); */ const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj); -lv_color_palette_t lv_theme_get_palette_primary(lv_obj_t * obj); - -lv_color_palette_t lv_theme_get_palette_secondary(lv_obj_t * obj); - /** * Get the primary color of the theme * @return the color diff --git a/src/draw/lv_draw_img.c b/src/draw/lv_draw_img.c index 7e2ad93e3..8c3aef444 100644 --- a/src/draw/lv_draw_img.c +++ b/src/draw/lv_draw_img.c @@ -61,7 +61,6 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc) dsc->opa = LV_OPA_COVER; dsc->zoom = LV_IMG_ZOOM_NONE; dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; - } /** diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index 2d3930195..a1a8523bd 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -100,7 +100,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc) dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_color = lv_color_black(); - dsc->sel_bg_color = lv_color_blue(); + dsc->sel_bg_color = lv_palette_main(LV_PALETTE_BLUE); dsc->bidi_dir = LV_BIDI_DIR_LTR; } @@ -124,7 +124,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area int32_t w; /*No need to waste processor time if string is empty*/ - if(txt[0] == '\0') return; + if (txt == NULL || txt[0] == '\0') + return; lv_area_t clipped_area; bool clip_ok = _lv_area_intersect(&clipped_area, coords, mask); diff --git a/src/draw/lv_draw_line.c b/src/draw/lv_draw_line.c index 23b610209..ae0501544 100644 --- a/src/draw/lv_draw_line.c +++ b/src/draw/lv_draw_line.c @@ -6,7 +6,6 @@ /********************* * INCLUDES *********************/ -#include #include #include "lv_draw_mask.h" #include "lv_draw_blend.h" diff --git a/src/draw/lv_img_buf.h b/src/draw/lv_img_buf.h index d2752ae31..6f339d8cf 100644 --- a/src/draw/lv_img_buf.h +++ b/src/draw/lv_img_buf.h @@ -98,9 +98,7 @@ enum { }; typedef uint8_t lv_img_cf_t; -/** - * LVGL image header - */ + /** * The first 8 bit is very important to distinguish the different source types. * For more info see `lv_img_get_src_type()` in lv_img.c @@ -135,9 +133,9 @@ typedef struct { /** Image header it is compatible with * the result from image converter utility*/ typedef struct { - lv_img_header_t header; - uint32_t data_size; - const uint8_t * data; + lv_img_header_t header; /**< A header describing the basics of the image*/ + uint32_t data_size; /**< Size of the image in bytes*/ + const uint8_t * data; /**< Pointer to the data of the image*/ } lv_img_dsc_t; typedef struct { diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index da4a42849..dc1d8bba9 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -18,9 +18,9 @@ * TYPEDEFS **********************/ typedef struct { - lv_flex_place_t main_place; - lv_flex_place_t cross_place; - lv_flex_place_t track_place; + lv_flex_align_t main_place; + lv_flex_align_t cross_place; + lv_flex_align_t track_place; uint8_t row :1; uint8_t wrap :1; uint8_t rev :1; @@ -53,10 +53,10 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static void flex_update(lv_obj_t * cont); +static void flex_update(lv_obj_t * cont, void * user_data); static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t item_gap, lv_coord_t max_main_size, track_t * t); static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t); -static void place_content(lv_flex_place_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap); +static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap); static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id); /********************** @@ -88,7 +88,7 @@ lv_style_prop_t LV_STYLE_FLEX_GROW; void lv_flex_init(void) { - LV_LAYOUT_FLEX = lv_layout_register(flex_update); + LV_LAYOUT_FLEX = lv_layout_register(flex_update, NULL); LV_STYLE_FLEX_FLOW = lv_style_register_prop(); LV_STYLE_FLEX_MAIN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; @@ -102,7 +102,7 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow) lv_obj_set_style_layout(obj, LV_LAYOUT_FLEX, 0); } -void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place, lv_flex_place_t track_place) +void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_place) { lv_obj_set_style_flex_main_place(obj, main_place, 0); lv_obj_set_style_flex_cross_place(obj, cross_place, 0); @@ -119,9 +119,10 @@ void lv_obj_set_flex_grow(struct _lv_obj_t * obj, uint8_t grow) * STATIC FUNCTIONS **********************/ -static void flex_update(lv_obj_t * cont) +static void flex_update(lv_obj_t * cont, void * user_data) { LV_LOG_INFO("update %p container", cont); + LV_UNUSED(user_data); flex_t f; lv_flex_flow_t flow = lv_obj_get_style_flex_flow(cont, LV_PART_MAIN); @@ -135,11 +136,11 @@ static void flex_update(lv_obj_t * cont) bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false; lv_coord_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN); lv_coord_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t max_main_size = (f.row ? lv_obj_get_width_fit(cont) : lv_obj_get_height_fit(cont)); + lv_coord_t max_main_size = (f.row ? lv_obj_get_content_width(cont) : lv_obj_get_content_height(cont)); lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_PART_MAIN) - lv_obj_get_scroll_y(cont); lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_PART_MAIN) - lv_obj_get_scroll_x(cont); - lv_flex_place_t track_cross_place = f.track_place; + lv_flex_align_t track_cross_place = f.track_place; lv_coord_t * cross_pos = (f.row ? &abs_y : &abs_x); lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); @@ -148,12 +149,12 @@ static void flex_update(lv_obj_t * cont) if((f.row && h_set == LV_SIZE_CONTENT) || (!f.row && w_set == LV_SIZE_CONTENT)) { - track_cross_place = LV_FLEX_PLACE_START; + track_cross_place = LV_FLEX_ALIGN_START; } if(rtl && !f.row) { - if(track_cross_place == LV_FLEX_PLACE_START) track_cross_place = LV_FLEX_PLACE_END; - else if(track_cross_place == LV_FLEX_PLACE_END) track_cross_place = LV_FLEX_PLACE_START; + if(track_cross_place == LV_FLEX_ALIGN_START) track_cross_place = LV_FLEX_ALIGN_END; + else if(track_cross_place == LV_FLEX_ALIGN_END) track_cross_place = LV_FLEX_ALIGN_START; } lv_coord_t total_track_cross_size = 0; @@ -162,7 +163,7 @@ static void flex_update(lv_obj_t * cont) int32_t track_first_item; int32_t next_track_first_item; - if(track_cross_place != LV_FLEX_PLACE_START) { + if(track_cross_place != LV_FLEX_ALIGN_START) { track_first_item = f.rev ? cont->spec_attr->child_cnt - 1 : 0; track_t t; while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) { @@ -177,7 +178,7 @@ static void flex_update(lv_obj_t * cont) if(track_cnt) total_track_cross_size -= track_gap; /*No gap after the last track*/ /*Place the tracks to get the start position*/ - lv_coord_t max_cross_size = (f.row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont)); + lv_coord_t max_cross_size = (f.row ? lv_obj_get_content_height(cont) : lv_obj_get_content_width(cont)); place_content(track_cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap); } @@ -384,12 +385,12 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i lv_coord_t cross_pos = 0; switch(f->cross_place) { - case LV_FLEX_PLACE_CENTER: + case LV_FLEX_ALIGN_CENTER: /*Round up the cross size to avoid rounding error when dividing by 2 *The issue comes up e,g, with column direction with center cross direction if an element's width changes*/ cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2; break; - case LV_FLEX_PLACE_END: + case LV_FLEX_ALIGN_END: cross_pos = t->track_cross_size - area_get_cross_size(&item->coords); break; default: @@ -399,8 +400,16 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i if(f->row && rtl) main_pos -= area_get_main_size(&item->coords); - lv_coord_t diff_x = abs_x - item->coords.x1; - lv_coord_t diff_y = abs_y - item->coords.y1; + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(item); + lv_coord_t h = lv_obj_get_height(item); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + lv_coord_t diff_x = abs_x - item->coords.x1 + tr_x; + lv_coord_t diff_y = abs_y - item->coords.y1 + tr_y; diff_x += f->row ? main_pos : cross_pos; diff_y += f->row ? cross_pos : main_pos; @@ -424,14 +433,14 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i /** * Tell a start coordinate and gap for a placement type. */ -static void place_content(lv_flex_place_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap) +static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap) { if(item_cnt <= 1) { switch(place) { - case LV_FLEX_PLACE_SPACE_BETWEEN: - case LV_FLEX_PLACE_SPACE_AROUND: - case LV_FLEX_PLACE_SPACE_EVENLY: - place = LV_FLEX_PLACE_CENTER; + case LV_FLEX_ALIGN_SPACE_BETWEEN: + case LV_FLEX_ALIGN_SPACE_AROUND: + case LV_FLEX_ALIGN_SPACE_EVENLY: + place = LV_FLEX_ALIGN_CENTER; break; default: break; @@ -439,22 +448,22 @@ static void place_content(lv_flex_place_t place, lv_coord_t max_size, lv_coord_t } switch(place) { - case LV_FLEX_PLACE_CENTER: + case LV_FLEX_ALIGN_CENTER: *gap = 0; *start_pos += (max_size - content_size) / 2; break; - case LV_FLEX_PLACE_END: + case LV_FLEX_ALIGN_END: *gap = 0; *start_pos += max_size - content_size; break; - case LV_FLEX_PLACE_SPACE_BETWEEN: + case LV_FLEX_ALIGN_SPACE_BETWEEN: *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt - 1); break; - case LV_FLEX_PLACE_SPACE_AROUND: + case LV_FLEX_ALIGN_SPACE_AROUND: *gap += (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt); *start_pos += *gap / 2; break; - case LV_FLEX_PLACE_SPACE_EVENLY: + case LV_FLEX_ALIGN_SPACE_EVENLY: *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt + 1); *start_pos += *gap; break; diff --git a/src/extra/layouts/flex/lv_flex.h b/src/extra/layouts/flex/lv_flex.h index f5f1ae586..3044c5273 100644 --- a/src/extra/layouts/flex/lv_flex.h +++ b/src/extra/layouts/flex/lv_flex.h @@ -35,13 +35,13 @@ LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK); struct _lv_obj_t; typedef enum { - LV_FLEX_PLACE_START, - LV_FLEX_PLACE_END, - LV_FLEX_PLACE_CENTER, - LV_FLEX_PLACE_SPACE_EVENLY, - LV_FLEX_PLACE_SPACE_AROUND, - LV_FLEX_PLACE_SPACE_BETWEEN, -}lv_flex_place_t; + LV_FLEX_ALIGN_START, + LV_FLEX_ALIGN_END, + LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_SPACE_EVENLY, + LV_FLEX_ALIGN_SPACE_AROUND, + LV_FLEX_ALIGN_SPACE_BETWEEN, +}lv_flex_align_t; typedef enum { LV_FLEX_FLOW_ROW = 0x00, @@ -84,11 +84,11 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow); /** * Set how to place (where to align) the items an tracks * @param flex pointer: to a flex layout descriptor - * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_place_t`. - * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_PLACE_START/END/CENTER` - * @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_place_t`. + * @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`. + * @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER` + * @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`. */ -void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_place_t cross_place, lv_flex_place_t track_cross_place); +void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_cross_place); /** * Sets the width or height (on main axis) to grow the object in order fill the free space @@ -97,8 +97,6 @@ void lv_obj_set_flex_place(lv_obj_t * obj, lv_flex_place_t main_place, lv_flex_p */ void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow); - - static inline void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value) { lv_style_value_t v = { @@ -107,7 +105,7 @@ static inline void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t val lv_style_set_prop(style, LV_STYLE_FLEX_FLOW, v); } -static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -115,7 +113,7 @@ static inline void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_plac lv_style_set_prop(style, LV_STYLE_FLEX_MAIN_PLACE, v); } -static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -123,7 +121,7 @@ static inline void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_pla lv_style_set_prop(style, LV_STYLE_FLEX_CROSS_PLACE, v); } -static inline void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_place_t value) +static inline void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -149,7 +147,7 @@ static inline void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t val lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_FLOW, v, selector); } -static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -157,7 +155,7 @@ static inline void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_plac lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_MAIN_PLACE, v, selector); } -static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -165,7 +163,7 @@ static inline void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_pla lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_CROSS_PLACE, v, selector); } -static inline void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value @@ -187,22 +185,22 @@ static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, ui return (lv_flex_flow_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } -static inline lv_flex_place_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE); - return (lv_flex_place_t)v.num; + return (lv_flex_align_t)v.num; } static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part) diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c index 171b3144d..28ef71561 100644 --- a/src/extra/layouts/grid/lv_grid.c +++ b/src/extra/layouts/grid/lv_grid.c @@ -48,13 +48,13 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static void grid_update(lv_obj_t * cont); +static void grid_update(lv_obj_t * cont, void * user_data); static void calc(struct _lv_obj_t * obj, _lv_grid_calc_t * calc); static void calc_free(_lv_grid_calc_t * calc); static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c); static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c); static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * hint); -static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse); +static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse); static uint32_t count_tracks(const lv_coord_t * templ); static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_column_dsc_array(obj, 0); } @@ -63,25 +63,25 @@ static inline uint8_t get_col_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_ static inline uint8_t get_row_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_pos(obj, 0); } static inline uint8_t get_col_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_span(obj, 0); } static inline uint8_t get_row_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_span(obj, 0); } -static inline uint8_t get_cell_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_place(obj, 0); } -static inline uint8_t get_cell_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_place(obj, 0); } -static inline uint8_t get_grid_col_place(lv_obj_t * obj) {return lv_obj_get_style_grid_column_place(obj, 0); } -static inline uint8_t get_grid_row_place(lv_obj_t * obj) {return lv_obj_get_style_grid_row_place(obj, 0); } +static inline uint8_t get_cell_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_align(obj, 0); } +static inline uint8_t get_cell_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_align(obj, 0); } +static inline uint8_t get_grid_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_column_align(obj, 0); } +static inline uint8_t get_grid_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_row_align(obj, 0); } /********************** * GLOBAL VARIABLES **********************/ uint32_t LV_LAYOUT_GRID; lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY; -lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE; +lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN; lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY; -lv_style_prop_t LV_STYLE_GRID_ROW_PLACE; +lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN; lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS; lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN; -lv_style_prop_t LV_STYLE_GRID_CELL_COL_PLACE; +lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN; lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS; lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN; -lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; +lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN; /********************** * STATIC VARIABLES @@ -98,19 +98,19 @@ lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; void lv_grid_init(void) { - LV_LAYOUT_GRID = lv_layout_register(grid_update); + LV_LAYOUT_GRID = lv_layout_register(grid_update, NULL); LV_STYLE_GRID_COLUMN_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_ROW_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_COLUMN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_COLUMN_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_ROW_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_ROW_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_COL_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; LV_STYLE_GRID_CELL_COL_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_CELL_COL_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; - LV_STYLE_GRID_CELL_ROW_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_CELL_X_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; + LV_STYLE_GRID_CELL_Y_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR; } void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]) @@ -120,23 +120,23 @@ void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_obj_set_style_layout(obj, LV_LAYOUT_GRID, 0); } -void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place) +void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align) { - lv_obj_set_style_grid_column_place(obj, hor_place, 0); - lv_obj_set_style_grid_row_place(obj, ver_place, 0); + lv_obj_set_style_grid_column_align(obj, column_align, 0); + lv_obj_set_style_grid_row_align(obj, row_align, 0); } -void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col_pos, uint8_t col_span, - lv_grid_place_t ver_place, uint8_t row_pos, uint8_t row_span) +void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, uint8_t col_pos, uint8_t col_span, + lv_grid_align_t y_align, uint8_t row_pos, uint8_t row_span) { lv_obj_set_style_grid_cell_column_pos(obj, col_pos, 0); lv_obj_set_style_grid_cell_row_pos(obj, row_pos, 0); - lv_obj_set_style_grid_cell_x_place(obj, hor_place, 0); + lv_obj_set_style_grid_cell_x_align(obj, x_align, 0); lv_obj_set_style_grid_cell_column_span(obj, col_span, 0); lv_obj_set_style_grid_cell_row_span(obj, row_span, 0); - lv_obj_set_style_grid_cell_y_place(obj, ver_place, 0); + lv_obj_set_style_grid_cell_y_align(obj, y_align, 0); lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj)); } @@ -146,9 +146,10 @@ void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col * STATIC FUNCTIONS **********************/ -static void grid_update(lv_obj_t * cont) +static void grid_update(lv_obj_t * cont, void * user_data) { LV_LOG_INFO("update %p container", cont); + LV_UNUSED(user_data); const lv_coord_t * col_templ = get_col_dsc(cont); const lv_coord_t * row_templ = get_row_dsc(cont); @@ -207,12 +208,12 @@ static void calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out) lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); bool auto_w = w_set == LV_SIZE_CONTENT ? true : false; - lv_coord_t cont_w = lv_obj_get_width_fit(cont); - calc_out->grid_w = grid_place(cont_w, auto_w, get_grid_col_place(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev); + lv_coord_t cont_w = lv_obj_get_content_width(cont); + calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev); bool auto_h = h_set == LV_SIZE_CONTENT ? true : false; - lv_coord_t cont_h = lv_obj_get_height_fit(cont); - calc_out->grid_h = grid_place(cont_h, auto_h, get_grid_row_place(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false); + lv_coord_t cont_h = lv_obj_get_content_height(cont); + calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false); LV_ASSERT_MEM_INTEGRITY(); } @@ -232,7 +233,7 @@ static void calc_free(_lv_grid_calc_t * calc) static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) { const lv_coord_t * col_templ = get_col_dsc(cont); - lv_coord_t cont_w = lv_obj_get_width_fit(cont); + lv_coord_t cont_w = lv_obj_get_content_width(cont); c->col_num = count_tracks(col_templ); c->x = lv_mem_buf_get(sizeof(lv_coord_t) * c->col_num); @@ -283,13 +284,22 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) lv_coord_t free_w = cont_w - grid_w; if(free_w < 0) free_w = 0; + int32_t last_fr_i = -1; + int32_t last_fr_x = 0; for(i = 0; i < c->col_num; i++) { lv_coord_t x = col_templ[i]; if(IS_FR(x)) { lv_coord_t f = GET_FR(x); c->w[i] = (free_w * f) / col_fr_cnt; + last_fr_i = i; + last_fr_x = f; } } + + /*To avoid rounding errors set the last FR track to the remaining size */ + if(last_fr_i >= 0) { + c->w[last_fr_i] = free_w - ((free_w * (col_fr_cnt - last_fr_x)) / col_fr_cnt); + } } static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) @@ -336,11 +346,14 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) } } + lv_coord_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t cont_h = lv_obj_get_height_fit(cont) - row_gap * (c->row_num - 1); + lv_coord_t cont_h = lv_obj_get_content_height(cont) - row_gap * (c->row_num - 1); lv_coord_t free_h = cont_h - grid_h; if(free_h < 0) free_h = 0; + int32_t last_fr_i = -1; + int32_t last_fr_x = 0; for(i = 0; i < c->row_num; i++) { lv_coord_t x = row_templ[i]; if(IS_FR(x)) { @@ -348,6 +361,11 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) c->h[i] = (free_h * f) / row_fr_cnt; } } + + /*To avoid rounding errors set the last FR track to the remaining size */ + if(last_fr_i >= 0) { + c->h[last_fr_i] = free_h - ((free_h * (row_fr_cnt - last_fr_x)) / row_fr_cnt); + } } /** @@ -366,8 +384,8 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * uint32_t col_pos = get_col_pos(item); uint32_t row_pos = get_row_pos(item); - lv_grid_place_t col_place = get_cell_col_place(item); - lv_grid_place_t row_place = get_cell_row_place(item); + lv_grid_align_t col_align = get_cell_col_align(item); + lv_grid_align_t row_align = get_cell_row_align(item); lv_coord_t col_x1 = c->x[col_pos]; @@ -381,8 +399,8 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * /*If the item has RTL base dir switch start and end*/ if(lv_obj_get_base_dir(item) == LV_BIDI_DIR_RTL) { - if(col_place == LV_GRID_START) col_place = LV_GRID_END; - else if(col_place == LV_GRID_END) col_place = LV_GRID_START; + if(col_align == LV_GRID_ALIGN_START) col_align = LV_GRID_ALIGN_END; + else if(col_align == LV_GRID_ALIGN_END) col_align = LV_GRID_ALIGN_START; } lv_coord_t x; @@ -390,43 +408,43 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * lv_coord_t item_w = lv_area_get_width(&item->coords); lv_coord_t item_h = lv_area_get_height(&item->coords); - switch(col_place) { + switch(col_align) { default: - case LV_GRID_START: + case LV_GRID_ALIGN_START: x = c->x[col_pos]; item->w_layout = 0; break; - case LV_GRID_STRETCH: + case LV_GRID_ALIGN_STRETCH: x = c->x[col_pos]; item_w = col_w; item->w_layout = 1; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: x = c->x[col_pos] + (col_w - item_w) / 2; item->w_layout = 0; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: x = c->x[col_pos] + col_w - lv_obj_get_width(item); item->w_layout = 0; break; } - switch(row_place) { + switch(row_align) { default: - case LV_GRID_START: + case LV_GRID_ALIGN_START: y = c->y[row_pos]; item->h_layout = 0; break; - case LV_GRID_STRETCH: + case LV_GRID_ALIGN_STRETCH: y = c->y[row_pos]; item_h = row_h; item->h_layout = 1; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: y = c->y[row_pos] + (row_h - item_h) / 2; item->h_layout = 0; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: y = c->y[row_pos] + row_h - lv_obj_get_height(item); item->h_layout = 0; break; @@ -444,6 +462,18 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * lv_event_send(lv_obj_get_parent(item), LV_EVENT_CHILD_CHANGED, item); } + + /*Handle percentage value of translate*/ + lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); + lv_coord_t w = lv_obj_get_width(item); + lv_coord_t h = lv_obj_get_height(item); + if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; + if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; + + x += tr_x; + y += tr_y; + lv_coord_t diff_x = hint->grid_abs.x + x - item->coords.x1; lv_coord_t diff_y = hint->grid_abs.y + y - item->coords.y1; if(diff_x || diff_y) { @@ -458,18 +488,18 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * } /** - * Place the grid track according to place methods. It keeps the track sizes but sets their position. + * Place the grid track according to align methods. It keeps the track sizes but sets their position. * It can process both columns or rows according to the passed parameters. * @param cont_size size of the containers content area (width/height) * @param auto_size true: the container has auto size in the current direction - * @param place placeing method + * @param align align method * @param gap grid gap * @param track_num number of tracks * @param size_array array with the track sizes * @param pos_array write the positions of the tracks here * @return the total size of the grid */ -static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse) +static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse) { lv_coord_t grid_size = 0; uint32_t i; @@ -477,10 +507,10 @@ static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t plac if(auto_size) { pos_array[0] = 0; } else { - /*With spaced placements gap will be calculated from the remaining space*/ - if(place == LV_GRID_SPACE_AROUND || place == LV_GRID_SPACE_BETWEEN || place == LV_GRID_SPACE_EVENLY) { + /*With spaced alignment gap will be calculated from the remaining space*/ + if(align == LV_GRID_ALIGN_SPACE_AROUND || align == LV_GRID_ALIGN_SPACE_BETWEEN || align == LV_GRID_ALIGN_SPACE_EVENLY) { gap = 0; - if(track_num == 1) place = LV_GRID_CENTER; + if(track_num == 1) align = LV_GRID_ALIGN_CENTER; } /*Get the full grid size with gap*/ @@ -490,25 +520,25 @@ static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t plac grid_size -= gap; /*Calculate the position of the first item and set gap is necessary*/ - switch(place) { - case LV_GRID_START: + switch(align) { + case LV_GRID_ALIGN_START: pos_array[0] = 0; break; - case LV_GRID_CENTER: + case LV_GRID_ALIGN_CENTER: pos_array[0] = (cont_size - grid_size) / 2; break; - case LV_GRID_END: + case LV_GRID_ALIGN_END: pos_array[0] = cont_size - grid_size; break; - case LV_GRID_SPACE_BETWEEN: + case LV_GRID_ALIGN_SPACE_BETWEEN: pos_array[0] = 0; gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num - 1); break; - case LV_GRID_SPACE_AROUND: + case LV_GRID_ALIGN_SPACE_AROUND: gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num); pos_array[0] = gap / 2; break; - case LV_GRID_SPACE_EVENLY: + case LV_GRID_ALIGN_SPACE_EVENLY: gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num + 1); pos_array[0] = gap; break; diff --git a/src/extra/layouts/grid/lv_grid.h b/src/extra/layouts/grid/lv_grid.h index c2c37a9f2..5d9557c2f 100644 --- a/src/extra/layouts/grid/lv_grid.h +++ b/src/extra/layouts/grid/lv_grid.h @@ -36,14 +36,14 @@ extern "C" { struct _lv_obj_t; typedef enum { - LV_GRID_START, - LV_GRID_CENTER, - LV_GRID_END, - LV_GRID_STRETCH, - LV_GRID_SPACE_EVENLY, - LV_GRID_SPACE_AROUND, - LV_GRID_SPACE_BETWEEN, -}lv_grid_place_t; + LV_GRID_ALIGN_START, + LV_GRID_ALIGN_CENTER, + LV_GRID_ALIGN_END, + LV_GRID_ALIGN_STRETCH, + LV_GRID_ALIGN_SPACE_EVENLY, + LV_GRID_ALIGN_SPACE_AROUND, + LV_GRID_ALIGN_SPACE_BETWEEN, +}lv_grid_align_t; /********************** * GLOBAL VARIABLES @@ -51,15 +51,15 @@ typedef enum { extern uint32_t LV_LAYOUT_GRID; extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY; -extern lv_style_prop_t LV_STYLE_GRID_COLUMN_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY; -extern lv_style_prop_t LV_STYLE_GRID_ROW_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_POS; extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_SPAN; -extern lv_style_prop_t LV_STYLE_GRID_CELL_COL_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN; extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS; extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN; -extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; +extern lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN; /********************** * GLOBAL PROTOTYPES @@ -67,9 +67,9 @@ extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_PLACE; void lv_grid_init(void); -void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_templ[], const lv_coord_t row_templ[]); +void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]); -void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_place_t ver_place); +void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); /** * Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen @@ -81,8 +81,8 @@ void lv_obj_set_grid_place(lv_obj_t * obj, lv_grid_place_t hor_place, lv_grid_pl * @param row_pos row ID * @param row_span number of rows to take (>= 1) */ -void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_place_t hor_place, uint8_t col_pos, uint8_t col_span, - lv_grid_place_t ver_place, uint8_t row_pos, uint8_t row_span); +void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span, + lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span); /** * Just a wrapper to `LV_GRID_FR` for bindings. @@ -108,20 +108,20 @@ static inline void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_DSC_ARRAY, v); } -static inline void lv_style_set_grid_row_place(lv_style_t * style, lv_grid_place_t value) +static inline void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { - .num = (lv_grid_place_t)value + .num = (lv_grid_align_t)value }; - lv_style_set_prop(style, LV_STYLE_GRID_ROW_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_ROW_ALIGN, v); } -static inline void lv_style_set_grid_col_place(lv_style_t * style, lv_grid_place_t value) +static inline void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { - .num = (lv_grid_place_t)value + .num = (lv_grid_align_t)value }; - lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_ALIGN, v); } @@ -157,20 +157,20 @@ static inline void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_ lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_SPAN, v); } -static inline void lv_style_set_grid_cell_x_place(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = value }; - lv_style_set_prop(style, LV_STYLE_GRID_CELL_COL_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_CELL_X_ALIGN, v); } -static inline void lv_style_set_grid_cell_y_place(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { .num = value }; - lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_PLACE, v); + lv_style_set_prop(style, LV_STYLE_GRID_CELL_Y_ALIGN, v); } static inline void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector) @@ -190,20 +190,20 @@ static inline void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const } -static inline void lv_obj_set_style_grid_row_place(lv_obj_t * obj, lv_grid_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_ROW_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_ROW_ALIGN, v, selector); } -static inline void lv_obj_set_style_grid_column_place(lv_obj_t * obj, lv_grid_place_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t) value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_ALIGN, v, selector); } @@ -239,20 +239,20 @@ static inline void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, lv_coord_ lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_SPAN, v, selector); } -static inline void lv_obj_set_style_grid_cell_x_place(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_COL_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_X_ALIGN, v, selector); } -static inline void lv_obj_set_style_grid_cell_y_place(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = value }; - lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_PLACE, v, selector); + lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_Y_ALIGN, v, selector); } static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part) @@ -267,16 +267,16 @@ static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const st return (const lv_coord_t *)v.ptr; } -static inline lv_grid_place_t lv_obj_get_style_grid_row_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_PLACE); - return (lv_grid_place_t)v.num; + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN); + return (lv_grid_align_t)v.num; } -static inline lv_grid_place_t lv_obj_get_style_grid_column_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_PLACE); - return (lv_grid_place_t)v.num; + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN); + return (lv_grid_align_t)v.num; } static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part) @@ -291,7 +291,6 @@ static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const struct _lv return (lv_coord_t)v.num; } - static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); @@ -304,15 +303,15 @@ static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const struct _lv_ob return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_x_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COL_PLACE); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN); return (lv_coord_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_y_place(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_PLACE); + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN); return (lv_coord_t)v.num; } diff --git a/src/extra/themes/basic/lv_theme_basic.c b/src/extra/themes/basic/lv_theme_basic.c index 40eaac55e..9231e79a0 100644 --- a/src/extra/themes/basic/lv_theme_basic.c +++ b/src/extra/themes/basic/lv_theme_basic.c @@ -18,11 +18,11 @@ *********************/ #define COLOR_WHITE lv_color_white() -#define COLOR_LIGHT lv_color_grey_lighten_3() -#define COLOR_MID lv_color_grey_lighten_1() -#define COLOR_DARK lv_color_grey() -#define COLOR_DIM lv_color_grey_darken_2() -#define PAD_DEF LV_DPX(10) +#define COLOR_LIGHT lv_palette_lighten(LV_PALETTE_GREY, 3) +#define COLOR_MID lv_palette_lighten(LV_PALETTE_GREY, 1) +#define COLOR_DARK lv_palette_main(LV_PALETTE_GREY) +#define COLOR_DIM lv_palette_darken(LV_PALETTE_GREY, 2) +#define PAD_DEF LV_DPX(5) /********************** * TYPEDEFS @@ -35,6 +35,9 @@ typedef struct { lv_style_t pressed; lv_style_t disabled; lv_style_t pad_zero; +#if LV_USE_TEXTAREA + lv_style_t ta_cursor; +#endif } my_theme_styles_t; @@ -76,8 +79,8 @@ static void style_init(void) { style_init_reset(&styles->scrollbar); lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER); - lv_style_set_bg_color(&styles->scrollbar, lv_color_grey_darken_2()); - lv_style_set_size(&styles->scrollbar, PAD_DEF / 2); + lv_style_set_bg_color(&styles->scrollbar, lv_palette_darken(LV_PALETTE_GREY, 2)); + lv_style_set_width(&styles->scrollbar, PAD_DEF); style_init_reset(&styles->scr); lv_style_set_bg_opa(&styles->scr, LV_OPA_COVER); @@ -97,9 +100,6 @@ static void style_init(void) lv_style_set_line_color(&styles->light, COLOR_MID); lv_style_set_arc_width(&styles->light, LV_DPX(2)); lv_style_set_arc_color(&styles->light, COLOR_MID); - lv_style_set_width(&styles->light, 100); - lv_style_set_height(&styles->light, 60); - style_init_reset(&styles->dark); lv_style_set_bg_opa(&styles->dark, LV_OPA_COVER); @@ -112,8 +112,6 @@ static void style_init(void) lv_style_set_line_color(&styles->dark, COLOR_DIM); lv_style_set_arc_width(&styles->dark, LV_DPX(2)); lv_style_set_arc_color(&styles->dark, COLOR_DIM); - lv_style_set_width(&styles->dark, 100); - lv_style_set_height(&styles->dark, 60); static lv_color_filter_dsc_t dark_filter; lv_color_filter_dsc_init(&dark_filter, dark_color_filter_cb); @@ -132,6 +130,15 @@ static void style_init(void) style_init_reset(&styles->pad_zero); lv_style_set_pad_all(&styles->pad_zero, 0); lv_style_set_pad_gap(&styles->pad_zero, 0); + +#if LV_USE_TEXTAREA + style_init_reset(&styles->ta_cursor); + lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT); + lv_style_set_border_color(&styles->ta_cursor, COLOR_DIM); + lv_style_set_border_width(&styles->ta_cursor, 2); + lv_style_set_bg_opa(&styles->ta_cursor, LV_OPA_TRANSP); + lv_style_set_anim_time(&styles->ta_cursor, 500); +#endif } @@ -151,8 +158,6 @@ lv_theme_t * lv_theme_basic_init(lv_disp_t * disp) } theme.disp = disp; - theme.palette_primary = LV_COLOR_PALETTE_NONE; - theme.palette_secondary = LV_COLOR_PALETTE_NONE; theme.font_small = LV_FONT_DEFAULT; theme.font_normal = LV_FONT_DEFAULT; theme.font_large = LV_FONT_DEFAULT; @@ -334,7 +339,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_textarea_class)) { lv_obj_add_style(obj, &styles->light, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); - lv_obj_add_style(obj, &styles->dark, LV_PART_CURSOR); + lv_obj_add_style(obj, &styles->ta_cursor, LV_PART_CURSOR); lv_obj_add_style(obj, &styles->light, LV_PART_TEXTAREA_PLACEHOLDER); } #endif diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index c37fb398f..c16d0a8f8 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -16,26 +16,25 @@ /********************* * DEFINES *********************/ - -static lv_color_t color_primary_accent; -static lv_color_t color_secondary_accent; -static lv_color_t color_primary_muted; -static lv_color_t color_secondary_muted; - -#define COLOR_GREY lv_color_grey_lighten_2() - +#define MODE_DARK 1 #define RADIUS_DEFAULT (disp_size == DISP_LARGE ? LV_DPX(12) : LV_DPX(8)) /*SCREEN*/ -#define COLOR_SCR lv_color_grey_lighten_4() -#define COLOR_SCR_TEXT lv_color_grey_darken_4() +#define LIGHT_COLOR_SCR lv_palette_lighten(LV_PALETTE_GREY, 4) +#define LIGHT_COLOR_CARD lv_color_white() +#define LIGHT_COLOR_TEXT lv_palette_darken(LV_PALETTE_GREY, 4) +#define LIGHT_COLOR_GREY lv_palette_lighten(LV_PALETTE_GREY, 2) +#define DARK_COLOR_SCR lv_color_hex(0x15171A) +#define DARK_COLOR_CARD lv_color_hex(0x282b30) +#define DARK_COLOR_TEXT lv_palette_lighten(LV_PALETTE_GREY, 5) +#define DARK_COLOR_GREY lv_color_hex(0x2f3237) #define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME #define BORDER_WIDTH LV_DPX(2) -#define OUTLINE_WIDTH LV_DPX(4) +#define OUTLINE_WIDTH LV_DPX(3) -#define PAD_DEF (disp_size == DISP_LARGE ? LV_DPX(24) : disp_size == DISP_MEDIUM ? LV_DPX(20) : LV_DPX(20)) -#define PAD_SMALL (disp_size == DISP_LARGE ? LV_DPX(14) : disp_size == DISP_MEDIUM ? LV_DPX(12) : LV_DPX(12)) +#define PAD_DEF (disp_size == DISP_LARGE ? LV_DPX(24) : disp_size == DISP_MEDIUM ? LV_DPX(20) : LV_DPX(16)) +#define PAD_SMALL (disp_size == DISP_LARGE ? LV_DPX(14) : disp_size == DISP_MEDIUM ? LV_DPX(12) : LV_DPX(10)) #define PAD_TINY (disp_size == DISP_LARGE ? LV_DPX(8) : disp_size == DISP_MEDIUM ? LV_DPX(6) : LV_DPX(2)) /********************** @@ -87,11 +86,15 @@ typedef struct { #endif #if LV_USE_CHART - lv_style_t chart_series, chart_ticks, chart_bg; + lv_style_t chart_series, chart_indic, chart_ticks, chart_bg; +#endif + +#if LV_USE_DROPDOWN + lv_style_t dropdown_list; #endif #if LV_USE_CHECKBOX - lv_style_t cb_marker, cb_marker_checked, cb_bg_outline_pad; + lv_style_t cb_marker, cb_marker_checked; #endif #if LV_USE_SWITCH @@ -166,6 +169,11 @@ static my_theme_styles_t * styles; static lv_theme_t theme; static disp_size_t disp_size; static bool inited; +static lv_color_t color_scr; +static lv_color_t color_text; +static lv_color_t color_card; +static lv_color_t color_grey; + /********************** * MACROS @@ -185,7 +193,8 @@ static lv_color_t dark_color_filter_cb(const lv_color_filter_dsc_t * f, lv_color static lv_color_t grey_filter_cb(const lv_color_filter_dsc_t * f, lv_color_t color, lv_opa_t opa) { LV_UNUSED(f); - return lv_color_mix(lv_color_grey_lighten_2(), color, opa); + if(theme.flags & MODE_DARK) return lv_color_mix(lv_palette_darken(LV_PALETTE_GREY, 2), color, opa); + else return lv_color_mix(lv_palette_lighten(LV_PALETTE_GREY, 2), color, opa); } static void style_init(void) @@ -193,24 +202,22 @@ static void style_init(void) static const lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, + LV_STYLE_TRANSLATE_Y, LV_STYLE_TRANSLATE_X, LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE, LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_DSC, 0 }; - color_primary_accent = lv_color_get_palette_main(theme.palette_primary); - color_secondary_accent = lv_color_get_palette_main(theme.palette_secondary); - color_primary_muted = lv_color_get_palette_lighten_5(theme.palette_primary); - color_secondary_muted = lv_color_get_palette_lighten_5(theme.palette_secondary); - - theme.color_primary = color_primary_accent; - theme.color_secondary = color_secondary_accent; + color_scr = theme.flags & MODE_DARK ? DARK_COLOR_SCR : LIGHT_COLOR_SCR; + color_text = theme.flags & MODE_DARK ? DARK_COLOR_TEXT : LIGHT_COLOR_TEXT; + color_card = theme.flags & MODE_DARK ? DARK_COLOR_CARD : LIGHT_COLOR_CARD; + color_grey = theme.flags & MODE_DARK ? DARK_COLOR_GREY : LIGHT_COLOR_GREY; static lv_style_transition_dsc_t trans_delayed; - lv_style_transition_dsc_init(&trans_delayed, trans_props, &lv_anim_path_def, TRANSITION_TIME, 70); + lv_style_transition_dsc_init(&trans_delayed, trans_props, lv_anim_path_linear, TRANSITION_TIME, 70); static lv_style_transition_dsc_t trans_normal; - lv_style_transition_dsc_init(&trans_normal, trans_props, &lv_anim_path_def, TRANSITION_TIME, 0); + lv_style_transition_dsc_init(&trans_normal, trans_props, lv_anim_path_linear, TRANSITION_TIME, 0); style_init_reset(&styles->transition_delayed); lv_style_set_transition(&styles->transition_delayed, &trans_delayed); /*Go back to default state with delay*/ @@ -219,8 +226,7 @@ static void style_init(void) lv_style_set_transition(&styles->transition_normal, &trans_normal); /*Go back to default state with delay*/ style_init_reset(&styles->scrollbar); - lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER); - lv_style_set_bg_color(&styles->scrollbar, lv_color_grey()); + lv_style_set_bg_color(&styles->scrollbar, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY, 2) : lv_palette_main(LV_PALETTE_GREY)); lv_style_set_radius(&styles->scrollbar, LV_RADIUS_CIRCLE); lv_style_set_pad_right(&styles->scrollbar, LV_DPX(7)); lv_style_set_pad_top(&styles->scrollbar, LV_DPX(7)); @@ -233,43 +239,46 @@ static void style_init(void) style_init_reset(&styles->scr); lv_style_set_bg_opa(&styles->scr, LV_OPA_COVER); - lv_style_set_bg_color(&styles->scr, COLOR_SCR); - lv_style_set_text_color(&styles->scr, COLOR_SCR_TEXT); + lv_style_set_bg_color(&styles->scr, color_scr); + lv_style_set_text_color(&styles->scr, color_text); lv_style_set_pad_row(&styles->scr, PAD_SMALL); lv_style_set_pad_column(&styles->scr, PAD_SMALL); style_init_reset(&styles->card); lv_style_set_radius(&styles->card, RADIUS_DEFAULT); lv_style_set_bg_opa(&styles->card, LV_OPA_COVER); - lv_style_set_bg_color(&styles->card, lv_color_white()); - lv_style_set_border_color(&styles->card, COLOR_GREY); + lv_style_set_bg_color(&styles->card, color_card); + lv_style_set_border_color(&styles->card, color_grey); lv_style_set_border_width(&styles->card, BORDER_WIDTH); lv_style_set_border_post(&styles->card, true); - lv_style_set_text_color(&styles->card, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->card, color_text); lv_style_set_pad_all(&styles->card, PAD_DEF); lv_style_set_pad_row(&styles->card, PAD_SMALL); lv_style_set_pad_column(&styles->card, PAD_SMALL); - lv_style_set_line_color(&styles->card, lv_color_grey()); + lv_style_set_line_color(&styles->card, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_line_width(&styles->card, LV_DPX(1)); style_init_reset(&styles->outline_primary); - lv_style_set_outline_color(&styles->outline_primary, color_primary_accent); + lv_style_set_outline_color(&styles->outline_primary, theme.color_primary); lv_style_set_outline_width(&styles->outline_primary, OUTLINE_WIDTH); + lv_style_set_outline_pad(&styles->outline_primary, OUTLINE_WIDTH); lv_style_set_outline_opa(&styles->outline_primary, LV_OPA_50); style_init_reset(&styles->outline_secondary); - lv_style_set_outline_color(&styles->outline_secondary, color_secondary_accent); + lv_style_set_outline_color(&styles->outline_secondary, theme.color_secondary); lv_style_set_outline_width(&styles->outline_secondary, OUTLINE_WIDTH); lv_style_set_outline_opa(&styles->outline_secondary, LV_OPA_50); style_init_reset(&styles->btn); lv_style_set_radius(&styles->btn, (disp_size == DISP_LARGE ? LV_DPX(16) : disp_size == DISP_MEDIUM ? LV_DPX(12) : LV_DPX(8))); lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER); - lv_style_set_bg_color(&styles->btn, COLOR_GREY); - lv_style_set_shadow_color(&styles->btn, lv_color_grey_lighten_3()); - lv_style_set_shadow_width(&styles->btn, 1); - lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4)); - lv_style_set_text_color(&styles->btn, lv_color_grey_darken_4()); + lv_style_set_bg_color(&styles->btn, color_grey); + if(!(theme.flags & MODE_DARK)) { + lv_style_set_shadow_color(&styles->btn, lv_palette_lighten(LV_PALETTE_GREY, 3)); + lv_style_set_shadow_width(&styles->btn, 1); + lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4)); + } + lv_style_set_text_color(&styles->btn, color_text); lv_style_set_pad_hor(&styles->btn, PAD_DEF); lv_style_set_pad_ver(&styles->btn, PAD_SMALL); lv_style_set_pad_column(&styles->btn, LV_DPX(5)); @@ -325,34 +334,34 @@ static void style_init(void) lv_style_set_pad_column(&styles->pad_tiny, PAD_TINY); style_init_reset(&styles->bg_color_primary); - lv_style_set_bg_color(&styles->bg_color_primary, color_primary_accent); + lv_style_set_bg_color(&styles->bg_color_primary, theme.color_primary); lv_style_set_text_color(&styles->bg_color_primary, lv_color_white()); lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER); style_init_reset(&styles->bg_color_primary_muted); - lv_style_set_bg_color(&styles->bg_color_primary_muted, color_primary_muted); - lv_style_set_text_color(&styles->bg_color_primary_muted, color_primary_accent); - lv_style_set_bg_opa(&styles->bg_color_primary_muted, LV_OPA_COVER); + lv_style_set_bg_color(&styles->bg_color_primary_muted, theme.color_primary); + lv_style_set_text_color(&styles->bg_color_primary_muted, theme.color_primary); + lv_style_set_bg_opa(&styles->bg_color_primary_muted, LV_OPA_20); style_init_reset(&styles->bg_color_secondary); - lv_style_set_bg_color(&styles->bg_color_secondary, color_secondary_accent); + lv_style_set_bg_color(&styles->bg_color_secondary, theme.color_secondary); lv_style_set_text_color(&styles->bg_color_secondary, lv_color_white()); lv_style_set_bg_opa(&styles->bg_color_secondary, LV_OPA_COVER); style_init_reset(&styles->bg_color_secondary_muted); - lv_style_set_bg_color(&styles->bg_color_secondary_muted, color_secondary_muted); - lv_style_set_text_color(&styles->bg_color_secondary_muted, color_secondary_accent); - lv_style_set_bg_opa(&styles->bg_color_secondary_muted, LV_OPA_COVER); + lv_style_set_bg_color(&styles->bg_color_secondary_muted, theme.color_secondary); + lv_style_set_text_color(&styles->bg_color_secondary_muted, theme.color_secondary); + lv_style_set_bg_opa(&styles->bg_color_secondary_muted, LV_OPA_20); style_init_reset(&styles->bg_color_grey); - lv_style_set_bg_color(&styles->bg_color_grey, COLOR_GREY); + lv_style_set_bg_color(&styles->bg_color_grey, color_grey); lv_style_set_bg_opa(&styles->bg_color_grey, LV_OPA_COVER); - lv_style_set_text_color(&styles->bg_color_grey, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->bg_color_grey, color_text); style_init_reset(&styles->bg_color_white); - lv_style_set_bg_color(&styles->bg_color_white, lv_color_white()); + lv_style_set_bg_color(&styles->bg_color_white, color_card); lv_style_set_bg_opa(&styles->bg_color_white, LV_OPA_COVER); - lv_style_set_text_color(&styles->bg_color_white, lv_color_grey_darken_4()); + lv_style_set_text_color(&styles->bg_color_white, color_text); style_init_reset(&styles->circle); lv_style_set_radius(&styles->circle, LV_RADIUS_CIRCLE); @@ -367,7 +376,7 @@ static void style_init(void) #endif style_init_reset(&styles->knob); - lv_style_set_bg_color(&styles->knob, color_primary_accent); + lv_style_set_bg_color(&styles->knob, theme.color_primary); lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER); lv_style_set_pad_all(&styles->knob, LV_DPX(6)); lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE); @@ -377,20 +386,24 @@ static void style_init(void) #if LV_USE_ARC style_init_reset(&styles->arc_indic); - lv_style_set_arc_color(&styles->arc_indic, COLOR_GREY); + lv_style_set_arc_color(&styles->arc_indic, color_grey); lv_style_set_arc_width(&styles->arc_indic, LV_DPX(15)); lv_style_set_arc_rounded(&styles->arc_indic, true); style_init_reset(&styles->arc_indic_primary); - lv_style_set_arc_color(&styles->arc_indic_primary, color_primary_accent); + lv_style_set_arc_color(&styles->arc_indic_primary, theme.color_primary); #endif +#if LV_USE_DROPDOWN + style_init_reset(&styles->dropdown_list); + lv_style_set_max_height(&styles->dropdown_list, LV_DPI_DEF * 2); +#endif #if LV_USE_CHECKBOX style_init_reset(&styles->cb_marker); lv_style_set_pad_all(&styles->cb_marker, LV_DPX(3)); lv_style_set_border_width(&styles->cb_marker, BORDER_WIDTH); - lv_style_set_border_color(&styles->cb_marker, color_primary_accent); - lv_style_set_bg_color(&styles->cb_marker, lv_color_white()); + lv_style_set_border_color(&styles->cb_marker, theme.color_primary); + lv_style_set_bg_color(&styles->cb_marker, color_card); lv_style_set_bg_opa(&styles->cb_marker, LV_OPA_COVER); lv_style_set_radius(&styles->cb_marker, RADIUS_DEFAULT / 2); @@ -398,51 +411,55 @@ static void style_init(void) lv_style_set_bg_img_src(&styles->cb_marker_checked, LV_SYMBOL_OK); lv_style_set_text_color(&styles->cb_marker_checked, lv_color_white()); lv_style_set_text_font(&styles->cb_marker_checked, theme.font_small); - - style_init_reset(&styles->cb_bg_outline_pad); - lv_style_set_outline_pad(&styles->cb_bg_outline_pad, LV_DPX(5)); #endif #if LV_USE_SWITCH style_init_reset(&styles->switch_knob); lv_style_set_pad_all(&styles->switch_knob, - LV_DPX(4)); + lv_style_set_bg_color(&styles->switch_knob, lv_color_white()); #endif #if LV_USE_LINE style_init_reset(&styles->line); lv_style_set_line_width(&styles->line, 1); - lv_style_set_line_color(&styles->line, COLOR_SCR_TEXT); + lv_style_set_line_color(&styles->line, color_text); #endif #if LV_USE_CHART style_init_reset(&styles->chart_bg); lv_style_set_border_post(&styles->chart_bg, false); lv_style_set_pad_column(&styles->chart_bg, LV_DPX(10)); - lv_style_set_line_color(&styles->chart_bg, COLOR_GREY); + lv_style_set_line_color(&styles->chart_bg, color_grey); style_init_reset(&styles->chart_series); lv_style_set_line_width(&styles->chart_series, LV_DPX(3)); lv_style_set_radius(&styles->chart_series, LV_DPX(3)); - lv_style_set_size(&styles->chart_series, LV_DPX(4)); + lv_style_set_size(&styles->chart_series, LV_DPX(8)); lv_style_set_pad_column(&styles->chart_series, LV_DPX(2)); + style_init_reset(&styles->chart_indic); + lv_style_set_radius(&styles->chart_indic,LV_RADIUS_CIRCLE); + lv_style_set_size(&styles->chart_indic, LV_DPX(8)); + lv_style_set_bg_color(&styles->chart_indic, theme.color_primary); + lv_style_set_bg_opa(&styles->chart_indic, LV_OPA_COVER); + style_init_reset(&styles->chart_ticks); lv_style_set_line_width(&styles->chart_ticks, LV_DPX(1)); - lv_style_set_line_color(&styles->chart_ticks, COLOR_SCR_TEXT); + lv_style_set_line_color(&styles->chart_ticks, color_text); lv_style_set_pad_all(&styles->chart_ticks, LV_DPX(2)); - lv_style_set_text_color(&styles->chart_ticks, lv_color_grey()); + lv_style_set_text_color(&styles->chart_ticks, lv_palette_main(LV_PALETTE_GREY)); #endif #if LV_USE_METER style_init_reset(&styles->meter_marker); lv_style_set_line_width(&styles->meter_marker, LV_DPX(5)); - lv_style_set_line_color(&styles->meter_marker, lv_color_grey_darken_4()); + lv_style_set_line_color(&styles->meter_marker, color_text); lv_style_set_size(&styles->meter_marker, LV_DPX(20)); lv_style_set_pad_left(&styles->meter_marker, LV_DPX(15)); style_init_reset(&styles->meter_indic); lv_style_set_radius(&styles->meter_indic, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&styles->meter_indic, lv_color_grey_darken_4()); + lv_style_set_bg_color(&styles->meter_indic, color_text); lv_style_set_bg_opa(&styles->meter_indic, LV_OPA_COVER); lv_style_set_size(&styles->meter_indic, LV_DPX(15)); #endif @@ -450,20 +467,20 @@ static void style_init(void) #if LV_USE_TABLE style_init_reset(&styles->table_cell); lv_style_set_border_width(&styles->table_cell, LV_DPX(1)); - lv_style_set_border_color(&styles->table_cell, color_primary_muted); + lv_style_set_border_color(&styles->table_cell, color_grey); lv_style_set_border_side(&styles->table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM ); #endif #if LV_USE_TEXTAREA style_init_reset(&styles->ta_cursor); - lv_style_set_border_color(&styles->ta_cursor, COLOR_SCR_TEXT); + lv_style_set_border_color(&styles->ta_cursor, color_text); lv_style_set_border_width(&styles->ta_cursor, LV_DPX(2)); lv_style_set_pad_left(&styles->ta_cursor, LV_DPX(1)); lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT); lv_style_set_anim_time(&styles->ta_cursor, 400); style_init_reset(&styles->ta_placeholder); - lv_style_set_text_color(&styles->ta_placeholder, lv_color_grey()); + lv_style_set_text_color(&styles->ta_placeholder, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY, 2) : lv_palette_lighten(LV_PALETTE_GREY, 1)); #endif #if LV_USE_CALENDAR @@ -474,8 +491,9 @@ static void style_init(void) style_init_reset(&styles->calendar_day); lv_style_set_border_width(&styles->calendar_day, LV_DPX(1)); - lv_style_set_border_color(&styles->calendar_day, color_primary_muted); - lv_style_set_bg_opa(&styles->calendar_day, LV_OPA_COVER); + lv_style_set_border_color(&styles->calendar_day, color_grey); + lv_style_set_bg_color(&styles->calendar_day, color_card); + lv_style_set_bg_opa(&styles->calendar_day, LV_OPA_20); #endif #if LV_USE_COLORWHEEL @@ -496,7 +514,7 @@ static void style_init(void) #if LV_USE_TABVIEW style_init_reset(&styles->tab_btn); - lv_style_set_border_color(&styles->tab_btn, color_primary_accent); + lv_style_set_border_color(&styles->tab_btn, theme.color_primary); lv_style_set_border_width(&styles->tab_btn, BORDER_WIDTH * 2); lv_style_set_border_side(&styles->tab_btn, LV_BORDER_SIDE_BOTTOM); #endif @@ -510,7 +528,7 @@ static void style_init(void) style_init_reset(&styles->list_btn); lv_style_set_border_width(&styles->list_btn, LV_DPX(1)); - lv_style_set_border_color(&styles->list_btn, color_primary_muted); + lv_style_set_border_color(&styles->list_btn, color_grey); lv_style_set_border_side(&styles->list_btn, LV_BORDER_SIDE_BOTTOM); lv_style_set_pad_all(&styles->list_btn, PAD_SMALL); lv_style_set_pad_column(&styles->list_btn, PAD_SMALL); @@ -526,7 +544,7 @@ static void style_init(void) style_init_reset(&styles->led); lv_style_set_bg_opa(&styles->led, LV_OPA_COVER); lv_style_set_bg_color(&styles->led, lv_color_white()); - lv_style_set_bg_grad_color(&styles->led, lv_color_grey()); + lv_style_set_bg_grad_color(&styles->led, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_radius(&styles->led, LV_RADIUS_CIRCLE); lv_style_set_shadow_width(&styles->led, LV_DPX(15)); lv_style_set_shadow_color(&styles->led, lv_color_white()); @@ -539,8 +557,7 @@ static void style_init(void) * GLOBAL FUNCTIONS **********************/ -lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_primary, lv_color_palette_t palette_secondary, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large) +lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font) { /*This trick is required only to avoid the garbage collection of @@ -556,12 +573,13 @@ lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_ else disp_size = DISP_LARGE; theme.disp = disp; - theme.palette_primary = palette_primary; - theme.palette_secondary = palette_secondary; - theme.font_small = font_small; - theme.font_normal = font_normal; - theme.font_large = font_large; + theme.color_primary = color_primary; + theme.color_secondary = color_secondary; + theme.font_small = font; + theme.font_normal = font; + theme.font_large = font; theme.apply_cb = theme_apply; + theme.flags = dark ? MODE_DARK : 0; style_init(); @@ -594,13 +612,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); /*Tabview content area*/ if(lv_obj_check_type(parent, &lv_tabview_class)) { - lv_obj_add_style(obj, &styles->bg_color_grey, 0); - lv_obj_add_style(obj, &styles->pad_gap, 0); return; } /*Tabview pages*/ else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) { - lv_obj_add_style(obj, &styles->scr, 0); lv_obj_add_style(obj, &styles->pad_normal, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); @@ -659,7 +674,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, &styles->btn, LV_PART_ITEMS); lv_obj_add_style(obj, &styles->pressed, LV_PART_ITEMS | LV_STATE_PRESSED); lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_ITEMS | LV_STATE_CHECKED); - lv_obj_add_style(obj, &styles->outline_primary, LV_PART_ITEMS | LV_STATE_FOCUS_KEY); + lv_obj_add_style(obj, &styles->bg_color_primary_muted, LV_PART_ITEMS | LV_STATE_FOCUS_KEY); + lv_obj_add_style(obj, &styles->bg_color_secondary_muted, LV_PART_ITEMS | LV_STATE_EDITED); return; } #endif @@ -736,7 +752,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_checkbox_class)) { lv_obj_add_style(obj, &styles->pad_gap, 0); lv_obj_add_style(obj, &styles->outline_primary, LV_STATE_FOCUS_KEY); - lv_obj_add_style(obj, &styles->cb_bg_outline_pad, LV_STATE_FOCUS_KEY); lv_obj_add_style(obj, &styles->disabled, LV_PART_INDICATOR | LV_STATE_DISABLED); lv_obj_add_style(obj, &styles->cb_marker, LV_PART_INDICATOR); lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_INDICATOR | LV_STATE_CHECKED); @@ -774,7 +789,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); lv_obj_add_style(obj, &styles->chart_series, LV_PART_ITEMS); - lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_ITEMS | LV_STATE_PRESSED); + lv_obj_add_style(obj, &styles->chart_indic, LV_PART_INDICATOR); lv_obj_add_style(obj, &styles->chart_ticks, LV_PART_TICKS); lv_obj_add_style(obj, &styles->chart_series, LV_PART_CURSOR); } @@ -805,6 +820,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_dropdownlist_class)) { lv_obj_add_style(obj, &styles->card, 0); lv_obj_add_style(obj, &styles->line_space_large, 0); + lv_obj_add_style(obj, &styles->dropdown_list, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); lv_obj_add_style(obj, &styles->bg_color_white, LV_PART_SELECTED); @@ -868,7 +884,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, &styles->keyboard_btn_bg, LV_PART_ITEMS); lv_obj_add_style(obj, &styles->pressed, LV_PART_ITEMS | LV_STATE_PRESSED); lv_obj_add_style(obj, &styles->bg_color_grey, LV_PART_ITEMS | LV_STATE_CHECKED); - lv_obj_add_style(obj, &styles->outline_primary, LV_PART_ITEMS | LV_STATE_FOCUSED); + lv_obj_add_style(obj, &styles->outline_primary, LV_PART_ITEMS | LV_STATE_FOCUS_KEY); + lv_obj_add_style(obj, &styles->outline_secondary, LV_PART_ITEMS | LV_STATE_EDITED); } #endif #if LV_USE_LIST @@ -920,6 +937,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) } #endif +#if LV_USE_TABVIEW + if(lv_obj_check_type(obj, &lv_tabview_class)) { + lv_obj_add_style(obj, &styles->scr, 0); + lv_obj_add_style(obj, &styles->pad_zero, 0); + return; + } +#endif + #if LV_USE_COLORWHEEL else if(lv_obj_check_type(obj, &lv_colorwheel_class)) { lv_obj_add_style(obj, &styles->colorwheel_main, 0); diff --git a/src/extra/themes/default/lv_theme_default.h b/src/extra/themes/default/lv_theme_default.h index 02d010d17..ef8502622 100644 --- a/src/extra/themes/default/lv_theme_default.h +++ b/src/extra/themes/default/lv_theme_default.h @@ -36,8 +36,7 @@ extern "C" { * @param font pointer to a font to use. * @return a pointer to reference this theme later */ -lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_primary, lv_color_palette_t palette_secondary, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large); +lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font); bool lv_theme_default_is_inited(void); diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index 32f27e5b1..f7ddc8e68 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -23,8 +23,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void draw_event_cb(lv_obj_t * obj, lv_event_t e); +static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void draw_part_begin_event_cb(lv_event_t * e); static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day); static uint8_t get_month_length(int32_t year, int32_t month); @@ -35,9 +35,10 @@ static void highlight_update(lv_obj_t * calendar); * STATIC VARIABLES **********************/ const lv_obj_class_t lv_calendar_class = { - .constructor_cb = my_constructor, + .constructor_cb = lv_calendar_constructor, .width_def = (LV_DPI_DEF * 3) / 2, .height_def =(LV_DPI_DEF * 3) / 2, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_calendar_t), .base_class = &lv_btnmatrix_class }; @@ -55,7 +56,7 @@ static const char * day_names_def[7] = LV_CALENDAR_DEFAULT_DAY_NAMES; lv_obj_t * lv_calendar_create(lv_obj_t * parent) { - lv_obj_t * obj = lv_obj_create_from_class(&lv_calendar_class, parent); + lv_obj_t * obj = lv_obj_class_create_obj(&lv_calendar_class, parent, NULL); return obj; } @@ -179,7 +180,7 @@ uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * obj) return calendar->highlighted_dates_num; } -bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * date) +lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * date) { lv_calendar_t * calendar = (lv_calendar_t *)obj; uint16_t d = lv_btnmatrix_get_selected_btn(obj); @@ -187,7 +188,7 @@ bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * dat date->year = 0; date->month = 0; date->day = 0; - return false; + return LV_RES_INV; } const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); @@ -198,7 +199,7 @@ bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * dat date->year = calendar->showed_date.year; date->month = calendar->showed_date.month; - return true; + return LV_RES_OK; } @@ -206,7 +207,7 @@ bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * dat * STATIC FUNCTIONS **********************/ -static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) +static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); lv_calendar_t * calendar = (lv_calendar_t *)obj; @@ -247,42 +248,39 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_calendar_set_showed_date(obj, calendar->showed_date.year, calendar->showed_date.month); lv_calendar_set_today_date(obj, calendar->today.year, calendar->today.month, calendar->today.day); - lv_obj_add_event_cb(obj, draw_event_cb, NULL); - - + lv_obj_add_event_cb(obj, draw_part_begin_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL); } -static void draw_event_cb(lv_obj_t * obj, lv_event_t e) +static void draw_part_begin_event_cb(lv_event_t * e) { - if(e == LV_EVENT_DRAW_PART_BEGIN) { - lv_obj_draw_dsc_t * dsc = lv_event_get_param(); - if(dsc->part == LV_PART_ITEMS) { - /*Day name styles*/ - if(dsc->id < 7) { - dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; - dsc->rect_dsc->border_opa = LV_OPA_TRANSP; - } - else if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) { - dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; - dsc->rect_dsc->border_opa = LV_OPA_TRANSP; - dsc->label_dsc->color = lv_color_grey(); - } - - if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) { - dsc->rect_dsc->bg_opa = LV_OPA_40; - dsc->rect_dsc->bg_color = lv_theme_get_color_primary(obj); - if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) { - dsc->rect_dsc->bg_opa = LV_OPA_70; - } - } - - if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_TODAY)) { - dsc->rect_dsc->border_opa = LV_OPA_COVER; - dsc->rect_dsc->border_color = lv_theme_get_color_primary(obj); - dsc->rect_dsc->border_width += 1; - } - + lv_obj_t * obj = lv_event_get_target(e); + lv_obj_draw_dsc_t * dsc = lv_event_get_param(e); + if(dsc->part == LV_PART_ITEMS) { + /*Day name styles*/ + if(dsc->id < 7) { + dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; + dsc->rect_dsc->border_opa = LV_OPA_TRANSP; } + else if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) { + dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; + dsc->rect_dsc->border_opa = LV_OPA_TRANSP; + dsc->label_dsc->color = lv_palette_main(LV_PALETTE_GREY); + } + + if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) { + dsc->rect_dsc->bg_opa = LV_OPA_40; + dsc->rect_dsc->bg_color = lv_theme_get_color_primary(obj); + if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) { + dsc->rect_dsc->bg_opa = LV_OPA_70; + } + } + + if(lv_btnmatrix_has_btn_ctrl(obj, dsc->id, LV_CALENDAR_CTRL_TODAY)) { + dsc->rect_dsc->border_opa = LV_OPA_COVER; + dsc->rect_dsc->border_color = lv_theme_get_color_primary(obj); + dsc->rect_dsc->border_width += 1; + } + } } diff --git a/src/extra/widgets/calendar/lv_calendar.h b/src/extra/widgets/calendar/lv_calendar.h index 0169620e6..1fe0c4654 100644 --- a/src/extra/widgets/calendar/lv_calendar.h +++ b/src/extra/widgets/calendar/lv_calendar.h @@ -133,9 +133,9 @@ uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar); * Get the currently pressed day * @param calendar pointer to a calendar object * @param date store the pressed date here - * @return true: there is a valid pressed date; false: there is no pressed data + * @return LV_RES_OK: there is a valid pressed date; LV_RES_INV: there is no pressed data */ -bool lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date); +lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date); /*===================== * Other functions diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index 5dcaa6842..f31d4134b 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -25,7 +25,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void month_event_cb(lv_obj_t * btn, lv_event_t e); +static void month_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -57,12 +57,12 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_place(header, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * mo_prev = lv_btn_create(header); lv_obj_set_style_bg_img_src(mo_prev, LV_SYMBOL_LEFT, 0); lv_obj_set_size(mo_prev, btn_size, btn_size); - lv_obj_add_event_cb(mo_prev, month_event_cb, calendar); + lv_obj_add_event_cb(mo_prev, month_event_cb, LV_EVENT_CLICKED, calendar); lv_obj_clear_flag(mo_prev, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_t * label = lv_label_create(header); @@ -74,7 +74,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_obj_t * mo_next = lv_btn_create(header); lv_obj_set_style_bg_img_src(mo_next, LV_SYMBOL_RIGHT, 0); lv_obj_set_size(mo_next, btn_size, btn_size); - lv_obj_add_event_cb(mo_next, month_event_cb, calendar); + lv_obj_add_event_cb(mo_next, month_event_cb, LV_EVENT_CLICKED, calendar); lv_obj_clear_flag(mo_next, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0); @@ -86,12 +86,12 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda * STATIC FUNCTIONS **********************/ -static void month_event_cb(lv_obj_t * btn, lv_event_t e) +static void month_event_cb(lv_event_t * e) { - if(e != LV_EVENT_CLICKED) return; + lv_obj_t * btn = lv_event_get_target(e); lv_obj_t * header = lv_obj_get_parent(btn); - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * calendar = lv_event_get_user_data(e); const lv_calendar_date_t * d; d = lv_calendar_get_showed_date(calendar); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index 13a6343b8..74cd69ce3 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -24,8 +24,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void year_event_cb(lv_obj_t * btn, lv_event_t e); -static void month_event_cb(lv_obj_t * btn, lv_event_t e); +static void year_event_cb(lv_event_t * e); +static void month_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -38,7 +38,7 @@ static const char * year_list = { "1980\n1979\n1978\n1977\n1976\n1975\n1974\n1973\n1972\n1971\n1970\n1969\n1968\n1967\n1966\n1965\n1964\n1963\n1962\n1961\n" "1960\n1959\n1958\n1957\n1956\n1955\n1954\n1953\n1952\n1951\n1950\n1949\n1948\n1947\n1946\n1945\n1944\n1943\n1942\n1941\n" "1940\n1939\n1938\n1937\n1936\n1935\n1934\n1933\n1932\n1931\n1930\n1929\n1928\n1927\n1926\n1925\n1924\n1923\n1922\n1921\n" - "1920\n1919\n1918\n1917\n1916\n1915\n1914\n1913\n1912\n1911\n1910\n1909\n1908\n1907\n1906\n1905\n1904\n1903\n1902\n0901" + "1920\n1919\n1918\n1917\n1916\n1915\n1914\n1913\n1912\n1911\n1910\n1909\n1908\n1907\n1906\n1905\n1904\n1903\n1902\n1901" }; /********************** @@ -66,18 +66,18 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale lv_coord_t w = lv_obj_get_width(calendar); lv_obj_set_size(header, w, LV_SIZE_CONTENT); lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_place(header, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_START); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * year_dd = lv_dropdown_create(header); lv_dropdown_set_options(year_dd, year_list); lv_dropdown_set_selected(year_dd, 2023 - cur_date->year); - lv_obj_add_event_cb(year_dd, year_event_cb, calendar); + lv_obj_add_event_cb(year_dd, year_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(year_dd, 1); lv_obj_t * month_dd = lv_dropdown_create(header); lv_dropdown_set_options(month_dd, month_list); lv_dropdown_set_selected(month_dd, cur_date->month - 1); - lv_obj_add_event_cb(month_dd, month_event_cb, calendar); + lv_obj_add_event_cb(month_dd, month_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(month_dd, 1); lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0); @@ -89,11 +89,10 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale * STATIC FUNCTIONS **********************/ -static void month_event_cb(lv_obj_t * dropdown, lv_event_t e) +static void month_event_cb(lv_event_t * e) { - if(e != LV_EVENT_VALUE_CHANGED) return; - - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * dropdown = lv_event_get_target(e); + lv_obj_t * calendar = lv_event_get_user_data(e); uint16_t sel = lv_dropdown_get_selected(dropdown); @@ -104,11 +103,10 @@ static void month_event_cb(lv_obj_t * dropdown, lv_event_t e) lv_calendar_set_showed_date(calendar, newd.year, newd.month); } -static void year_event_cb(lv_obj_t * dropdown, lv_event_t e) +static void year_event_cb(lv_event_t * e) { - if(e != LV_EVENT_VALUE_CHANGED) return; - - lv_obj_t * calendar = lv_event_get_user_data(); + lv_obj_t * dropdown = lv_event_get_target(e); + lv_obj_t * calendar = lv_event_get_user_data(e); uint16_t sel = lv_dropdown_get_selected(dropdown); diff --git a/src/widgets/lv_chart.c b/src/extra/widgets/chart/lv_chart.c similarity index 88% rename from src/widgets/lv_chart.c rename to src/extra/widgets/chart/lv_chart.c index df56d87f8..b4d94935e 100644 --- a/src/widgets/lv_chart.c +++ b/src/extra/widgets/chart/lv_chart.c @@ -9,13 +9,6 @@ #include "lv_chart.h" #if LV_USE_CHART != 0 -#include "../misc/lv_assert.h" -#include "../core/lv_refr.h" -#include "../draw/lv_draw.h" -#include "../core/lv_disp.h" -#include "../core/lv_indev.h" -#include "../misc/lv_math.h" - /********************* * DEFINES *********************/ @@ -38,7 +31,7 @@ **********************/ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_chart_event(lv_obj_t * obj, lv_event_t e); +static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_div_lines(lv_obj_t * obj , const lv_area_t * mask); static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area); @@ -55,7 +48,7 @@ const lv_obj_class_t lv_chart_class = { .constructor_cb = lv_chart_constructor, .destructor_cb = lv_chart_destructor, .event_cb = lv_chart_event, - .width_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), .height_def = LV_DPI_DEF * 2, .instance_size = sizeof(lv_chart_t), .base_class = &lv_obj_class @@ -72,7 +65,7 @@ const lv_obj_class_t lv_chart_class = { lv_obj_t * lv_chart_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_chart_class, parent); + return lv_obj_class_create_obj(&lv_chart_class, parent, NULL); } void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type) @@ -196,6 +189,7 @@ void lv_chart_set_zoom_x(lv_obj_t * obj, uint16_t zoom_x) if(chart->zoom_x == zoom_x) return; chart->zoom_x = zoom_x; + lv_obj_refresh_self_size(obj); lv_obj_invalidate(obj); } @@ -207,6 +201,7 @@ void lv_chart_set_zoom_y(lv_obj_t * obj, uint16_t zoom_y) if(chart->zoom_y == zoom_y) return; chart->zoom_y = zoom_y; + lv_obj_refresh_self_size(obj); lv_obj_invalidate(obj); } @@ -279,7 +274,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1 return; } - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; if(chart->type & LV_CHART_TYPE_LINE) { p_out->x = (w * id) / (chart->point_cnt - 1); @@ -305,7 +300,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1 p_out->x += lv_obj_get_style_pad_left(obj, LV_PART_MAIN); p_out->x -= lv_obj_get_scroll_left(obj); - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; p_out->y = (int32_t)((int32_t)ser->points[id] - chart->ymin[ser->y_axis]) * h; p_out->y = p_out->y / (chart->ymax[ser->y_axis] - chart->ymin[ser->y_axis]); @@ -611,16 +606,21 @@ static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_chart_event(lv_obj_t * obj, lv_event_t e) +static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ lv_res_t res; - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + lv_chart_t * chart = (lv_chart_t *)obj; - if(e == LV_EVENT_PRESSED) { + if(code == LV_EVENT_PRESSED) { lv_indev_t * indev = lv_indev_get_act(); lv_point_t p; lv_indev_get_point(indev, &p); @@ -633,19 +633,21 @@ static void lv_chart_event(lv_obj_t * obj, lv_event_t e) chart->pressed_point_id = id; lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); } - } else if(e == LV_EVENT_RELEASED) { + } else if(code == LV_EVENT_RELEASED) { invalidate_point(obj, chart->pressed_point_id); chart->pressed_point_id = LV_CHART_POINT_NONE; - } else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + } else if(code == LV_EVENT_SIZE_CHANGED) { + lv_obj_refresh_self_size(obj); + } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX4(*s, chart->tick[LV_CHART_AXIS_X].draw_size, chart->tick[LV_CHART_AXIS_PRIMARY_Y].draw_size, chart->tick[LV_CHART_AXIS_SECONDARY_Y].draw_size); - } else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); - p->x = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - p->y = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; - } else if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + } else if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); + p->x = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + p->y = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; + } else if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); draw_div_lines(obj, clip_area); draw_axes(obj, clip_area); @@ -664,29 +666,55 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) bool mask_ret = _lv_area_intersect(&series_mask, &obj->coords, clip_area); if(mask_ret == false) return; - uint16_t i; + int16_t i; + int16_t i_start; + int16_t i_end; lv_point_t p1; lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, &line_dsc); + lv_obj_draw_dsc_t obj_draw_dsc; + lv_obj_draw_dsc_init(&obj_draw_dsc, clip_area); + obj_draw_dsc.line_dsc = &line_dsc; + obj_draw_dsc.part = LV_PART_MAIN; + + lv_opa_t border_opa = lv_obj_get_style_border_opa(obj, LV_PART_MAIN); + lv_coord_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + lv_border_side_t border_side = lv_obj_get_style_border_side(obj, LV_PART_MAIN); + lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); lv_coord_t scroll_top = lv_obj_get_scroll_top(obj); if(chart->hdiv_cnt != 0) { lv_coord_t y_ofs = obj->coords.y1 + pad_top - scroll_top; p1.x = obj->coords.x1; p2.x = obj->coords.x2; - for(i = 0; i < chart->hdiv_cnt; i++) { + + i_start = 0; + i_end = chart->hdiv_cnt; + if(border_opa > LV_OPA_MIN && border_w > 0) { + if(border_side & LV_BORDER_SIDE_TOP) i_start++; + if(border_side & LV_BORDER_SIDE_BOTTOM) i_end--; + } + + for(i = i_start; i < i_end; i++) { p1.y = (int32_t)((int32_t)(h - line_dsc.width) * i) / (chart->hdiv_cnt - 1); p1.y += y_ofs; p2.y = p1.y; + + obj_draw_dsc.p1 = &p1; + obj_draw_dsc.p2 = &p2; + obj_draw_dsc.id = i; + + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } } @@ -694,11 +722,25 @@ static void draw_div_lines(lv_obj_t * obj, const lv_area_t * clip_area) lv_coord_t x_ofs = obj->coords.x1 + pad_left - scroll_left; p1.y = obj->coords.y1; p2.y = obj->coords.y2; - for(i = 0; i < chart->vdiv_cnt; i++) { + i_start = 0; + i_end = chart->vdiv_cnt; + if(border_opa > LV_OPA_MIN && border_w > 0) { + if(border_side & LV_BORDER_SIDE_LEFT) i_start++; + if(border_side & LV_BORDER_SIDE_RIGHT) i_end--; + } + + for(i = i_start; i < i_end; i++) { p1.x = (int32_t)((int32_t)(w - line_dsc.width) * i) / (chart->vdiv_cnt - 1); p1.x += x_ofs; p2.x = p1.x; + + obj_draw_dsc.p1 = &p1; + obj_draw_dsc.p2 = &p2; + obj_draw_dsc.id = i; + + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); lv_draw_line(&p1, &p2, &series_mask, &line_dsc); + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } } } @@ -715,8 +757,8 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_coord_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); lv_coord_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); lv_chart_series_t * ser; @@ -725,29 +767,19 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) bool mask_ret = _lv_area_intersect(&series_mask, &obj->coords, clip_area); if(mask_ret == false) return; - lv_state_t state_ori = obj->state; - obj->state = LV_STATE_DEFAULT; - obj->skip_trans = 1; lv_draw_line_dsc_t line_dsc_default; lv_draw_line_dsc_init(&line_dsc_default); lv_obj_init_draw_line_dsc(obj, LV_PART_ITEMS, &line_dsc_default); lv_draw_rect_dsc_t point_dsc_default; lv_draw_rect_dsc_init(&point_dsc_default); - point_dsc_default.radius = LV_RADIUS_CIRCLE; + lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &point_dsc_default); - lv_coord_t point_size = lv_obj_get_style_size(obj, LV_PART_ITEMS); - - obj->state = LV_STATE_PRESSED; - lv_coord_t point_size_pr = lv_obj_get_style_size(obj, LV_PART_ITEMS); - - obj->state = state_ori; - obj->skip_trans = 0; - - lv_coord_t point_size_act; + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; /*Do not bother with line ending is the point will over it*/ - if(point_size > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; + if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1; if(line_dsc_default.width == 1) line_dsc_default.raw_end = 1; /*If there are mire points than pixels draw only vertical lines*/ @@ -784,9 +816,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) p1.x = p2.x; p1.y = p2.y; - point_size_act = p_act == chart->pressed_point_id ? point_size_pr : point_size; - - if(p1.x > clip_area->x2 + point_size_act + 1) break; + if(p1.x > clip_area->x2 + point_w + 1) break; p2.x = ((w * i) / (chart->point_cnt - 1)) + x_ofs; p_act = (start_point + i) % chart->point_cnt; @@ -795,7 +825,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) y_tmp = y_tmp / (chart->ymax[ser->y_axis] - chart->ymin[ser->y_axis]); p2.y = h - y_tmp + y_ofs; - if(p2.x < clip_area->x1 - point_size_act - 1) { + if(p2.x < clip_area->x1 - point_w - 1) { p_prev = p_act; continue; } @@ -822,10 +852,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } } else { lv_area_t point_area; - point_area.x1 = p1.x - point_size_act; - point_area.x2 = p1.x + point_size_act; - point_area.y1 = p1.y - point_size_act; - point_area.y2 = p1.y + point_size_act; + point_area.x1 = p1.x - point_w; + point_area.x2 = p1.x + point_w; + point_area.y1 = p1.y - point_h; + point_area.y2 = p1.y + point_h; dsc.id = i - 1; dsc.p1 = ser->points[p_prev] != LV_CHART_POINT_NONE ? &p1 : NULL; @@ -839,7 +869,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line(&p1, &p2, &series_mask, &line_dsc_default); } - if(point_size_act && ser->points[p_act] != LV_CHART_POINT_NONE) { + if(point_w && point_h && ser->points[p_act] != LV_CHART_POINT_NONE) { lv_draw_rect(&point_area, &series_mask, &point_dsc_default); } @@ -851,15 +881,14 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area) } /*Draw the last point*/ - point_size_act = p_act == chart->pressed_point_id ? point_size_pr : point_size; - if(!crowded_mode && point_size_act && i == chart->point_cnt) { + if(!crowded_mode && i == chart->point_cnt) { if(ser->points[p_act] != LV_CHART_POINT_NONE) { lv_area_t point_area; - point_area.x1 = p2.x - point_size_act; - point_area.x2 = p2.x + point_size_act; - point_area.y1 = p2.y - point_size_act; - point_area.y2 = p2.y + point_size_act; + point_area.x1 = p2.x - point_w; + point_area.x2 = p2.x + point_w; + point_area.y1 = p2.y - point_h; + point_area.y2 = p2.y + point_h; dsc.id = i - 1; dsc.p1 = NULL; @@ -885,8 +914,8 @@ static void draw_series_bar(lv_obj_t * obj, const lv_area_t * clip_area) lv_area_t col_a; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; int32_t y_tmp; lv_chart_series_t * ser; uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); @@ -975,10 +1004,8 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area) lv_draw_line_dsc_t line_dsc_tmp; lv_draw_rect_dsc_t point_dsc_tmp; - lv_coord_t point_radius = lv_obj_get_style_size(obj, LV_PART_CURSOR); - - /*Do not bother with line ending is the point will over it*/ - if(point_radius > line_dsc_ori.width / 2) line_dsc_ori.raw_end = 1; + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + lv_coord_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; lv_obj_draw_dsc_t dsc; lv_obj_draw_dsc_init(&dsc, clip_area); @@ -1022,13 +1049,13 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area) lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc); } - if(point_radius) { + if(point_w && point_h) { lv_area_t point_area; - point_area.x1 = cx - point_radius; - point_area.x2 = cx + point_radius; - point_area.y1 = cy - point_radius; - point_area.y2 = cy + point_radius; + point_area.x1 = cx - point_w; + point_area.x2 = cx + point_w; + point_area.y1 = cy - point_h; + point_area.y2 = cy + point_h; dsc.draw_area = &point_area; dsc.p1 = NULL; @@ -1056,7 +1083,7 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a lv_point_t p2; lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t h = (lv_obj_get_height_fit(obj) * chart->zoom_y) >> 8; + lv_coord_t h = (lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; lv_coord_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); lv_coord_t label_gap; @@ -1117,7 +1144,7 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a /*add text only to major tick*/ if(major && t->label_en) { - int32_t tick_value = chart->ymax[axis] - lv_map(i, 0, total_tick_num, chart->ymin[axis], chart->ymax[axis]); + int32_t tick_value = lv_map(total_tick_num - i, 0, total_tick_num, chart->ymin[axis], chart->ymax[axis]); lv_snprintf(dsc.text, sizeof(dsc.text), "%d", tick_value); dsc.value = tick_value; lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &dsc); @@ -1163,7 +1190,7 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area) lv_point_t p2; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); lv_coord_t y_ofs = obj->coords.y2; @@ -1256,7 +1283,7 @@ static void draw_axes(lv_obj_t * obj, const lv_area_t * mask) static uint32_t get_index_from_x(lv_obj_t * obj, lv_coord_t x) { lv_chart_t * chart = (lv_chart_t *)obj; - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); x-= pad_left; @@ -1273,27 +1300,27 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i) lv_chart_t * chart = (lv_chart_t *)obj; if(i >= chart->point_cnt) return; - lv_coord_t w = (lv_obj_get_width_fit(obj) * chart->zoom_x) >> 8; + lv_coord_t w = (lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); if(chart->type == LV_CHART_TYPE_LINE) { lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left; lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); - lv_coord_t point_radius = lv_obj_get_style_size(obj, LV_PART_ITEMS); + lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR); lv_area_t coords; lv_area_copy(&coords, &obj->coords); - coords.y1 -= line_width + point_radius; - coords.y2 += line_width + point_radius; + coords.y1 -= line_width + point_w; + coords.y2 += line_width + point_w; if(i < chart->point_cnt - 1) { - coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; + coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; lv_obj_invalidate_area(obj, &coords); } if(i > 0) { - coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius; - coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius; + coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; + coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; lv_obj_invalidate_area(obj, &coords); } } diff --git a/src/widgets/lv_chart.h b/src/extra/widgets/chart/lv_chart.h similarity index 99% rename from src/widgets/lv_chart.h rename to src/extra/widgets/chart/lv_chart.h index de7b64f15..7ca9c9ebe 100644 --- a/src/widgets/lv_chart.h +++ b/src/extra/widgets/chart/lv_chart.h @@ -13,13 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "../../../lvgl.h" #if LV_USE_CHART != 0 -#include "../core/lv_obj.h" -#include "lv_line.h" - /********************* * DEFINES *********************/ diff --git a/src/extra/widgets/colorwheel/lv_colorwheel.c b/src/extra/widgets/colorwheel/lv_colorwheel.c index 048150d9d..cfb90696f 100644 --- a/src/extra/widgets/colorwheel/lv_colorwheel.c +++ b/src/extra/widgets/colorwheel/lv_colorwheel.c @@ -33,10 +33,10 @@ * STATIC PROTOTYPES **********************/ static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e); +static void lv_colorwheel_event(const lv_obj_class_t * class_p, lv_event_t * e); -static void draw_disc_grad(lv_obj_t * obj); -static void draw_knob(lv_obj_t * obj); +static void draw_disc_grad(lv_event_t * e); +static void draw_knob(lv_event_t * e); static void invalidate_knob(lv_obj_t * obj); static lv_area_t get_knob_area(lv_obj_t * obj); @@ -75,7 +75,7 @@ static bool create_knob_recolor; lv_obj_t * lv_colorwheel_create(lv_obj_t * parent, bool knob_recolor) { create_knob_recolor = knob_recolor; - return lv_obj_create_from_class(&lv_colorwheel_class, parent); + return lv_obj_class_create_obj(&lv_colorwheel_class, parent, NULL); } /*===================== @@ -225,9 +225,10 @@ static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * refr_knob_pos(obj); } -static void draw_disc_grad(lv_obj_t * obj) +static void draw_disc_grad(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); lv_coord_t cx = obj->coords.x1 + w / 2; @@ -286,9 +287,10 @@ static void draw_disc_grad(lv_obj_t * obj) #endif } -static void draw_knob(lv_obj_t * obj) +static void draw_knob(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj; lv_draw_rect_dsc_t cir_dsc; @@ -335,39 +337,43 @@ static lv_area_t get_knob_area(lv_obj_t * obj) return knob_area; } -static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) +static void lv_colorwheel_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); lv_coord_t bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_pad = LV_MAX4(left, right, top, bottom) + 2; - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_pad); } - else if(e == LV_EVENT_SIZE_CHANGED) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_SIZE_CHANGED) { + void * param = lv_event_get_param(e); /*Refresh extended draw area to make knob visible*/ if(lv_obj_get_width(obj) != lv_area_get_width(param) || lv_obj_get_height(obj) != lv_area_get_height(param)) { refr_knob_pos(obj); } } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { /*Refresh extended draw area to make knob visible*/ refr_knob_pos(obj); } - else if(e == LV_EVENT_KEY) { - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + else if(code == LV_EVENT_KEY) { + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { lv_color_hsv_t hsv_cur; @@ -412,13 +418,13 @@ static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { colorwheel->last_change_time = lv_tick_get(); lv_indev_get_point(lv_indev_get_act(), &colorwheel->last_press_point); res = double_click_reset(obj); if(res != LV_RES_OK) return; } - else if(e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); if(indev == NULL) return; @@ -498,18 +504,18 @@ static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e) if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param();; + else if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e);; /*Valid clicks can be only in the circle*/ info->result = _lv_area_is_point_on(&obj->coords, info->point, LV_RADIUS_CIRCLE); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_disc_grad(obj); - draw_knob(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_disc_grad(e); + draw_knob(e); } - else if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res != LV_DRAW_RES_MASKED) info->res = LV_DRAW_RES_NOT_COVER; } } @@ -654,7 +660,7 @@ static lv_color_t angle_to_mode_color_fast(lv_obj_t * obj, uint16_t angle) fast_hsv2rgb(h, s, angle, &r, &g, &b); break; } - return LV_COLOR_MAKE(r, g, b); + return lv_color_make(r, g, b); } static uint16_t get_angle(lv_obj_t * obj) diff --git a/src/extra/widgets/imgbtn/lv_imgbtn.c b/src/extra/widgets/imgbtn/lv_imgbtn.c index 51da085de..99e47d732 100644 --- a/src/extra/widgets/imgbtn/lv_imgbtn.c +++ b/src/extra/widgets/imgbtn/lv_imgbtn.c @@ -24,8 +24,8 @@ * STATIC PROTOTYPES **********************/ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void draw_main(lv_obj_t * obj); -static void lv_imgbtn_event(lv_obj_t * imgbtn, lv_event_t e); +static void draw_main(lv_event_t * e); +static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e); static void refr_img(lv_obj_t * imgbtn); static lv_imgbtn_state_t suggest_state(lv_obj_t * imgbtn, lv_imgbtn_state_t state); lv_imgbtn_state_t get_state(const lv_obj_t * imgbtn); @@ -55,7 +55,7 @@ const lv_obj_class_t lv_imgbtn_class = { */ lv_obj_t * lv_imgbtn_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_imgbtn_class, parent); + return lv_obj_class_create_obj(&lv_imgbtn_class, parent, NULL); } /*===================== @@ -160,27 +160,32 @@ static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_imgbtn_event(lv_obj_t * obj, lv_event_t e) +static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e) { - lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, obj, e); + LV_UNUSED(class_p); + + lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { refr_img(obj); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } - else if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res != LV_DRAW_RES_MASKED) info->res = LV_DRAW_RES_NOT_COVER; } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_imgbtn_t * imgbtn = (lv_imgbtn_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); /*Just draw_main an image*/ lv_imgbtn_state_t state = suggest_state(obj, get_state(obj)); diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index 44731d2b5..513fc43b1 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -32,8 +32,8 @@ static void lv_keyboard_update_map(lv_obj_t * obj); **********************/ const lv_obj_class_t lv_keyboard_class = { .constructor_cb = lv_keyboard_constructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(50), + .width_def = LV_PCT(100), + .height_def = LV_PCT(50), .instance_size = sizeof(lv_keyboard_t), .editable = 1, .base_class = &lv_btnmatrix_class @@ -121,7 +121,7 @@ static const lv_btnmatrix_ctrl_t * kb_ctrl[5] = { */ lv_obj_t * lv_keyboard_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_keyboard_class, parent); + return lv_obj_class_create_obj(&lv_keyboard_class, parent, NULL); } /*===================== @@ -220,15 +220,13 @@ lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * obj) * @param kb pointer to a keyboard * @param event the triggering event */ -void lv_keyboard_def_event_cb(lv_obj_t * obj, lv_event_t event) +void lv_keyboard_def_event_cb(lv_event_t * e) { - if(event != LV_EVENT_VALUE_CHANGED) return; + lv_obj_t * obj = lv_event_get_target(e); lv_keyboard_t * keyboard = (lv_keyboard_t *)obj; uint16_t btn_id = lv_btnmatrix_get_selected_btn(obj); if(btn_id == LV_BTNMATRIX_BTN_NONE) return; - if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED)) return; - if(lv_btnmatrix_has_btn_ctrl(obj, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return; const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); if(txt == NULL) return; @@ -330,7 +328,7 @@ static void lv_keyboard_constructor(const lv_obj_class_t * class_p, lv_obj_t * o keyboard->mode = LV_KEYBOARD_MODE_TEXT_LOWER; lv_obj_align(obj, LV_ALIGN_BOTTOM_MID, 0, 0); - lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, NULL); + lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_base_dir(obj, LV_BIDI_DIR_LTR); lv_btnmatrix_set_map(obj, kb_map[keyboard->mode]); diff --git a/src/extra/widgets/keyboard/lv_keyboard.h b/src/extra/widgets/keyboard/lv_keyboard.h index 32ee85833..2aa2f3d11 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.h +++ b/src/extra/widgets/keyboard/lv_keyboard.h @@ -130,7 +130,7 @@ static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) * @param kb pointer to a keyboard * @param event the triggering event */ -void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event); +void lv_keyboard_def_event_cb(lv_event_t * e); /********************** * MACROS diff --git a/src/extra/widgets/led/lv_led.c b/src/extra/widgets/led/lv_led.c index e50ae975d..2f858d3b1 100644 --- a/src/extra/widgets/led/lv_led.c +++ b/src/extra/widgets/led/lv_led.c @@ -30,7 +30,7 @@ * STATIC PROTOTYPES **********************/ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_led_event(lv_obj_t * obj, lv_event_t e); +static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e); /********************** * STATIC VARIABLES @@ -59,7 +59,7 @@ const lv_obj_class_t lv_led_class = { */ lv_obj_t * lv_led_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_led_class, parent); + return lv_obj_class_create_obj(&lv_led_class, parent, NULL); } /*===================== @@ -156,15 +156,19 @@ static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) led->bright = LV_LED_BRIGHT_MAX; } -static void lv_led_event(lv_obj_t * obj, lv_event_t e) +static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /* Call the ancestor's event handler */ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_DRAW_MAIN) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { /*Make darker colors in a temporary style according to the brightness*/ lv_led_t * led = (lv_led_t *)obj; @@ -193,7 +197,7 @@ static void lv_led_event(lv_obj_t * obj, lv_event_t e) rect_dsc.shadow_spread = ((led->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_spread) / (LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN); - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_rect(&obj->coords, clip_area, &rect_dsc); } } diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index 7bcc0d546..b401eecc3 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -55,7 +55,7 @@ const lv_obj_class_t lv_list_text_class = { lv_obj_t * lv_list_create(lv_obj_t * parent) { - lv_obj_t * list = lv_obj_create_from_class(&lv_list_class, parent); + lv_obj_t * list = lv_obj_class_create_obj(&lv_list_class, parent, NULL); lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN); return list; @@ -63,18 +63,20 @@ lv_obj_t * lv_list_create(lv_obj_t * parent) lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt) { - lv_obj_t * label = lv_obj_create_from_class(&lv_list_text_class, list); + lv_obj_t * label = lv_obj_class_create_obj(&lv_list_text_class, list, NULL); lv_label_set_text(label, txt); lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); - lv_obj_set_width(label, LV_SIZE_PCT(100)); + lv_obj_set_width(label, LV_PCT(100)); return label; } lv_obj_t * lv_list_add_btn(lv_obj_t * list, const char * icon, const char * txt, lv_event_cb_t event_cb) { - lv_obj_t * btn = lv_obj_create_from_class(&lv_list_btn_class, list); - lv_obj_set_size(btn, LV_SIZE_PCT(100), LV_SIZE_CONTENT); - lv_obj_add_event_cb(btn, event_cb, NULL); + lv_obj_t * btn = lv_obj_class_create_obj(&lv_list_btn_class, list, NULL); + lv_obj_set_size(btn, LV_PCT(100), LV_SIZE_CONTENT); + if(event_cb) { + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_ALL, NULL); + } if(icon) { lv_obj_t * img = lv_img_create(btn); diff --git a/src/extra/widgets/lv_widgets.h b/src/extra/widgets/lv_widgets.h index a0a3725fd..21042e831 100644 --- a/src/extra/widgets/lv_widgets.h +++ b/src/extra/widgets/lv_widgets.h @@ -16,9 +16,11 @@ extern "C" { #include "calendar/lv_calendar.h" #include "calendar/lv_calendar_header_arrow.h" #include "calendar/lv_calendar_header_dropdown.h" +#include "chart/lv_chart.h" #include "keyboard/lv_keyboard.h" #include "list/lv_list.h" #include "msgbox/lv_msgbox.h" +#include "meter/lv_meter.h" #include "spinbox/lv_spinbox.h" #include "spinner/lv_spinner.h" #include "tabview/lv_tabview.h" diff --git a/src/widgets/lv_meter.c b/src/extra/widgets/meter/lv_meter.c similarity index 79% rename from src/widgets/lv_meter.c rename to src/extra/widgets/meter/lv_meter.c index 3f1639cf2..d42ed3dc5 100644 --- a/src/widgets/lv_meter.c +++ b/src/extra/widgets/meter/lv_meter.c @@ -9,12 +9,6 @@ #include "lv_meter.h" #if LV_USE_METER != 0 -#include "../misc/lv_assert.h" -#include "../draw/lv_draw.h" -#include "../core/lv_group.h" -#include "../misc/lv_math.h" -#include "../core/lv_disp.h" - /********************* * DEFINES *********************/ @@ -29,11 +23,10 @@ **********************/ static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_meter_event(lv_obj_t * obj, lv_event_t e); +static void lv_meter_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); -static lv_meter_scale_t * get_scale_of_indic(lv_obj_t * obj, lv_meter_indicator_t * indic); static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_value, int32_t new_value); static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value); @@ -59,7 +52,7 @@ const lv_obj_class_t lv_meter_class = { lv_obj_t * lv_meter_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_meter_class, parent); + return lv_obj_class_create_obj(&lv_meter_class, parent, NULL); } /*===================== @@ -74,7 +67,6 @@ lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj) LV_ASSERT_MALLOC(scale); lv_memset_00(scale, sizeof(lv_meter_scale_t)); - _lv_ll_init(&scale->indicator_ll, sizeof(lv_meter_indicator_t)); scale->angle_range = 270; scale->rotation = 90 + (360 - scale->angle_range) / 2; scale->min = 0; @@ -121,9 +113,11 @@ void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod) { - lv_meter_indicator_t * indic = _lv_ll_ins_head(&scale->indicator_ll); + lv_meter_t * meter = (lv_meter_t *)obj; + lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll); LV_ASSERT_MALLOC(indic); lv_memset_00(indic, sizeof(lv_meter_indicator_t)); + indic->scale = scale; indic->opa = LV_OPA_COVER; indic->type = LV_METER_INDICATOR_TYPE_NEEDLE_LINE; @@ -137,9 +131,11 @@ lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src, lv_coord_t pivot_x, lv_coord_t pivot_y) { - lv_meter_indicator_t * indic = _lv_ll_ins_head(&scale->indicator_ll); + lv_meter_t * meter = (lv_meter_t *)obj; + lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll); LV_ASSERT_MALLOC(indic); lv_memset_00(indic, sizeof(lv_meter_indicator_t)); + indic->scale = scale; indic->opa = LV_OPA_COVER; indic->type = LV_METER_INDICATOR_TYPE_NEEDLE_IMG; @@ -153,9 +149,11 @@ lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod) { - lv_meter_indicator_t * indic = _lv_ll_ins_head(&scale->indicator_ll); + lv_meter_t * meter = (lv_meter_t *)obj; + lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll); LV_ASSERT_MALLOC(indic); lv_memset_00(indic, sizeof(lv_meter_indicator_t)); + indic->scale = scale; indic->opa = LV_OPA_COVER; indic->type = LV_METER_INDICATOR_TYPE_ARC; @@ -169,9 +167,11 @@ lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start, lv_color_t color_end, bool local, int16_t width_mod) { - lv_meter_indicator_t * indic = _lv_ll_ins_head(&scale->indicator_ll); + lv_meter_t * meter = (lv_meter_t *)obj; + lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll); LV_ASSERT_MALLOC(indic); lv_memset_00(indic, sizeof(lv_meter_indicator_t)); + indic->scale = scale; indic->opa = LV_OPA_COVER; indic->type = LV_METER_INDICATOR_TYPE_SCALE_LINES; @@ -254,6 +254,7 @@ static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_meter_t * meter = (lv_meter_t *)obj; _lv_ll_init(&meter->scale_ll, sizeof(lv_meter_scale_t)); + _lv_ll_init(&meter->indicator_ll, sizeof(lv_meter_indicator_t)); LV_TRACE_OBJ_CREATE("finished"); } @@ -262,31 +263,24 @@ static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); lv_meter_t * meter = (lv_meter_t *)obj; - lv_meter_scale_t * scale; - scale = _lv_ll_get_head(&meter->scale_ll); - while(scale) { - lv_meter_indicator_t * indicator = _lv_ll_get_head(&scale->indicator_ll); - while(indicator) { - _lv_ll_remove(&scale->indicator_ll, indicator); - lv_mem_free(indicator); - indicator = _lv_ll_get_head(&scale->indicator_ll); - } - _lv_ll_remove(&meter->scale_ll, scale); - lv_mem_free(scale); - scale = _lv_ll_get_head(&meter->scale_ll); - } + _lv_ll_clear(&meter->indicator_ll); + _lv_ll_clear(&meter->scale_ll); } -static void lv_meter_event(lv_obj_t * obj, lv_event_t e) +static void lv_meter_event(const lv_obj_class_t * class_p, lv_event_t * e) { - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + LV_UNUSED(class_p); + + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_DRAW_MAIN) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); draw_arcs(obj, clip_area, &scale_area); draw_ticks_and_labels(obj, clip_area, &scale_area); @@ -300,12 +294,13 @@ static void lv_meter_event(lv_obj_t * obj, lv_event_t e) lv_draw_rect_dsc_t mid_dsc; lv_draw_rect_dsc_init(&mid_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &mid_dsc); - lv_coord_t size = lv_obj_get_style_size(obj, LV_PART_INDICATOR) / 2; + lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; lv_area_t nm_cord; - nm_cord.x1 = scale_center.x - size; - nm_cord.y1 = scale_center.y - size; - nm_cord.x2 = scale_center.x + size; - nm_cord.y2 = scale_center.y + size; + nm_cord.x1 = scale_center.x - w; + nm_cord.y1 = scale_center.y - h; + nm_cord.x2 = scale_center.x + w; + nm_cord.y2 = scale_center.y + h; lv_draw_rect(&nm_cord, clip_area, &mid_dsc); } } @@ -323,21 +318,20 @@ static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area scale_center.x = scale_area->x1 + r_out; scale_center.y = scale_area->y1 + r_out; - lv_meter_scale_t * scale; - _LV_LL_READ_BACK(&meter->scale_ll, scale) { - lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN); - lv_meter_indicator_t * indic; - _LV_LL_READ_BACK(&scale->indicator_ll, indic) { - if(indic->type != LV_METER_INDICATOR_TYPE_ARC) continue; + lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN); + lv_meter_indicator_t * indic; + _LV_LL_READ_BACK(&meter->indicator_ll, indic) { + if(indic->type != LV_METER_INDICATOR_TYPE_ARC) continue; - arc_dsc.color = indic->type_data.arc.color; - arc_dsc.width = indic->type_data.arc.width; - arc_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; + arc_dsc.color = indic->type_data.arc.color; + arc_dsc.width = indic->type_data.arc.width; + arc_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; - int32_t start_angle = lv_map(indic->start_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); - int32_t end_angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); - lv_draw_arc(scale_center.x, scale_center.y, r_out + indic->type_data.arc.r_mod, start_angle, end_angle, clip_area, &arc_dsc); - } + lv_meter_scale_t * scale = indic->scale; + + int32_t start_angle = lv_map(indic->start_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); + int32_t end_angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); + lv_draw_arc(scale_center.x, scale_center.y, r_out + indic->type_data.arc.r_mod, start_angle, end_angle, clip_area, &arc_dsc); } } @@ -426,7 +420,7 @@ static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, c lv_coord_t line_width = line_width_ori; lv_meter_indicator_t * indic; - _LV_LL_READ_BACK(&scale->indicator_ll, indic) { + _LV_LL_READ_BACK(&meter->indicator_ll, indic) { if(indic->type != LV_METER_INDICATOR_TYPE_SCALE_LINES) continue; if(value_of_line >= indic->start_value && value_of_line <= indic->end_value) { line_width += indic->type_data.scale_lines.width_mod; @@ -537,8 +531,6 @@ static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_a { lv_meter_t * meter = (lv_meter_t *)obj; - lv_meter_scale_t * scale; - lv_coord_t r_edge = lv_area_get_width(scale_area) / 2; lv_point_t scale_center; scale_center.x = scale_area->x1 + r_edge; @@ -551,70 +543,52 @@ static void draw_needles(lv_obj_t * obj, const lv_area_t * clip_area, const lv_a lv_draw_img_dsc_t img_dsc; lv_draw_img_dsc_init(&img_dsc); lv_obj_init_draw_img_dsc(obj, LV_PART_INDICATOR, &img_dsc); - + img_dsc.antialias = 1; lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN); - _LV_LL_READ_BACK(&meter->scale_ll, scale) { - lv_meter_indicator_t * indic; - _LV_LL_READ_BACK(&scale->indicator_ll, indic) { - if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_LINE) { - int32_t angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); - lv_coord_t r_out = r_edge + scale->r_mod + indic->type_data.needle_line.r_mod; - lv_point_t p_end; - p_end.y = (lv_trigo_sin(angle) * (r_out)) / LV_TRIGO_SIN_MAX + scale_center.y; - p_end.x = (lv_trigo_cos(angle) * (r_out)) / LV_TRIGO_SIN_MAX + scale_center.x; - line_dsc.color = indic->type_data.needle_line.color; - line_dsc.width = indic->type_data.needle_line.width; - line_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; - lv_draw_line(&scale_center, &p_end, clip_area, &line_dsc); - } - else if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_IMG) { - if(indic->type_data.needle_img.src == NULL) continue; + lv_meter_indicator_t * indic; + _LV_LL_READ_BACK(&meter->indicator_ll, indic) { + lv_meter_scale_t * scale = indic->scale; + if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_LINE) { + int32_t angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); + lv_coord_t r_out = r_edge + scale->r_mod + indic->type_data.needle_line.r_mod; + lv_point_t p_end; + p_end.y = (lv_trigo_sin(angle) * (r_out)) / LV_TRIGO_SIN_MAX + scale_center.y; + p_end.x = (lv_trigo_cos(angle) * (r_out)) / LV_TRIGO_SIN_MAX + scale_center.x; + line_dsc.color = indic->type_data.needle_line.color; + line_dsc.width = indic->type_data.needle_line.width; + line_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; + lv_draw_line(&scale_center, &p_end, clip_area, &line_dsc); + } + else if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_IMG) { + if(indic->type_data.needle_img.src == NULL) continue; - int32_t angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); - lv_img_header_t info; - lv_img_decoder_get_info(indic->type_data.needle_img.src, &info); - lv_area_t a; - a.x1 = scale_center.x - indic->type_data.needle_img.pivot.x; - a.y1 = scale_center.y - indic->type_data.needle_img.pivot.y; - a.x2 = a.x1 + info.w - 1; - a.y2 = a.y1 + info.h - 1; + int32_t angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); + lv_img_header_t info; + lv_img_decoder_get_info(indic->type_data.needle_img.src, &info); + lv_area_t a; + a.x1 = scale_center.x - indic->type_data.needle_img.pivot.x; + a.y1 = scale_center.y - indic->type_data.needle_img.pivot.y; + a.x2 = a.x1 + info.w - 1; + a.y2 = a.y1 + info.h - 1; - img_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; - img_dsc.pivot.x = indic->type_data.needle_img.pivot.x; - img_dsc.pivot.y = indic->type_data.needle_img.pivot.y; - angle = angle * 10; - if(angle > 3600) angle -= 3600; - img_dsc.angle = angle; - lv_draw_img(&a, clip_area, indic->type_data.needle_img.src, &img_dsc); - } + img_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; + img_dsc.pivot.x = indic->type_data.needle_img.pivot.x; + img_dsc.pivot.y = indic->type_data.needle_img.pivot.y; + angle = angle * 10; + if(angle > 3600) angle -= 3600; + img_dsc.angle = angle; + lv_draw_img(&a, clip_area, indic->type_data.needle_img.src, &img_dsc); } } } -static lv_meter_scale_t * get_scale_of_indic(lv_obj_t * obj, lv_meter_indicator_t * indic) -{ - lv_meter_t * meter = (lv_meter_t *)obj; - - lv_meter_scale_t * scale; - - _LV_LL_READ_BACK(&meter->scale_ll, scale) { - lv_meter_indicator_t * ind; - _LV_LL_READ_BACK(&scale->indicator_ll, ind) { - if(ind == indic) return scale; - } - } - - return NULL; -} - - static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_value, int32_t new_value) { bool rounded = lv_obj_get_style_arc_rounded(obj, LV_PART_ITEMS); lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); lv_coord_t r_out = lv_area_get_width(&scale_area) / 2; lv_point_t scale_center; @@ -623,7 +597,7 @@ static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_va r_out += indic->type_data.arc.r_mod; - lv_meter_scale_t * scale = get_scale_of_indic(obj, indic); + lv_meter_scale_t * scale = indic->scale; int32_t start_angle = lv_map(old_value, scale->min, scale->max, scale->rotation, scale->angle_range + scale->rotation); int32_t end_angle = lv_map(new_value, scale->min, scale->max, scale->rotation, scale->angle_range + scale->rotation); @@ -636,14 +610,14 @@ static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_va static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value) { lv_area_t scale_area; - lv_obj_get_coords_fit(obj, &scale_area); + lv_obj_get_content_coords(obj, &scale_area); lv_coord_t r_out = lv_area_get_width(&scale_area) / 2; lv_point_t scale_center; scale_center.x = scale_area.x1 + r_out; scale_center.y = scale_area.y1 + r_out; - lv_meter_scale_t * scale = get_scale_of_indic(obj, indic); + lv_meter_scale_t * scale = indic->scale; if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_LINE) { int32_t angle = lv_map(value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); @@ -670,10 +644,10 @@ static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value lv_area_t a; _lv_img_buf_get_transformed_area(&a, info.w, info.h, angle, LV_IMG_ZOOM_NONE, &indic->type_data.needle_img.pivot); - a.x1 += scale_center.x; - a.y1 += scale_center.y; - a.x2 += scale_center.x; - a.y2 += scale_center.y; + a.x1 += scale_center.x - 2; + a.y1 += scale_center.y - 2; + a.x2 += scale_center.x + 2; + a.y2 += scale_center.y + 2; lv_obj_invalidate_area(obj, &a); } diff --git a/src/widgets/lv_meter.h b/src/extra/widgets/meter/lv_meter.h similarity index 99% rename from src/widgets/lv_meter.h rename to src/extra/widgets/meter/lv_meter.h index 8000b837c..62cc1e72b 100644 --- a/src/widgets/lv_meter.h +++ b/src/extra/widgets/meter/lv_meter.h @@ -13,12 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "../../../lvgl.h" #if LV_USE_METER != 0 -#include "../core/lv_obj.h" - /********************* * DEFINES *********************/ @@ -27,6 +25,27 @@ extern "C" { * TYPEDEFS **********************/ +typedef struct { + lv_color_t tick_color; + uint16_t tick_cnt; + uint16_t tick_length; + uint16_t tick_width; + + lv_color_t tick_major_color; + uint16_t tick_major_nth; + uint16_t tick_major_length; + uint16_t tick_major_width; + + int16_t label_gap; + int16_t label_color; + + int32_t min; + int32_t max; + int16_t r_mod; + uint16_t angle_range; + int16_t rotation; +}lv_meter_scale_t; + typedef enum { LV_METER_INDICATOR_TYPE_NEEDLE_IMG, LV_METER_INDICATOR_TYPE_NEEDLE_LINE, @@ -35,6 +54,7 @@ typedef enum { }lv_meter_indicator_type_t; typedef struct { + lv_meter_scale_t * scale; lv_meter_indicator_type_t type; lv_opa_t opa; int32_t start_value; @@ -64,33 +84,12 @@ typedef struct { } type_data; }lv_meter_indicator_t; -typedef struct { - lv_ll_t indicator_ll; - - lv_color_t tick_color; - uint16_t tick_cnt; - uint16_t tick_length; - uint16_t tick_width; - - lv_color_t tick_major_color; - uint16_t tick_major_nth; - uint16_t tick_major_length; - uint16_t tick_major_width; - - int16_t label_gap; - int16_t label_color; - - int32_t min; - int32_t max; - int16_t r_mod; - uint16_t angle_range; - int16_t rotation; -}lv_meter_scale_t; /*Data of line meter*/ typedef struct { lv_obj_t obj; lv_ll_t scale_ll; + lv_ll_t indicator_ll; } lv_meter_t; extern const lv_obj_class_t lv_meter_class; diff --git a/src/extra/widgets/msgbox/lv_msgbox.c b/src/extra/widgets/msgbox/lv_msgbox.c index 32754ef04..cf4cca091 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.c +++ b/src/extra/widgets/msgbox/lv_msgbox.c @@ -13,6 +13,7 @@ /********************* * DEFINES *********************/ +#define LV_MSGBOX_FLAG_AUTO_PARENT LV_OBJ_FLAG_WIDGET_1 /*Mark that the parent was automatically created*/ /********************** * TYPEDEFS @@ -21,7 +22,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void msgbox_close_event_cb(lv_obj_t * btn, lv_event_t e); +static void msgbox_close_click_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -36,41 +37,41 @@ const lv_obj_class_t lv_msgbox_class = {.base_class = &lv_obj_class}; * GLOBAL FUNCTIONS **********************/ -/** - * Create a message box objects - * @param par pointer to an object, it will be the parent of the new message box - * @return pointer to the created message box - */ -lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * btn_txts[], bool add_close_btn) +lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[], bool add_close_btn) { - lv_obj_t * parent = lv_obj_create(lv_layer_top()); - lv_obj_set_size(parent, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + bool auto_parent = false; + if(parent == NULL) { + auto_parent = true; + parent = lv_obj_create(lv_scr_act()); + lv_obj_remove_style_all(parent); + lv_obj_set_style_bg_color(parent, lv_palette_main(LV_PALETTE_GREY), 0); + lv_obj_set_style_bg_opa(parent, LV_OPA_50, 0); + lv_obj_set_size(parent, LV_PCT(100), LV_PCT(100)); + } - lv_obj_remove_style_all(parent); - lv_obj_set_style_bg_color(parent, lv_color_grey(), 0); - lv_obj_set_style_bg_opa(parent, LV_OPA_50, 0); - - lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox_class, parent); + lv_obj_t * mbox = lv_obj_class_create_obj(&lv_msgbox_class, parent, NULL); LV_ASSERT_MALLOC(mbox); if(mbox == NULL) return NULL; - lv_coord_t w = lv_obj_get_width_fit(parent); + if(auto_parent) lv_obj_add_flag(mbox, LV_MSGBOX_FLAG_AUTO_PARENT); + lv_coord_t w = lv_obj_get_content_width(parent); if(w > 2 * LV_DPI_DEF) w = 2 * LV_DPI_DEF; lv_obj_set_size(mbox, w, LV_SIZE_CONTENT); lv_obj_set_flex_flow(mbox, LV_FLEX_FLOW_ROW_WRAP); + lv_obj_set_flex_align(mbox, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); lv_obj_t * label; label = lv_label_create(mbox); lv_label_set_text(label, title); lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); if(add_close_btn) lv_obj_set_flex_grow(label, 1); - else lv_obj_set_width(label, LV_SIZE_PCT(100)); + else lv_obj_set_width(label, LV_PCT(100)); if(add_close_btn) { lv_obj_t * close_btn = lv_btn_create(mbox); lv_obj_set_ext_click_area(close_btn, LV_DPX(10)); - lv_obj_add_event_cb(close_btn, msgbox_close_event_cb, NULL); + lv_obj_add_event_cb(close_btn, msgbox_close_click_event_cb, LV_EVENT_CLICKED, NULL); label = lv_label_create(close_btn); lv_label_set_text(label, LV_SYMBOL_CLOSE); lv_coord_t close_btn_size = LV_MAX(lv_obj_get_width(label), lv_obj_get_height(label)) + LV_DPX(10); @@ -81,14 +82,14 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b label = lv_label_create(mbox); lv_label_set_text(label, txt); lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); - lv_obj_set_width(label, LV_SIZE_PCT(100)); + lv_obj_set_width(label, LV_PCT(100)); lv_obj_t * btns = lv_btnmatrix_create(mbox); lv_btnmatrix_set_map(btns, btn_txts); lv_btnmatrix_set_btn_ctrl_all(btns, LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_NO_REPEAT); uint32_t btn_cnt = 0; - while(btn_txts[btn_cnt][0] != '\0') { + while(btn_txts[btn_cnt] && btn_txts[btn_cnt][0] != '\0') { btn_cnt++; } @@ -130,7 +131,8 @@ const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox) void lv_msgbox_close(lv_obj_t * mbox) { - lv_obj_del(lv_obj_get_parent(mbox)); + if(lv_obj_has_flag(mbox, LV_MSGBOX_FLAG_AUTO_PARENT)) lv_obj_del(lv_obj_get_parent(mbox)); + else lv_obj_del(mbox); } @@ -138,12 +140,11 @@ void lv_msgbox_close(lv_obj_t * mbox) * STATIC FUNCTIONS **********************/ -static void msgbox_close_event_cb(lv_obj_t * btn, lv_event_t e) +static void msgbox_close_click_event_cb(lv_event_t * e) { - if(e == LV_EVENT_CLICKED) { - lv_obj_t * mbox = lv_obj_get_parent(btn); - lv_msgbox_close(mbox); - } + lv_obj_t * btn = lv_event_get_target(e); + lv_obj_t * mbox = lv_obj_get_parent(btn); + lv_msgbox_close(mbox); } #endif /*LV_USE_MSGBOX*/ diff --git a/src/extra/widgets/msgbox/lv_msgbox.h b/src/extra/widgets/msgbox/lv_msgbox.h index 44d314482..6a54f85fa 100644 --- a/src/extra/widgets/msgbox/lv_msgbox.h +++ b/src/extra/widgets/msgbox/lv_msgbox.h @@ -41,10 +41,14 @@ extern const lv_obj_class_t lv_msgbox_class; /** * Create a message box objects - * @param par pointer to an object, it will be the parent of the new message box - * @return pointer to the created message box + * @param parent pointer to parent or NULL to create a full screen modal message box + * @param title the title of the message box + * @param txt the text of the message box + * @param btn_txts the buttons as an array of texts terminated by an "" element. E.g. {"btn1", "btn2", ""} + * @param add_close_btn true: add a close button + * @return pointer to the message box object */ -lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * btn_txts[], bool add_close_btn); +lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[], bool add_close_btn); lv_obj_t * lv_msgbox_get_title(lv_obj_t * mbox); diff --git a/src/extra/widgets/spinbox/lv_spinbox.c b/src/extra/widgets/spinbox/lv_spinbox.c index db50fbde6..e4dbe2b5a 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.c +++ b/src/extra/widgets/spinbox/lv_spinbox.c @@ -23,7 +23,7 @@ **********************/ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e); +static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e); static void lv_spinbox_updatevalue(lv_obj_t * obj); /********************** @@ -46,7 +46,7 @@ const lv_obj_class_t lv_spinbox_class = { lv_obj_t * lv_spinbox_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_spinbox_class, parent); + return lv_obj_class_create_obj(&lv_spinbox_class, parent, NULL); } /*===================== @@ -294,15 +294,19 @@ static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_LOG_TRACE("Spinbox constructor finished"); } -static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e) +static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + /*Call the ancestor's event handler*/ lv_res_t res = LV_RES_OK; - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_spinbox_t * spinbox = (lv_spinbox_t *)obj; - if(e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_RELEASED) { /*If released with an ENCODER then move to the next digit*/ lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) { @@ -352,10 +356,10 @@ static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e) for(i = 0; i < pos; i++) spinbox->step *= 10; } } - else if(e == LV_EVENT_KEY) { + else if(code == LV_EVENT_KEY) { lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT) { if(indev_type == LV_INDEV_TYPE_ENCODER) lv_spinbox_increment(obj); diff --git a/src/extra/widgets/spinner/lv_spinner.c b/src/extra/widgets/spinner/lv_spinner.c index 36c6c1367..972575ac9 100644 --- a/src/extra/widgets/spinner/lv_spinner.c +++ b/src/extra/widgets/spinner/lv_spinner.c @@ -49,10 +49,6 @@ lv_obj_t * lv_spinner_create(lv_obj_t * parent, uint32_t time, uint32_t arc_leng lv_obj_remove_style(spinner, NULL, LV_PART_KNOB | LV_STATE_ANY); - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_in_out); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, spinner); @@ -62,7 +58,7 @@ lv_obj_t * lv_spinner_create(lv_obj_t * parent, uint32_t time, uint32_t arc_leng lv_anim_set_values(&a, arc_length, 360 + arc_length); lv_anim_start(&a); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out); lv_anim_set_values(&a, 0, 360); lv_anim_set_exec_cb(&a, arc_anim_start_angle); lv_anim_start(&a); diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index a51383ac5..27c36317c 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -22,8 +22,8 @@ **********************/ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void btns_event_cb(lv_obj_t * btns, lv_event_t e); -static void cont_event_cb(lv_obj_t * cont, lv_event_t e); +static void btns_value_changed_event_cb(lv_event_t * e); +static void cont_scroll_end_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -31,8 +31,8 @@ static void cont_event_cb(lv_obj_t * cont, lv_event_t e); const lv_obj_class_t lv_tabview_class = { .constructor_cb = lv_tabview_constructor, .destructor_cb = lv_tabview_destructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), + .height_def = LV_PCT(100), .base_class = &lv_obj_class, .instance_size = sizeof(lv_tabview_t)}; @@ -51,7 +51,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab { tabpos_create = tab_pos; tabsize_create = tab_size; - return lv_obj_create_from_class(&lv_tabview_class, parent); + return lv_obj_class_create_obj(&lv_tabview_class, parent, NULL); } lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name) @@ -60,7 +60,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name) lv_obj_t * cont = lv_tabview_get_content(obj); lv_obj_t * page = lv_obj_create(cont); - lv_obj_set_size(page, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(page, LV_PCT(100), LV_PCT(100)); lv_obj_clear_flag(page, LV_OBJ_FLAG_CLICK_FOCUSABLE); uint32_t tab_id = lv_obj_get_child_cnt(cont); @@ -168,7 +168,7 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob break; } - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); lv_obj_t * btnm; lv_obj_t * cont; @@ -180,23 +180,23 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob tabview->map = lv_mem_alloc(sizeof(const char *)); tabview->map[0] = ""; lv_btnmatrix_set_map(btnm, (const char **)tabview->map); - lv_obj_add_event_cb(btnm, btns_event_cb, NULL); + lv_obj_add_event_cb(btnm, btns_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(btnm, LV_OBJ_FLAG_EVENT_BUBBLE); - lv_obj_add_event_cb(cont, cont_event_cb, NULL); + lv_obj_add_event_cb(cont, cont_scroll_end_event_cb, LV_EVENT_SCROLL_END, NULL); lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF); switch(tabview->tab_pos) { case LV_DIR_TOP: case LV_DIR_BOTTOM: - lv_obj_set_size(btnm, LV_SIZE_PCT(100), tabsize_create); - lv_obj_set_width(cont, LV_SIZE_PCT(100)); + lv_obj_set_size(btnm, LV_PCT(100), tabsize_create); + lv_obj_set_width(cont, LV_PCT(100)); lv_obj_set_flex_grow(cont, 1); break; case LV_DIR_LEFT: case LV_DIR_RIGHT: - lv_obj_set_size(btnm, tabsize_create, LV_SIZE_PCT(100)); - lv_obj_set_height(cont, LV_SIZE_PCT(100)); + lv_obj_set_size(btnm, tabsize_create, LV_PCT(100)); + lv_obj_set_height(cont, LV_PCT(100)); lv_obj_set_flex_grow(cont, 1); break; } @@ -228,26 +228,26 @@ static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj tabview->map = NULL; } -static void btns_event_cb(lv_obj_t * btns, lv_event_t e) +static void btns_value_changed_event_cb(lv_event_t * e) { - if(e == LV_EVENT_VALUE_CHANGED) { - lv_obj_t * tv = lv_obj_get_parent(btns); - uint32_t id = lv_btnmatrix_get_selected_btn(btns); - lv_tabview_set_act(tv, id, LV_ANIM_ON); - } + lv_obj_t * btns = lv_event_get_target(e); + + lv_obj_t * tv = lv_obj_get_parent(btns); + uint32_t id = lv_btnmatrix_get_selected_btn(btns); + lv_tabview_set_act(tv, id, LV_ANIM_ON); } -static void cont_event_cb(lv_obj_t * cont, lv_event_t e) +static void cont_scroll_end_event_cb(lv_event_t * e) { - if(e == LV_EVENT_SCROLL_END) { - lv_obj_t * tv = lv_obj_get_parent(cont); + lv_obj_t * cont = lv_event_get_target(e); - lv_point_t p; - lv_obj_get_scroll_end(cont, &p); + lv_obj_t * tv = lv_obj_get_parent(cont); - lv_coord_t w = lv_obj_get_width_fit(cont); - lv_coord_t t = (p.x + w/ 2) / w; - if(t < 0) t = 0; - lv_tabview_set_act(tv, t, LV_ANIM_ON); - } + lv_point_t p; + lv_obj_get_scroll_end(cont, &p); + + lv_coord_t w = lv_obj_get_content_width(cont); + lv_coord_t t = (p.x + w/ 2) / w; + if(t < 0) t = 0; + lv_tabview_set_act(tv, t, LV_ANIM_ON); } #endif /*LV_USE_TABVIEW*/ diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index 4edb5a1ac..3c651d0fa 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -22,7 +22,7 @@ **********************/ static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void tileview_event_cb(lv_obj_t * tv, lv_event_t e); +static void tileview_event_cb(lv_event_t * e); /********************** * STATIC VARIABLES @@ -50,7 +50,7 @@ static uint32_t create_row_id; lv_obj_t * lv_tileview_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_tileview_class, parent); + return lv_obj_class_create_obj(&lv_tileview_class, parent, NULL); } /*====================== @@ -62,7 +62,7 @@ lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, l create_dir = dir; create_col_id = col_id; create_row_id = row_id; - return lv_obj_create_from_class(&lv_tileview_tile_class, tv); + return lv_obj_class_create_obj(&lv_tileview_tile_class, tv, NULL); } void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en) @@ -77,8 +77,8 @@ void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_e void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en) { - lv_coord_t w = lv_obj_get_width_fit(tv); - lv_coord_t h = lv_obj_get_height_fit(tv); + lv_coord_t w = lv_obj_get_content_width(tv); + lv_coord_t h = lv_obj_get_content_height(tv); lv_coord_t tx = col_id * w; lv_coord_t ty = row_id * h; @@ -104,8 +104,8 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); - lv_obj_add_event_cb(obj, tileview_event_cb, NULL); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); + lv_obj_add_event_cb(obj, tileview_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ONE); lv_obj_set_scroll_snap_x(obj, LV_SCROLL_SNAP_CENTER); lv_obj_set_scroll_snap_y(obj, LV_SCROLL_SNAP_CENTER); @@ -116,8 +116,8 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_ { LV_UNUSED(class_p); lv_obj_t * parent = lv_obj_get_parent(obj); - lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); - lv_obj_set_pos(obj, create_col_id * lv_obj_get_width_fit(parent), create_row_id * lv_obj_get_height_fit(parent)); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); + lv_obj_set_pos(obj, create_col_id * lv_obj_get_content_width(parent), create_row_id * lv_obj_get_content_height(parent)); lv_tileview_tile_t * tile = (lv_tileview_tile_t *)obj; tile->dir = create_dir; @@ -127,11 +127,13 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_ } } -static void tileview_event_cb(lv_obj_t * tv, lv_event_t e) +static void tileview_event_cb(lv_event_t * e) { - if(e == LV_EVENT_SCROLL_END) { - lv_coord_t w = lv_obj_get_width_fit(tv); - lv_coord_t h = lv_obj_get_height_fit(tv); + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * tv = lv_event_get_target(e); + if(code == LV_EVENT_SCROLL_END) { + lv_coord_t w = lv_obj_get_content_width(tv); + lv_coord_t h = lv_obj_get_content_height(tv); lv_point_t scroll_end; lv_obj_get_scroll_end(tv, &scroll_end); diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index 74b622b0a..6afdc165f 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -28,8 +28,8 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); **********************/ const lv_obj_class_t lv_win_class = { .constructor_cb = lv_win_constructor, - .width_def = LV_SIZE_PCT(100), - .height_def = LV_SIZE_PCT(100), + .width_def = LV_PCT(100), + .height_def = LV_PCT(100), .base_class = &lv_obj_class, .instance_size = sizeof(lv_win_t) }; @@ -45,7 +45,7 @@ static lv_coord_t create_header_height; lv_obj_t * lv_win_create(lv_obj_t * parent, lv_coord_t header_height) { create_header_height = header_height; - return lv_obj_create_from_class(&lv_win_class, parent); + return lv_obj_class_create_obj(&lv_win_class, parent, NULL); } lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt) @@ -62,8 +62,8 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * icon, lv_coord_t btn_w, l { lv_obj_t * header = lv_win_get_header(win); lv_obj_t * btn = lv_btn_create(header); - lv_obj_set_size(btn, btn_w, LV_SIZE_PCT(100)); - lv_obj_add_event_cb(btn, event_cb, NULL); + lv_obj_set_size(btn, btn_w, LV_PCT(100)); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_ALL, NULL); lv_obj_t * img = lv_img_create(btn); lv_img_set_src(img, icon); @@ -94,13 +94,13 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN); lv_obj_t * header = lv_obj_create(obj); - lv_obj_set_size(header, LV_SIZE_PCT(100), create_header_height); + lv_obj_set_size(header, LV_PCT(100), create_header_height); lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_place(header, LV_FLEX_PLACE_START, LV_FLEX_PLACE_CENTER, LV_FLEX_PLACE_CENTER); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t * cont = lv_obj_create(obj); lv_obj_set_flex_grow(cont, 1); - lv_obj_set_width(cont, LV_SIZE_PCT(100)); + lv_obj_set_width(cont, LV_PCT(100)); } #endif diff --git a/src/font/lv_font_dejavu_16_persian_hebrew.c b/src/font/lv_font_dejavu_16_persian_hebrew.c index 8eb425c6b..6d7ebde59 100644 --- a/src/font/lv_font_dejavu_16_persian_hebrew.c +++ b/src/font/lv_font_dejavu_16_persian_hebrew.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_dejavu_16_persian_hebrew.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_dejavu_16_persian_hebrew.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3161,6 +3161,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -6182,275 +6197,276 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 18573, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 18678, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 18790, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 18888, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 18984, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 19080, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19192, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19304, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 19412, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19574, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 19670, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 19820, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 19920, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20020, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20120, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20220, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20320, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 20467, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 20563, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 20675, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 20820, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 20940, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 21036, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21130, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21202, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21277, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21302, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21332, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21404, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21479, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21504, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21534, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21606, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 21681, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21706, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 21736, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21788, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21848, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 21873, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 21903, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 21955, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22015, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22040, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22070, .adv_w = 241, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22135, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 22203, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22236, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22269, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 22374, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 22470, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22518, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22573, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 22678, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 22774, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22822, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 22877, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 22937, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23002, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23062, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23134, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23199, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23259, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 23309, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 23369, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23429, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23489, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23549, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23621, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 23681, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 23741, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23801, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23873, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23908, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23953, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23988, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24033, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24075, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24129, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24171, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 24225, .adv_w = 124, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24288, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24358, .adv_w = 124, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24430, .adv_w = 141, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 24510, .adv_w = 229, .box_w = 14, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24608, .adv_w = 229, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24713, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 24772, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 24837, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 24949, .adv_w = 229, .box_w = 15, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25069, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25137, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25212, .adv_w = 229, .box_w = 14, .box_h = 20, .ofs_x = 1, .ofs_y = -6}, - {.bitmap_index = 25352, .adv_w = 229, .box_w = 15, .box_h = 21, .ofs_x = 1, .ofs_y = -6}, - {.bitmap_index = 25510, .adv_w = 122, .box_w = 9, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 25600, .adv_w = 141, .box_w = 10, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 25700, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25812, .adv_w = 229, .box_w = 15, .box_h = 15, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 25925, .adv_w = 122, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 25988, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26058, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 26108, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 26168, .adv_w = 188, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 26238, .adv_w = 195, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 26316, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26349, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26382, .adv_w = 179, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26427, .adv_w = 162, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 26482, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26523, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 26573, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26650, .adv_w = 216, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 26741, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26809, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 26884, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 26944, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27019, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27075, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27145, .adv_w = 124, .box_w = 8, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27209, .adv_w = 132, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27289, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27345, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27415, .adv_w = 200, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -7}, - {.bitmap_index = 27492, .adv_w = 213, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = -7}, - {.bitmap_index = 27570, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27595, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 27625, .adv_w = 71, .box_w = 5, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27638, .adv_w = 77, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27653, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 27708, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 27760, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 27780, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 27804, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27817, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27859, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27872, .adv_w = 67, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 27880, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27890, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27898, .adv_w = 75, .box_w = 6, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27934, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, - {.bitmap_index = 27947, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 27989, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 27997, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28012, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 10}, - {.bitmap_index = 28027, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28069, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = 10}, - {.bitmap_index = 28079, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28121, .adv_w = 120, .box_w = 6, .box_h = 8, .ofs_x = 1, .ofs_y = 1}, - {.bitmap_index = 28145, .adv_w = 71, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28198, .adv_w = 78, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28251, .adv_w = 71, .box_w = 4, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 28285, .adv_w = 78, .box_w = 6, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 28336, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 28396, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 28471, .adv_w = 71, .box_w = 4, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 28503, .adv_w = 78, .box_w = 6, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 28551, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 28617, .adv_w = 213, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 28689, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28714, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 28744, .adv_w = 71, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28756, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28786, .adv_w = 241, .box_w = 13, .box_h = 9, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 28845, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 28913, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28933, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 28957, .adv_w = 134, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 28989, .adv_w = 137, .box_w = 8, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29021, .adv_w = 241, .box_w = 13, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29060, .adv_w = 251, .box_w = 15, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29105, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29125, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29149, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29201, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 29261, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29286, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29316, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29381, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 29441, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 29491, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 29551, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29611, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29676, .adv_w = 158, .box_w = 10, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29711, .adv_w = 165, .box_w = 12, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29753, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29823, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 29893, .adv_w = 158, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29938, .adv_w = 165, .box_w = 12, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 29992, .adv_w = 114, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30017, .adv_w = 134, .box_w = 9, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30049, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30084, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30129, .adv_w = 124, .box_w = 8, .box_h = 9, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30165, .adv_w = 141, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30215, .adv_w = 124, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30263, .adv_w = 141, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 30323, .adv_w = 313, .box_w = 18, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30413, .adv_w = 326, .box_w = 20, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 30523, .adv_w = 215, .box_w = 14, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30565, .adv_w = 228, .box_w = 16, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30613, .adv_w = 313, .box_w = 18, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30739, .adv_w = 326, .box_w = 20, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 30879, .adv_w = 215, .box_w = 14, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 30942, .adv_w = 228, .box_w = 16, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31022, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31130, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31244, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31293, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31349, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31457, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 31571, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31620, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31676, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 31754, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 31844, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 31922, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32012, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 32090, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 32180, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32258, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32348, .adv_w = 153, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32418, .adv_w = 136, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32478, .adv_w = 153, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32519, .adv_w = 124, .box_w = 9, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32551, .adv_w = 153, .box_w = 10, .box_h = 15, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32626, .adv_w = 136, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 32696, .adv_w = 134, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32746, .adv_w = 124, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32787, .adv_w = 265, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 32877, .adv_w = 265, .box_w = 16, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, - {.bitmap_index = 32957, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 32997, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33042, .adv_w = 199, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33126, .adv_w = 214, .box_w = 14, .box_h = 13, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 33217, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33257, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33302, .adv_w = 211, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33368, .adv_w = 216, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33446, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33505, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33570, .adv_w = 186, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33645, .adv_w = 194, .box_w = 12, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33735, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33765, .adv_w = 85, .box_w = 7, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33807, .adv_w = 159, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 33847, .adv_w = 170, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 33892, .adv_w = 137, .box_w = 9, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33915, .adv_w = 148, .box_w = 11, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 33943, .adv_w = 188, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 33998, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34058, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34078, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34102, .adv_w = 134, .box_w = 7, .box_h = 7, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 34127, .adv_w = 137, .box_w = 8, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 34151, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34192, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34242, .adv_w = 124, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34282, .adv_w = 132, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34332, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 34387, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 34439, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34505, .adv_w = 213, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, - {.bitmap_index = 34570, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 34590, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 34614, .adv_w = 146, .box_w = 10, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, - {.bitmap_index = 34684, .adv_w = 153, .box_w = 12, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, - {.bitmap_index = 34768, .adv_w = 146, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34840, .adv_w = 153, .box_w = 11, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, - {.bitmap_index = 34928, .adv_w = 146, .box_w = 8, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 34992, .adv_w = 153, .box_w = 10, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35072, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 35120, .adv_w = 153, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 35180, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 18888, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 18986, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19082, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 19178, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19290, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19402, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19510, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 19672, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 19768, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 19918, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20018, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20118, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20218, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20318, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 20418, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 20565, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 20661, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 20773, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 20918, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 21038, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 21134, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21228, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21300, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21375, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21400, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21430, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21502, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21577, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21602, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21632, .adv_w = 241, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21704, .adv_w = 251, .box_w = 15, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 21779, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21804, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 21834, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 21886, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 21946, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 21971, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22001, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22053, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22113, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22138, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22168, .adv_w = 241, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22233, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 22301, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22334, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22367, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 22472, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 22568, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22616, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22671, .adv_w = 265, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 22776, .adv_w = 265, .box_w = 16, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 22872, .adv_w = 122, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22920, .adv_w = 130, .box_w = 10, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 22975, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23035, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23100, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23160, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23232, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23297, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23357, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 23407, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 23467, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23527, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23587, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23647, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23719, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 23779, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 23839, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23899, .adv_w = 165, .box_w = 12, .box_h = 12, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23971, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 24006, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 24051, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24086, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24131, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24173, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24227, .adv_w = 114, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24269, .adv_w = 134, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 24323, .adv_w = 124, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24386, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24456, .adv_w = 124, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24528, .adv_w = 141, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 24608, .adv_w = 229, .box_w = 14, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 24706, .adv_w = 229, .box_w = 15, .box_h = 14, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 24811, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 24870, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 24935, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25047, .adv_w = 229, .box_w = 15, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25167, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 25235, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 25310, .adv_w = 229, .box_w = 14, .box_h = 20, .ofs_x = 1, .ofs_y = -6}, + {.bitmap_index = 25450, .adv_w = 229, .box_w = 15, .box_h = 21, .ofs_x = 1, .ofs_y = -6}, + {.bitmap_index = 25608, .adv_w = 122, .box_w = 9, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 25698, .adv_w = 141, .box_w = 10, .box_h = 20, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 25798, .adv_w = 229, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 25910, .adv_w = 229, .box_w = 15, .box_h = 15, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 26023, .adv_w = 122, .box_w = 9, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26086, .adv_w = 141, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26156, .adv_w = 188, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 26206, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 26266, .adv_w = 188, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 26336, .adv_w = 195, .box_w = 12, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 26414, .adv_w = 71, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26447, .adv_w = 77, .box_w = 6, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26480, .adv_w = 179, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26525, .adv_w = 162, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 26580, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26621, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 26671, .adv_w = 211, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26748, .adv_w = 216, .box_w = 13, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 26839, .adv_w = 122, .box_w = 9, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26907, .adv_w = 141, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 26982, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27042, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27117, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27173, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27243, .adv_w = 124, .box_w = 8, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27307, .adv_w = 132, .box_w = 10, .box_h = 16, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27387, .adv_w = 124, .box_w = 8, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27443, .adv_w = 132, .box_w = 10, .box_h = 14, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27513, .adv_w = 200, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = -7}, + {.bitmap_index = 27590, .adv_w = 213, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = -7}, + {.bitmap_index = 27668, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27693, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 27723, .adv_w = 71, .box_w = 5, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27736, .adv_w = 77, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27751, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 27806, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 27858, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 27878, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 27902, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27915, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 27957, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27970, .adv_w = 67, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27978, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27988, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 27996, .adv_w = 75, .box_w = 6, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28032, .adv_w = 75, .box_w = 5, .box_h = 5, .ofs_x = 0, .ofs_y = 9}, + {.bitmap_index = 28045, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28087, .adv_w = 75, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 28095, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 28110, .adv_w = 75, .box_w = 6, .box_h = 5, .ofs_x = -1, .ofs_y = 10}, + {.bitmap_index = 28125, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28167, .adv_w = 75, .box_w = 5, .box_h = 4, .ofs_x = 0, .ofs_y = 10}, + {.bitmap_index = 28177, .adv_w = 75, .box_w = 6, .box_h = 14, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28219, .adv_w = 120, .box_w = 6, .box_h = 8, .ofs_x = 1, .ofs_y = 1}, + {.bitmap_index = 28243, .adv_w = 71, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28296, .adv_w = 78, .box_w = 7, .box_h = 15, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28349, .adv_w = 71, .box_w = 4, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 28383, .adv_w = 78, .box_w = 6, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 28434, .adv_w = 124, .box_w = 8, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 28494, .adv_w = 132, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 28569, .adv_w = 71, .box_w = 4, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 28601, .adv_w = 78, .box_w = 6, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 28649, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 28715, .adv_w = 213, .box_w = 13, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 28787, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28812, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 28842, .adv_w = 71, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 28854, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 28884, .adv_w = 241, .box_w = 13, .box_h = 9, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 28943, .adv_w = 251, .box_w = 15, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 29011, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29031, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29055, .adv_w = 134, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29087, .adv_w = 137, .box_w = 8, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29119, .adv_w = 241, .box_w = 13, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29158, .adv_w = 251, .box_w = 15, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29203, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29223, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29247, .adv_w = 241, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29299, .adv_w = 251, .box_w = 15, .box_h = 8, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 29359, .adv_w = 71, .box_w = 5, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29384, .adv_w = 77, .box_w = 6, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29414, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29479, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 29539, .adv_w = 158, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29589, .adv_w = 165, .box_w = 12, .box_h = 10, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 29649, .adv_w = 165, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29709, .adv_w = 165, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29774, .adv_w = 158, .box_w = 10, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29809, .adv_w = 165, .box_w = 12, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 29851, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29921, .adv_w = 165, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 29991, .adv_w = 158, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30036, .adv_w = 165, .box_w = 12, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30090, .adv_w = 114, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30115, .adv_w = 134, .box_w = 9, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30147, .adv_w = 114, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30182, .adv_w = 134, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 30227, .adv_w = 124, .box_w = 8, .box_h = 9, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30263, .adv_w = 141, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30313, .adv_w = 124, .box_w = 8, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30361, .adv_w = 141, .box_w = 10, .box_h = 12, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 30421, .adv_w = 313, .box_w = 18, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30511, .adv_w = 326, .box_w = 20, .box_h = 11, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 30621, .adv_w = 215, .box_w = 14, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30663, .adv_w = 228, .box_w = 16, .box_h = 6, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 30711, .adv_w = 313, .box_w = 18, .box_h = 14, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30837, .adv_w = 326, .box_w = 20, .box_h = 14, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 30977, .adv_w = 215, .box_w = 14, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31040, .adv_w = 228, .box_w = 16, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31120, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31228, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31342, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31391, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31447, .adv_w = 310, .box_w = 18, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31555, .adv_w = 314, .box_w = 19, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 31669, .adv_w = 217, .box_w = 14, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31718, .adv_w = 222, .box_w = 16, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 31774, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 31852, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 31942, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32020, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32110, .adv_w = 237, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 32188, .adv_w = 243, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 32278, .adv_w = 204, .box_w = 13, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32356, .adv_w = 210, .box_w = 15, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32446, .adv_w = 153, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32516, .adv_w = 136, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32576, .adv_w = 153, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32617, .adv_w = 124, .box_w = 9, .box_h = 7, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32649, .adv_w = 153, .box_w = 10, .box_h = 15, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32724, .adv_w = 136, .box_w = 10, .box_h = 14, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 32794, .adv_w = 134, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32844, .adv_w = 124, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 32885, .adv_w = 265, .box_w = 15, .box_h = 12, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 32975, .adv_w = 265, .box_w = 16, .box_h = 10, .ofs_x = 1, .ofs_y = -1}, + {.bitmap_index = 33055, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33095, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33140, .adv_w = 199, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 33224, .adv_w = 214, .box_w = 14, .box_h = 13, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 33315, .adv_w = 122, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33355, .adv_w = 130, .box_w = 10, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33400, .adv_w = 211, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33466, .adv_w = 216, .box_w = 13, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33544, .adv_w = 122, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33603, .adv_w = 141, .box_w = 10, .box_h = 13, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33668, .adv_w = 186, .box_w = 10, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 33743, .adv_w = 194, .box_w = 12, .box_h = 15, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 33833, .adv_w = 78, .box_w = 5, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33863, .adv_w = 85, .box_w = 7, .box_h = 12, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 33905, .adv_w = 159, .box_w = 8, .box_h = 10, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 33945, .adv_w = 170, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 33990, .adv_w = 137, .box_w = 9, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34013, .adv_w = 148, .box_w = 11, .box_h = 5, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34041, .adv_w = 188, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 34096, .adv_w = 195, .box_w = 12, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34156, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34176, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34200, .adv_w = 134, .box_w = 7, .box_h = 7, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 34225, .adv_w = 137, .box_w = 8, .box_h = 6, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 34249, .adv_w = 135, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34290, .adv_w = 118, .box_w = 9, .box_h = 11, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34340, .adv_w = 124, .box_w = 8, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34380, .adv_w = 132, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 34430, .adv_w = 200, .box_w = 11, .box_h = 10, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 34485, .adv_w = 213, .box_w = 13, .box_h = 8, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 34537, .adv_w = 200, .box_w = 11, .box_h = 12, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34603, .adv_w = 213, .box_w = 13, .box_h = 10, .ofs_x = 1, .ofs_y = -5}, + {.bitmap_index = 34668, .adv_w = 71, .box_w = 5, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 34688, .adv_w = 77, .box_w = 6, .box_h = 8, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 34712, .adv_w = 146, .box_w = 10, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, + {.bitmap_index = 34782, .adv_w = 153, .box_w = 12, .box_h = 14, .ofs_x = -2, .ofs_y = 0}, + {.bitmap_index = 34866, .adv_w = 146, .box_w = 9, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 34938, .adv_w = 153, .box_w = 11, .box_h = 16, .ofs_x = -1, .ofs_y = 0}, + {.bitmap_index = 35026, .adv_w = 146, .box_w = 8, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35090, .adv_w = 153, .box_w = 10, .box_h = 16, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35170, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 35218, .adv_w = 153, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 35278, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -6476,9 +6492,9 @@ static const uint16_t unicode_list_7[] = { 0xe978, 0xe97d, 0xe982, 0xe985, 0xe986, 0xe987, 0xe98b, 0xe98c, 0xe98d, 0xe98e, 0xe9a1, 0xe9a2, 0xe9a8, 0xe9aa, 0xe9ab, 0xe9ae, 0xe9b1, 0xe9b2, 0xe9b3, 0xe9b5, 0xe9cd, 0xe9cf, 0xe9fe, 0xe9ff, - 0xea01, 0xea1a, 0xea21, 0xea24, 0xea2d, 0xea56, 0xea5e, 0xea95, - 0xeb25, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, 0xeb7e, 0xebc1, 0xebcd, - 0xec27, 0xec3e, 0xee94, 0xf0fc, 0xf1dc + 0xea01, 0xea03, 0xea1a, 0xea21, 0xea24, 0xea2d, 0xea56, 0xea5e, + 0xea95, 0xeb25, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, 0xeb7e, 0xebc1, + 0xebcd, 0xec27, 0xec3e, 0xee94, 0xf0fc, 0xf1dc }; static const uint16_t unicode_list_9[] = { @@ -6521,22 +6537,22 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 1734, .range_length = 61917, .glyph_id_start = 270, - .unicode_list = unicode_list_7, .glyph_id_ofs_list = NULL, .list_length = 77, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_7, .glyph_id_ofs_list = NULL, .list_length = 78, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY }, { - .range_start = 64338, .range_length = 82, .glyph_id_start = 347, + .range_start = 64338, .range_length = 82, .glyph_id_start = 348, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY }, { - .range_start = 64426, .range_length = 715, .glyph_id_start = 429, + .range_start = 64426, .range_length = 715, .glyph_id_start = 430, .unicode_list = unicode_list_9, .glyph_id_ofs_list = NULL, .list_length = 31, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY }, { - .range_start = 65142, .range_length = 135, .glyph_id_start = 460, + .range_start = 65142, .range_length = 135, .glyph_id_start = 461, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY }, { - .range_start = 65279, .range_length = 1, .glyph_id_start = 595, + .range_start = 65279, .range_length = 1, .glyph_id_start = 596, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY } }; diff --git a/src/font/lv_font_montserrat_10.c b/src/font/lv_font_montserrat_10.c index 33928bb11..b6a806d5a 100644 --- a/src/font/lv_font_montserrat_10.c +++ b/src/font/lv_font_montserrat_10.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 10 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 10 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_10.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 10 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_10.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -791,6 +791,14 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x20, 0x9f, 0xf9, 0xff, 0xfc, 0x7f, 0xff, 0x9a, 0xdd, 0xdd, 0xdd, 0xd4, + /* U+F0C9 "" */ + 0x67, 0x77, 0x77, 0x77, 0x4e, 0xff, 0xff, 0xff, + 0xfb, 0x0, 0x0, 0x0, 0x0, 0x6, 0x77, 0x77, + 0x77, 0x74, 0xef, 0xff, 0xff, 0xff, 0xb0, 0x0, + 0x0, 0x0, 0x0, 0x45, 0x55, 0x55, 0x55, 0x3f, + 0xff, 0xff, 0xff, 0xfb, 0x11, 0x11, 0x11, 0x11, + 0x0, + /* U+F0E0 "" */ 0x58, 0x88, 0x88, 0x88, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0xf6, 0xc5, @@ -1108,26 +1116,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 3376, .adv_w = 140, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 3421, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 3471, .adv_w = 140, .box_w = 9, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3516, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3556, .adv_w = 100, .box_w = 8, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 3600, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3650, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3700, .adv_w = 180, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3748, .adv_w = 160, .box_w = 12, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 3814, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 3858, .adv_w = 200, .box_w = 13, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 3923, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 3969, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4015, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4061, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4107, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4153, .adv_w = 200, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 4212, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4262, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4312, .adv_w = 160, .box_w = 11, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 4373, .adv_w = 200, .box_w = 13, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 4425, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 4469, .adv_w = 161, .box_w = 11, .box_h = 7, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 3516, .adv_w = 140, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3557, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3597, .adv_w = 100, .box_w = 8, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 3641, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3691, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3741, .adv_w = 180, .box_w = 12, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3789, .adv_w = 160, .box_w = 12, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 3855, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3899, .adv_w = 200, .box_w = 13, .box_h = 10, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 3964, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4010, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4056, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4102, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4148, .adv_w = 200, .box_w = 13, .box_h = 7, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4194, .adv_w = 200, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 4253, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4303, .adv_w = 140, .box_w = 9, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4353, .adv_w = 160, .box_w = 11, .box_h = 11, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 4414, .adv_w = 200, .box_w = 13, .box_h = 8, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 4466, .adv_w = 120, .box_w = 8, .box_h = 11, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 4510, .adv_w = 161, .box_w = 11, .box_h = 7, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1140,9 +1149,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1154,7 +1163,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1185,7 +1194,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1210,7 +1219,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_12.c b/src/font/lv_font_montserrat_12.c index aedca1f87..e3a1ee91c 100644 --- a/src/font/lv_font_montserrat_12.c +++ b/src/font/lv_font_montserrat_12.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 12 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1000,6 +1000,16 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x4f, 0xff, 0xfc, 0xaf, 0xff, 0xf4, 0xaf, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, + 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x89, 0x99, + 0x99, 0x99, 0x99, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0x12, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x9a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, 0xff, 0xff, @@ -1367,26 +1377,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 5020, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 5081, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 5153, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5214, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5268, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5327, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5399, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5471, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5534, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5625, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5684, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5774, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5842, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5910, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5978, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6046, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6114, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6202, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6267, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6339, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 6424, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6492, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6551, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 5214, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5275, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5329, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5388, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5460, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5532, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5595, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5686, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5745, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5835, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5903, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5971, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6039, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6107, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6175, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6263, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6328, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6400, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 6485, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6553, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6612, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1399,9 +1410,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1413,7 +1424,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1444,7 +1455,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1469,7 +1480,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_12_subpx.c b/src/font/lv_font_montserrat_12_subpx.c index 232699e5e..c9d1d4f9f 100644 --- a/src/font/lv_font_montserrat_12_subpx.c +++ b/src/font/lv_font_montserrat_12_subpx.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 12 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12_subpx.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 12 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_12_subpx.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1000,6 +1000,16 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0x4f, 0xff, 0xfc, 0xaf, 0xff, 0xf4, 0xaf, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, + 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x89, 0x99, + 0x99, 0x99, 0x99, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0x12, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x9a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, 0xff, 0xff, @@ -1367,26 +1377,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 5020, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 5081, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 5153, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5214, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5268, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5327, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5399, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5471, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5534, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 5625, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 5684, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 5774, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5842, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5910, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 5978, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6046, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6114, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6202, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6267, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6339, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 6424, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6492, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 6551, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 5214, .adv_w = 168, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5275, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5329, .adv_w = 120, .box_w = 9, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5388, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5460, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5532, .adv_w = 216, .box_w = 14, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5595, .adv_w = 192, .box_w = 14, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 5686, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 5745, .adv_w = 240, .box_w = 15, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 5835, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5903, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 5971, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6039, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6107, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6175, .adv_w = 240, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6263, .adv_w = 168, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6328, .adv_w = 168, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6400, .adv_w = 192, .box_w = 13, .box_h = 13, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 6485, .adv_w = 240, .box_w = 15, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 6553, .adv_w = 144, .box_w = 9, .box_h = 13, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 6612, .adv_w = 193, .box_w = 13, .box_h = 9, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1399,9 +1410,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1413,7 +1424,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1444,7 +1455,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1469,7 +1480,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_14.c b/src/font/lv_font_montserrat_14.c index 5deda6ee0..86dd97cdf 100644 --- a/src/font/lv_font_montserrat_14.c +++ b/src/font/lv_font_montserrat_14.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 14 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 14 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_14.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 14 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_14.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1211,6 +1211,18 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xed, 0xff, 0xff, 0xf6, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x10, + /* U+F0C9 "" */ + 0xcd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0x2f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf3, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xde, + 0xee, 0xee, 0xee, 0xee, 0xee, 0x20, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xd, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x37, 0x88, 0x88, 0x88, 0x88, 0x88, 0x73, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xef, 0xff, @@ -1641,26 +1653,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 6614, .adv_w = 196, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 6699, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 6797, .adv_w = 196, .box_w = 13, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 6882, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 6959, .adv_w = 140, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 7034, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7132, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7230, .adv_w = 252, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7318, .adv_w = 224, .box_w = 16, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 7438, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 7521, .adv_w = 280, .box_w = 18, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 7638, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7728, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7818, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7908, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 7998, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8088, .adv_w = 280, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 8196, .adv_w = 196, .box_w = 12, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8286, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8384, .adv_w = 224, .box_w = 15, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 8497, .adv_w = 280, .box_w = 18, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8596, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 8679, .adv_w = 225, .box_w = 15, .box_h = 10, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 6882, .adv_w = 196, .box_w = 13, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 6960, .adv_w = 224, .box_w = 14, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7037, .adv_w = 140, .box_w = 10, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 7112, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7210, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7308, .adv_w = 252, .box_w = 16, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7396, .adv_w = 224, .box_w = 16, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 7516, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 7599, .adv_w = 280, .box_w = 18, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 7716, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7806, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7896, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 7986, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8076, .adv_w = 280, .box_w = 18, .box_h = 10, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8166, .adv_w = 280, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 8274, .adv_w = 196, .box_w = 12, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8364, .adv_w = 196, .box_w = 13, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8462, .adv_w = 224, .box_w = 15, .box_h = 15, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 8575, .adv_w = 280, .box_w = 18, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8674, .adv_w = 168, .box_w = 11, .box_h = 15, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 8757, .adv_w = 225, .box_w = 15, .box_h = 10, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -1673,9 +1686,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1687,7 +1700,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1718,7 +1731,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -1743,7 +1756,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_16.c b/src/font/lv_font_montserrat_16.c index 860528da3..b1dde1745 100644 --- a/src/font/lv_font_montserrat_16.c +++ b/src/font/lv_font_montserrat_16.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_16.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_16.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1437,6 +1437,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -1907,26 +1922,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 8435, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 8540, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 8652, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 8750, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 8846, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 8942, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9054, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9166, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 9274, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 9436, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 9532, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 9682, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9782, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9882, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 9982, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 10082, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 10182, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 10329, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 10425, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 10537, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 10682, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 10802, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 10898, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 8750, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 8848, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 8944, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 9040, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9152, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9264, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 9372, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 9534, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 9630, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 9780, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 9880, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 9980, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10080, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10180, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 10280, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 10427, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 10523, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 10635, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 10780, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 10900, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 10996, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -1939,9 +1955,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -1953,7 +1969,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -1984,7 +2000,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2009,7 +2025,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_18.c b/src/font/lv_font_montserrat_18.c index 0f08f8875..1583b97fb 100644 --- a/src/font/lv_font_montserrat_18.c +++ b/src/font/lv_font_montserrat_18.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 18 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 18 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_18.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 18 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_18.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -1740,6 +1740,23 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x1, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + /* U+F0C9 "" */ + 0x79, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x95, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0x68, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x3, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -2305,26 +2322,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 10691, .adv_w = 252, .box_w = 16, .box_h = 17, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 10827, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 10979, .adv_w = 252, .box_w = 16, .box_h = 17, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 11115, .adv_w = 288, .box_w = 18, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 11241, .adv_w = 180, .box_w = 13, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 11365, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 11517, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 11669, .adv_w = 324, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 11816, .adv_w = 288, .box_w = 20, .box_h = 20, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 12016, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 12149, .adv_w = 360, .box_w = 23, .box_h = 18, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 12356, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12494, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12632, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12770, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 12908, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 13046, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 13219, .adv_w = 252, .box_w = 14, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 13352, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13504, .adv_w = 288, .box_w = 19, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 13685, .adv_w = 360, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 13846, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13979, .adv_w = 290, .box_w = 19, .box_h = 12, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 11115, .adv_w = 252, .box_w = 16, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 11235, .adv_w = 288, .box_w = 18, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 11361, .adv_w = 180, .box_w = 13, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 11485, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 11637, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 11789, .adv_w = 324, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 11936, .adv_w = 288, .box_w = 20, .box_h = 20, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 12136, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 12269, .adv_w = 360, .box_w = 23, .box_h = 18, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 12476, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12614, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12752, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 12890, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 13028, .adv_w = 360, .box_w = 23, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 13166, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 13339, .adv_w = 252, .box_w = 14, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 13472, .adv_w = 252, .box_w = 16, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 13624, .adv_w = 288, .box_w = 19, .box_h = 19, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 13805, .adv_w = 360, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 13966, .adv_w = 216, .box_w = 14, .box_h = 19, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14099, .adv_w = 290, .box_w = 19, .box_h = 12, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2337,9 +2355,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2351,7 +2369,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2382,7 +2400,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2407,7 +2425,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_20.c b/src/font/lv_font_montserrat_20.c index 61e884e52..ee916d99d 100644 --- a/src/font/lv_font_montserrat_20.c +++ b/src/font/lv_font_montserrat_20.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 20 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 20 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_20.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 20 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_20.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2018,6 +2018,28 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xa0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf8, 0xac, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xc4, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xd5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf8, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xac, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc4, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xef, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, + /* U+F0E0 "" */ 0x5e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe5, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -2657,26 +2679,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 12730, .adv_w = 280, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 12901, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 13090, .adv_w = 280, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 13261, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 13411, .adv_w = 200, .box_w = 14, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 13558, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13747, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 13936, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 14109, .adv_w = 320, .box_w = 22, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 14340, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 14498, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 14736, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 14899, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15062, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15225, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15388, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15551, .adv_w = 400, .box_w = 26, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 15772, .adv_w = 280, .box_w = 16, .box_h = 21, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 15940, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16129, .adv_w = 320, .box_w = 21, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 16350, .adv_w = 400, .box_w = 25, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 16538, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16696, .adv_w = 322, .box_w = 21, .box_h = 13, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 13261, .adv_w = 280, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 13414, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 13564, .adv_w = 200, .box_w = 14, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 13711, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 13900, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14089, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 14262, .adv_w = 320, .box_w = 22, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 14493, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 14651, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 14889, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15052, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15215, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15378, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15541, .adv_w = 400, .box_w = 25, .box_h = 13, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15704, .adv_w = 400, .box_w = 26, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 15925, .adv_w = 280, .box_w = 16, .box_h = 21, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 16093, .adv_w = 280, .box_w = 18, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16282, .adv_w = 320, .box_w = 21, .box_h = 21, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 16503, .adv_w = 400, .box_w = 25, .box_h = 15, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 16691, .adv_w = 240, .box_w = 15, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16849, .adv_w = 322, .box_w = 21, .box_h = 13, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2689,9 +2712,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2703,7 +2726,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2734,7 +2757,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2759,7 +2782,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_22.c b/src/font/lv_font_montserrat_22.c index a28eb8381..cee57dce3 100644 --- a/src/font/lv_font_montserrat_22.c +++ b/src/font/lv_font_montserrat_22.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 22 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 22 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_22.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 22 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_22.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2340,6 +2340,31 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + /* U+F0C9 "" */ + 0xce, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xd1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x13, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x20, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf3, 0x12, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xdf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x10, + /* U+F0E0 "" */ 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x20, 0x7f, 0xff, 0xff, 0xff, 0xff, @@ -3083,26 +3108,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 15442, .adv_w = 308, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 15642, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 15872, .adv_w = 308, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 16072, .adv_w = 352, .box_w = 22, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 16259, .adv_w = 220, .box_w = 15, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 16432, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16662, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 16892, .adv_w = 396, .box_w = 25, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 17105, .adv_w = 352, .box_w = 24, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 17381, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 17577, .adv_w = 440, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 17871, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18081, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18291, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18501, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18711, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 18921, .adv_w = 440, .box_w = 28, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 19173, .adv_w = 308, .box_w = 17, .box_h = 23, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 19369, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19599, .adv_w = 352, .box_w = 23, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19864, .adv_w = 440, .box_w = 28, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 20102, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 20298, .adv_w = 354, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 16072, .adv_w = 308, .box_w = 20, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 16252, .adv_w = 352, .box_w = 22, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 16439, .adv_w = 220, .box_w = 15, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 16612, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 16842, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 17072, .adv_w = 396, .box_w = 25, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 17285, .adv_w = 352, .box_w = 24, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 17561, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 17757, .adv_w = 440, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 18051, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18261, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18471, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18681, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 18891, .adv_w = 440, .box_w = 28, .box_h = 15, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 19101, .adv_w = 440, .box_w = 28, .box_h = 18, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 19353, .adv_w = 308, .box_w = 17, .box_h = 23, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 19549, .adv_w = 308, .box_w = 20, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19779, .adv_w = 352, .box_w = 23, .box_h = 23, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 20044, .adv_w = 440, .box_w = 28, .box_h = 17, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 20282, .adv_w = 264, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 20478, .adv_w = 354, .box_w = 23, .box_h = 14, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -3115,9 +3141,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -3129,7 +3155,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -3160,7 +3186,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -3185,7 +3211,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_24.c b/src/font/lv_font_montserrat_24.c index b6667d38e..44ecf1757 100644 --- a/src/font/lv_font_montserrat_24.c +++ b/src/font/lv_font_montserrat_24.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 24 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 24 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_24.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 24 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_24.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2668,6 +2668,35 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xb1, 0x8b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0x81, + /* U+F0C9 "" */ + 0x13, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0x13, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x10, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x57, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x5f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfc, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xee, 0xeb, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x31, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x31, + /* U+F0E0 "" */ 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd3, 0xdf, 0xff, 0xff, 0xff, @@ -3490,26 +3519,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 17894, .adv_w = 336, .box_w = 22, .box_h = 22, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 18136, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 18388, .adv_w = 336, .box_w = 21, .box_h = 22, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 18619, .adv_w = 384, .box_w = 24, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 18835, .adv_w = 240, .box_w = 17, .box_h = 24, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 19039, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19291, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 19543, .adv_w = 432, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 19786, .adv_w = 384, .box_w = 26, .box_h = 26, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 20124, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 20340, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 20685, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 20925, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21165, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21405, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21645, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 21885, .adv_w = 480, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 22195, .adv_w = 336, .box_w = 19, .box_h = 24, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 22423, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 22675, .adv_w = 384, .box_w = 25, .box_h = 25, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 22988, .adv_w = 480, .box_w = 30, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23258, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 23474, .adv_w = 386, .box_w = 25, .box_h = 16, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 18619, .adv_w = 336, .box_w = 21, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 18829, .adv_w = 384, .box_w = 24, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19045, .adv_w = 240, .box_w = 17, .box_h = 24, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 19249, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19501, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 19753, .adv_w = 432, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 19996, .adv_w = 384, .box_w = 26, .box_h = 26, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 20334, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 20550, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 20895, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21135, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21375, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21615, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 21855, .adv_w = 480, .box_w = 30, .box_h = 16, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 22095, .adv_w = 480, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 22405, .adv_w = 336, .box_w = 19, .box_h = 24, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 22633, .adv_w = 336, .box_w = 21, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 22885, .adv_w = 384, .box_w = 25, .box_h = 25, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23198, .adv_w = 480, .box_w = 30, .box_h = 18, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 23468, .adv_w = 288, .box_w = 18, .box_h = 24, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 23684, .adv_w = 386, .box_w = 25, .box_h = 16, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -3522,9 +3552,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -3536,7 +3566,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -3567,7 +3597,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -3592,7 +3622,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_26.c b/src/font/lv_font_montserrat_26.c index b61124274..b08e87769 100644 --- a/src/font/lv_font_montserrat_26.c +++ b/src/font/lv_font_montserrat_26.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 26 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 26 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_26.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 26 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_26.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3072,6 +3072,39 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x41, 0x9d, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, 0x60, + /* U+F0C9 "" */ + 0x8b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0x5f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x69, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x4f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x69, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcd, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, + /* U+F0E0 "" */ 0x1, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x10, 0x4f, 0xff, 0xff, @@ -4021,26 +4054,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 20933, .adv_w = 364, .box_w = 24, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 21221, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 21532, .adv_w = 364, .box_w = 23, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 21808, .adv_w = 416, .box_w = 26, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 22068, .adv_w = 260, .box_w = 18, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 22311, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 22622, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 22933, .adv_w = 468, .box_w = 30, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 23233, .adv_w = 416, .box_w = 28, .box_h = 28, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 23625, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 23895, .adv_w = 520, .box_w = 33, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 24291, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 24572, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 24853, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25134, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25415, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 25696, .adv_w = 520, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 26043, .adv_w = 364, .box_w = 21, .box_h = 27, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 26327, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26638, .adv_w = 416, .box_w = 27, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 27003, .adv_w = 520, .box_w = 33, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 27333, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27603, .adv_w = 418, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 21808, .adv_w = 364, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 22050, .adv_w = 416, .box_w = 26, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 22310, .adv_w = 260, .box_w = 18, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 22553, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 22864, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 23175, .adv_w = 468, .box_w = 30, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 23475, .adv_w = 416, .box_w = 28, .box_h = 28, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 23867, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 24137, .adv_w = 520, .box_w = 33, .box_h = 24, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 24533, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 24814, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25095, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25376, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25657, .adv_w = 520, .box_w = 33, .box_h = 17, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 25938, .adv_w = 520, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 26285, .adv_w = 364, .box_w = 21, .box_h = 27, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 26569, .adv_w = 364, .box_w = 23, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26880, .adv_w = 416, .box_w = 27, .box_h = 27, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 27245, .adv_w = 520, .box_w = 33, .box_h = 20, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27575, .adv_w = 312, .box_w = 20, .box_h = 27, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27845, .adv_w = 418, .box_w = 27, .box_h = 18, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -4053,9 +4087,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -4067,7 +4101,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -4098,7 +4132,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -4123,7 +4157,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_28.c b/src/font/lv_font_montserrat_28.c index d981e0b8d..a5fed0853 100644 --- a/src/font/lv_font_montserrat_28.c +++ b/src/font/lv_font_montserrat_28.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 28 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3503,6 +3503,44 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0, + /* U+F0C9 "" */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf8, 0xae, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xee, 0xed, 0x40, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x7, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xa2, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xef, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x61, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xae, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xed, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8d, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb1, 0xbf, 0xff, @@ -4565,26 +4603,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 24249, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 24562, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 24925, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 25238, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 25532, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 25808, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26171, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 26534, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 26870, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 27305, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 27610, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 28065, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 28398, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 28731, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29064, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29397, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 29730, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 30144, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 30463, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 30826, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 31247, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 31615, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 31920, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 25238, .adv_w = 392, .box_w = 25, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 25526, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 25820, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 26096, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26459, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 26822, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 27158, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 27593, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 27898, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 28353, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 28686, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29019, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29352, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 29685, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 30018, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 30432, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 30751, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 31114, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 31535, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 31903, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 32208, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -4597,9 +4636,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -4611,7 +4650,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -4642,7 +4681,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -4667,7 +4706,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_28_compressed.c b/src/font/lv_font_montserrat_28_compressed.c index be54f644c..82c43679a 100644 --- a/src/font/lv_font_montserrat_28_compressed.c +++ b/src/font/lv_font_montserrat_28_compressed.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 28 px * Bpp: 4 - * Opts: --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28_compressed.c --force-fast-kern-format + * Opts: --bpp 4 --size 28 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_28_compressed.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -2155,6 +2155,18 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xf3, 0xa8, 0x7, 0xff, 0x28, 0x4e, 0xd4, 0x40, 0x3f, 0xf8, 0xe7, 0xa0, + /* U+F0C9 "" */ + 0x0, 0xff, 0xe6, 0xef, 0xff, 0xff, 0x2d, 0x48, + 0x3, 0xff, 0x97, 0xa0, 0x1f, 0xfc, 0xd5, 0x11, + 0xff, 0xe5, 0x16, 0x57, 0x77, 0xff, 0x2b, 0x50, + 0x3, 0xff, 0xfe, 0xf7, 0x7f, 0xfc, 0xaa, 0x28, + 0x44, 0xff, 0xe5, 0x2a, 0x80, 0x3f, 0xf9, 0x9e, + 0x20, 0x1f, 0xfc, 0xbe, 0xfb, 0xbf, 0xfe, 0x56, + 0x30, 0xa2, 0x7f, 0xf2, 0x8c, 0x3, 0xff, 0xfe, + 0x15, 0xdd, 0xff, 0xca, 0xd4, 0x51, 0x1f, 0xfe, + 0x51, 0x60, 0x7, 0xff, 0x34, 0x80, 0x3f, 0xf9, + 0x7b, 0xaf, 0xff, 0xfe, 0x5a, 0x80, + /* U+F0E0 "" */ 0x1b, 0xff, 0xff, 0xe6, 0x58, 0xd2, 0x0, 0x7f, 0xf3, 0x12, 0x90, 0x3, 0xff, 0x9c, 0x80, 0x1f, @@ -2721,26 +2733,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 13945, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 14184, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 14291, .adv_w = 392, .box_w = 25, .box_h = 25, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 14423, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 14556, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 14713, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 14840, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 15006, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 15203, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 15385, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 15459, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 15716, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15817, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 15919, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16020, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16120, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 16211, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 16422, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 16665, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 16785, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 17012, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 17213, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 17309, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 14423, .adv_w = 392, .box_w = 25, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 14501, .adv_w = 448, .box_w = 28, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 14634, .adv_w = 280, .box_w = 19, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 14791, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 14918, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 15084, .adv_w = 504, .box_w = 32, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 15281, .adv_w = 448, .box_w = 30, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 15463, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 15537, .adv_w = 560, .box_w = 35, .box_h = 26, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 15794, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15895, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 15997, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16098, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16198, .adv_w = 560, .box_w = 35, .box_h = 19, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 16289, .adv_w = 560, .box_w = 36, .box_h = 23, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 16500, .adv_w = 392, .box_w = 22, .box_h = 29, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 16743, .adv_w = 392, .box_w = 25, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 16863, .adv_w = 448, .box_w = 29, .box_h = 29, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 17090, .adv_w = 560, .box_w = 35, .box_h = 21, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 17291, .adv_w = 336, .box_w = 21, .box_h = 29, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 17387, .adv_w = 451, .box_w = 29, .box_h = 19, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -2753,9 +2766,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -2767,7 +2780,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -2798,7 +2811,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -2823,7 +2836,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_30.c b/src/font/lv_font_montserrat_30.c index fd605ad6b..22f736a64 100644 --- a/src/font/lv_font_montserrat_30.c +++ b/src/font/lv_font_montserrat_30.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 30 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 30 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_30.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 30 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_30.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -3949,6 +3949,49 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x0, + /* U+F0C9 "" */ + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x24, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4c, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xe1, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf4, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x21, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x20, + /* U+F0E0 "" */ 0x0, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x0, 0x2d, @@ -5142,26 +5185,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 27677, .adv_w = 420, .box_w = 27, .box_h = 27, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 28042, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 28461, .adv_w = 420, .box_w = 27, .box_h = 27, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 28826, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 29171, .adv_w = 300, .box_w = 20, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 29481, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 29900, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 30319, .adv_w = 540, .box_w = 34, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 30710, .adv_w = 480, .box_w = 32, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 31206, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 31563, .adv_w = 600, .box_w = 38, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 32095, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 32475, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 32855, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33235, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33615, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 33995, .adv_w = 600, .box_w = 38, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 34451, .adv_w = 420, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = -4}, - {.bitmap_index = 34823, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35242, .adv_w = 480, .box_w = 31, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 35723, .adv_w = 600, .box_w = 38, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 36160, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 36517, .adv_w = 483, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 28826, .adv_w = 420, .box_w = 27, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 29150, .adv_w = 480, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 29495, .adv_w = 300, .box_w = 20, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 29805, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 30224, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 30643, .adv_w = 540, .box_w = 34, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 31034, .adv_w = 480, .box_w = 32, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 31530, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 31887, .adv_w = 600, .box_w = 38, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 32419, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 32799, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33179, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33559, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 33939, .adv_w = 600, .box_w = 38, .box_h = 20, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 34319, .adv_w = 600, .box_w = 38, .box_h = 24, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 34775, .adv_w = 420, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 35147, .adv_w = 420, .box_w = 27, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35566, .adv_w = 480, .box_w = 31, .box_h = 31, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 36047, .adv_w = 600, .box_w = 38, .box_h = 23, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 36484, .adv_w = 360, .box_w = 23, .box_h = 31, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 36841, .adv_w = 483, .box_w = 31, .box_h = 20, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -5174,9 +5218,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -5188,7 +5232,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -5219,7 +5263,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -5244,7 +5288,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_32.c b/src/font/lv_font_montserrat_32.c index 2042edb63..3c2fbb59c 100644 --- a/src/font/lv_font_montserrat_32.c +++ b/src/font/lv_font_montserrat_32.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 32 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 32 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_32.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 32 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_32.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -4348,6 +4348,54 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xf8, 0x8, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x80, + /* U+F0C9 "" */ + 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x47, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x74, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x47, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x74, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x8, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x80, @@ -5626,26 +5674,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 30759, .adv_w = 448, .box_w = 29, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 31165, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, {.bitmap_index = 31613, .adv_w = 448, .box_w = 28, .box_h = 28, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 32005, .adv_w = 512, .box_w = 32, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 32389, .adv_w = 320, .box_w = 22, .box_h = 32, .ofs_x = -1, .ofs_y = -4}, - {.bitmap_index = 32741, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33189, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 33637, .adv_w = 576, .box_w = 36, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 34069, .adv_w = 512, .box_w = 34, .box_h = 34, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 34647, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 35031, .adv_w = 640, .box_w = 40, .box_h = 29, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 35611, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36011, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36411, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 36811, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 37211, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 37611, .adv_w = 640, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 38144, .adv_w = 448, .box_w = 24, .box_h = 32, .ofs_x = 2, .ofs_y = -4}, - {.bitmap_index = 38528, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 38976, .adv_w = 512, .box_w = 33, .box_h = 33, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 39521, .adv_w = 640, .box_w = 40, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 40001, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, - {.bitmap_index = 40385, .adv_w = 515, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 32005, .adv_w = 448, .box_w = 28, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 32369, .adv_w = 512, .box_w = 32, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 32753, .adv_w = 320, .box_w = 22, .box_h = 32, .ofs_x = -1, .ofs_y = -4}, + {.bitmap_index = 33105, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 33553, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 34001, .adv_w = 576, .box_w = 36, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 34433, .adv_w = 512, .box_w = 34, .box_h = 34, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 35011, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 35395, .adv_w = 640, .box_w = 40, .box_h = 29, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 35975, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 36375, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 36775, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37175, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37575, .adv_w = 640, .box_w = 40, .box_h = 20, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 37975, .adv_w = 640, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 38508, .adv_w = 448, .box_w = 24, .box_h = 32, .ofs_x = 2, .ofs_y = -4}, + {.bitmap_index = 38892, .adv_w = 448, .box_w = 28, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 39340, .adv_w = 512, .box_w = 33, .box_h = 33, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 39885, .adv_w = 640, .box_w = 40, .box_h = 24, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 40365, .adv_w = 384, .box_w = 24, .box_h = 32, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 40749, .adv_w = 515, .box_w = 33, .box_h = 21, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -5658,9 +5707,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -5672,7 +5721,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -5703,7 +5752,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -5728,7 +5777,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_34.c b/src/font/lv_font_montserrat_34.c index 1ece618be..a583b199c 100644 --- a/src/font/lv_font_montserrat_34.c +++ b/src/font/lv_font_montserrat_34.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 34 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 34 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_34.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 34 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_34.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -4960,6 +4960,59 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, + /* U+F0C9 "" */ + 0x8c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc5, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfb, 0xcf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0x7b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xb5, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7b, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xb5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xcf, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0E0 "" */ 0x0, 0x24, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x42, @@ -6420,26 +6473,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 35465, .adv_w = 476, .box_w = 31, .box_h = 31, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 35946, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 36471, .adv_w = 476, .box_w = 30, .box_h = 31, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 36936, .adv_w = 544, .box_w = 34, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 37378, .adv_w = 340, .box_w = 23, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 37781, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 38306, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 38831, .adv_w = 612, .box_w = 39, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 39338, .adv_w = 544, .box_w = 36, .box_h = 36, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 39986, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 40441, .adv_w = 680, .box_w = 43, .box_h = 32, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 41129, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 41602, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 42075, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 42548, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 43021, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 43494, .adv_w = 680, .box_w = 43, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 44075, .adv_w = 476, .box_w = 26, .box_h = 35, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 44530, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 45055, .adv_w = 544, .box_w = 35, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 45668, .adv_w = 680, .box_w = 43, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 46227, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 46682, .adv_w = 547, .box_w = 35, .box_h = 22, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 36936, .adv_w = 476, .box_w = 30, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 37341, .adv_w = 544, .box_w = 34, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 37783, .adv_w = 340, .box_w = 23, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 38186, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 38711, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 39236, .adv_w = 612, .box_w = 39, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 39743, .adv_w = 544, .box_w = 36, .box_h = 36, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 40391, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 40846, .adv_w = 680, .box_w = 43, .box_h = 32, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 41534, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42007, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42480, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 42953, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 43426, .adv_w = 680, .box_w = 43, .box_h = 22, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 43899, .adv_w = 680, .box_w = 43, .box_h = 27, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 44480, .adv_w = 476, .box_w = 26, .box_h = 35, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 44935, .adv_w = 476, .box_w = 30, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 45460, .adv_w = 544, .box_w = 35, .box_h = 35, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 46073, .adv_w = 680, .box_w = 43, .box_h = 26, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 46632, .adv_w = 408, .box_w = 26, .box_h = 35, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 47087, .adv_w = 547, .box_w = 35, .box_h = 22, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -6452,9 +6506,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -6466,7 +6520,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -6497,7 +6551,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -6522,7 +6576,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_36.c b/src/font/lv_font_montserrat_36.c index b60e0c1cb..750ddd5f2 100644 --- a/src/font/lv_font_montserrat_36.c +++ b/src/font/lv_font_montserrat_36.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 36 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 36 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_36.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 36 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_36.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -5461,6 +5461,66 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + /* U+F0C9 "" */ + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0x5, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -7057,26 +7117,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 39236, .adv_w = 504, .box_w = 32, .box_h = 33, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 39764, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 40356, .adv_w = 504, .box_w = 32, .box_h = 33, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 40884, .adv_w = 576, .box_w = 36, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 41370, .adv_w = 360, .box_w = 24, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 41814, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 42406, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 42998, .adv_w = 648, .box_w = 41, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 43552, .adv_w = 576, .box_w = 38, .box_h = 38, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 44274, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 44774, .adv_w = 720, .box_w = 45, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 45539, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 46057, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 46575, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 47093, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 47611, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 48129, .adv_w = 720, .box_w = 46, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 48796, .adv_w = 504, .box_w = 28, .box_h = 37, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 49314, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 49906, .adv_w = 576, .box_w = 37, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 50591, .adv_w = 720, .box_w = 45, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 51199, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 51699, .adv_w = 579, .box_w = 37, .box_h = 23, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 40884, .adv_w = 504, .box_w = 32, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 41348, .adv_w = 576, .box_w = 36, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 41834, .adv_w = 360, .box_w = 24, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 42278, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 42870, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 43462, .adv_w = 648, .box_w = 41, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 44016, .adv_w = 576, .box_w = 38, .box_h = 38, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 44738, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 45238, .adv_w = 720, .box_w = 45, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 46003, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 46521, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 47039, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 47557, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 48075, .adv_w = 720, .box_w = 45, .box_h = 23, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 48593, .adv_w = 720, .box_w = 46, .box_h = 29, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 49260, .adv_w = 504, .box_w = 28, .box_h = 37, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 49778, .adv_w = 504, .box_w = 32, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 50370, .adv_w = 576, .box_w = 37, .box_h = 37, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 51055, .adv_w = 720, .box_w = 45, .box_h = 27, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 51663, .adv_w = 432, .box_w = 27, .box_h = 37, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 52163, .adv_w = 579, .box_w = 37, .box_h = 23, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -7089,9 +7150,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -7103,7 +7164,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -7134,7 +7195,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -7159,7 +7220,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_38.c b/src/font/lv_font_montserrat_38.c index bb9f2db79..1ecfe953b 100644 --- a/src/font/lv_font_montserrat_38.c +++ b/src/font/lv_font_montserrat_38.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 38 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 38 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_38.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 38 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_38.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -6024,6 +6024,72 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10, 0x0, + /* U+F0C9 "" */ + 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xd1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xef, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf2, 0x26, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x40, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xaf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xd1, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf2, 0x26, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf4, 0xef, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf2, 0x14, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x20, + /* U+F0E0 "" */ 0x0, 0x14, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -7796,26 +7862,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 43535, .adv_w = 532, .box_w = 34, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 44113, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 44776, .adv_w = 532, .box_w = 34, .box_h = 34, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 45354, .adv_w = 608, .box_w = 38, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 45905, .adv_w = 380, .box_w = 26, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 46412, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 47075, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 47738, .adv_w = 684, .box_w = 43, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 48362, .adv_w = 608, .box_w = 40, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 49142, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 49708, .adv_w = 760, .box_w = 48, .box_h = 35, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 50548, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 51148, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 51748, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 52348, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 52948, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 53548, .adv_w = 760, .box_w = 48, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 54268, .adv_w = 532, .box_w = 30, .box_h = 39, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 54853, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 55516, .adv_w = 608, .box_w = 39, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 56277, .adv_w = 760, .box_w = 48, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 56973, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 57539, .adv_w = 612, .box_w = 39, .box_h = 25, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 45354, .adv_w = 532, .box_w = 34, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 45864, .adv_w = 608, .box_w = 38, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 46415, .adv_w = 380, .box_w = 26, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 46922, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 47585, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 48248, .adv_w = 684, .box_w = 43, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 48872, .adv_w = 608, .box_w = 40, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 49652, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 50218, .adv_w = 760, .box_w = 48, .box_h = 35, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 51058, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 51658, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 52258, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 52858, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 53458, .adv_w = 760, .box_w = 48, .box_h = 25, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 54058, .adv_w = 760, .box_w = 48, .box_h = 30, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 54778, .adv_w = 532, .box_w = 30, .box_h = 39, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 55363, .adv_w = 532, .box_w = 34, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 56026, .adv_w = 608, .box_w = 39, .box_h = 39, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 56787, .adv_w = 760, .box_w = 48, .box_h = 29, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 57483, .adv_w = 456, .box_w = 29, .box_h = 39, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 58049, .adv_w = 612, .box_w = 39, .box_h = 25, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -7828,9 +7895,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -7842,7 +7909,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -7873,7 +7940,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -7898,7 +7965,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_40.c b/src/font/lv_font_montserrat_40.c index b4a131709..0a6d36cad 100644 --- a/src/font/lv_font_montserrat_40.c +++ b/src/font/lv_font_montserrat_40.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 40 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 40 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_40.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 40 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_40.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -6728,6 +6728,78 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xb7, 0x10, + /* U+F0C9 "" */ + 0x48, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfc, 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x5, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xa5, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x90, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x83, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0x3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -8638,26 +8710,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 49090, .adv_w = 560, .box_w = 36, .box_h = 36, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 49738, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, {.bitmap_index = 50438, .adv_w = 560, .box_w = 35, .box_h = 36, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 51068, .adv_w = 640, .box_w = 40, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 51668, .adv_w = 400, .box_w = 27, .box_h = 40, .ofs_x = -1, .ofs_y = -5}, - {.bitmap_index = 52208, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 52908, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 53608, .adv_w = 720, .box_w = 45, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 54283, .adv_w = 640, .box_w = 42, .box_h = 42, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 55165, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 55765, .adv_w = 800, .box_w = 50, .box_h = 37, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 56690, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 57340, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 57990, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 58640, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 59290, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 59940, .adv_w = 800, .box_w = 51, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 60756, .adv_w = 560, .box_w = 31, .box_h = 40, .ofs_x = 2, .ofs_y = -5}, - {.bitmap_index = 61376, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 62076, .adv_w = 640, .box_w = 41, .box_h = 41, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 62917, .adv_w = 800, .box_w = 50, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 63667, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, - {.bitmap_index = 64267, .adv_w = 644, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 51068, .adv_w = 560, .box_w = 35, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 51628, .adv_w = 640, .box_w = 40, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 52228, .adv_w = 400, .box_w = 27, .box_h = 40, .ofs_x = -1, .ofs_y = -5}, + {.bitmap_index = 52768, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 53468, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 54168, .adv_w = 720, .box_w = 45, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 54843, .adv_w = 640, .box_w = 42, .box_h = 42, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 55725, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 56325, .adv_w = 800, .box_w = 50, .box_h = 37, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 57250, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 57900, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 58550, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 59200, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 59850, .adv_w = 800, .box_w = 50, .box_h = 26, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 60500, .adv_w = 800, .box_w = 51, .box_h = 32, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 61316, .adv_w = 560, .box_w = 31, .box_h = 40, .ofs_x = 2, .ofs_y = -5}, + {.bitmap_index = 61936, .adv_w = 560, .box_w = 35, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 62636, .adv_w = 640, .box_w = 41, .box_h = 41, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 63477, .adv_w = 800, .box_w = 50, .box_h = 30, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 64227, .adv_w = 480, .box_w = 30, .box_h = 40, .ofs_x = 0, .ofs_y = -5}, + {.bitmap_index = 64827, .adv_w = 644, .box_w = 41, .box_h = 26, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -8670,9 +8743,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -8684,7 +8757,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -8715,7 +8788,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -8740,7 +8813,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_42.c b/src/font/lv_font_montserrat_42.c index dbbf43f34..dd92e2864 100644 --- a/src/font/lv_font_montserrat_42.c +++ b/src/font/lv_font_montserrat_42.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 42 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 42 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_42.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 42 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_42.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -7363,6 +7363,85 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xb5, 0x0, + /* U+F0C9 "" */ + 0x8d, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x8, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xd4, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfb, 0xbf, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x70, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0x4f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0x1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x0, + /* U+F0E0 "" */ 0x0, 0x3, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -9473,26 +9552,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 53937, .adv_w = 588, .box_w = 38, .box_h = 38, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 54659, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 55455, .adv_w = 588, .box_w = 37, .box_h = 38, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 56158, .adv_w = 672, .box_w = 42, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 56830, .adv_w = 420, .box_w = 28, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 57432, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 58228, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 59024, .adv_w = 756, .box_w = 48, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 59792, .adv_w = 672, .box_w = 44, .box_h = 44, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 60760, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 61448, .adv_w = 840, .box_w = 53, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 62482, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 63198, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 63914, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 64630, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 65346, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 66062, .adv_w = 840, .box_w = 53, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 66937, .adv_w = 588, .box_w = 33, .box_h = 43, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 67647, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 68443, .adv_w = 672, .box_w = 43, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 69368, .adv_w = 840, .box_w = 53, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 70216, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 70904, .adv_w = 676, .box_w = 43, .box_h = 28, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 56158, .adv_w = 588, .box_w = 37, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 56769, .adv_w = 672, .box_w = 42, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 57441, .adv_w = 420, .box_w = 28, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 58043, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 58839, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 59635, .adv_w = 756, .box_w = 48, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 60403, .adv_w = 672, .box_w = 44, .box_h = 44, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 61371, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 62059, .adv_w = 840, .box_w = 53, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 63093, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 63809, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 64525, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 65241, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 65957, .adv_w = 840, .box_w = 53, .box_h = 27, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 66673, .adv_w = 840, .box_w = 53, .box_h = 33, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 67548, .adv_w = 588, .box_w = 33, .box_h = 43, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 68258, .adv_w = 588, .box_w = 37, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 69054, .adv_w = 672, .box_w = 43, .box_h = 43, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 69979, .adv_w = 840, .box_w = 53, .box_h = 32, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 70827, .adv_w = 504, .box_w = 32, .box_h = 43, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 71515, .adv_w = 676, .box_w = 43, .box_h = 28, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -9505,9 +9585,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -9519,7 +9599,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -9550,7 +9630,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -9575,7 +9655,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_44.c b/src/font/lv_font_montserrat_44.c index 687212bd1..86d0f0cd2 100644 --- a/src/font/lv_font_montserrat_44.c +++ b/src/font/lv_font_montserrat_44.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 44 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 44 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_44.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 44 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_44.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -7997,6 +7997,94 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x30, 0x0, + /* U+F0C9 "" */ + 0x3, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x32, 0xc, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf7, 0x8f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, + 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x15, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x64, 0xd, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x6c, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, + 0xdb, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfd, 0x2f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7c, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x3, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, + 0x33, 0x32, 0x0, + /* U+F0E0 "" */ 0x1, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -10290,26 +10378,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 58697, .adv_w = 616, .box_w = 39, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 59458, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 60336, .adv_w = 616, .box_w = 39, .box_h = 39, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 61097, .adv_w = 704, .box_w = 44, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 61823, .adv_w = 440, .box_w = 29, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 62476, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 63354, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 64232, .adv_w = 792, .box_w = 50, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 65057, .adv_w = 704, .box_w = 46, .box_h = 46, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 66115, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 66858, .adv_w = 880, .box_w = 55, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 67986, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 68784, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 69582, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 70380, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 71178, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 71976, .adv_w = 880, .box_w = 56, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 72956, .adv_w = 616, .box_w = 34, .box_h = 45, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 73721, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 74599, .adv_w = 704, .box_w = 45, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 75612, .adv_w = 880, .box_w = 55, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 76520, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 77263, .adv_w = 708, .box_w = 45, .box_h = 29, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 61097, .adv_w = 616, .box_w = 39, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 61780, .adv_w = 704, .box_w = 44, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 62506, .adv_w = 440, .box_w = 29, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 63159, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 64037, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 64915, .adv_w = 792, .box_w = 50, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 65740, .adv_w = 704, .box_w = 46, .box_h = 46, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 66798, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 67541, .adv_w = 880, .box_w = 55, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 68669, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 69467, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 70265, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 71063, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 71861, .adv_w = 880, .box_w = 55, .box_h = 29, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 72659, .adv_w = 880, .box_w = 56, .box_h = 35, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 73639, .adv_w = 616, .box_w = 34, .box_h = 45, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 74404, .adv_w = 616, .box_w = 39, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 75282, .adv_w = 704, .box_w = 45, .box_h = 45, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 76295, .adv_w = 880, .box_w = 55, .box_h = 33, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 77203, .adv_w = 528, .box_w = 33, .box_h = 45, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 77946, .adv_w = 708, .box_w = 45, .box_h = 29, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -10322,9 +10411,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -10336,7 +10425,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -10367,7 +10456,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -10392,7 +10481,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_46.c b/src/font/lv_font_montserrat_46.c index f3f2ccd88..9d3f9a25d 100644 --- a/src/font/lv_font_montserrat_46.c +++ b/src/font/lv_font_montserrat_46.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 46 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 46 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_46.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 46 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_46.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -8744,6 +8744,101 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x30, 0x0, + /* U+F0C9 "" */ + 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfb, 0xf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4e, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xf2, 0x27, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, + 0x77, 0x77, 0x74, 0xe, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xf3, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x10, 0xa, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd0, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x4f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x20, + /* U+F0E0 "" */ 0x0, 0x2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, @@ -11235,26 +11330,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 64467, .adv_w = 644, .box_w = 41, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 65308, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 66272, .adv_w = 644, .box_w = 41, .box_h = 41, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 67113, .adv_w = 736, .box_w = 46, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 67918, .adv_w = 460, .box_w = 31, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 68647, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 69611, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 70575, .adv_w = 828, .box_w = 52, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 71485, .adv_w = 736, .box_w = 48, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 72613, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 73436, .adv_w = 920, .box_w = 58, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 74654, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 75524, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 76394, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 77264, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 78134, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, - {.bitmap_index = 79004, .adv_w = 920, .box_w = 58, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 80048, .adv_w = 644, .box_w = 36, .box_h = 47, .ofs_x = 2, .ofs_y = -6}, - {.bitmap_index = 80894, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 81858, .adv_w = 736, .box_w = 47, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 82963, .adv_w = 920, .box_w = 58, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 83978, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 84801, .adv_w = 740, .box_w = 47, .box_h = 30, .ofs_x = 0, .ofs_y = 2} + {.bitmap_index = 67113, .adv_w = 644, .box_w = 41, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 67851, .adv_w = 736, .box_w = 46, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 68656, .adv_w = 460, .box_w = 31, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 69385, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 70349, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 71313, .adv_w = 828, .box_w = 52, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 72223, .adv_w = 736, .box_w = 48, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 73351, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 74174, .adv_w = 920, .box_w = 58, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 75392, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 76262, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 77132, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 78002, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 78872, .adv_w = 920, .box_w = 58, .box_h = 30, .ofs_x = 0, .ofs_y = 2}, + {.bitmap_index = 79742, .adv_w = 920, .box_w = 58, .box_h = 36, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 80786, .adv_w = 644, .box_w = 36, .box_h = 47, .ofs_x = 2, .ofs_y = -6}, + {.bitmap_index = 81632, .adv_w = 644, .box_w = 41, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 82596, .adv_w = 736, .box_w = 47, .box_h = 47, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 83701, .adv_w = 920, .box_w = 58, .box_h = 35, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 84716, .adv_w = 552, .box_w = 35, .box_h = 47, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 85539, .adv_w = 740, .box_w = 47, .box_h = 30, .ofs_x = 0, .ofs_y = 2} }; /*--------------------- @@ -11267,9 +11363,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -11281,7 +11377,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -11312,7 +11408,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -11337,7 +11433,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_48.c b/src/font/lv_font_montserrat_48.c index a05ab34b0..c627fdde3 100644 --- a/src/font/lv_font_montserrat_48.c +++ b/src/font/lv_font_montserrat_48.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 48 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 48 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_48.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 48 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_48.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -9304,6 +9304,108 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x0, + /* U+F0C9 "" */ + 0x39, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x93, 0xef, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfa, 0x2, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x20, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x39, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x93, + 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x2, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x93, 0xef, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfa, 0x2, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x20, + /* U+F0E0 "" */ 0x0, 0x8d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -11929,26 +12031,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 68831, .adv_w = 672, .box_w = 43, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, {.bitmap_index = 69734, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, {.bitmap_index = 70742, .adv_w = 672, .box_w = 42, .box_h = 42, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 71624, .adv_w = 768, .box_w = 48, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 72488, .adv_w = 480, .box_w = 32, .box_h = 48, .ofs_x = -1, .ofs_y = -6}, - {.bitmap_index = 73256, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 74264, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 75272, .adv_w = 864, .box_w = 54, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 76244, .adv_w = 768, .box_w = 50, .box_h = 50, .ofs_x = -1, .ofs_y = -7}, - {.bitmap_index = 77494, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 78358, .adv_w = 960, .box_w = 60, .box_h = 44, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 79678, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 80578, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 81478, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 82378, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 83278, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, - {.bitmap_index = 84178, .adv_w = 960, .box_w = 61, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 85337, .adv_w = 672, .box_w = 36, .box_h = 48, .ofs_x = 3, .ofs_y = -6}, - {.bitmap_index = 86201, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 87209, .adv_w = 768, .box_w = 49, .box_h = 49, .ofs_x = -1, .ofs_y = -7}, - {.bitmap_index = 88410, .adv_w = 960, .box_w = 60, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 89490, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, - {.bitmap_index = 90354, .adv_w = 773, .box_w = 49, .box_h = 31, .ofs_x = 0, .ofs_y = 3} + {.bitmap_index = 71624, .adv_w = 672, .box_w = 42, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 72422, .adv_w = 768, .box_w = 48, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 73286, .adv_w = 480, .box_w = 32, .box_h = 48, .ofs_x = -1, .ofs_y = -6}, + {.bitmap_index = 74054, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 75062, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 76070, .adv_w = 864, .box_w = 54, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 77042, .adv_w = 768, .box_w = 50, .box_h = 50, .ofs_x = -1, .ofs_y = -7}, + {.bitmap_index = 78292, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 79156, .adv_w = 960, .box_w = 60, .box_h = 44, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 80476, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 81376, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 82276, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 83176, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 84076, .adv_w = 960, .box_w = 60, .box_h = 30, .ofs_x = 0, .ofs_y = 3}, + {.bitmap_index = 84976, .adv_w = 960, .box_w = 61, .box_h = 38, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 86135, .adv_w = 672, .box_w = 36, .box_h = 48, .ofs_x = 3, .ofs_y = -6}, + {.bitmap_index = 86999, .adv_w = 672, .box_w = 42, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 88007, .adv_w = 768, .box_w = 49, .box_h = 49, .ofs_x = -1, .ofs_y = -7}, + {.bitmap_index = 89208, .adv_w = 960, .box_w = 60, .box_h = 36, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 90288, .adv_w = 576, .box_w = 36, .box_h = 48, .ofs_x = 0, .ofs_y = -6}, + {.bitmap_index = 91152, .adv_w = 773, .box_w = 49, .box_h = 31, .ofs_x = 0, .ofs_y = 3} }; /*--------------------- @@ -11961,9 +12064,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -11975,7 +12078,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -12006,7 +12109,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -12031,7 +12134,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_montserrat_8.c b/src/font/lv_font_montserrat_8.c index 25ced69c3..8cd303f69 100644 --- a/src/font/lv_font_montserrat_8.c +++ b/src/font/lv_font_montserrat_8.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 8 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 8 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_8.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 8 --font Montserrat-Medium.ttf -r 0x20-0x7F,0xB0,0x2022 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_montserrat_8.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -626,6 +626,12 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xf9, 0x9, 0xff, 0xff, 0xd5, 0xdf, 0xf8, 0xbb, 0xbb, 0xb8, + /* U+F0C9 "" */ + 0x1, 0x11, 0x11, 0xf, 0xff, 0xff, 0xff, 0x1, + 0x11, 0x11, 0x5, 0x55, 0x55, 0x55, 0xcc, 0xcc, + 0xcc, 0xc0, 0x11, 0x11, 0x10, 0xff, 0xff, 0xff, + 0xf0, 0x11, 0x11, 0x10, + /* U+F0E0 "" */ 0xdf, 0xff, 0xff, 0xfd, 0x9f, 0xff, 0xff, 0xf9, 0xb7, 0xff, 0xff, 0x7b, 0xfe, 0x7c, 0xc7, 0xef, @@ -896,26 +902,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 2160, .adv_w = 112, .box_w = 8, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2192, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2220, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2248, .adv_w = 128, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2272, .adv_w = 80, .box_w = 7, .box_h = 8, .ofs_x = -1, .ofs_y = -1}, - {.bitmap_index = 2300, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2248, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2276, .adv_w = 128, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2300, .adv_w = 80, .box_w = 7, .box_h = 8, .ofs_x = -1, .ofs_y = -1}, {.bitmap_index = 2328, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2356, .adv_w = 144, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2383, .adv_w = 128, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 2433, .adv_w = 96, .box_w = 6, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2457, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2497, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2527, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2557, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2587, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2617, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2647, .adv_w = 160, .box_w = 11, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2691, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2356, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2384, .adv_w = 144, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2411, .adv_w = 128, .box_w = 10, .box_h = 10, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 2461, .adv_w = 96, .box_w = 6, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2485, .adv_w = 160, .box_w = 10, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2525, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2555, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2585, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2615, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2645, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2675, .adv_w = 160, .box_w = 11, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 2719, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2747, .adv_w = 128, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 2788, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 2818, .adv_w = 96, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2846, .adv_w = 129, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0} + {.bitmap_index = 2747, .adv_w = 112, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2775, .adv_w = 128, .box_w = 9, .box_h = 9, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 2816, .adv_w = 160, .box_w = 10, .box_h = 6, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2846, .adv_w = 96, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2874, .adv_w = 129, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0} }; /*--------------------- @@ -928,9 +935,9 @@ static const uint16_t unicode_list_1[] = { 0xef8e, 0xef93, 0xef98, 0xef9b, 0xef9c, 0xef9d, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefb7, 0xefb8, 0xefbe, 0xefc0, 0xefc1, 0xefc4, 0xefc7, 0xefc8, 0xefc9, 0xefcb, 0xefe3, 0xefe5, 0xf014, 0xf015, - 0xf017, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, 0xf0ab, - 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, 0xf1e3, - 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 + 0xf017, 0xf019, 0xf030, 0xf037, 0xf03a, 0xf043, 0xf06c, 0xf074, + 0xf0ab, 0xf13b, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf1d7, + 0xf1e3, 0xf23d, 0xf254, 0xf4aa, 0xf712, 0xf7f2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -942,7 +949,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 176, .range_length = 63475, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 61, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 62, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; @@ -973,7 +980,7 @@ static const uint8_t kern_left_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Map glyph_ids to kern right classes*/ @@ -998,7 +1005,7 @@ static const uint8_t kern_right_class_mapping[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; /*Kern values between classes*/ diff --git a/src/font/lv_font_simsun_16_cjk.c b/src/font/lv_font_simsun_16_cjk.c index ef6b03961..dee4a98f2 100644 --- a/src/font/lv_font_simsun_16_cjk.c +++ b/src/font/lv_font_simsun_16_cjk.c @@ -1,7 +1,7 @@ /******************************************************************************* * Size: 16 px * Bpp: 4 - * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_simsun_16_cjk.c --force-fast-kern-format + * Opts: --no-compress --no-prefilter --bpp 4 --size 16 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部 --font FontAwesome5-Solid+Brands+Regular.woff -r 61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61507,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61641,61664,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650 --format lvgl -o lv_font_simsun_16_cjk.c --force-fast-kern-format ******************************************************************************/ #ifdef LV_LVGL_H_INCLUDE_SIMPLE @@ -12343,6 +12343,21 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, + /* U+F0C9 "" */ + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x21, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x21, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x21, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x21, + /* U+F0E0 "" */ 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -13461,26 +13476,27 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { {.bitmap_index = 84593, .adv_w = 224, .box_w = 15, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, {.bitmap_index = 84698, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, {.bitmap_index = 84810, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 84908, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 85004, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, - {.bitmap_index = 85100, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85212, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85324, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 85432, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 85594, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 85690, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 85840, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 85940, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86040, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86140, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86240, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 86340, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 86487, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 86583, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 86695, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, - {.bitmap_index = 86840, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 86960, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 87056, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} + {.bitmap_index = 84908, .adv_w = 224, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 85006, .adv_w = 256, .box_w = 16, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 85102, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 85198, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85310, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85422, .adv_w = 288, .box_w = 18, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 85530, .adv_w = 256, .box_w = 18, .box_h = 18, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 85692, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 85788, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 85938, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86038, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86138, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86238, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86338, .adv_w = 320, .box_w = 20, .box_h = 10, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 86438, .adv_w = 320, .box_w = 21, .box_h = 14, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 86585, .adv_w = 224, .box_w = 12, .box_h = 16, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 86681, .adv_w = 224, .box_w = 14, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 86793, .adv_w = 256, .box_w = 17, .box_h = 17, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 86938, .adv_w = 320, .box_w = 20, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 87058, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 87154, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} }; /*--------------------- @@ -13574,9 +13590,9 @@ static const uint16_t unicode_list_1[] = { 0xa243, 0xa248, 0xa24b, 0xa24c, 0xa24d, 0xa251, 0xa252, 0xa253, 0xa254, 0xa267, 0xa268, 0xa26e, 0xa270, 0xa271, 0xa274, 0xa277, 0xa278, 0xa279, 0xa27b, 0xa293, 0xa295, 0xa2c4, 0xa2c5, 0xa2c7, - 0xa2e0, 0xa2e7, 0xa2ea, 0xa2f3, 0xa31c, 0xa324, 0xa35b, 0xa3eb, - 0xa440, 0xa441, 0xa442, 0xa443, 0xa444, 0xa487, 0xa493, 0xa4ed, - 0xa504, 0xa75a, 0xa9c2, 0xaaa2 + 0xa2c9, 0xa2e0, 0xa2e7, 0xa2ea, 0xa2f3, 0xa31c, 0xa324, 0xa35b, + 0xa3eb, 0xa440, 0xa441, 0xa442, 0xa443, 0xa444, 0xa487, 0xa493, + 0xa4ed, 0xa504, 0xa75a, 0xa9c2, 0xaaa2 }; /*Collect the unicode lists and glyph_id offsets*/ @@ -13588,7 +13604,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = }, { .range_start = 19968, .range_length = 43683, .glyph_id_start = 97, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 708, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 709, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY } }; diff --git a/src/font/lv_symbol_def.h b/src/font/lv_symbol_def.h index ef9bdd486..0e619e74b 100644 --- a/src/font/lv_symbol_def.h +++ b/src/font/lv_symbol_def.h @@ -62,6 +62,7 @@ extern "C" { #define LV_SYMBOL_CUT "\xef\x83\x84" /*61636, 0xF0C4*/ #define LV_SYMBOL_COPY "\xef\x83\x85" /*61637, 0xF0C5*/ #define LV_SYMBOL_SAVE "\xef\x83\x87" /*61639, 0xF0C7*/ +#define LV_SYMBOL_BARS "\xef\x83\x89" /*61641, 0xF0C9*/ #define LV_SYMBOL_CHARGE "\xef\x83\xa7" /*61671, 0xF0E7*/ #define LV_SYMBOL_PASTE "\xef\x83\xAA" /*61674, 0xF0EA*/ #define LV_SYMBOL_BELL "\xef\x83\xb3" /*61683, 0xF0F3*/ diff --git a/src/gpu/lv_gpu_nxp_vglite.c b/src/gpu/lv_gpu_nxp_vglite.c index 64fd654bc..94ab5ca9a 100644 --- a/src/gpu/lv_gpu_nxp_vglite.c +++ b/src/gpu/lv_gpu_nxp_vglite.c @@ -108,7 +108,7 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv rect.height = (fill_area->y2 - fill_area->y1) + 1; if(disp && disp->driver->clean_dcache_cb) { /*Clean & invalidate cache*/ - disp->driver->clean_dcache_cb(&disp->driver); + disp->driver->clean_dcache_cb(disp->driver); } err |= vg_lite_clear(&rt, &rect, col32.full); @@ -142,7 +142,7 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv colMix.ch.alpha = opa; if(disp && disp->driver->clean_dcache_cb) { /*Clean & invalidate cache*/ - disp->driver->clean_dcache_cb(&disp->driver); + disp->driver->clean_dcache_cb(disp->driver); } vg_lite_matrix_t matrix; @@ -220,7 +220,7 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit) vg_lite_translate(blit->dst_area.x1, blit->dst_area.y1, &matrix); if(disp && disp->driver->clean_dcache_cb) { /*Clean & invalidate cache*/ - disp->driver->clean_dcache_cb(&disp->driver); + disp->driver->clean_dcache_cb(disp->driver); } uint32_t color; diff --git a/src/gpu/lv_gpu_stm32_dma2d.c b/src/gpu/lv_gpu_stm32_dma2d.c index f3cf1808c..e988589dc 100644 --- a/src/gpu/lv_gpu_stm32_dma2d.c +++ b/src/gpu/lv_gpu_stm32_dma2d.c @@ -239,7 +239,7 @@ void lv_gpu_stm32_dma2d_wait_cb(lv_disp_drv_t * drv) static void invalidate_cache(void) { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - if(disp->driver->clean_dcache_cb) disp->driver->clean_dcache_cb(&disp->driver); + if(disp->driver->clean_dcache_cb) disp->driver->clean_dcache_cb(disp->driver); else { #if __CORTEX_M >= 0x07 if((SCB->CCR) & (uint32_t)SCB_CCR_DC_Msk) @@ -254,7 +254,7 @@ static void wait_finish(void) if(disp->driver->gpu_wait_cb) return; while(DMA2D->CR & DMA2D_CR_START_Msk) { - if(disp->driver->wait_cb) disp->driver->wait_cb(&disp->driver); + if(disp->driver->wait_cb) disp->driver->wait_cb(disp->driver); } } diff --git a/src/hal/lv_hal_disp.c b/src/hal/lv_hal_disp.c index c4bdebca0..812bae36c 100644 --- a/src/hal/lv_hal_disp.c +++ b/src/hal/lv_hal_disp.c @@ -132,7 +132,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) #if LV_USE_THEME_DEFAULT if(lv_theme_default_is_inited() == false) { - disp->theme = lv_theme_default_init(disp, LV_COLOR_PALETTE_BLUE, LV_COLOR_PALETTE_CYAN, LV_FONT_DEFAULT, LV_FONT_DEFAULT, LV_FONT_DEFAULT); + disp->theme = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT); } #endif @@ -360,28 +360,6 @@ lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t * disp) return disp->driver->draw_buf; } -/** - * Get the number of areas in the buffer - * @return number of invalid areas - */ -uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp) -{ - return disp->inv_p; -} - -/** - * Pop (delete) the last 'num' invalidated areas from the buffer - * @param num number of areas to delete - */ -void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num) -{ - - if(disp->inv_p < num) - disp->inv_p = 0; - else - disp->inv_p -= num; -} - /** * Set the rotation of this display. * @param disp pointer to a display (NULL to use the default display) diff --git a/src/hal/lv_hal_disp.h b/src/hal/lv_hal_disp.h index 2e76be23d..fbeb93b9d 100644 --- a/src/hal/lv_hal_disp.h +++ b/src/hal/lv_hal_disp.h @@ -313,25 +313,6 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp); */ lv_disp_draw_buf_t * lv_disp_get_draw_buf(lv_disp_t * disp); -/** - * Get the number of areas in the buffer - * @return number of invalid areas - */ -uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp); - -/** - * Pop (delete) the last 'num' invalidated areas from the buffer - * @param num number of areas to delete - */ -void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num); - -/** - * Check the driver configuration if it's double buffered (both `buf1` and `buf2` are set) - * @param disp pointer to to display to check - * @return true: double buffered; false: not double buffered - */ -bool lv_disp_is_double_buf(lv_disp_t * disp); - /********************** * MACROS **********************/ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index b06911ff6..876bf1f46 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -42,6 +42,10 @@ # endif #endif + +/*---------------------------------- + * Start parsing lv_conf_template.h + -----------------------------------*/ /*clang-format off*/ #include @@ -1394,12 +1398,12 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #endif #if LV_USE_THEME_DEFAULT -/*1: Light mode; 0: Dark mode*/ -#ifndef LV_THEME_DEFAULT_PALETTE_LIGHT -# ifdef CONFIG_LV_THEME_DEFAULT_PALETTE_LIGHT -# define LV_THEME_DEFAULT_PALETTE_LIGHT CONFIG_LV_THEME_DEFAULT_PALETTE_LIGHT +/*0: Light mode; 1: Dark mode*/ +#ifndef LV_THEME_DEFAULT_DARK +# ifdef CONFIG_LV_THEME_DEFAULT_DARK +# define LV_THEME_DEFAULT_DARK CONFIG_LV_THEME_DEFAULT_DARK # else -# define LV_THEME_DEFAULT_PALETTE_LIGHT 1 +# define LV_THEME_DEFAULT_DARK 0 # endif #endif @@ -1468,14 +1472,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ +/*---------------------------------- + * End of parsing lv_conf_template.h + -----------------------------------*/ + +LV_EXPORT_CONST_INT(LV_DPI_DEF); + /*If running without lv_conf.h add typdesf with default value*/ #if defined(LV_CONF_SKIP) - -# if LV_USE_USER_DATA - typedef void * lv_obj_user_data_t; -# endif - # if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ # define _CRT_SECURE_NO_WARNINGS # endif diff --git a/src/misc/lv_anim.c b/src/misc/lv_anim.c index 6aa223eaa..cd51141f6 100644 --- a/src/misc/lv_anim.c +++ b/src/misc/lv_anim.c @@ -41,7 +41,6 @@ static uint32_t last_timer_run; static bool anim_list_changed; static bool anim_run_round; static lv_timer_t * _lv_anim_tmr; -const lv_anim_path_t lv_anim_path_def = {.cb = lv_anim_path_linear}; /********************** * MACROS @@ -82,8 +81,8 @@ void lv_anim_init(lv_anim_t * a) a->time = 500; a->start_value = 0; a->end_value = 100; - lv_memcpy_small(&a->path, &lv_anim_path_def, sizeof(lv_anim_path_cb_t)); a->repeat_cnt = 1; + a->path_cb = lv_anim_path_linear; a->early_apply = 1; } /** @@ -130,27 +129,6 @@ void lv_anim_start(lv_anim_t * a) TRACE_ANIM("finished"); } -/** - * Initialize an animation path - * @param path pointer to path - */ -void lv_anim_path_init(lv_anim_path_t * path) -{ - lv_memset_00(path, sizeof(lv_anim_path_t)); -} - - -/** - * Set the path (curve) of the animation. - * @param a pointer to an initialized `lv_anim_t` variable - * @param path_cb a function the get the current value of the animation. - * The built in functions starts with `lv_anim_path_...` - */ -void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path) -{ - lv_memcpy_small(&a->path, path, sizeof(lv_anim_path_t)); -} - /** * Delete an animation of a variable with a given animator function * @param var pointer to variable @@ -258,10 +236,8 @@ void lv_anim_refr_now(void) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_linear(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ int32_t step = lv_map(a->act_time, 0, a->time, 0, LV_ANIM_RESOLUTION); @@ -280,12 +256,9 @@ int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_in(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 50, 100, 1024); @@ -302,10 +275,8 @@ int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_out(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 900, 950, 1024); @@ -323,10 +294,8 @@ int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_ease_in_out(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 50, 952, 1024); @@ -344,12 +313,9 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_overshoot(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t step = lv_bezier3(t, 0, 1000, 1300, 1024); @@ -366,13 +332,10 @@ int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_bounce(const lv_anim_t * a) { - LV_UNUSED(path); - /*Calculate the current step*/ - - uint32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); + int32_t t = lv_map(a->act_time, 0, a->time, 0, 1024); int32_t diff = (a->end_value - a->start_value); /*3 bounces has 5 parts: 3 down and 2 up. One part is t / 5 long*/ @@ -409,6 +372,7 @@ int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) } if(t > 1024) t = 1024; + if(t < 0) t = 0; int32_t step = lv_bezier3(t, 1024, 800, 500, 0); int32_t new_value; @@ -425,10 +389,8 @@ int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a) +int32_t lv_anim_path_step(const lv_anim_t * a) { - LV_UNUSED(path); - if(a->act_time >= a->time) return a->end_value; else @@ -479,8 +441,7 @@ static void anim_timer(lv_timer_t * param) if(a->act_time > a->time) a->act_time = a->time; int32_t new_value; - if(a->path.cb) new_value = a->path.cb(&a->path, a); - else new_value = lv_anim_path_linear(&a->path, a); + new_value = a->path_cb(a); if(new_value != a->current_value) { a->current_value = new_value; @@ -559,7 +520,7 @@ static void anim_mark_list_change(void) { anim_list_changed = true; if(_lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)) == NULL) - lv_timer_pause(_lv_anim_tmr, true); + lv_timer_pause(_lv_anim_tmr); else - lv_timer_pause(_lv_anim_tmr, false); + lv_timer_resume(_lv_anim_tmr); } diff --git a/src/misc/lv_anim.h b/src/misc/lv_anim.h index d4e6fb7e8..6ea049320 100644 --- a/src/misc/lv_anim.h +++ b/src/misc/lv_anim.h @@ -38,12 +38,7 @@ typedef enum { struct _lv_anim_t; struct _lv_anim_path_t; /** Get the current value during an animation*/ -typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_path_t *, const struct _lv_anim_t *); - -typedef struct _lv_anim_path_t { - lv_anim_path_cb_t cb; - void * user_data; -} lv_anim_path_t; +typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *); /** Generic prototype of "animator" functions. * First parameter is the variable to animate. @@ -76,7 +71,7 @@ typedef struct _lv_anim_t { #if LV_USE_USER_DATA void * user_data; /**< Custom user data*/ #endif - lv_anim_path_t path; /**< Describe the path (curve) of animations*/ + lv_anim_path_cb_t path_cb; /**< Describe the path (curve) of animations*/ int32_t start_value; /**< Start value*/ int32_t current_value; /**< Current value*/ int32_t end_value; /**< End value*/ @@ -186,10 +181,12 @@ static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec /** * Set the path (curve) of the animation. * @param a pointer to an initialized `lv_anim_t` variable - * @param path a function the get the current value of the animation. - * The built in functions starts with `lv_anim_path_...` + * @param path_cb a function the get the current value of the animation. */ -void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path); +static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb) +{ + a->path_cb = path_cb; +} /** * Set a function call when the animation really starts (considering `delay`) @@ -278,32 +275,6 @@ static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en) */ void lv_anim_start(lv_anim_t * a); -/** - * Initialize an animation path - * @param path pointer to path - */ -void lv_anim_path_init(lv_anim_path_t * path); - -/** - * Set a callback for a path - * @param path pointer to an initialized path - * @param cb the callback - */ -static inline void lv_anim_path_set_cb(lv_anim_path_t * path, lv_anim_path_cb_t cb) -{ - path->cb = cb; -} - -/** - * Set a user data for a path - * @param path pointer to an initialized path - * @param user_data pointer to the user data - */ -static inline void lv_anim_path_set_user_data(lv_anim_path_t * path, void * user_data) -{ - path->user_data = user_data; -} - /** * Get a delay before starting the animation * @param a pointer to an initialized `lv_anim_t` variable @@ -381,42 +352,42 @@ void lv_anim_refr_now(void); * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_linear(const lv_anim_t * a); /** * Calculate the current value of an animation slowing down the start phase * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_in(const lv_anim_t * a); /** * Calculate the current value of an animation slowing down the end phase * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_out(const lv_anim_t * a); /** * Calculate the current value of an animation applying an "S" characteristic (cosine) * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_ease_in_out(const lv_anim_t * a); /** * Calculate the current value of an animation with overshoot at the end * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_overshoot(const lv_anim_t * a); /** * Calculate the current value of an animation with 3 bounces * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_bounce(const lv_anim_t * a); /** * Calculate the current value of an animation applying step characteristic. @@ -424,12 +395,11 @@ int32_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a); * @param a pointer to an animation * @return the current value to set */ -int32_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a); +int32_t lv_anim_path_step(const lv_anim_t * a); /********************** * GLOBAL VARIABLES **********************/ -extern const lv_anim_path_t lv_anim_path_def; /********************** * MACROS diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 4ba14eec8..d10782388 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -103,6 +103,22 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) return size; } +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) +{ + area->x1 -= w_extra; + area->x2 += w_extra; + area->y1 -= h_extra; + area->y2 += h_extra; +} + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + area->x1 += x_ofs; + area->x2 += x_ofs; + area->y1 += y_ofs; + area->y2 += y_ofs; +} + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored here diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 20ac488d5..90b613830 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -173,6 +173,10 @@ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); */ uint32_t lv_area_get_size(const lv_area_t * area_p); +void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra); + +void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); + /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored her @@ -243,10 +247,23 @@ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align #define LV_COORD_SET_SPEC(x) ((x) | _LV_COORD_TYPE_SPEC) /*Special coordinates*/ -#define LV_SIZE_PCT(x) LV_COORD_SET_SPEC(x) -#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= 1000) ? true : false) -#define LV_COORD_GET_PCT(x) _LV_COORD_PLAIN(x) -#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(1001) +#define LV_PCT(x) (x < 0 ? LV_COORD_SET_SPEC(1000 - (x)) : LV_COORD_SET_SPEC(x)) +#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= 2000) ? true : false) +#define LV_COORD_GET_PCT(x) (_LV_COORD_PLAIN(x) > 1000 ? 1000 - _LV_COORD_PLAIN(x) : _LV_COORD_PLAIN(x)) +#define LV_SIZE_CONTENT LV_COORD_SET_SPEC(2001) + +LV_EXPORT_CONST_INT(LV_SIZE_CONTENT); + +/** + * Convert a percentage value to `lv_coord_t`. + * Percentage values are stored in special range + * @param x the percentage (0..1000) + * @return a coordinate that stores the percentage + */ +static inline lv_coord_t lv_pct(lv_coord_t x) +{ + return LV_PCT(x); +} #ifdef __cplusplus } /*extern "C"*/ diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index 2c59c3d46..8cfb18c1e 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -271,263 +271,101 @@ lv_color_hsv_t lv_color_to_hsv(lv_color_t color) return lv_color_rgb_to_hsv(color32.ch.red, color32.ch.green, color32.ch.blue); } - lv_color_t lv_color_get_palette_main(lv_color_palette_t palette) +lv_color_t lv_palette_main(lv_palette_t p) { - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey(); - default: return lv_color_black(); + static const lv_color_t colors[] = { + LV_COLOR_MAKE(0xF4, 0x43, 0x36), LV_COLOR_MAKE(0xE9, 0x1E, 0x63), LV_COLOR_MAKE(0x9C, 0x27, 0xB0), LV_COLOR_MAKE(0x67, 0x3A, 0xB7), + LV_COLOR_MAKE(0x3F, 0x51, 0xB5), LV_COLOR_MAKE(0x21, 0x96, 0xF3), LV_COLOR_MAKE(0x03, 0xA9, 0xF4), LV_COLOR_MAKE(0x00, 0xBC, 0xD4), + LV_COLOR_MAKE(0x00, 0x96, 0x88), LV_COLOR_MAKE(0x4C, 0xAF, 0x50), LV_COLOR_MAKE(0x8B, 0xC3, 0x4A), LV_COLOR_MAKE(0xCD, 0xDC, 0x39), + LV_COLOR_MAKE(0xFF, 0xEB, 0x3B), LV_COLOR_MAKE(0xFF, 0xC1, 0x07), LV_COLOR_MAKE(0xFF, 0x98, 0x00), LV_COLOR_MAKE(0xFF, 0x57, 0x22), + LV_COLOR_MAKE(0x79, 0x55, 0x48), LV_COLOR_MAKE(0x60, 0x7D, 0x8B), LV_COLOR_MAKE(0x9E, 0x9E, 0x9E) + }; + + if(p >= _LV_PALETTE_LAST) { + LV_LOG_WARN("Invalid palette: %d", p); + return lv_color_black(); } + return colors[p]; + } - lv_color_t lv_color_get_palette_lighten_1(lv_color_palette_t palette) +lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl) { - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_lighten_1(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_lighten_1(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_lighten_1(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_lighten_1(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_lighten_1(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_lighten_1(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_lighten_1(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_lighten_1(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_lighten_1(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_lighten_1(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_lighten_1(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_lighten_1(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_lighten_1(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_lighten_1(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_lighten_1(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_lighten_1(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_lighten_1(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_lighten_1(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_lighten_1(); - default: return lv_color_black(); - } + static const lv_color_t colors[][5] = { + {LV_COLOR_MAKE(0xEF, 0x53, 0x50), LV_COLOR_MAKE(0xE5, 0x73, 0x73), LV_COLOR_MAKE(0xEF, 0x9A, 0x9A), LV_COLOR_MAKE(0xFF, 0xCD, 0xD2), LV_COLOR_MAKE(0xFF, 0xEB, 0xEE)}, + {LV_COLOR_MAKE(0xEC, 0x40, 0x7A), LV_COLOR_MAKE(0xF0, 0x62, 0x92), LV_COLOR_MAKE(0xF4, 0x8F, 0xB1), LV_COLOR_MAKE(0xF8, 0xBB, 0xD0), LV_COLOR_MAKE(0xFC, 0xE4, 0xEC)}, + {LV_COLOR_MAKE(0xAB, 0x47, 0xBC), LV_COLOR_MAKE(0xBA, 0x68, 0xC8), LV_COLOR_MAKE(0xCE, 0x93, 0xD8), LV_COLOR_MAKE(0xE1, 0xBE, 0xE7), LV_COLOR_MAKE(0xF3, 0xE5, 0xF5)}, + {LV_COLOR_MAKE(0x7E, 0x57, 0xC2), LV_COLOR_MAKE(0x95, 0x75, 0xCD), LV_COLOR_MAKE(0xB3, 0x9D, 0xDB), LV_COLOR_MAKE(0xD1, 0xC4, 0xE9), LV_COLOR_MAKE(0xED, 0xE7, 0xF6)}, + {LV_COLOR_MAKE(0x5C, 0x6B, 0xC0), LV_COLOR_MAKE(0x79, 0x86, 0xCB), LV_COLOR_MAKE(0x9F, 0xA8, 0xDA), LV_COLOR_MAKE(0xC5, 0xCA, 0xE9), LV_COLOR_MAKE(0xE8, 0xEA, 0xF6)}, + {LV_COLOR_MAKE(0x42, 0xA5, 0xF5), LV_COLOR_MAKE(0x64, 0xB5, 0xF6), LV_COLOR_MAKE(0x90, 0xCA, 0xF9), LV_COLOR_MAKE(0xBB, 0xDE, 0xFB), LV_COLOR_MAKE(0xE3, 0xF2, 0xFD)}, + {LV_COLOR_MAKE(0x29, 0xB6, 0xF6), LV_COLOR_MAKE(0x4F, 0xC3, 0xF7), LV_COLOR_MAKE(0x81, 0xD4, 0xFA), LV_COLOR_MAKE(0xB3, 0xE5, 0xFC), LV_COLOR_MAKE(0xE1, 0xF5, 0xFE)}, + {LV_COLOR_MAKE(0x26, 0xC6, 0xDA), LV_COLOR_MAKE(0x4D, 0xD0, 0xE1), LV_COLOR_MAKE(0x80, 0xDE, 0xEA), LV_COLOR_MAKE(0xB2, 0xEB, 0xF2), LV_COLOR_MAKE(0xE0, 0xF7, 0xFA)}, + {LV_COLOR_MAKE(0x26, 0xA6, 0x9A), LV_COLOR_MAKE(0x4D, 0xB6, 0xAC), LV_COLOR_MAKE(0x80, 0xCB, 0xC4), LV_COLOR_MAKE(0xB2, 0xDF, 0xDB), LV_COLOR_MAKE(0xE0, 0xF2, 0xF1)}, + {LV_COLOR_MAKE(0x66, 0xBB, 0x6A), LV_COLOR_MAKE(0x81, 0xC7, 0x84), LV_COLOR_MAKE(0xA5, 0xD6, 0xA7), LV_COLOR_MAKE(0xC8, 0xE6, 0xC9), LV_COLOR_MAKE(0xE8, 0xF5, 0xE9)}, + {LV_COLOR_MAKE(0x9C, 0xCC, 0x65), LV_COLOR_MAKE(0xAE, 0xD5, 0x81), LV_COLOR_MAKE(0xC5, 0xE1, 0xA5), LV_COLOR_MAKE(0xDC, 0xED, 0xC8), LV_COLOR_MAKE(0xF1, 0xF8, 0xE9)}, + {LV_COLOR_MAKE(0xD4, 0xE1, 0x57), LV_COLOR_MAKE(0xDC, 0xE7, 0x75), LV_COLOR_MAKE(0xE6, 0xEE, 0x9C), LV_COLOR_MAKE(0xF0, 0xF4, 0xC3), LV_COLOR_MAKE(0xF9, 0xFB, 0xE7)}, + {LV_COLOR_MAKE(0xFF, 0xEE, 0x58), LV_COLOR_MAKE(0xFF, 0xF1, 0x76), LV_COLOR_MAKE(0xFF, 0xF5, 0x9D), LV_COLOR_MAKE(0xFF, 0xF9, 0xC4), LV_COLOR_MAKE(0xFF, 0xFD, 0xE7)}, + {LV_COLOR_MAKE(0xFF, 0xCA, 0x28), LV_COLOR_MAKE(0xFF, 0xD5, 0x4F), LV_COLOR_MAKE(0xFF, 0xE0, 0x82), LV_COLOR_MAKE(0xFF, 0xEC, 0xB3), LV_COLOR_MAKE(0xFF, 0xF8, 0xE1)}, + {LV_COLOR_MAKE(0xFF, 0xA7, 0x26), LV_COLOR_MAKE(0xFF, 0xB7, 0x4D), LV_COLOR_MAKE(0xFF, 0xCC, 0x80), LV_COLOR_MAKE(0xFF, 0xE0, 0xB2), LV_COLOR_MAKE(0xFF, 0xF3, 0xE0)}, + {LV_COLOR_MAKE(0xFF, 0x70, 0x43), LV_COLOR_MAKE(0xFF, 0x8A, 0x65), LV_COLOR_MAKE(0xFF, 0xAB, 0x91), LV_COLOR_MAKE(0xFF, 0xCC, 0xBC), LV_COLOR_MAKE(0xFB, 0xE9, 0xE7)}, + {LV_COLOR_MAKE(0x8D, 0x6E, 0x63), LV_COLOR_MAKE(0xA1, 0x88, 0x7F), LV_COLOR_MAKE(0xBC, 0xAA, 0xA4), LV_COLOR_MAKE(0xD7, 0xCC, 0xC8), LV_COLOR_MAKE(0xEF, 0xEB, 0xE9)}, + {LV_COLOR_MAKE(0x78, 0x90, 0x9C), LV_COLOR_MAKE(0x90, 0xA4, 0xAE), LV_COLOR_MAKE(0xB0, 0xBE, 0xC5), LV_COLOR_MAKE(0xCF, 0xD8, 0xDC), LV_COLOR_MAKE(0xEC, 0xEF, 0xF1)}, + {LV_COLOR_MAKE(0xBD, 0xBD, 0xBD), LV_COLOR_MAKE(0xE0, 0xE0, 0xE0), LV_COLOR_MAKE(0xEE, 0xEE, 0xEE), LV_COLOR_MAKE(0xF5, 0xF5, 0xF5), LV_COLOR_MAKE(0xFA, 0xFA, 0xFA)}, + }; + + if(p >= _LV_PALETTE_LAST) { + LV_LOG_WARN("Invalid palette: %d", p); + return lv_color_black(); + } + + if(lvl == 0 || lvl > 5) { + LV_LOG_WARN("Invalid level: %d. Must be 1..5", lvl); + return lv_color_black(); + } + + lvl--; + + return colors[p][lvl]; } - lv_color_t lv_color_get_palette_lighten_2(lv_color_palette_t palette) +lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl) { - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_lighten_2(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_lighten_2(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_lighten_2(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_lighten_2(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_lighten_2(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_lighten_2(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_lighten_2(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_lighten_2(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_lighten_2(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_lighten_2(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_lighten_2(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_lighten_2(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_lighten_2(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_lighten_2(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_lighten_2(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_lighten_2(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_lighten_2(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_lighten_2(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_lighten_2(); - default: return lv_color_black(); - } + static const lv_color_t colors[][4] = { + {LV_COLOR_MAKE(0xE5, 0x39, 0x35), LV_COLOR_MAKE(0xD3, 0x2F, 0x2F), LV_COLOR_MAKE(0xC6, 0x28, 0x28), LV_COLOR_MAKE(0xB7, 0x1C, 0x1C)}, + {LV_COLOR_MAKE(0xD8, 0x1B, 0x60), LV_COLOR_MAKE(0xC2, 0x18, 0x5B), LV_COLOR_MAKE(0xAD, 0x14, 0x57), LV_COLOR_MAKE(0x88, 0x0E, 0x4F)}, + {LV_COLOR_MAKE(0x8E, 0x24, 0xAA), LV_COLOR_MAKE(0x7B, 0x1F, 0xA2), LV_COLOR_MAKE(0x6A, 0x1B, 0x9A), LV_COLOR_MAKE(0x4A, 0x14, 0x8C)}, + {LV_COLOR_MAKE(0x5E, 0x35, 0xB1), LV_COLOR_MAKE(0x51, 0x2D, 0xA8), LV_COLOR_MAKE(0x45, 0x27, 0xA0), LV_COLOR_MAKE(0x31, 0x1B, 0x92)}, + {LV_COLOR_MAKE(0x39, 0x49, 0xAB), LV_COLOR_MAKE(0x30, 0x3F, 0x9F), LV_COLOR_MAKE(0x28, 0x35, 0x93), LV_COLOR_MAKE(0x1A, 0x23, 0x7E)}, + {LV_COLOR_MAKE(0x1E, 0x88, 0xE5), LV_COLOR_MAKE(0x19, 0x76, 0xD2), LV_COLOR_MAKE(0x15, 0x65, 0xC0), LV_COLOR_MAKE(0x0D, 0x47, 0xA1)}, + {LV_COLOR_MAKE(0x03, 0x9B, 0xE5), LV_COLOR_MAKE(0x02, 0x88, 0xD1), LV_COLOR_MAKE(0x02, 0x77, 0xBD), LV_COLOR_MAKE(0x01, 0x57, 0x9B)}, + {LV_COLOR_MAKE(0x00, 0xAC, 0xC1), LV_COLOR_MAKE(0x00, 0x97, 0xA7), LV_COLOR_MAKE(0x00, 0x83, 0x8F), LV_COLOR_MAKE(0x00, 0x60, 0x64)}, + {LV_COLOR_MAKE(0x00, 0x89, 0x7B), LV_COLOR_MAKE(0x00, 0x79, 0x6B), LV_COLOR_MAKE(0x00, 0x69, 0x5C), LV_COLOR_MAKE(0x00, 0x4D, 0x40)}, + {LV_COLOR_MAKE(0x43, 0xA0, 0x47), LV_COLOR_MAKE(0x38, 0x8E, 0x3C), LV_COLOR_MAKE(0x2E, 0x7D, 0x32), LV_COLOR_MAKE(0x1B, 0x5E, 0x20)}, + {LV_COLOR_MAKE(0x7C, 0xB3, 0x42), LV_COLOR_MAKE(0x68, 0x9F, 0x38), LV_COLOR_MAKE(0x55, 0x8B, 0x2F), LV_COLOR_MAKE(0x33, 0x69, 0x1E)}, + {LV_COLOR_MAKE(0xC0, 0xCA, 0x33), LV_COLOR_MAKE(0xAF, 0xB4, 0x2B), LV_COLOR_MAKE(0x9E, 0x9D, 0x24), LV_COLOR_MAKE(0x82, 0x77, 0x17)}, + {LV_COLOR_MAKE(0xFD, 0xD8, 0x35), LV_COLOR_MAKE(0xFB, 0xC0, 0x2D), LV_COLOR_MAKE(0xF9, 0xA8, 0x25), LV_COLOR_MAKE(0xF5, 0x7F, 0x17)}, + {LV_COLOR_MAKE(0xFF, 0xB3, 0x00), LV_COLOR_MAKE(0xFF, 0xA0, 0x00), LV_COLOR_MAKE(0xFF, 0x8F, 0x00), LV_COLOR_MAKE(0xFF, 0x6F, 0x00)}, + {LV_COLOR_MAKE(0xFB, 0x8C, 0x00), LV_COLOR_MAKE(0xF5, 0x7C, 0x00), LV_COLOR_MAKE(0xEF, 0x6C, 0x00), LV_COLOR_MAKE(0xE6, 0x51, 0x00)}, + {LV_COLOR_MAKE(0xF4, 0x51, 0x1E), LV_COLOR_MAKE(0xE6, 0x4A, 0x19), LV_COLOR_MAKE(0xD8, 0x43, 0x15), LV_COLOR_MAKE(0xBF, 0x36, 0x0C)}, + {LV_COLOR_MAKE(0x6D, 0x4C, 0x41), LV_COLOR_MAKE(0x5D, 0x40, 0x37), LV_COLOR_MAKE(0x4E, 0x34, 0x2E), LV_COLOR_MAKE(0x3E, 0x27, 0x23)}, + {LV_COLOR_MAKE(0x54, 0x6E, 0x7A), LV_COLOR_MAKE(0x45, 0x5A, 0x64), LV_COLOR_MAKE(0x37, 0x47, 0x4F), LV_COLOR_MAKE(0x26, 0x32, 0x38)}, + {LV_COLOR_MAKE(0x75, 0x75, 0x75), LV_COLOR_MAKE(0x61, 0x61, 0x61), LV_COLOR_MAKE(0x42, 0x42, 0x42), LV_COLOR_MAKE(0x21, 0x21, 0x21)}, + }; + + if(p >= _LV_PALETTE_LAST) { + LV_LOG_WARN("Invalid palette: %d", p); + return lv_color_black(); + } + + if(lvl == 0 || lvl > 4) { + LV_LOG_WARN("Invalid level: %d. Must be 1..4", lvl); + return lv_color_black(); + } + + lvl--; + + return colors[p][lvl]; } - lv_color_t lv_color_get_palette_lighten_3(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_lighten_3(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_lighten_3(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_lighten_3(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_lighten_3(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_lighten_3(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_lighten_3(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_lighten_3(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_lighten_3(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_lighten_3(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_lighten_3(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_lighten_3(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_lighten_3(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_lighten_3(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_lighten_3(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_lighten_3(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_lighten_3(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_lighten_3(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_lighten_3(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_lighten_3(); - default: return lv_color_black(); - } -} - lv_color_t lv_color_get_palette_lighten_4(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_lighten_4(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_lighten_4(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_lighten_4(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_lighten_4(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_lighten_4(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_lighten_4(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_lighten_4(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_lighten_4(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_lighten_4(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_lighten_4(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_lighten_4(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_lighten_4(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_lighten_4(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_lighten_4(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_lighten_4(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_lighten_4(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_lighten_4(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_lighten_4(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_lighten_4(); - default: return lv_color_black(); - } -} - - lv_color_t lv_color_get_palette_lighten_5(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_lighten_5(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_lighten_5(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_lighten_5(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_lighten_5(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_lighten_5(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_lighten_5(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_lighten_5(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_lighten_5(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_lighten_5(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_lighten_5(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_lighten_5(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_lighten_5(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_lighten_5(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_lighten_5(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_lighten_5(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_lighten_5(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_lighten_5(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_lighten_5(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_lighten_5(); - default: return lv_color_black(); - } -} - - lv_color_t lv_color_get_palette_darken_1(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_darken_1(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_darken_1(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_darken_1(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_darken_1(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_darken_1(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_darken_1(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_darken_1(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_darken_1(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_darken_1(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_darken_1(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_darken_1(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_darken_1(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_darken_1(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_darken_1(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_darken_1(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_darken_1(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_darken_1(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_darken_1(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_darken_1(); - default: return lv_color_black(); - } -} - - lv_color_t lv_color_get_palette_darken_2(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_darken_2(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_darken_2(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_darken_2(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_darken_2(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_darken_2(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_darken_2(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_darken_2(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_darken_2(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_darken_2(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_darken_2(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_darken_2(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_darken_2(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_darken_2(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_darken_2(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_darken_2(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_darken_2(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_darken_2(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_darken_2(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_darken_2(); - default: return lv_color_black(); - } -} - - lv_color_t lv_color_get_palette_darken_3(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_darken_3(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_darken_3(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_darken_3(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_darken_3(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_darken_3(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_darken_3(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_darken_3(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_darken_3(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_darken_3(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_darken_3(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_darken_3(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_darken_3(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_darken_3(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_darken_3(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_darken_3(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_darken_3(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_darken_3(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_darken_3(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_darken_3(); - default: return lv_color_black(); - } -} - - lv_color_t lv_color_get_palette_darken_4(lv_color_palette_t palette) -{ - switch(palette) { - case LV_COLOR_PALETTE_RED: return lv_color_red_darken_4(); - case LV_COLOR_PALETTE_PINK: return lv_color_pink_darken_4(); - case LV_COLOR_PALETTE_PURPLE: return lv_color_purple_darken_4(); - case LV_COLOR_PALETTE_DEEP_PURPLE: return lv_color_deep_purple_darken_4(); - case LV_COLOR_PALETTE_INDIGO: return lv_color_indigo_darken_4(); - case LV_COLOR_PALETTE_BLUE: return lv_color_blue_darken_4(); - case LV_COLOR_PALETTE_LIGHT_BLUE: return lv_color_light_blue_darken_4(); - case LV_COLOR_PALETTE_CYAN: return lv_color_cyan_darken_4(); - case LV_COLOR_PALETTE_TEAL: return lv_color_teal_darken_4(); - case LV_COLOR_PALETTE_GREEN: return lv_color_green_darken_4(); - case LV_COLOR_PALETTE_LIGHT_GREEN: return lv_color_light_green_darken_4(); - case LV_COLOR_PALETTE_LIME: return lv_color_lime_darken_4(); - case LV_COLOR_PALETTE_YELLOW: return lv_color_yellow_darken_4(); - case LV_COLOR_PALETTE_AMBER: return lv_color_amber_darken_4(); - case LV_COLOR_PALETTE_ORANGE: return lv_color_orange_darken_4(); - case LV_COLOR_PALETTE_DEEP_ORANGE: return lv_color_deep_orange_darken_4(); - case LV_COLOR_PALETTE_BROWN: return lv_color_brown_darken_4(); - case LV_COLOR_PALETTE_BLUE_GREY: return lv_color_blue_grey_darken_4(); - case LV_COLOR_PALETTE_GREY: return lv_color_grey_darken_4(); - default: return lv_color_black(); - } -} diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index 1a3f788cf..16d9e5a27 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -130,7 +130,7 @@ enum { # define LV_COLOR_GET_A1(c) 0xFF # define _LV_COLOR_ZERO_INITIALIZER1 {0x00} -# define LV_COLOR_MAKE1(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{(uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))}) +# define LV_COLOR_MAKE1(r8, g8, b8) {(uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))} # define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)((v) & 0x7U) # define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)((v) & 0x7U) @@ -142,8 +142,8 @@ enum { # define LV_COLOR_GET_B8(c) (c).ch.blue # define LV_COLOR_GET_A8(c) 0xFF -# define _LV_COLOR_ZERO_INITIALIZER8 {{0x00, 0x00, 0x00}} -# define LV_COLOR_MAKE8(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}}) +# define _LV_COLOR_ZERO_INITIALIZER8 _LV_COLOR_MAKE_TYPE_HELPER {{0x00, 0x00, 0x00}} +# define LV_COLOR_MAKE8(r8, g8, b8) _LV_COLOR_MAKE_TYPE_HELPER {{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}} # define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)((v) & 0x1FU) #if LV_COLOR_16_SWAP == 0 @@ -164,11 +164,11 @@ enum { # define LV_COLOR_GET_A16(c) 0xFF #if LV_COLOR_16_SWAP == 0 -# define _LV_COLOR_ZERO_INITIALIZER16 {{0x00, 0x00, 0x00}} -# define LV_COLOR_MAKE16(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x3FU), (uint8_t)((r8 >> 3) & 0x1FU)}}) +# define _LV_COLOR_ZERO_INITIALIZER16 {{0x00, 0x00, 0x00}} +# define LV_COLOR_MAKE16(r8, g8, b8) {{(uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x3FU), (uint8_t)((r8 >> 3) & 0x1FU)}} #else # define _LV_COLOR_ZERO_INITIALIZER16 {{0x00, 0x00, 0x00, 0x00}} -# define LV_COLOR_MAKE16(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 3) & 0x1FU), (uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x7U)}}) +# define LV_COLOR_MAKE16(r8, g8, b8) {{(uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 3) & 0x1FU), (uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x7U)}} #endif # define LV_COLOR_SET_R32(c, v) (c).ch.red = (uint8_t)((v) & 0xFF) @@ -181,8 +181,8 @@ enum { # define LV_COLOR_GET_B32(c) (c).ch.blue # define LV_COLOR_GET_A32(c) (c).ch.alpha -# define _LV_COLOR_ZERO_INITIALIZER32 {{0x00, 0x00, 0x00, 0x00}} -# define LV_COLOR_MAKE32(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/ +# define _LV_COLOR_ZERO_INITIALIZER32 {{0x00, 0x00, 0x00, 0x00}} +# define LV_COLOR_MAKE32(r8, g8, b8) {{b8, g8, r8, 0xff}} /*Fix 0xff alpha*/ /*--------------------------------------- * Macros for the current color depth @@ -276,28 +276,28 @@ typedef struct _lv_color_filter_dsc_t { typedef enum { - LV_COLOR_PALETTE_NONE, - LV_COLOR_PALETTE_RED, - LV_COLOR_PALETTE_PINK, - LV_COLOR_PALETTE_PURPLE, - LV_COLOR_PALETTE_DEEP_PURPLE, - LV_COLOR_PALETTE_INDIGO, - LV_COLOR_PALETTE_BLUE, - LV_COLOR_PALETTE_LIGHT_BLUE, - LV_COLOR_PALETTE_CYAN, - LV_COLOR_PALETTE_TEAL, - LV_COLOR_PALETTE_GREEN, - LV_COLOR_PALETTE_LIGHT_GREEN, - LV_COLOR_PALETTE_LIME, - LV_COLOR_PALETTE_YELLOW, - LV_COLOR_PALETTE_AMBER, - LV_COLOR_PALETTE_ORANGE, - LV_COLOR_PALETTE_DEEP_ORANGE, - LV_COLOR_PALETTE_BROWN, - LV_COLOR_PALETTE_BLUE_GREY, - LV_COLOR_PALETTE_GREY, - _LV_COLOR_PALETTE_LAST -}lv_color_palette_t; + LV_PALETTE_RED, + LV_PALETTE_PINK, + LV_PALETTE_PURPLE, + LV_PALETTE_DEEP_PURPLE, + LV_PALETTE_INDIGO, + LV_PALETTE_BLUE, + LV_PALETTE_LIGHT_BLUE, + LV_PALETTE_CYAN, + LV_PALETTE_TEAL, + LV_PALETTE_GREEN, + LV_PALETTE_LIGHT_GREEN, + LV_PALETTE_LIME, + LV_PALETTE_YELLOW, + LV_PALETTE_AMBER, + LV_PALETTE_ORANGE, + LV_PALETTE_DEEP_ORANGE, + LV_PALETTE_BROWN, + LV_PALETTE_BLUE_GREY, + LV_PALETTE_GREY, + _LV_PALETTE_LAST, + LV_PALETTE_NONE = 0xff, +}lv_palette_t; /********************** * GLOBAL PROTOTYPES @@ -601,7 +601,7 @@ static inline uint8_t lv_color_brightness(lv_color_t color) static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) { - return LV_COLOR_MAKE(r, g, b); + return _LV_COLOR_MAKE_TYPE_HELPER LV_COLOR_MAKE(r, g, b); } static inline lv_color_t lv_color_hex(uint32_t c) @@ -656,243 +656,16 @@ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8); */ lv_color_hsv_t lv_color_to_hsv(lv_color_t color); -lv_color_t lv_color_get_palette_main(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_lighten_1(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_lighten_2(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_lighten_3(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_lighten_4(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_lighten_5(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_darken_1(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_darken_2(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_darken_3(lv_color_palette_t palette); - -lv_color_t lv_color_get_palette_darken_4(lv_color_palette_t palette); - /********************** * PREDEFINED COLORS **********************/ /*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/ -static inline lv_color_t lv_color_red(void) { return lv_color_hex(0xF44336); } -static inline lv_color_t lv_color_red_lighten_5(void) { return lv_color_hex(0xFFEBEE); } -static inline lv_color_t lv_color_red_lighten_4(void) { return lv_color_hex(0xFFCDD2); } -static inline lv_color_t lv_color_red_lighten_3(void) { return lv_color_hex(0xEF9A9A); } -static inline lv_color_t lv_color_red_lighten_2(void) { return lv_color_hex(0xE57373); } -static inline lv_color_t lv_color_red_lighten_1(void) { return lv_color_hex(0xEF5350); } -static inline lv_color_t lv_color_red_darken_1(void) { return lv_color_hex(0xE53935); } -static inline lv_color_t lv_color_red_darken_2(void) { return lv_color_hex(0xD32F2F); } -static inline lv_color_t lv_color_red_darken_3(void) { return lv_color_hex(0xC62828); } -static inline lv_color_t lv_color_red_darken_4(void) { return lv_color_hex(0xB71C1C); } - -static inline lv_color_t lv_color_pink(void) { return lv_color_hex(0xE91E63); } -static inline lv_color_t lv_color_pink_lighten_5(void) { return lv_color_hex(0xFCE4EC); } -static inline lv_color_t lv_color_pink_lighten_4(void) { return lv_color_hex(0xF8BBD0); } -static inline lv_color_t lv_color_pink_lighten_3(void) { return lv_color_hex(0xF48FB1); } -static inline lv_color_t lv_color_pink_lighten_2(void) { return lv_color_hex(0xF06292); } -static inline lv_color_t lv_color_pink_lighten_1(void) { return lv_color_hex(0xEC407A); } -static inline lv_color_t lv_color_pink_darken_1(void) { return lv_color_hex(0xD81B60); } -static inline lv_color_t lv_color_pink_darken_2(void) { return lv_color_hex(0xC2185B); } -static inline lv_color_t lv_color_pink_darken_3(void) { return lv_color_hex(0xAD1457); } -static inline lv_color_t lv_color_pink_darken_4(void) { return lv_color_hex(0x880E4F); } - -static inline lv_color_t lv_color_purple(void) { return lv_color_hex(0x9C27B0); } -static inline lv_color_t lv_color_purple_lighten_5(void) { return lv_color_hex(0xF3E5F5); } -static inline lv_color_t lv_color_purple_lighten_4(void) { return lv_color_hex(0xE1BEE7); } -static inline lv_color_t lv_color_purple_lighten_3(void) { return lv_color_hex(0xCE93D8); } -static inline lv_color_t lv_color_purple_lighten_2(void) { return lv_color_hex(0xBA68C8); } -static inline lv_color_t lv_color_purple_lighten_1(void) { return lv_color_hex(0xAB47BC); } -static inline lv_color_t lv_color_purple_darken_1(void) { return lv_color_hex(0x8E24AA); } -static inline lv_color_t lv_color_purple_darken_2(void) { return lv_color_hex(0x7B1FA2); } -static inline lv_color_t lv_color_purple_darken_3(void) { return lv_color_hex(0x6A1B9A); } -static inline lv_color_t lv_color_purple_darken_4(void) { return lv_color_hex(0x4A148C); } - -static inline lv_color_t lv_color_deep_purple(void) { return lv_color_hex(0x673AB7); } -static inline lv_color_t lv_color_deep_purple_lighten_5(void) { return lv_color_hex(0xEDE7F6); } -static inline lv_color_t lv_color_deep_purple_lighten_4(void) { return lv_color_hex(0xD1C4E9); } -static inline lv_color_t lv_color_deep_purple_lighten_3(void) { return lv_color_hex(0xB39DDB); } -static inline lv_color_t lv_color_deep_purple_lighten_2(void) { return lv_color_hex(0x9575CD); } -static inline lv_color_t lv_color_deep_purple_lighten_1(void) { return lv_color_hex(0x7E57C2); } -static inline lv_color_t lv_color_deep_purple_darken_1(void) { return lv_color_hex(0x5E35B1); } -static inline lv_color_t lv_color_deep_purple_darken_2(void) { return lv_color_hex(0x512DA8); } -static inline lv_color_t lv_color_deep_purple_darken_3(void) { return lv_color_hex(0x4527A0); } -static inline lv_color_t lv_color_deep_purple_darken_4(void) { return lv_color_hex(0x311B92); } - -static inline lv_color_t lv_color_indigo(void) { return lv_color_hex(0x3F51B5); } -static inline lv_color_t lv_color_indigo_lighten_5(void) { return lv_color_hex(0xE8EAF6); } -static inline lv_color_t lv_color_indigo_lighten_4(void) { return lv_color_hex(0xC5CAE9); } -static inline lv_color_t lv_color_indigo_lighten_3(void) { return lv_color_hex(0x9FA8DA); } -static inline lv_color_t lv_color_indigo_lighten_2(void) { return lv_color_hex(0x7986CB); } -static inline lv_color_t lv_color_indigo_lighten_1(void) { return lv_color_hex(0x5C6BC0); } -static inline lv_color_t lv_color_indigo_darken_1(void) { return lv_color_hex(0x3949AB); } -static inline lv_color_t lv_color_indigo_darken_2(void) { return lv_color_hex(0x303F9F); } -static inline lv_color_t lv_color_indigo_darken_3(void) { return lv_color_hex(0x283593); } -static inline lv_color_t lv_color_indigo_darken_4(void) { return lv_color_hex(0x1A237E); } - -static inline lv_color_t lv_color_blue(void) { return lv_color_hex(0x2196F3); } -static inline lv_color_t lv_color_blue_lighten_5(void) { return lv_color_hex(0xE3F2FD); } -static inline lv_color_t lv_color_blue_lighten_4(void) { return lv_color_hex(0xBBDEFB); } -static inline lv_color_t lv_color_blue_lighten_3(void) { return lv_color_hex(0x90CAF9); } -static inline lv_color_t lv_color_blue_lighten_2(void) { return lv_color_hex(0x64B5F6); } -static inline lv_color_t lv_color_blue_lighten_1(void) { return lv_color_hex(0x42A5F5); } -static inline lv_color_t lv_color_blue_darken_1(void) { return lv_color_hex(0x1E88E5); } -static inline lv_color_t lv_color_blue_darken_2(void) { return lv_color_hex(0x1976D2); } -static inline lv_color_t lv_color_blue_darken_3(void) { return lv_color_hex(0x1565C0); } -static inline lv_color_t lv_color_blue_darken_4(void) { return lv_color_hex(0x0D47A1); } - -static inline lv_color_t lv_color_light_blue(void) { return lv_color_hex(0x03A9F4); } -static inline lv_color_t lv_color_light_blue_lighten_5(void) { return lv_color_hex(0xE1F5FE); } -static inline lv_color_t lv_color_light_blue_lighten_4(void) { return lv_color_hex(0xB3E5FC); } -static inline lv_color_t lv_color_light_blue_lighten_3(void) { return lv_color_hex(0x81D4FA); } -static inline lv_color_t lv_color_light_blue_lighten_2(void) { return lv_color_hex(0x4FC3F7); } -static inline lv_color_t lv_color_light_blue_lighten_1(void) { return lv_color_hex(0x29B6F6); } -static inline lv_color_t lv_color_light_blue_darken_1(void) { return lv_color_hex(0x039BE5); } -static inline lv_color_t lv_color_light_blue_darken_2(void) { return lv_color_hex(0x0288D1); } -static inline lv_color_t lv_color_light_blue_darken_3(void) { return lv_color_hex(0x0277BD); } -static inline lv_color_t lv_color_light_blue_darken_4(void) { return lv_color_hex(0x01579B); } - -static inline lv_color_t lv_color_cyan(void) { return lv_color_hex(0x00BCD4); } -static inline lv_color_t lv_color_cyan_lighten_5(void) { return lv_color_hex(0xE0F7FA); } -static inline lv_color_t lv_color_cyan_lighten_4(void) { return lv_color_hex(0xB2EBF2); } -static inline lv_color_t lv_color_cyan_lighten_3(void) { return lv_color_hex(0x80DEEA); } -static inline lv_color_t lv_color_cyan_lighten_2(void) { return lv_color_hex(0x4DD0E1); } -static inline lv_color_t lv_color_cyan_lighten_1(void) { return lv_color_hex(0x26C6DA); } -static inline lv_color_t lv_color_cyan_darken_1(void) { return lv_color_hex(0x00ACC1); } -static inline lv_color_t lv_color_cyan_darken_2(void) { return lv_color_hex(0x0097A7); } -static inline lv_color_t lv_color_cyan_darken_3(void) { return lv_color_hex(0x00838F); } -static inline lv_color_t lv_color_cyan_darken_4(void) { return lv_color_hex(0x006064); } - -static inline lv_color_t lv_color_teal(void) { return lv_color_hex(0x009688); } -static inline lv_color_t lv_color_teal_lighten_5(void) { return lv_color_hex(0xE0F2F1); } -static inline lv_color_t lv_color_teal_lighten_4(void) { return lv_color_hex(0xB2DFDB); } -static inline lv_color_t lv_color_teal_lighten_3(void) { return lv_color_hex(0x80CBC4); } -static inline lv_color_t lv_color_teal_lighten_2(void) { return lv_color_hex(0x4DB6AC); } -static inline lv_color_t lv_color_teal_lighten_1(void) { return lv_color_hex(0x26A69A); } -static inline lv_color_t lv_color_teal_darken_1(void) { return lv_color_hex(0x00897B); } -static inline lv_color_t lv_color_teal_darken_2(void) { return lv_color_hex(0x00796B); } -static inline lv_color_t lv_color_teal_darken_3(void) { return lv_color_hex(0x00695C); } -static inline lv_color_t lv_color_teal_darken_4(void) { return lv_color_hex(0x004D40); } - -static inline lv_color_t lv_color_green(void) { return lv_color_hex(0x4CAF50); } -static inline lv_color_t lv_color_green_lighten_5(void) { return lv_color_hex(0xE8F5E9); } -static inline lv_color_t lv_color_green_lighten_4(void) { return lv_color_hex(0xC8E6C9); } -static inline lv_color_t lv_color_green_lighten_3(void) { return lv_color_hex(0xA5D6A7); } -static inline lv_color_t lv_color_green_lighten_2(void) { return lv_color_hex(0x81C784); } -static inline lv_color_t lv_color_green_lighten_1(void) { return lv_color_hex(0x66BB6A); } -static inline lv_color_t lv_color_green_darken_1(void) { return lv_color_hex(0x43A047); } -static inline lv_color_t lv_color_green_darken_2(void) { return lv_color_hex(0x388E3C); } -static inline lv_color_t lv_color_green_darken_3(void) { return lv_color_hex(0x2E7D32); } -static inline lv_color_t lv_color_green_darken_4(void) { return lv_color_hex(0x1B5E20); } - -static inline lv_color_t lv_color_light_green(void) { return lv_color_hex(0x8BC34A); } -static inline lv_color_t lv_color_light_green_lighten_5(void) { return lv_color_hex(0xF1F8E9); } -static inline lv_color_t lv_color_light_green_lighten_4(void) { return lv_color_hex(0xDCEDC8); } -static inline lv_color_t lv_color_light_green_lighten_3(void) { return lv_color_hex(0xC5E1A5); } -static inline lv_color_t lv_color_light_green_lighten_2(void) { return lv_color_hex(0xAED581); } -static inline lv_color_t lv_color_light_green_lighten_1(void) { return lv_color_hex(0x9CCC65); } -static inline lv_color_t lv_color_light_green_darken_1(void) { return lv_color_hex(0x7CB342); } -static inline lv_color_t lv_color_light_green_darken_2(void) { return lv_color_hex(0x689F38); } -static inline lv_color_t lv_color_light_green_darken_3(void) { return lv_color_hex(0x558B2F); } -static inline lv_color_t lv_color_light_green_darken_4(void) { return lv_color_hex(0x33691E); } - -static inline lv_color_t lv_color_lime(void) { return lv_color_hex(0xCDDC39); } -static inline lv_color_t lv_color_lime_lighten_5(void) { return lv_color_hex(0xF9FBE7); } -static inline lv_color_t lv_color_lime_lighten_4(void) { return lv_color_hex(0xF0F4C3); } -static inline lv_color_t lv_color_lime_lighten_3(void) { return lv_color_hex(0xE6EE9C); } -static inline lv_color_t lv_color_lime_lighten_2(void) { return lv_color_hex(0xDCE775); } -static inline lv_color_t lv_color_lime_lighten_1(void) { return lv_color_hex(0xD4E157); } -static inline lv_color_t lv_color_lime_darken_1(void) { return lv_color_hex(0xC0CA33); } -static inline lv_color_t lv_color_lime_darken_2(void) { return lv_color_hex(0xAFB42B); } -static inline lv_color_t lv_color_lime_darken_3(void) { return lv_color_hex(0x9E9D24); } -static inline lv_color_t lv_color_lime_darken_4(void) { return lv_color_hex(0x827717); } - -static inline lv_color_t lv_color_yellow(void) { return lv_color_hex(0xFFEB3B); } -static inline lv_color_t lv_color_yellow_lighten_5(void) { return lv_color_hex(0xFFFDE7); } -static inline lv_color_t lv_color_yellow_lighten_4(void) { return lv_color_hex(0xFFF9C4); } -static inline lv_color_t lv_color_yellow_lighten_3(void) { return lv_color_hex(0xFFF59D); } -static inline lv_color_t lv_color_yellow_lighten_2(void) { return lv_color_hex(0xFFF176); } -static inline lv_color_t lv_color_yellow_lighten_1(void) { return lv_color_hex(0xFFEE58); } -static inline lv_color_t lv_color_yellow_darken_1(void) { return lv_color_hex(0xFDD835); } -static inline lv_color_t lv_color_yellow_darken_2(void) { return lv_color_hex(0xFBC02D); } -static inline lv_color_t lv_color_yellow_darken_3(void) { return lv_color_hex(0xF9A825); } -static inline lv_color_t lv_color_yellow_darken_4(void) { return lv_color_hex(0xF57F17); } - -static inline lv_color_t lv_color_amber(void) { return lv_color_hex(0xFFC107); } -static inline lv_color_t lv_color_amber_lighten_5(void) { return lv_color_hex(0xFFF8E1); } -static inline lv_color_t lv_color_amber_lighten_4(void) { return lv_color_hex(0xFFECB3); } -static inline lv_color_t lv_color_amber_lighten_3(void) { return lv_color_hex(0xFFE082); } -static inline lv_color_t lv_color_amber_lighten_2(void) { return lv_color_hex(0xFFD54F); } -static inline lv_color_t lv_color_amber_lighten_1(void) { return lv_color_hex(0xFFCA28); } -static inline lv_color_t lv_color_amber_darken_1(void) { return lv_color_hex(0xFFB300); } -static inline lv_color_t lv_color_amber_darken_2(void) { return lv_color_hex(0xFFA000); } -static inline lv_color_t lv_color_amber_darken_3(void) { return lv_color_hex(0xFF8F00); } -static inline lv_color_t lv_color_amber_darken_4(void) { return lv_color_hex(0xFF6F00); } - -static inline lv_color_t lv_color_orange(void) { return lv_color_hex(0xFF9800); } -static inline lv_color_t lv_color_orange_lighten_5(void) { return lv_color_hex(0xFFF3E0); } -static inline lv_color_t lv_color_orange_lighten_4(void) { return lv_color_hex(0xFFE0B2); } -static inline lv_color_t lv_color_orange_lighten_3(void) { return lv_color_hex(0xFFCC80); } -static inline lv_color_t lv_color_orange_lighten_2(void) { return lv_color_hex(0xFFB74D); } -static inline lv_color_t lv_color_orange_lighten_1(void) { return lv_color_hex(0xFFA726); } -static inline lv_color_t lv_color_orange_darken_1(void) { return lv_color_hex(0xFB8C00); } -static inline lv_color_t lv_color_orange_darken_2(void) { return lv_color_hex(0xF57C00); } -static inline lv_color_t lv_color_orange_darken_3(void) { return lv_color_hex(0xEF6C00); } -static inline lv_color_t lv_color_orange_darken_4(void) { return lv_color_hex(0xE65100); } - -static inline lv_color_t lv_color_deep_orange(void) { return lv_color_hex(0xFF5722); } -static inline lv_color_t lv_color_deep_orange_lighten_5(void) { return lv_color_hex(0xFBE9E7); } -static inline lv_color_t lv_color_deep_orange_lighten_4(void) { return lv_color_hex(0xFFCCBC); } -static inline lv_color_t lv_color_deep_orange_lighten_3(void) { return lv_color_hex(0xFFAB91); } -static inline lv_color_t lv_color_deep_orange_lighten_2(void) { return lv_color_hex(0xFF8A65); } -static inline lv_color_t lv_color_deep_orange_lighten_1(void) { return lv_color_hex(0xFF7043); } -static inline lv_color_t lv_color_deep_orange_darken_1(void) { return lv_color_hex(0xF4511E); } -static inline lv_color_t lv_color_deep_orange_darken_2(void) { return lv_color_hex(0xE64A19); } -static inline lv_color_t lv_color_deep_orange_darken_3(void) { return lv_color_hex(0xD84315); } -static inline lv_color_t lv_color_deep_orange_darken_4(void) { return lv_color_hex(0xBF360C); } - -static inline lv_color_t lv_color_brown(void) { return lv_color_hex(0x795548); } -static inline lv_color_t lv_color_brown_lighten_5(void) { return lv_color_hex(0xEFEBE9); } -static inline lv_color_t lv_color_brown_lighten_4(void) { return lv_color_hex(0xD7CCC8); } -static inline lv_color_t lv_color_brown_lighten_3(void) { return lv_color_hex(0xBCAAA4); } -static inline lv_color_t lv_color_brown_lighten_2(void) { return lv_color_hex(0xA1887F); } -static inline lv_color_t lv_color_brown_lighten_1(void) { return lv_color_hex(0x8D6E63); } -static inline lv_color_t lv_color_brown_darken_1(void) { return lv_color_hex(0x6D4C41); } -static inline lv_color_t lv_color_brown_darken_2(void) { return lv_color_hex(0x5D4037); } -static inline lv_color_t lv_color_brown_darken_3(void) { return lv_color_hex(0x4E342E); } -static inline lv_color_t lv_color_brown_darken_4(void) { return lv_color_hex(0x3E2723); } - -static inline lv_color_t lv_color_blue_grey(void) { return lv_color_hex(0x607D8B); } -static inline lv_color_t lv_color_blue_grey_lighten_5(void) { return lv_color_hex(0xECEFF1); } -static inline lv_color_t lv_color_blue_grey_lighten_4(void) { return lv_color_hex(0xCFD8DC); } -static inline lv_color_t lv_color_blue_grey_lighten_3(void) { return lv_color_hex(0xB0BEC5); } -static inline lv_color_t lv_color_blue_grey_lighten_2(void) { return lv_color_hex(0x90A4AE); } -static inline lv_color_t lv_color_blue_grey_lighten_1(void) { return lv_color_hex(0x78909C); } -static inline lv_color_t lv_color_blue_grey_darken_1(void) { return lv_color_hex(0x546E7A); } -static inline lv_color_t lv_color_blue_grey_darken_2(void) { return lv_color_hex(0x455A64); } -static inline lv_color_t lv_color_blue_grey_darken_3(void) { return lv_color_hex(0x37474F); } -static inline lv_color_t lv_color_blue_grey_darken_4(void) { return lv_color_hex(0x263238); } - -static inline lv_color_t lv_color_grey(void) { return lv_color_hex(0x9E9E9E); } -static inline lv_color_t lv_color_grey_lighten_5(void) { return lv_color_hex(0xFAFAFA); } -static inline lv_color_t lv_color_grey_lighten_4(void) { return lv_color_hex(0xF5F5F5); } -static inline lv_color_t lv_color_grey_lighten_3(void) { return lv_color_hex(0xEEEEEE); } -static inline lv_color_t lv_color_grey_lighten_2(void) { return lv_color_hex(0xE0E0E0); } -static inline lv_color_t lv_color_grey_lighten_1(void) { return lv_color_hex(0xBDBDBD); } -static inline lv_color_t lv_color_grey_darken_1(void) { return lv_color_hex(0x757575); } -static inline lv_color_t lv_color_grey_darken_2(void) { return lv_color_hex(0x616161); } -static inline lv_color_t lv_color_grey_darken_3(void) { return lv_color_hex(0x424242); } -static inline lv_color_t lv_color_grey_darken_4(void) { return lv_color_hex(0x212121); } - -static inline lv_color_t lv_color_white(void) { return lv_color_hex(0xFFFFFF); } -static inline lv_color_t lv_color_black(void) { return lv_color_hex(0x000000); } - +lv_color_t lv_palette_main(lv_palette_t p); +static inline lv_color_t lv_color_white(void) { return lv_color_make(0xff, 0xff, 0xff);} +static inline lv_color_t lv_color_black(void) { return lv_color_make(0x00, 0x0, 0x00);} +lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl); +lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl); /********************** * MACROS **********************/ diff --git a/src/misc/lv_gc.h b/src/misc/lv_gc.h index 08a34357d..5f00f4377 100644 --- a/src/misc/lv_gc.h +++ b/src/misc/lv_gc.h @@ -20,6 +20,7 @@ extern "C" { #include "lv_timer.h" #include "../draw/lv_img_cache.h" #include "../draw/lv_draw_mask.h" +#include "../core/lv_obj_pos.h" /********************* * DEFINES @@ -47,6 +48,7 @@ extern "C" { LV_DISPATCH(f, lv_ll_t, _lv_group_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_img_decoder_ll) \ LV_DISPATCH(f, lv_ll_t, _lv_obj_style_trans_ll) \ + LV_DISPATCH(f, lv_layout_dsc_t *, _lv_layout_list) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t*, _lv_img_cache_array, LV_IMG_CACHE_DEF, 1) \ LV_DISPATCH_COND(f, lv_img_cache_entry_t, _lv_img_cache_single, LV_IMG_CACHE_DEF, 0) \ LV_DISPATCH(f, lv_timer_t*, _lv_timer_act) \ diff --git a/src/misc/lv_log.c b/src/misc/lv_log.c index 9ee1be339..83c80058e 100644 --- a/src/misc/lv_log.c +++ b/src/misc/lv_log.c @@ -70,11 +70,10 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * if(level >= LV_LOG_LEVEL) { va_list args; va_start(args, format); - char buf[256]; - lv_vsnprintf(buf, sizeof(buf), format, args); + char msg[256]; + lv_vsnprintf(msg, sizeof(msg), format, args); va_end(args); -#if LV_LOG_PRINTF /*Use only the file name not the path*/ size_t p; for(p = strlen(file); p > 0; p--) { @@ -84,15 +83,24 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * } } + char buf[512]; uint32_t t = lv_tick_get(); static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error", "User"}; - printf("[%s]\t(%d.%03d)\t %s: %s \t(in %s line #%d)\n", lvl_prefix[level], t / 1000, t % 1000, func, buf, &file[p], line); -#else - if(custom_print_cb) custom_print_cb(level, file, line, func, buf); -#endif + lv_snprintf(buf, sizeof(buf), "[%s]\t(%d.%03d)\t %s: %s \t(in %s line #%d)\n", lvl_prefix[level], t / 1000, t % 1000, func, msg, &file[p], line); + + lv_log(buf); } } +void lv_log(const char * buf) +{ +#if LV_LOG_PRINTF + printf("%s", buf); +#endif + if(custom_print_cb) custom_print_cb(buf); + +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/misc/lv_log.h b/src/misc/lv_log.h index f0d7dcbc2..7fd4b5e3e 100644 --- a/src/misc/lv_log.h +++ b/src/misc/lv_log.h @@ -45,9 +45,9 @@ typedef int8_t lv_log_level_t; **********************/ /** - * Log print function. Receives "Log Level", "File path", "Line number", "Function name" and "Description". + * Log print function. Receives a string buffer to print". */ -typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *, const char *); +typedef void (*lv_log_print_g_cb_t)(const char *buf); /********************** * GLOBAL PROTOTYPES @@ -57,18 +57,25 @@ typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t * Register custom print/write function to call when a log is added. * It can format its "File path", "Line number" and "Description" as required * and send the formatted log message to a console or serial port. - * @param print_cb a function pointer to print a log + * @param print_cb a function pointer to print a log */ void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb); +/** + * Print a log message via `printf` if enabled with `LV_LOG_PRINTF` in `lv_conf.h` + * and/or a print callback if registered with `lv_log_register_print_cb` + * @param buf a string message to print + */ +void lv_log(const char * buf); + /** * Add a log - * @param level the level of log. (From `lv_log_level_t` enum) - * @param file name of the file when the log added - * @param line line number in the source code where the log added - * @param func name of the function when the log added - * @param format printf-like format string - * @param ... parameters for `format` + * @param level the level of log. (From `lv_log_level_t` enum) + * @param file name of the file when the log added + * @param line line number in the source code where the log added + * @param func name of the function when the log added + * @param format printf-like format string + * @param ... parameters for `format` */ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...); diff --git a/src/misc/lv_math.c b/src/misc/lv_math.c index 071f00b30..fc107b138 100644 --- a/src/misc/lv_math.c +++ b/src/misc/lv_math.c @@ -8,8 +8,6 @@ *********************/ #include "lv_math.h" #include -#include -#include /********************* * DEFINES diff --git a/src/misc/lv_mem.c b/src/misc/lv_mem.c index 453e16722..49781bfe8 100644 --- a/src/misc/lv_mem.c +++ b/src/misc/lv_mem.c @@ -421,7 +421,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len) } } - uint32_t v32 = v + (v << 8) + (v << 16) + (v << 24); + uint32_t v32 = (uint32_t)v + ((uint32_t)v << 8) + ((uint32_t)v << 16) + ((uint32_t)v << 24); uint32_t * d32 = (uint32_t *)d8; diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index cc3476347..e77f5881d 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -55,6 +55,11 @@ void lv_style_reset(lv_style_t * style) { LV_ASSERT_STYLE(style); + if(style->is_const) { + LV_LOG_ERROR("Cannot reset const style"); + return; + } + if(style->prop_cnt > 1) lv_mem_free(style->v_p.values_and_props); lv_memset_00(style, sizeof(lv_style_t)); #if LV_USE_ASSERT_STYLE @@ -74,6 +79,11 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop) { LV_ASSERT_STYLE(style); + if(style->is_const) { + LV_LOG_ERROR("Cannot remove prop from const style"); + return false; + } + if(style->prop_cnt == 0) return false; if(style->prop_cnt == 1) { @@ -92,10 +102,11 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop) if(old_props[i] == prop) { lv_style_value_t * old_values = (lv_style_value_t *)style->v_p.values_and_props; - uint16_t * new_props = &style->prop1; - lv_style_value_t * new_values = &style->v_p.value1; - - if(style->prop_cnt > 2) { + if(style->prop_cnt == 2) { + style->prop_cnt = 1; + style->prop1 = i == 0 ? old_props[1] : old_props[0]; + style->v_p.value1 = i == 0 ? old_values[1] : old_values[0]; + } else { size_t size = (style->prop_cnt - 1) * (sizeof(lv_style_value_t) + sizeof(uint16_t)); uint8_t * new_values_and_props = lv_mem_alloc(size); if(new_values_and_props == NULL) return false; @@ -103,19 +114,15 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop) style->prop_cnt--; tmp = new_values_and_props + style->prop_cnt * sizeof(lv_style_value_t); - new_props = (uint16_t *)tmp; - new_values = (lv_style_value_t *)new_values_and_props; - } else { - style->prop_cnt = 1; - style->prop1 = i == 0 ? old_props[1] : old_props[0]; - style->v_p.value1 = i == 0 ? old_values[1] : old_values[0]; - } + uint16_t * new_props = (uint16_t *)tmp; + lv_style_value_t * new_values = (lv_style_value_t *)new_values_and_props; - uint32_t j; - for(i = j = 0; j <= style->prop_cnt; j++) { /*<=: because prop_cnt already reduced but all the old props. needs to be checked.*/ - if(old_props[j] != prop) { - new_values[i] = old_values[j]; - new_props[i++] = old_props[j]; + uint32_t j; + for(i = j = 0; j <= style->prop_cnt; j++) { /*<=: because prop_cnt already reduced but all the old props. needs to be checked.*/ + if(old_props[j] != prop) { + new_values[i] = old_values[j]; + new_props[i++] = old_props[j]; + } } } @@ -131,6 +138,11 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_ { LV_ASSERT_STYLE(style); + if(style->is_const) { + LV_LOG_ERROR("Cannot set property of constant style"); + return; + } + if(style->prop_cnt > 1) { uint8_t * tmp = style->v_p.values_and_props + style->prop_cnt * sizeof(lv_style_value_t); uint16_t * props = (uint16_t *)tmp; @@ -198,11 +210,11 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va return lv_style_get_prop_inlined(style, prop, value); } -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, const lv_anim_path_t * path, uint32_t time, uint32_t delay) +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay) { lv_memset_00(tr, sizeof(lv_style_transition_dsc_t)); tr->props = props; - tr->path = path == NULL ? &lv_anim_path_def : path; + tr->path_xcb = path_cb == NULL ? lv_anim_path_linear : path_cb; tr->time = time; tr->delay = delay; } @@ -237,9 +249,6 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) case LV_STYLE_TEXT_FONT: value.ptr = LV_FONT_DEFAULT; break; - case LV_STYLE_SIZE: - value.num = 5; - break; case LV_STYLE_MAX_WIDTH: case LV_STYLE_MAX_HEIGHT: value.num = LV_COORD_MAX; diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 87225e6b6..609676d63 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -31,10 +31,11 @@ extern "C" { /** * Flags for style properties */ -#define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/ -#define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/ -#define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/ -#define LV_STYLE_PROP_FILTER (1 << 13) /*Apply color filter*/ +#define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/ +#define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/ +#define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/ +#define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 13) /*Requires layout update on parent when changed*/ +#define LV_STYLE_PROP_FILTER (1 << 14) /*Apply color filter*/ /** * Other constants @@ -42,6 +43,12 @@ extern "C" { #define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/ LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE); +#if LV_USE_ASSERT_STYLE +#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .sentinel = LV_STYLE_SENTINEL_VALUE, .v_p = { .const_props = prop_array }, .has_group = 0xFF, .is_const = 1 } +#else +#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .v_p = { .const_props = prop_array }, .has_group = 0xFF, .is_const = 1 } +#endif + /********************** * TYPEDEFS **********************/ @@ -115,16 +122,18 @@ typedef enum { LV_STYLE_CLIP_CORNER = 2, LV_STYLE_TRANSFORM_WIDTH = 3 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_TRANSFORM_HEIGHT = 4 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_ZOOM = 5 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_TRANSFORM_ANGLE = 6 | LV_STYLE_PROP_EXT_DRAW, - LV_STYLE_OPA = 7 | LV_STYLE_PROP_INHERIT, + LV_STYLE_TRANSLATE_X = 5 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSLATE_Y = 6 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR, + LV_STYLE_TRANSFORM_ZOOM = 7 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_TRANSFORM_ANGLE = 8 | LV_STYLE_PROP_EXT_DRAW, + LV_STYLE_OPA = 9 | LV_STYLE_PROP_INHERIT, - LV_STYLE_COLOR_FILTER_DSC = 8, - LV_STYLE_COLOR_FILTER_OPA = 9, - LV_STYLE_ANIM_TIME = 10, - LV_STYLE_TRANSITION = 11, - LV_STYLE_SIZE = 12, - LV_STYLE_BLEND_MODE = 13, + LV_STYLE_COLOR_FILTER_DSC = 10, + LV_STYLE_COLOR_FILTER_OPA = 11, + LV_STYLE_ANIM_TIME = 12, + LV_STYLE_ANIM_SPEED = 12, + LV_STYLE_TRANSITION = 14, + LV_STYLE_BLEND_MODE = 15, /*Group 1*/ LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_LAYOUT_REFR, @@ -217,7 +226,7 @@ typedef enum { _LV_STYLE_LAST_BUILT_IN_PROP = 111, - LV_STYLE_PROP_ALL = 0xFFFF + LV_STYLE_PROP_ANY = 0xFFFF }lv_style_prop_t; /** @@ -225,17 +234,22 @@ typedef enum { */ typedef struct _lv_style_transiton_t { const lv_style_prop_t * props; /**< An array with the properties to animate.*/ - const lv_anim_path_t * path; /**< A path for the animation.*/ +#if LV_USE_USER_DATA + void * user_data; /**< A custom user data that will be passed to the animation's user_data */ +#endif + lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/ uint32_t time; /**< Duration of the transition in [ms]*/ uint32_t delay; /**< Delay before the transition in [ms]*/ }lv_style_transition_dsc_t; -#if LV_USE_ASSERT_STYLE -# define _LV_STYLE_SENTINEL uint32_t sentinel; -#else -# define _LV_STYLE_SENTINEL -#endif +/** + * Descriptor of a constant style property. + */ +typedef struct { + lv_style_prop_t prop; + lv_style_value_t value; +} lv_style_const_prop_t; /** * Descriptor of a style (a collection of properties and values). */ @@ -250,9 +264,11 @@ typedef struct { union { lv_style_value_t value1; uint8_t * values_and_props; + const lv_style_const_prop_t * const_props; } v_p; - uint16_t prop1; + uint16_t prop1 :15; + uint16_t is_const :1; uint8_t has_group; uint8_t prop_cnt; } lv_style_t; @@ -288,7 +304,7 @@ void lv_style_reset(lv_style_t * style); * ... * MY_PROP = lv_style_register_prop(); * ... - * lv_style_set_my_prop(&style1, lv_color_red()); + * lv_style_set_my_prop(&style1, lv_palette_main(LV_PALETTE_RED)); */ lv_style_prop_t lv_style_register_prop(void); @@ -334,6 +350,17 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va */ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value) { + if(style->is_const) { + const lv_style_const_prop_t *const_prop; + for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) { + if(const_prop->prop == prop) { + *value = const_prop->value; + return LV_RES_OK; + } + } + return LV_RES_INV; + } + if(style->prop_cnt == 0) return LV_RES_INV; if(style->prop_cnt > 1) { @@ -356,18 +383,17 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr /** * Initialize a transition descriptor. - * @param tr pointer to a transition descriptor to initialize - * @param props an array with the properties to transition. The last element must be zero. - * @param path and animation path. If `NULL` a default liner path will be used. - * @param time duration of the transition in [ms] - * @param delay delay before the transition in [ms] + * @param tr pointer to a transition descriptor to initialize + * @param props an array with the properties to transition. The last element must be zero. + * @param path_cb and animation path (ease) callback. If `NULL` liner path will be used. + * @param time duration of the transition in [ms] + * @param delay delay before the transition in [ms] * @example * const static lv_style_prop_t trans_props[] = { LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, 0 }; * static lv_style_transition_dsc_t trans1; * lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0); - * @note For performance reasons there are no sanity check on `style` */ -void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t * props, const lv_anim_path_t * path, uint32_t time, uint32_t delay); +void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay); /** * Get the default value of a property @@ -415,6 +441,11 @@ static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value) { lv_style_set_pad_column(style, value); } +static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) { + lv_style_set_width(style, value); + lv_style_set_height(style, value); +} + /************************* * GLOBAL VARIABLES diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index b75a98eb8..6e198d9f6 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -6,6 +6,14 @@ static inline void lv_style_set_radius(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_RADIUS, v); } +#define LV_STYLE_CONST_RADIUS(val) \ + { \ + .prop = LV_STYLE_RADIUS, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_clip_corner(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -14,6 +22,14 @@ static inline void lv_style_set_clip_corner(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_CLIP_CORNER, v); } +#define LV_STYLE_CONST_CLIP_CORNER(val) \ + { \ + .prop = LV_STYLE_CLIP_CORNER, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_transform_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -22,6 +38,14 @@ static inline void lv_style_set_transform_width(lv_style_t * style, lv_coord_t v lv_style_set_prop(style, LV_STYLE_TRANSFORM_WIDTH, v); } +#define LV_STYLE_CONST_TRANSFORM_WIDTH(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -30,6 +54,46 @@ static inline void lv_style_set_transform_height(lv_style_t * style, lv_coord_t lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); } +#define LV_STYLE_CONST_TRANSFORM_HEIGHT(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_HEIGHT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + +static inline void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_TRANSLATE_X, v); +} + +#define LV_STYLE_CONST_TRANSLATE_X(val) \ + { \ + .prop = LV_STYLE_TRANSLATE_X, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + +static inline void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_TRANSLATE_Y, v); +} + +#define LV_STYLE_CONST_TRANSLATE_Y(val) \ + { \ + .prop = LV_STYLE_TRANSLATE_Y, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -38,6 +102,14 @@ static inline void lv_style_set_transform_zoom(lv_style_t * style, lv_coord_t va lv_style_set_prop(style, LV_STYLE_TRANSFORM_ZOOM, v); } +#define LV_STYLE_CONST_TRANSFORM_ZOOM(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_ZOOM, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -46,6 +118,14 @@ static inline void lv_style_set_transform_angle(lv_style_t * style, lv_coord_t v lv_style_set_prop(style, LV_STYLE_TRANSFORM_ANGLE, v); } +#define LV_STYLE_CONST_TRANSFORM_ANGLE(val) \ + { \ + .prop = LV_STYLE_TRANSFORM_ANGLE, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -54,6 +134,14 @@ static inline void lv_style_set_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OPA, v); } +#define LV_STYLE_CONST_OPA(val) \ + { \ + .prop = LV_STYLE_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value) { lv_style_value_t v = { @@ -62,6 +150,14 @@ static inline void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_co lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_DSC, v); } +#define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \ + { \ + .prop = LV_STYLE_COLOR_FILTER_DSC, \ + .value = { \ + .ptr = val \ + } \ + } + static inline void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -70,6 +166,14 @@ static inline void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t va lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_OPA, v); } +#define LV_STYLE_CONST_COLOR_FILTER_OPA(val) \ + { \ + .prop = LV_STYLE_COLOR_FILTER_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_anim_time(lv_style_t * style, uint32_t value) { lv_style_value_t v = { @@ -78,6 +182,30 @@ static inline void lv_style_set_anim_time(lv_style_t * style, uint32_t value) lv_style_set_prop(style, LV_STYLE_ANIM_TIME, v); } +#define LV_STYLE_CONST_ANIM_TIME(val) \ + { \ + .prop = LV_STYLE_ANIM_TIME, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + +static inline void lv_style_set_anim_speed(lv_style_t * style, uint32_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_ANIM_SPEED, v); +} + +#define LV_STYLE_CONST_ANIM_SPEED(val) \ + { \ + .prop = LV_STYLE_ANIM_SPEED, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value) { lv_style_value_t v = { @@ -86,13 +214,13 @@ static inline void lv_style_set_transition(lv_style_t * style, const lv_style_tr lv_style_set_prop(style, LV_STYLE_TRANSITION, v); } -static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) -{ - lv_style_value_t v = { - .num = (int32_t)value - }; - lv_style_set_prop(style, LV_STYLE_SIZE, v); -} +#define LV_STYLE_CONST_TRANSITION(val) \ + { \ + .prop = LV_STYLE_TRANSITION, \ + .value = { \ + .ptr = val \ + } \ + } static inline void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value) { @@ -102,6 +230,14 @@ static inline void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t v lv_style_set_prop(style, LV_STYLE_BLEND_MODE, v); } +#define LV_STYLE_CONST_BLEND_MODE(val) \ + { \ + .prop = LV_STYLE_BLEND_MODE, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -110,6 +246,14 @@ static inline void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_TOP, v); } +#define LV_STYLE_CONST_PAD_TOP(val) \ + { \ + .prop = LV_STYLE_PAD_TOP, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -118,6 +262,14 @@ static inline void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_BOTTOM, v); } +#define LV_STYLE_CONST_PAD_BOTTOM(val) \ + { \ + .prop = LV_STYLE_PAD_BOTTOM, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -126,6 +278,14 @@ static inline void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_LEFT, v); } +#define LV_STYLE_CONST_PAD_LEFT(val) \ + { \ + .prop = LV_STYLE_PAD_LEFT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -134,6 +294,14 @@ static inline void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_RIGHT, v); } +#define LV_STYLE_CONST_PAD_RIGHT(val) \ + { \ + .prop = LV_STYLE_PAD_RIGHT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -142,6 +310,14 @@ static inline void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_ROW, v); } +#define LV_STYLE_CONST_PAD_ROW(val) \ + { \ + .prop = LV_STYLE_PAD_ROW, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -150,6 +326,14 @@ static inline void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_PAD_COLUMN, v); } +#define LV_STYLE_CONST_PAD_COLUMN(val) \ + { \ + .prop = LV_STYLE_PAD_COLUMN, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -158,6 +342,14 @@ static inline void lv_style_set_width(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_WIDTH, v); } +#define LV_STYLE_CONST_WIDTH(val) \ + { \ + .prop = LV_STYLE_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_min_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -166,6 +358,14 @@ static inline void lv_style_set_min_width(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_MIN_WIDTH, v); } +#define LV_STYLE_CONST_MIN_WIDTH(val) \ + { \ + .prop = LV_STYLE_MIN_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_max_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -174,6 +374,14 @@ static inline void lv_style_set_max_width(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_MAX_WIDTH, v); } +#define LV_STYLE_CONST_MAX_WIDTH(val) \ + { \ + .prop = LV_STYLE_MAX_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_height(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -182,6 +390,14 @@ static inline void lv_style_set_height(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_HEIGHT, v); } +#define LV_STYLE_CONST_HEIGHT(val) \ + { \ + .prop = LV_STYLE_HEIGHT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_min_height(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -190,6 +406,14 @@ static inline void lv_style_set_min_height(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_MIN_HEIGHT, v); } +#define LV_STYLE_CONST_MIN_HEIGHT(val) \ + { \ + .prop = LV_STYLE_MIN_HEIGHT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_max_height(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -198,6 +422,14 @@ static inline void lv_style_set_max_height(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_MAX_HEIGHT, v); } +#define LV_STYLE_CONST_MAX_HEIGHT(val) \ + { \ + .prop = LV_STYLE_MAX_HEIGHT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_x(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -206,6 +438,14 @@ static inline void lv_style_set_x(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_X, v); } +#define LV_STYLE_CONST_X(val) \ + { \ + .prop = LV_STYLE_X, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_y(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -214,6 +454,14 @@ static inline void lv_style_set_y(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_Y, v); } +#define LV_STYLE_CONST_Y(val) \ + { \ + .prop = LV_STYLE_Y, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_align(lv_style_t * style, lv_align_t value) { lv_style_value_t v = { @@ -222,6 +470,14 @@ static inline void lv_style_set_align(lv_style_t * style, lv_align_t value) lv_style_set_prop(style, LV_STYLE_ALIGN, v); } +#define LV_STYLE_CONST_ALIGN(val) \ + { \ + .prop = LV_STYLE_ALIGN, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_layout(lv_style_t * style, uint16_t value) { lv_style_value_t v = { @@ -230,6 +486,14 @@ static inline void lv_style_set_layout(lv_style_t * style, uint16_t value) lv_style_set_prop(style, LV_STYLE_LAYOUT, v); } +#define LV_STYLE_CONST_LAYOUT(val) \ + { \ + .prop = LV_STYLE_LAYOUT, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -238,6 +502,14 @@ static inline void lv_style_set_bg_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_BG_COLOR, v); } +#define LV_STYLE_CONST_BG_COLOR(val) \ + { \ + .prop = LV_STYLE_BG_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -246,6 +518,14 @@ static inline void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t lv_style_set_prop(style, LV_STYLE_BG_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_BG_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_BG_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -254,6 +534,14 @@ static inline void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_OPA, v); } +#define LV_STYLE_CONST_BG_OPA(val) \ + { \ + .prop = LV_STYLE_BG_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -262,6 +550,14 @@ static inline void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t val lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR, v); } +#define LV_STYLE_CONST_BG_GRAD_COLOR(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -270,6 +566,14 @@ static inline void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_co lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_BG_GRAD_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value) { lv_style_value_t v = { @@ -278,6 +582,14 @@ static inline void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t va lv_style_set_prop(style, LV_STYLE_BG_GRAD_DIR, v); } +#define LV_STYLE_CONST_BG_GRAD_DIR(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_DIR, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -286,6 +598,14 @@ static inline void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_BG_MAIN_STOP, v); } +#define LV_STYLE_CONST_BG_MAIN_STOP(val) \ + { \ + .prop = LV_STYLE_BG_MAIN_STOP, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -294,6 +614,14 @@ static inline void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_BG_GRAD_STOP, v); } +#define LV_STYLE_CONST_BG_GRAD_STOP(val) \ + { \ + .prop = LV_STYLE_BG_GRAD_STOP, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_img_src(lv_style_t * style, const void * value) { lv_style_value_t v = { @@ -302,6 +630,14 @@ static inline void lv_style_set_bg_img_src(lv_style_t * style, const void * valu lv_style_set_prop(style, LV_STYLE_BG_IMG_SRC, v); } +#define LV_STYLE_CONST_BG_IMG_SRC(val) \ + { \ + .prop = LV_STYLE_BG_IMG_SRC, \ + .value = { \ + .ptr = val \ + } \ + } + static inline void lv_style_set_bg_img_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -310,6 +646,14 @@ static inline void lv_style_set_bg_img_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_IMG_OPA, v); } +#define LV_STYLE_CONST_BG_IMG_OPA(val) \ + { \ + .prop = LV_STYLE_BG_IMG_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_img_recolor(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -318,6 +662,14 @@ static inline void lv_style_set_bg_img_recolor(lv_style_t * style, lv_color_t va lv_style_set_prop(style, LV_STYLE_BG_IMG_RECOLOR, v); } +#define LV_STYLE_CONST_BG_IMG_RECOLOR(val) \ + { \ + .prop = LV_STYLE_BG_IMG_RECOLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_img_recolor_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -326,6 +678,14 @@ static inline void lv_style_set_bg_img_recolor_filtered(lv_style_t * style, lv_c lv_style_set_prop(style, LV_STYLE_BG_IMG_RECOLOR_FILTERED, v); } +#define LV_STYLE_CONST_BG_IMG_RECOLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_BG_IMG_RECOLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_bg_img_recolor_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -334,6 +694,14 @@ static inline void lv_style_set_bg_img_recolor_opa(lv_style_t * style, lv_opa_t lv_style_set_prop(style, LV_STYLE_BG_IMG_RECOLOR_OPA, v); } +#define LV_STYLE_CONST_BG_IMG_RECOLOR_OPA(val) \ + { \ + .prop = LV_STYLE_BG_IMG_RECOLOR_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_bg_img_tiled(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -342,6 +710,14 @@ static inline void lv_style_set_bg_img_tiled(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_BG_IMG_TILED, v); } +#define LV_STYLE_CONST_BG_IMG_TILED(val) \ + { \ + .prop = LV_STYLE_BG_IMG_TILED, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_border_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -350,6 +726,14 @@ static inline void lv_style_set_border_color(lv_style_t * style, lv_color_t valu lv_style_set_prop(style, LV_STYLE_BORDER_COLOR, v); } +#define LV_STYLE_CONST_BORDER_COLOR(val) \ + { \ + .prop = LV_STYLE_BORDER_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_border_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -358,6 +742,14 @@ static inline void lv_style_set_border_color_filtered(lv_style_t * style, lv_col lv_style_set_prop(style, LV_STYLE_BORDER_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_BORDER_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_BORDER_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -366,6 +758,14 @@ static inline void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BORDER_OPA, v); } +#define LV_STYLE_CONST_BORDER_OPA(val) \ + { \ + .prop = LV_STYLE_BORDER_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_border_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -374,6 +774,14 @@ static inline void lv_style_set_border_width(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_BORDER_WIDTH, v); } +#define LV_STYLE_CONST_BORDER_WIDTH(val) \ + { \ + .prop = LV_STYLE_BORDER_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value) { lv_style_value_t v = { @@ -382,6 +790,14 @@ static inline void lv_style_set_border_side(lv_style_t * style, lv_border_side_t lv_style_set_prop(style, LV_STYLE_BORDER_SIDE, v); } +#define LV_STYLE_CONST_BORDER_SIDE(val) \ + { \ + .prop = LV_STYLE_BORDER_SIDE, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_border_post(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -390,6 +806,14 @@ static inline void lv_style_set_border_post(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_BORDER_POST, v); } +#define LV_STYLE_CONST_BORDER_POST(val) \ + { \ + .prop = LV_STYLE_BORDER_POST, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_text_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -398,6 +822,14 @@ static inline void lv_style_set_text_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_TEXT_COLOR, v); } +#define LV_STYLE_CONST_TEXT_COLOR(val) \ + { \ + .prop = LV_STYLE_TEXT_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_text_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -406,6 +838,14 @@ static inline void lv_style_set_text_color_filtered(lv_style_t * style, lv_color lv_style_set_prop(style, LV_STYLE_TEXT_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_TEXT_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_TEXT_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -414,6 +854,14 @@ static inline void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_TEXT_OPA, v); } +#define LV_STYLE_CONST_TEXT_OPA(val) \ + { \ + .prop = LV_STYLE_TEXT_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value) { lv_style_value_t v = { @@ -422,6 +870,14 @@ static inline void lv_style_set_text_font(lv_style_t * style, const lv_font_t * lv_style_set_prop(style, LV_STYLE_TEXT_FONT, v); } +#define LV_STYLE_CONST_TEXT_FONT(val) \ + { \ + .prop = LV_STYLE_TEXT_FONT, \ + .value = { \ + .ptr = val \ + } \ + } + static inline void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -430,6 +886,14 @@ static inline void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t lv_style_set_prop(style, LV_STYLE_TEXT_LETTER_SPACE, v); } +#define LV_STYLE_CONST_TEXT_LETTER_SPACE(val) \ + { \ + .prop = LV_STYLE_TEXT_LETTER_SPACE, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -438,6 +902,14 @@ static inline void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t v lv_style_set_prop(style, LV_STYLE_TEXT_LINE_SPACE, v); } +#define LV_STYLE_CONST_TEXT_LINE_SPACE(val) \ + { \ + .prop = LV_STYLE_TEXT_LINE_SPACE, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value) { lv_style_value_t v = { @@ -446,6 +918,14 @@ static inline void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t v lv_style_set_prop(style, LV_STYLE_TEXT_DECOR, v); } +#define LV_STYLE_CONST_TEXT_DECOR(val) \ + { \ + .prop = LV_STYLE_TEXT_DECOR, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value) { lv_style_value_t v = { @@ -454,6 +934,14 @@ static inline void lv_style_set_text_align(lv_style_t * style, lv_text_align_t v lv_style_set_prop(style, LV_STYLE_TEXT_ALIGN, v); } +#define LV_STYLE_CONST_TEXT_ALIGN(val) \ + { \ + .prop = LV_STYLE_TEXT_ALIGN, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_img_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -462,6 +950,14 @@ static inline void lv_style_set_img_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_IMG_OPA, v); } +#define LV_STYLE_CONST_IMG_OPA(val) \ + { \ + .prop = LV_STYLE_IMG_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -470,6 +966,14 @@ static inline void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR, v); } +#define LV_STYLE_CONST_IMG_RECOLOR(val) \ + { \ + .prop = LV_STYLE_IMG_RECOLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -478,6 +982,14 @@ static inline void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_colo lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_FILTERED, v); } +#define LV_STYLE_CONST_IMG_RECOLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_IMG_RECOLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -486,6 +998,14 @@ static inline void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t val lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_OPA, v); } +#define LV_STYLE_CONST_IMG_RECOLOR_OPA(val) \ + { \ + .prop = LV_STYLE_IMG_RECOLOR_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -494,6 +1014,14 @@ static inline void lv_style_set_outline_width(lv_style_t * style, lv_coord_t val lv_style_set_prop(style, LV_STYLE_OUTLINE_WIDTH, v); } +#define LV_STYLE_CONST_OUTLINE_WIDTH(val) \ + { \ + .prop = LV_STYLE_OUTLINE_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_outline_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -502,6 +1030,14 @@ static inline void lv_style_set_outline_color(lv_style_t * style, lv_color_t val lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR, v); } +#define LV_STYLE_CONST_OUTLINE_COLOR(val) \ + { \ + .prop = LV_STYLE_OUTLINE_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_outline_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -510,6 +1046,14 @@ static inline void lv_style_set_outline_color_filtered(lv_style_t * style, lv_co lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_OUTLINE_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_OUTLINE_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -518,6 +1062,14 @@ static inline void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OUTLINE_OPA, v); } +#define LV_STYLE_CONST_OUTLINE_OPA(val) \ + { \ + .prop = LV_STYLE_OUTLINE_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -526,6 +1078,14 @@ static inline void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value lv_style_set_prop(style, LV_STYLE_OUTLINE_PAD, v); } +#define LV_STYLE_CONST_OUTLINE_PAD(val) \ + { \ + .prop = LV_STYLE_OUTLINE_PAD, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -534,6 +1094,14 @@ static inline void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_SHADOW_WIDTH, v); } +#define LV_STYLE_CONST_SHADOW_WIDTH(val) \ + { \ + .prop = LV_STYLE_SHADOW_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_shadow_ofs_x(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -542,6 +1110,14 @@ static inline void lv_style_set_shadow_ofs_x(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_X, v); } +#define LV_STYLE_CONST_SHADOW_OFS_X(val) \ + { \ + .prop = LV_STYLE_SHADOW_OFS_X, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_shadow_ofs_y(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -550,6 +1126,14 @@ static inline void lv_style_set_shadow_ofs_y(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_SHADOW_OFS_Y, v); } +#define LV_STYLE_CONST_SHADOW_OFS_Y(val) \ + { \ + .prop = LV_STYLE_SHADOW_OFS_Y, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -558,6 +1142,14 @@ static inline void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t val lv_style_set_prop(style, LV_STYLE_SHADOW_SPREAD, v); } +#define LV_STYLE_CONST_SHADOW_SPREAD(val) \ + { \ + .prop = LV_STYLE_SHADOW_SPREAD, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -566,6 +1158,14 @@ static inline void lv_style_set_shadow_color(lv_style_t * style, lv_color_t valu lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR, v); } +#define LV_STYLE_CONST_SHADOW_COLOR(val) \ + { \ + .prop = LV_STYLE_SHADOW_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -574,6 +1174,14 @@ static inline void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_col lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_SHADOW_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_SHADOW_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -582,6 +1190,14 @@ static inline void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_OPA, v); } +#define LV_STYLE_CONST_SHADOW_OPA(val) \ + { \ + .prop = LV_STYLE_SHADOW_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_line_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -590,6 +1206,14 @@ static inline void lv_style_set_line_width(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_LINE_WIDTH, v); } +#define LV_STYLE_CONST_LINE_WIDTH(val) \ + { \ + .prop = LV_STYLE_LINE_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -598,6 +1222,14 @@ static inline void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t v lv_style_set_prop(style, LV_STYLE_LINE_DASH_WIDTH, v); } +#define LV_STYLE_CONST_LINE_DASH_WIDTH(val) \ + { \ + .prop = LV_STYLE_LINE_DASH_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -606,6 +1238,14 @@ static inline void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t val lv_style_set_prop(style, LV_STYLE_LINE_DASH_GAP, v); } +#define LV_STYLE_CONST_LINE_DASH_GAP(val) \ + { \ + .prop = LV_STYLE_LINE_DASH_GAP, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_line_rounded(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -614,6 +1254,14 @@ static inline void lv_style_set_line_rounded(lv_style_t * style, lv_coord_t valu lv_style_set_prop(style, LV_STYLE_LINE_ROUNDED, v); } +#define LV_STYLE_CONST_LINE_ROUNDED(val) \ + { \ + .prop = LV_STYLE_LINE_ROUNDED, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_line_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -622,6 +1270,14 @@ static inline void lv_style_set_line_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_LINE_COLOR, v); } +#define LV_STYLE_CONST_LINE_COLOR(val) \ + { \ + .prop = LV_STYLE_LINE_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_line_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -630,6 +1286,14 @@ static inline void lv_style_set_line_color_filtered(lv_style_t * style, lv_color lv_style_set_prop(style, LV_STYLE_LINE_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_LINE_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_LINE_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -638,6 +1302,14 @@ static inline void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_LINE_OPA, v); } +#define LV_STYLE_CONST_LINE_OPA(val) \ + { \ + .prop = LV_STYLE_LINE_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -646,6 +1318,14 @@ static inline void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value) lv_style_set_prop(style, LV_STYLE_ARC_WIDTH, v); } +#define LV_STYLE_CONST_ARC_WIDTH(val) \ + { \ + .prop = LV_STYLE_ARC_WIDTH, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_arc_rounded(lv_style_t * style, lv_coord_t value) { lv_style_value_t v = { @@ -654,6 +1334,14 @@ static inline void lv_style_set_arc_rounded(lv_style_t * style, lv_coord_t value lv_style_set_prop(style, LV_STYLE_ARC_ROUNDED, v); } +#define LV_STYLE_CONST_ARC_ROUNDED(val) \ + { \ + .prop = LV_STYLE_ARC_ROUNDED, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_arc_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -662,6 +1350,14 @@ static inline void lv_style_set_arc_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_ARC_COLOR, v); } +#define LV_STYLE_CONST_ARC_COLOR(val) \ + { \ + .prop = LV_STYLE_ARC_COLOR, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_arc_color_filtered(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -670,6 +1366,14 @@ static inline void lv_style_set_arc_color_filtered(lv_style_t * style, lv_color_ lv_style_set_prop(style, LV_STYLE_ARC_COLOR_FILTERED, v); } +#define LV_STYLE_CONST_ARC_COLOR_FILTERED(val) \ + { \ + .prop = LV_STYLE_ARC_COLOR_FILTERED, \ + .value = { \ + .color = val \ + } \ + } + static inline void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -678,6 +1382,14 @@ static inline void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_ARC_OPA, v); } +#define LV_STYLE_CONST_ARC_OPA(val) \ + { \ + .prop = LV_STYLE_ARC_OPA, \ + .value = { \ + .num = (int32_t)val \ + } \ + } + static inline void lv_style_set_arc_img_src(lv_style_t * style, const void * value) { lv_style_value_t v = { @@ -686,3 +1398,11 @@ static inline void lv_style_set_arc_img_src(lv_style_t * style, const void * val lv_style_set_prop(style, LV_STYLE_ARC_IMG_SRC, v); } +#define LV_STYLE_CONST_ARC_IMG_SRC(val) \ + { \ + .prop = LV_STYLE_ARC_IMG_SRC, \ + .value = { \ + .ptr = val \ + } \ + } + diff --git a/src/misc/lv_timer.c b/src/misc/lv_timer.c index b751c6284..24f3bed11 100644 --- a/src/misc/lv_timer.c +++ b/src/misc/lv_timer.c @@ -196,12 +196,17 @@ void lv_timer_del(lv_timer_t * timer) /** * Pause/resume a timer. * @param timer pointer to an lv_timer - * @param pause true: pause the timer; false: resume */ -void lv_timer_pause(lv_timer_t * timer, bool pause) +void lv_timer_pause(lv_timer_t * timer) { - timer->paused = pause; + timer->paused = true; } + +void lv_timer_resume(lv_timer_t * timer) +{ + timer->paused = false; +} + /** * Set new period for a lv_timer * @param timer pointer to a lv_timer @@ -283,19 +288,27 @@ static bool lv_timer_exec(lv_timer_t * timer) { if(timer->paused) return false; + if(timer->repeat_count == 0) { + TIMER_TRACE("deleting timer with %p callback because the repeat count is over", timer->timer_cb); + lv_timer_del(timer); + return false; + } + bool exec = false; if(lv_timer_time_remaining(timer) == 0) { + /* Decrement the repeat count before executing the timer_cb. + * If any timer is deleted `if(timer->repeat_count == 0)` is not executed below + * but at least the repeat count is zero and the timer can be deleted in the next round*/ + int32_t original_repeat_count = timer->repeat_count; + if(timer->repeat_count > 0) timer->repeat_count--; timer->last_run = lv_tick_get(); TIMER_TRACE("calling timer callback: %p", timer->timer_cb); - if(timer->timer_cb) timer->timer_cb(timer); + if(timer->timer_cb && original_repeat_count != 0) timer->timer_cb(timer); TIMER_TRACE("timer callback %p finished", timer->timer_cb); LV_ASSERT_MEM_INTEGRITY(); /*Delete if it was a one shot lv_timer*/ if(timer_deleted == false) { /*The timer might be deleted by itself as well*/ - if(timer->repeat_count > 0) { - timer->repeat_count--; - } if(timer->repeat_count == 0) { TIMER_TRACE("deleting timer with %p callback because the repeat count is over", timer->timer_cb); lv_timer_del(timer); diff --git a/src/misc/lv_timer.h b/src/misc/lv_timer.h index 3eae483a1..045bc59c2 100644 --- a/src/misc/lv_timer.h +++ b/src/misc/lv_timer.h @@ -98,7 +98,9 @@ void lv_timer_del(lv_timer_t * timer); * @param timer pointer to an lv_timer * @param pause true: pause the timer; false: resume */ -void lv_timer_pause(lv_timer_t * timer, bool pause); +void lv_timer_pause(lv_timer_t * timer); + +void lv_timer_resume(lv_timer_t * timer); /** * Set the callback the timer (the function to call periodically) diff --git a/src/misc/lv_tlsf.c b/src/misc/lv_tlsf.c index 0ae03c9e0..94c129e67 100644 --- a/src/misc/lv_tlsf.c +++ b/src/misc/lv_tlsf.c @@ -4,12 +4,8 @@ #include #include #include -#include -#include -#include - #include "lv_tlsf.h" - +#include "lv_mem.h" #include "lv_log.h" #define printf LV_LOG_ERROR @@ -1265,7 +1261,7 @@ void* tlsf_realloc(tlsf_t tlsf, void* ptr, size_t size) if (p) { const size_t minsize = tlsf_min(cursize, size); - memcpy(p, ptr, minsize); + lv_memcpy(p, ptr, minsize); tlsf_free(tlsf, ptr); } } diff --git a/src/misc/lv_utils.c b/src/misc/lv_utils.c index 61ae7bb62..7f73ba18b 100644 --- a/src/misc/lv_utils.c +++ b/src/misc/lv_utils.c @@ -37,43 +37,6 @@ * GLOBAL FUNCTIONS **********************/ -/** - * Convert a number to string - * @param num a number - * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) - * @return same as `buf` (just for convenience) - */ -char * _lv_utils_num_to_str(int32_t num, char * buf) -{ - if(num == 0) { - buf[0] = '0'; - buf[1] = '\0'; - return buf; - } - int8_t digitCount = 0; - int8_t i = 0; - if(num < 0) { - buf[digitCount++] = '-'; - num = LV_ABS(num); - ++i; - } - while(num) { - char digit = num % 10; - buf[digitCount++] = digit + 48; - num /= 10; - } - buf[digitCount] = '\0'; - digitCount--; - while(digitCount > i) { - char temp = buf[i]; - buf[i] = buf[digitCount]; - buf[digitCount] = temp; - digitCount--; - i++; - } - return buf; -} - /** Searches base[0] to base[n - 1] for an item that matches *key. * * @note The function cmp must return negative if its first diff --git a/src/misc/lv_utils.h b/src/misc/lv_utils.h index 313760f21..c798f1b15 100644 --- a/src/misc/lv_utils.h +++ b/src/misc/lv_utils.h @@ -27,13 +27,6 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ -/** - * Convert a number to string - * @param num a number - * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) - * @return same as `buf` (just for convenience) - */ -char * _lv_utils_num_to_str(int32_t num, char * buf); /** Searches base[0] to base[n - 1] for an item that matches *key. * diff --git a/src/widgets/lv_arc.c b/src/widgets/lv_arc.c index 80db692d0..87703ca1c 100644 --- a/src/widgets/lv_arc.c +++ b/src/widgets/lv_arc.c @@ -31,8 +31,8 @@ **********************/ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_arc_draw(lv_obj_t * obj); -static void lv_arc_event(lv_obj_t * obj, lv_event_t e); +static void lv_arc_draw(lv_event_t * e); +static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e); static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_part_t part); static void get_center(lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); @@ -65,7 +65,7 @@ const lv_obj_class_t lv_arc_class = { lv_obj_t * lv_arc_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_arc_class, parent); + return lv_obj_class_create_obj(&lv_arc_class, parent, NULL); } /*====================== @@ -283,7 +283,7 @@ void lv_arc_set_rotation(lv_obj_t * obj, uint16_t rotation) * @param arc pointer to arc object * @param type arc type */ -void lv_arc_set_type(lv_obj_t * obj, lv_arc_type_t type) +void lv_arc_set_mode(lv_obj_t * obj, lv_arc_mode_t type) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_arc_t * arc = (lv_arc_t *)obj; @@ -297,12 +297,12 @@ void lv_arc_set_type(lv_obj_t * obj, lv_arc_type_t type) if(arc->bg_angle_end bg_angle_start) bg_end =arc->bg_angle_end + 360; switch(arc->type) { - case LV_ARC_TYPE_SYMMETRIC: + case LV_ARC_MODE_SYMMETRICAL: bg_midpoint = (arc->bg_angle_start + bg_end) / 2; lv_arc_set_start_angle(obj, bg_midpoint); lv_arc_set_end_angle(obj, bg_midpoint); break; - case LV_ARC_TYPE_REVERSE: + case LV_ARC_MODE_REVERSE: lv_arc_set_end_angle(obj,arc->bg_angle_end); break; default: /** LV_ARC_TYPE_NORMAL*/ @@ -366,7 +366,7 @@ void lv_arc_set_range(lv_obj_t * obj, int16_t min, int16_t max) * @param arc pointer to a arc object * @param threshold increment threshold */ -void lv_arc_set_chg_rate(lv_obj_t * obj, uint16_t rate) +void lv_arc_set_change_rate(lv_obj_t * obj, uint16_t rate) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_arc_t * arc = (lv_arc_t *)obj; @@ -461,7 +461,7 @@ int16_t lv_arc_get_max_value(const lv_obj_t * obj) * @param arc pointer to a arc object * @return arc type */ -lv_arc_type_t lv_arc_get_type(const lv_obj_t * obj) +lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); return ((lv_arc_t*) obj)->type; @@ -492,7 +492,7 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) arc->bg_angle_end = 45; arc->indic_angle_start = 135; arc->indic_angle_end = 270; - arc->type = LV_ARC_TYPE_NORMAL; + arc->type = LV_ARC_MODE_NORMAL; arc->value = VALUE_UNSET; arc->min_close = 1; arc->min_value = 0; @@ -509,16 +509,20 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_arc_event(lv_obj_t * obj, lv_event_t e) +static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - lv_arc_t * arc = (lv_arc_t *)obj; - if(e == LV_EVENT_PRESSING) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + lv_arc_t * arc = (lv_arc_t *)e->target; + if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); if(indev == NULL) return; @@ -622,7 +626,7 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) arc->last_tick = lv_tick_get(); /*Cache timestamp for the next iteration*/ } } - else if(e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { arc->dragging = false; /*Leave edit mode if released. (No need to wait for LONG_PRESS)*/ @@ -634,8 +638,8 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); int16_t old_value =arc->value; if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { @@ -650,7 +654,7 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) if(res != LV_RES_OK) return; } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); @@ -663,32 +667,44 @@ static void lv_arc_event(lv_obj_t * obj, lv_event_t e) lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_pad = LV_MAX4(knob_left, knob_right, knob_top, knob_bottom) + 2; - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_pad - bg_pad); - } else if(e == LV_EVENT_DRAW_MAIN) { - lv_arc_draw(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + lv_arc_draw(e); } } -static void lv_arc_draw(lv_obj_t * obj) +static void lv_arc_draw(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_arc_t * arc = (lv_arc_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_point_t center; lv_coord_t arc_r; get_center(obj, ¢er, &arc_r); + lv_obj_draw_dsc_t obj_draw_dsc; + lv_obj_draw_dsc_init(&obj_draw_dsc, clip_area); + /*Draw the background arc*/ lv_draw_arc_dsc_t arc_dsc; if(arc_r > 0) { lv_draw_arc_dsc_init(&arc_dsc); lv_obj_init_draw_arc_dsc(obj, LV_PART_MAIN, &arc_dsc); - lv_draw_arc(center.x, center.y, arc_r,arc->bg_angle_start +arc->rotation, + obj_draw_dsc.part = LV_PART_MAIN; + obj_draw_dsc.p1 = ¢er; + obj_draw_dsc.radius = arc_r; + obj_draw_dsc.arc_dsc = &arc_dsc; + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + + lv_draw_arc(center.x, center.y, arc_r, arc->bg_angle_start + arc->rotation, arc->bg_angle_end + arc->rotation, clip_area, &arc_dsc); + + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } /*make the indicator arc smaller or larger according to its greatest padding value*/ @@ -702,9 +718,17 @@ static void lv_arc_draw(lv_obj_t * obj) lv_draw_arc_dsc_init(&arc_dsc); lv_obj_init_draw_arc_dsc(obj, LV_PART_INDICATOR, &arc_dsc); - lv_draw_arc(center.x, center.y, indic_r,arc->indic_angle_start +arc->rotation, - arc->indic_angle_end +arc->rotation, clip_area, + obj_draw_dsc.part = LV_PART_INDICATOR; + obj_draw_dsc.p1 = ¢er; + obj_draw_dsc.radius = indic_r; + obj_draw_dsc.arc_dsc = &arc_dsc; + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + + lv_draw_arc(center.x, center.y, indic_r, arc->indic_angle_start +arc->rotation, + arc->indic_angle_end + arc->rotation, clip_area, &arc_dsc); + + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } lv_area_t knob_area; @@ -714,7 +738,14 @@ static void lv_arc_draw(lv_obj_t * obj) lv_draw_rect_dsc_init(&knob_rect_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_KNOB, &knob_rect_dsc); + obj_draw_dsc.part = LV_PART_KNOB; + obj_draw_dsc.draw_area = &knob_area; + obj_draw_dsc.rect_dsc = &knob_rect_dsc; + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc); + + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } static void inv_arc_area(lv_obj_t * obj, uint16_t start_angle, uint16_t end_angle, lv_part_t part) @@ -868,13 +899,13 @@ static void get_knob_area(lv_obj_t * obj, const lv_point_t * center, lv_coord_t r -= indic_width_half; uint16_t angle =arc->rotation; - if(arc->type == LV_ARC_TYPE_NORMAL) { + if(arc->type == LV_ARC_MODE_NORMAL) { angle +=arc->indic_angle_end; } - else if(arc->type == LV_ARC_TYPE_REVERSE) { + else if(arc->type == LV_ARC_MODE_REVERSE) { angle +=arc->indic_angle_start; } - else if(arc->type == LV_ARC_TYPE_SYMMETRIC) { + else if(arc->type == LV_ARC_MODE_SYMMETRICAL) { int32_t range_midpoint = (int32_t)(arc->min_value +arc->max_value) / 2; if(arc->value < range_midpoint) angle +=arc->indic_angle_start; else angle +=arc->indic_angle_end; @@ -910,7 +941,7 @@ static void value_update(lv_obj_t * obj) int16_t angle; switch(arc->type) { - case LV_ARC_TYPE_SYMMETRIC: + case LV_ARC_MODE_SYMMETRICAL: bg_midpoint = (arc->bg_angle_start + bg_end) / 2; range_midpoint = (int32_t)(arc->min_value +arc->max_value) / 2; @@ -925,7 +956,7 @@ static void value_update(lv_obj_t * obj) lv_arc_set_end_angle(obj, angle); } break; - case LV_ARC_TYPE_REVERSE: + case LV_ARC_MODE_REVERSE: angle = lv_map(arc->value,arc->min_value,arc->max_value,arc->bg_angle_start, bg_end); lv_arc_set_start_angle(obj, angle); break; diff --git a/src/widgets/lv_arc.h b/src/widgets/lv_arc.h index 96c19bcee..6fbc9b761 100644 --- a/src/widgets/lv_arc.h +++ b/src/widgets/lv_arc.h @@ -28,11 +28,11 @@ extern "C" { **********************/ enum { - LV_ARC_TYPE_NORMAL, - LV_ARC_TYPE_SYMMETRIC, - LV_ARC_TYPE_REVERSE + LV_ARC_MODE_NORMAL, + LV_ARC_MODE_SYMMETRICAL, + LV_ARC_MODE_REVERSE }; -typedef uint8_t lv_arc_type_t; +typedef uint8_t lv_arc_mode_t; typedef struct { lv_obj_t obj; @@ -41,15 +41,15 @@ typedef struct { uint16_t indic_angle_end; uint16_t bg_angle_start; uint16_t bg_angle_end; - int16_t value; /*Current value of the arc*/ - int16_t min_value; /*Minimum value of the arc*/ - int16_t max_value; /*Maximum value of the arc*/ + int16_t value; /*Current value of the arc*/ + int16_t min_value; /*Minimum value of the arc*/ + int16_t max_value; /*Maximum value of the arc*/ uint16_t dragging : 1; uint16_t type : 2; - uint16_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ - uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ - uint32_t last_tick; /*Last dragging event timestamp of the arc*/ - int16_t last_angle; /*Last dragging angle of the arc*/ + uint16_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ + uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ + uint32_t last_tick; /*Last dragging event timestamp of the arc*/ + int16_t last_angle; /*Last dragging angle of the arc*/ }lv_arc_t; extern const lv_obj_class_t lv_arc_class; @@ -75,84 +75,83 @@ lv_obj_t * lv_arc_create(lv_obj_t * parent); /** * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. - * @param arc pointer to an arc object + * @param arc pointer to an arc object * @param start the start angle */ void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start); /** - * Set the start angle of an arc. 0 deg: right, 90 bottom, etc. - * @param arc pointer to an arc object - * @param end the end angle + * Set the end angle of an arc. 0 deg: right, 90 bottom, etc. + * @param arc pointer to an arc object + * @param end the end angle */ void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end); /** * Set the start and end angles - * @param arc pointer to an arc object + * @param arc pointer to an arc object * @param start the start angle - * @param end the end angle + * @param end the end angle */ void lv_arc_set_angles(lv_obj_t * arc, uint16_t start, uint16_t end); /** * Set the start angle of an arc background. 0 deg: right, 90 bottom, etc. - * @param arc pointer to an arc object + * @param arc pointer to an arc object * @param start the start angle */ void lv_arc_set_bg_start_angle(lv_obj_t * arc, uint16_t start); /** * Set the start angle of an arc background. 0 deg: right, 90 bottom etc. - * @param arc pointer to an arc object - * @param end the end angle + * @param arc pointer to an arc object + * @param end the end angle */ void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end); /** * Set the start and end angles of the arc background - * @param arc pointer to an arc object + * @param arc pointer to an arc object * @param start the start angle - * @param end the end angle + * @param end the end angle */ void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end); /** * Set the rotation for the whole arc - * @param arc pointer to an arc object - * @param rotation_angle rotation angle + * @param arc pointer to an arc object + * @param rotation rotation angle */ void lv_arc_set_rotation(lv_obj_t * arc, uint16_t rotation); /** * Set the type of arc. - * @param arc pointer to arc object - * @param type arc type + * @param arc pointer to arc object + * @param mode arc's mode */ -void lv_arc_set_type(lv_obj_t * arc, lv_arc_type_t type); +void lv_arc_set_mode(lv_obj_t * arc, lv_arc_mode_t type); /** * Set a new value on the arc - * @param arc pointer to a arc object + * @param arc pointer to a arc object * @param value new value */ void lv_arc_set_value(lv_obj_t * arc, int16_t value); /** * Set minimum and the maximum values of a arc - * @param arc pointer to the arc object - * @param min minimum value - * @param max maximum value + * @param arc pointer to the arc object + * @param min minimum value + * @param max maximum value */ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max); /** - * Set the threshold of arc knob increments - * position. - * @param arc pointer to a arc object - * @param threshold increment threshold + * Set a change rate to limit the speed how fast the arc should reache the pressed point. + * @param arc pointer to a arc object + * @param rate the change rate */ -void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold); +void lv_arc_set_change_rate(lv_obj_t * arc, uint16_t rate); /*===================== * Getter functions @@ -160,59 +159,59 @@ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold); /** * Get the start angle of an arc. - * @param arc pointer to an arc object - * @return the start angle [0..360] + * @param arc pointer to an arc object + * @return the start angle [0..360] */ uint16_t lv_arc_get_angle_start(lv_obj_t * obj); /** * Get the end angle of an arc. - * @param arc pointer to an arc object - * @return the end angle [0..360] + * @param arc pointer to an arc object + * @return the end angle [0..360] */ uint16_t lv_arc_get_angle_end(lv_obj_t * obj); /** * Get the start angle of an arc background. - * @param arc pointer to an arc object - * @return the start angle [0..360] + * @param arc pointer to an arc object + * @return the start angle [0..360] */ uint16_t lv_arc_get_bg_angle_start(lv_obj_t * obj); /** * Get the end angle of an arc background. - * @param arc pointer to an arc object - * @return the end angle [0..360] + * @param arc pointer to an arc object + * @return the end angle [0..360] */ uint16_t lv_arc_get_bg_angle_end(lv_obj_t * obj); /** * Get the value of a arc - * @param arc pointer to a arc object - * @return the value of the arc + * @param arc pointer to a arc object + * @return the value of the arc */ int16_t lv_arc_get_value(const lv_obj_t * obj); /** * Get the minimum value of a arc - * @param arc pointer to a arc object - * @return the minimum value of the arc + * @param arc pointer to a arc object + * @return the minimum value of the arc */ int16_t lv_arc_get_min_value(const lv_obj_t * obj); /** * Get the maximum value of a arc - * @param arc pointer to a arc object - * @return the maximum value of the arc + * @param arc pointer to a arc object + * @return the maximum value of the arc */ int16_t lv_arc_get_max_value(const lv_obj_t * obj); /** * Get whether the arc is type or not. - * @param arc pointer to a arc object - * @return arc type + * @param arc pointer to a arc object + * @return arc's mode */ -lv_arc_type_t lv_arc_get_type(const lv_obj_t * obj); +lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj); /*===================== * Other functions diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index 6de4d2bcd..54a905490 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -13,7 +13,6 @@ #include "../draw/lv_draw.h" #include "../misc/lv_anim.h" #include "../misc/lv_math.h" -#include /********************* * DEFINES @@ -47,9 +46,9 @@ **********************/ static void lv_bar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_bar_event(lv_obj_t * bar, lv_event_t e); -static void draw_indic(lv_obj_t * bar); -static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr, +static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_indic(lv_event_t * e); +static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_t * value_ptr, lv_bar_anim_t * anim_info, lv_anim_enable_t en); static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim); static void lv_bar_anim(void * bar, int32_t value); @@ -79,14 +78,14 @@ const lv_obj_class_t lv_bar_class = { lv_obj_t * lv_bar_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_bar_class, parent); + return lv_obj_class_create_obj(&lv_bar_class, parent, NULL); } /*===================== * Setter functions *====================*/ -void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) +void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_bar_t * bar = (lv_bar_t *)obj; @@ -100,7 +99,7 @@ void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) lv_bar_set_value_with_anim(obj, value, &bar->cur_value, &bar->cur_value_anim, anim); } -void lv_bar_set_start_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) +void lv_bar_set_start_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -113,7 +112,7 @@ void lv_bar_set_start_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim lv_bar_set_value_with_anim(obj, value, &bar->start_value, &bar->start_value_anim, anim); } -void lv_bar_set_range(lv_obj_t * obj, int16_t min, int16_t max) +void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -155,7 +154,7 @@ void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode) * Getter functions *====================*/ -int16_t lv_bar_get_value(const lv_obj_t * obj) +int32_t lv_bar_get_value(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_bar_t * bar = (lv_bar_t *)obj; @@ -163,7 +162,7 @@ int16_t lv_bar_get_value(const lv_obj_t * obj) return LV_BAR_GET_ANIM_VALUE(bar->cur_value, bar->cur_value_anim); } -int16_t lv_bar_get_start_value(const lv_obj_t * obj) +int32_t lv_bar_get_start_value(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_bar_t * bar = (lv_bar_t *)obj; @@ -173,14 +172,14 @@ int16_t lv_bar_get_start_value(const lv_obj_t * obj) return LV_BAR_GET_ANIM_VALUE(bar->start_value, bar->start_value_anim); } -int16_t lv_bar_get_min_value(const lv_obj_t * obj) +int32_t lv_bar_get_min_value(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_bar_t * bar = (lv_bar_t *)obj; return bar->min_value; } -int16_t lv_bar_get_max_value(const lv_obj_t * obj) +int32_t lv_bar_get_max_value(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_bar_t * bar = (lv_bar_t *)obj; @@ -231,11 +230,12 @@ static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_anim_del(&bar->start_value_anim, NULL); } -static void draw_indic(lv_obj_t * obj) +static void draw_indic(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_bar_t * bar = (lv_bar_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t bar_coords; lv_obj_get_coords(obj, &bar_coords); @@ -377,35 +377,55 @@ static void draw_indic(lv_obj_t * obj) } } - /*Do not draw a zero length indicator*/ - if(!sym && indic_length_calc(&bar->indic_area) <= 1) return; + /*Do not draw a zero length indicator but at least call the draw part events*/ + if(!sym && indic_length_calc(&bar->indic_area) <= 1) { - uint16_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); + lv_obj_draw_dsc_t obj_draw_dsc; + lv_obj_draw_dsc_init(&obj_draw_dsc, clip_area); + obj_draw_dsc.part = LV_PART_INDICATOR; + obj_draw_dsc.draw_area = &bar->indic_area; + + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); + return; + } + + lv_coord_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); lv_coord_t short_side = LV_MIN(barw, barh); if(bg_radius > short_side >> 1) bg_radius = short_side >> 1; - lv_draw_rect_dsc_t draw_indic_dsc; - lv_draw_rect_dsc_init(&draw_indic_dsc); - lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &draw_indic_dsc); - lv_area_t indic_area; lv_area_copy(&indic_area, &bar->indic_area); + lv_draw_rect_dsc_t draw_rect_dsc; + lv_draw_rect_dsc_init(&draw_rect_dsc); + lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &draw_rect_dsc); + + lv_obj_draw_dsc_t obj_draw_dsc; + lv_obj_draw_dsc_init(&obj_draw_dsc, clip_area); + obj_draw_dsc.part = LV_PART_INDICATOR; + obj_draw_dsc.rect_dsc = &draw_rect_dsc; + obj_draw_dsc.draw_area = &bar->indic_area; + + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + /*Draw only the shadow if the indicator is long enough. *The radius of the bg and the indicator can make a strange shape where *it'd be very difficult to draw shadow.*/ if((hor && lv_area_get_width(&bar->indic_area) > bg_radius * 2) || (!hor && lv_area_get_height(&bar->indic_area) > bg_radius * 2)) { - lv_opa_t bg_opa = draw_indic_dsc.bg_opa; - lv_opa_t bg_img_opa = draw_indic_dsc.bg_img_opa; - lv_opa_t border_opa = draw_indic_dsc.border_opa; - draw_indic_dsc.bg_opa = LV_OPA_TRANSP; - draw_indic_dsc.bg_img_opa = LV_OPA_TRANSP; - draw_indic_dsc.border_opa = LV_OPA_TRANSP; - lv_draw_rect(&bar->indic_area, clip_area, &draw_indic_dsc); - draw_indic_dsc.bg_opa = bg_opa; - draw_indic_dsc.bg_img_opa = bg_img_opa; - draw_indic_dsc.border_opa = border_opa; + lv_opa_t bg_opa = draw_rect_dsc.bg_opa; + lv_opa_t bg_img_opa = draw_rect_dsc.bg_img_opa; + lv_opa_t border_opa = draw_rect_dsc.border_opa; + draw_rect_dsc.bg_opa = LV_OPA_TRANSP; + draw_rect_dsc.bg_img_opa = LV_OPA_TRANSP; + draw_rect_dsc.border_opa = LV_OPA_TRANSP; + + lv_draw_rect(&bar->indic_area, clip_area, &draw_rect_dsc); + + draw_rect_dsc.bg_opa = bg_opa; + draw_rect_dsc.bg_img_opa = bg_img_opa; + draw_rect_dsc.border_opa = border_opa; } #if LV_DRAW_COMPLEX @@ -417,14 +437,14 @@ static void draw_indic(lv_obj_t * obj) bg_mask_area.y2 = obj->coords.y2 - bg_bottom; lv_draw_mask_radius_init(&mask_bg_param, &bg_mask_area, bg_radius, false); - int16_t mask_bg_id = lv_draw_mask_add(&mask_bg_param, NULL); + lv_coord_t mask_bg_id = lv_draw_mask_add(&mask_bg_param, NULL); #endif /*Draw_only the background and background image*/ - lv_opa_t shadow_opa = draw_indic_dsc.shadow_opa; - lv_opa_t border_opa = draw_indic_dsc.border_opa; - draw_indic_dsc.border_opa = LV_OPA_TRANSP; - draw_indic_dsc.shadow_opa = LV_OPA_TRANSP; + lv_opa_t shadow_opa = draw_rect_dsc.shadow_opa; + lv_opa_t border_opa = draw_rect_dsc.border_opa; + draw_rect_dsc.border_opa = LV_OPA_TRANSP; + draw_rect_dsc.shadow_opa = LV_OPA_TRANSP; /*Get the max possible indicator area. The gradient should be applied on this*/ lv_area_t mask_indic_max_area; @@ -445,41 +465,47 @@ static void draw_indic(lv_obj_t * obj) #if LV_DRAW_COMPLEX /*Create a mask to the current indicator area to see only this part from the whole gradient.*/ lv_draw_mask_radius_param_t mask_indic_param; - lv_draw_mask_radius_init(&mask_indic_param, &bar->indic_area, draw_indic_dsc.radius, false); + lv_draw_mask_radius_init(&mask_indic_param, &bar->indic_area, draw_rect_dsc.radius, false); int16_t mask_indic_id = lv_draw_mask_add(&mask_indic_param, NULL); #endif - lv_draw_rect(&mask_indic_max_area, clip_area, &draw_indic_dsc); - draw_indic_dsc.border_opa = border_opa; - draw_indic_dsc.shadow_opa = shadow_opa; + lv_draw_rect(&mask_indic_max_area, clip_area, &draw_rect_dsc); + draw_rect_dsc.border_opa = border_opa; + draw_rect_dsc.shadow_opa = shadow_opa; /*Draw the border*/ - draw_indic_dsc.bg_opa = LV_OPA_TRANSP; - draw_indic_dsc.bg_img_opa = LV_OPA_TRANSP; - draw_indic_dsc.shadow_opa = LV_OPA_TRANSP; - lv_draw_rect(&bar->indic_area, clip_area, &draw_indic_dsc); + draw_rect_dsc.bg_opa = LV_OPA_TRANSP; + draw_rect_dsc.bg_img_opa = LV_OPA_TRANSP; + draw_rect_dsc.shadow_opa = LV_OPA_TRANSP; + lv_draw_rect(&bar->indic_area, clip_area, &draw_rect_dsc); #if LV_DRAW_COMPLEX lv_draw_mask_remove_id(mask_indic_id); lv_draw_mask_remove_id(mask_bg_id); #endif + + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); } -static void lv_bar_event(lv_obj_t * obj, lv_event_t e) +static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e) { - LV_ASSERT_OBJ(obj, MY_CLASS); + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t indic_size; indic_size = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); /*Bg size is handled by lv_obj*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, indic_size); /*Calculate the indicator area*/ @@ -492,11 +518,11 @@ static void lv_bar_event(lv_obj_t * obj, lv_event_t e) if(pad < 0) { *s = LV_MAX(*s, -pad); } - } else if(e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED) { + } else if(code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED) { lv_bar_t * bar = (lv_bar_t *)obj; lv_obj_invalidate_area(obj, &bar->indic_area); - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_indic(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_indic(e); } } @@ -521,7 +547,7 @@ static void lv_bar_anim_ready(lv_anim_t * a) lv_obj_invalidate(var->bar); } -static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr, +static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_t * value_ptr, lv_bar_anim_t * anim_info, lv_anim_enable_t en) { if(en == LV_ANIM_OFF) { diff --git a/src/widgets/lv_bar.h b/src/widgets/lv_bar.h index ea09e93d5..b5cc5d610 100644 --- a/src/widgets/lv_bar.h +++ b/src/widgets/lv_bar.h @@ -46,10 +46,10 @@ typedef struct { typedef struct { lv_obj_t obj; - int16_t cur_value; /**< Current value of the bar*/ - int16_t min_value; /**< Minimum value of the bar*/ - int16_t max_value; /**< Maximum value of the bar*/ - int16_t start_value; /**< Start value of the bar*/ + int32_t cur_value; /**< Current value of the bar*/ + int32_t min_value; /**< Minimum value of the bar*/ + int32_t max_value; /**< Maximum value of the bar*/ + int32_t start_value; /**< Start value of the bar*/ lv_area_t indic_area; /**< Save the indicator area. Might be used by derived types*/ lv_bar_anim_t cur_value_anim; lv_bar_anim_t start_value_anim; @@ -79,7 +79,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * parent); * @param value new value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim); +void lv_bar_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); /** * Set a new start value on the bar @@ -87,7 +87,7 @@ void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim); * @param value new start value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -void lv_bar_set_start_value(lv_obj_t * obj, int16_t start_value, lv_anim_enable_t anim); +void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_t anim); /** * Set minimum and the maximum values of a bar @@ -95,7 +95,7 @@ void lv_bar_set_start_value(lv_obj_t * obj, int16_t start_value, lv_anim_enable_ * @param min minimum value * @param max maximum value */ -void lv_bar_set_range(lv_obj_t * obj, int16_t min, int16_t max); +void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max); /** * Set the type of bar. @@ -113,28 +113,28 @@ void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode); * @param obj pointer to a bar object * @return the value of the bar */ -int16_t lv_bar_get_value(const lv_obj_t * obj); +int32_t lv_bar_get_value(const lv_obj_t * obj); /** * Get the start value of a bar * @param obj pointer to a bar object * @return the start value of the bar */ -int16_t lv_bar_get_start_value(const lv_obj_t * obj); +int32_t lv_bar_get_start_value(const lv_obj_t * obj); /** * Get the minimum value of a bar * @param obj pointer to a bar object * @return the minimum value of the bar */ -int16_t lv_bar_get_min_value(const lv_obj_t * obj); +int32_t lv_bar_get_min_value(const lv_obj_t * obj); /** * Get the maximum value of a bar * @param obj pointer to a bar object * @return the maximum value of the bar */ -int16_t lv_bar_get_max_value(const lv_obj_t * obj); +int32_t lv_bar_get_max_value(const lv_obj_t * obj); /** * Get the type of bar. diff --git a/src/widgets/lv_btn.c b/src/widgets/lv_btn.c index 668b04567..f6ac48d90 100644 --- a/src/widgets/lv_btn.c +++ b/src/widgets/lv_btn.c @@ -30,7 +30,7 @@ static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); **********************/ const lv_obj_class_t lv_btn_class = { .constructor_cb = lv_btn_constructor, - .width_def = LV_DPI_DEF, + .width_def = LV_SIZE_CONTENT, .height_def = LV_SIZE_CONTENT, .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_btn_t), @@ -48,7 +48,7 @@ const lv_obj_class_t lv_btn_class = { lv_obj_t * lv_btn_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_btn_class, parent); + return lv_obj_class_create_obj(&lv_btn_class, parent, NULL); } /********************** diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index 70d65a997..1f8ba1121 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -34,16 +34,18 @@ **********************/ static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); static uint8_t get_button_width(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_is_hidden(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_is_repeat_disabled(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_is_inactive(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_is_click_trig(lv_btnmatrix_ctrl_t ctrl_bits); -static bool button_is_tgl_enabled(lv_btnmatrix_ctrl_t ctrl_bits); +static bool button_is_checkable(lv_btnmatrix_ctrl_t ctrl_bits); +static bool button_is_recolor(lv_btnmatrix_ctrl_t ctrl_bits); static bool button_get_checked(lv_btnmatrix_ctrl_t ctrl_bits); +static bool button_is_recolor(lv_btnmatrix_ctrl_t ctrl_bits); static uint16_t get_button_from_point(lv_obj_t * obj, lv_point_t * p); static void allocate_btn_areas_and_controls(const lv_obj_t * obj, const char ** map); static void invalidate_button_area(const lv_obj_t * obj, uint16_t btn_idx); @@ -62,6 +64,7 @@ const lv_obj_class_t lv_btnmatrix_class = { .height_def = LV_DPI_DEF, .instance_size = sizeof(lv_btnmatrix_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .base_class = &lv_obj_class }; @@ -76,7 +79,7 @@ const lv_obj_class_t lv_btnmatrix_class = { lv_obj_t * lv_btnmatrix_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_btnmatrix_class, parent); + return lv_obj_class_create_obj(&lv_btnmatrix_class, parent, NULL); } /*===================== @@ -102,13 +105,13 @@ void lv_btnmatrix_set_map(lv_obj_t * obj, const char * map[]) lv_coord_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); lv_coord_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t max_w = lv_obj_get_width_fit(obj); - lv_coord_t max_h = lv_obj_get_height_fit(obj); + lv_coord_t max_w = lv_obj_get_content_width(obj); + lv_coord_t max_h = lv_obj_get_content_height(obj); /*Count the lines to calculate button height*/ uint8_t row_cnt = 1; uint32_t i; - for(i = 0; strlen(map[i]) != 0; i++) { + for(i = 0; map[i] && map[i][0] != '\0'; i++) { if(strcmp(map[i], "\n") == 0) row_cnt++; } @@ -127,7 +130,7 @@ void lv_btnmatrix_set_map(lv_obj_t * obj, const char * map[]) uint16_t unit_cnt = 0; /*Number of units in a row*/ uint16_t btn_cnt = 0; /*Number of buttons in a row*/ /*Count the buttons and units in this row*/ - while(strcmp(map_row[btn_cnt], "\n") != 0 && strlen(map_row[btn_cnt]) != '\0') { + while(map_row[btn_cnt] && strcmp(map_row[btn_cnt], "\n") != 0 && map_row[btn_cnt][0] != '\0') { unit_cnt += get_button_width(btnm->ctrl_bits[btn_tot_i + btn_cnt]); btn_cnt++; } @@ -196,16 +199,6 @@ void lv_btnmatrix_set_selected_btn(lv_obj_t * obj, uint16_t btn_id) invalidate_button_area(obj, btn_id); } -void lv_btnmatrix_set_recolor(const lv_obj_t * obj, bool en) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - - lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; - - btnm->recolor = en; - lv_obj_invalidate(obj); -} - void lv_btnmatrix_set_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -291,15 +284,6 @@ const char ** lv_btnmatrix_get_map(const lv_obj_t * obj) return btnm->map_p; } -bool lv_btnmatrix_get_recolor(const lv_obj_t * obj) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - - lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; - - return btnm->recolor; -} - uint16_t lv_btnmatrix_get_selected_btn(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -366,7 +350,6 @@ static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * btnm->button_areas = NULL; btnm->ctrl_bits = NULL; btnm->map_p = NULL; - btnm->recolor = 0; btnm->one_check = 0; lv_btnmatrix_set_map(obj, lv_btnmatrix_def_map); @@ -386,25 +369,29 @@ static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * o LV_TRACE_OBJ_CREATE("finshed"); } -static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) +static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; lv_point_t p; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { lv_btnmatrix_set_map(obj, btnm->map_p); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_btnmatrix_set_map(obj, btnm->map_p); } - else if(e == LV_EVENT_PRESSED) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_PRESSED) { + void * param = lv_event_get_param(e); invalidate_button_area(obj, btnm->btn_id_sel); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -433,8 +420,8 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSING) { - void * param = lv_event_get_param(); + else if(code == LV_EVENT_PRESSING) { + void * param = lv_event_get_param(e); uint16_t btn_pr = LV_BTNMATRIX_BTN_NONE; /*Search the pressed area*/ lv_indev_t * indev = lv_indev_get_act(); @@ -465,10 +452,10 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { /*Toggle the button if enabled*/ - if(button_is_tgl_enabled(btnm->ctrl_bits[btnm->btn_id_sel]) && + if(button_is_checkable(btnm->ctrl_bits[btnm->btn_id_sel]) && !button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) { if(button_get_checked(btnm->ctrl_bits[btnm->btn_id_sel]) && !btnm->one_check) { btnm->ctrl_bits[btnm->btn_id_sel] &= (~LV_BTNMATRIX_CTRL_CHECKED); @@ -497,7 +484,7 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } } - else if(e == LV_EVENT_LONG_PRESSED_REPEAT) { + else if(code == LV_EVENT_LONG_PRESSED_REPEAT) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { if(button_is_repeat_disabled(btnm->ctrl_bits[btnm->btn_id_sel]) == false && button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel]) == false && @@ -508,12 +495,12 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_PRESS_LOST) { invalidate_button_area(obj, btnm->btn_id_sel); btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } - else if(e == LV_EVENT_FOCUSED) { - lv_indev_t * indev = lv_indev_get_act(); + else if(code == LV_EVENT_FOCUSED) { + lv_indev_t * indev = lv_event_get_param(e); lv_indev_type_t indev_type = lv_indev_get_type(indev); /*If not focused by an input device assume the last input device*/ @@ -541,15 +528,15 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) btnm->btn_id_sel = b; } } - else if(e == LV_EVENT_DEFOCUSED || e == LV_EVENT_LEAVE) { + else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) { if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(obj, btnm->btn_id_sel); btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; } - else if(e == LV_EVENT_KEY) { + else if(code == LV_EVENT_KEY) { invalidate_button_area(obj, btnm->btn_id_sel); - char c = *((char *)lv_event_get_param()); + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT) { if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) btnm->btn_id_sel = 0; else btnm->btn_id_sel++; @@ -626,18 +613,19 @@ static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) } invalidate_button_area(obj, btnm->btn_id_sel); - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; if(btnm->btn_cnt == 0) return; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); obj->skip_trans = 1; lv_area_t area_obj; @@ -654,7 +642,6 @@ static void draw_main(lv_obj_t * obj) lv_draw_rect_dsc_t draw_rect_dsc_def; lv_draw_label_dsc_t draw_label_dsc_def; - lv_text_flag_t recolor_flag = btnm->recolor ? LV_TEXT_FLAG_RECOLOR : 0; lv_state_t state_ori = obj->state; obj->state = LV_STATE_DEFAULT; @@ -663,7 +650,6 @@ static void draw_main(lv_obj_t * obj) lv_draw_label_dsc_init(&draw_label_dsc_def); lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_def); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_def); - draw_label_dsc_act.flag |= recolor_flag; obj->skip_trans = 0; obj->state = state_ori; @@ -723,11 +709,15 @@ static void draw_main(lv_obj_t * obj) lv_draw_label_dsc_init(&draw_label_dsc_act); lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_act); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_act); - draw_label_dsc_act.flag = recolor_flag; obj->state = state_ori; obj->skip_trans = 0; } + bool recolor = button_is_recolor(btnm->ctrl_bits[btnm->ctrl_bits[btn_i]]); + if(recolor) draw_label_dsc_act.flag |= LV_TEXT_FLAG_RECOLOR; + else draw_label_dsc_act.flag &= ~LV_TEXT_FLAG_RECOLOR; + + dsc.draw_area = &btn_area; dsc.id = btn_i; lv_event_send(obj,LV_EVENT_DRAW_PART_BEGIN, &dsc); @@ -758,10 +748,9 @@ static void draw_main(lv_obj_t * obj) txt = txt_ap; } #endif - lv_point_t txt_size; lv_txt_get_size(&txt_size, txt, font, letter_space, - line_space, lv_area_get_width(&area_obj), recolor_flag); + line_space, lv_area_get_width(&area_obj), draw_label_dsc_act.flag); btn_area.x1 += (lv_area_get_width(&btn_area) - txt_size.x) / 2; btn_area.y1 += (lv_area_get_height(&btn_area) - txt_size.y) / 2; @@ -771,7 +760,6 @@ static void draw_main(lv_obj_t * obj) /*Draw the text*/ lv_draw_label(&btn_area, clip_area, &draw_label_dsc_act, txt, NULL); - lv_event_send(obj,LV_EVENT_DRAW_PART_END, &dsc); } @@ -790,7 +778,7 @@ static void allocate_btn_areas_and_controls(const lv_obj_t * obj, const char ** /*Count the buttons in the map*/ uint16_t btn_cnt = 0; uint16_t i = 0; - while(strlen(map[i]) != 0) { + while(map[i] && map[i][0] != '\0') { if(strcmp(map[i], "\n") != 0) { /*Do not count line breaks*/ btn_cnt++; } @@ -853,7 +841,7 @@ static bool button_is_click_trig(lv_btnmatrix_ctrl_t ctrl_bits) return (ctrl_bits & LV_BTNMATRIX_CTRL_CLICK_TRIG) ? true : false; } -static bool button_is_tgl_enabled(lv_btnmatrix_ctrl_t ctrl_bits) +static bool button_is_checkable(lv_btnmatrix_ctrl_t ctrl_bits) { return (ctrl_bits & LV_BTNMATRIX_CTRL_CHECKABLE) ? true : false; } @@ -863,6 +851,10 @@ static bool button_get_checked(lv_btnmatrix_ctrl_t ctrl_bits) return (ctrl_bits & LV_BTNMATRIX_CTRL_CHECKED) ? true : false; } +static bool button_is_recolor(lv_btnmatrix_ctrl_t ctrl_bits) +{ + return (ctrl_bits & LV_BTNMATRIX_CTRL_RECOLOR) ? true : false; +} /** * Gives the button id of a button under a given point * @param obj pointer to a button matrix object diff --git a/src/widgets/lv_btnmatrix.h b/src/widgets/lv_btnmatrix.h index 76168f904..8561d3a64 100644 --- a/src/widgets/lv_btnmatrix.h +++ b/src/widgets/lv_btnmatrix.h @@ -36,13 +36,13 @@ enum { LV_BTNMATRIX_CTRL_HIDDEN = 0x0008, /**< Button hidden*/ LV_BTNMATRIX_CTRL_NO_REPEAT = 0x0010, /**< Do not repeat press this button.*/ LV_BTNMATRIX_CTRL_DISABLED = 0x0020, /**< Disable this button.*/ - LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040, /**< Button *can* be toggled.*/ + LV_BTNMATRIX_CTRL_CHECKABLE = 0x0040, /**< The button can be toggled.*/ LV_BTNMATRIX_CTRL_CHECKED = 0x0080, /**< Button is currently toggled (e.g. checked).*/ LV_BTNMATRIX_CTRL_CLICK_TRIG = 0x0100, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/ - LV_BTNMATRIX_CTRL_CUSTOM_1 = 0x1000, /**< Custom free to use flag*/ - LV_BTNMATRIX_CTRL_CUSTOM_2 = 0x2000, /**< Custom free to use flag*/ - LV_BTNMATRIX_CTRL_CUSTOM_3 = 0x4000, /**< Custom free to use flag*/ - LV_BTNMATRIX_CTRL_CUSTOM_4 = 0x8000, /**< Custom free to use flag*/ + LV_BTNMATRIX_CTRL_RECOLOR = 0x1000, /**< Enable text recoloring with `#color`*/ + _LV_BTNMATRIX_CTRL_RESERVED = 0x2000, /**< Reserved for later use*/ + LV_BTNMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free to use flag*/ + LV_BTNMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free to use flag*/ }; typedef uint16_t lv_btnmatrix_ctrl_t; @@ -57,7 +57,6 @@ typedef struct { lv_btnmatrix_ctrl_t * ctrl_bits; /*Array of control bytes*/ uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/ uint16_t btn_id_sel; /*Index of the active button (being pressed/released etc) or LV_BTNMATRIX_BTN_NONE*/ - uint8_t recolor : 1; /*Enable button recoloring*/ uint8_t one_check : 1; /*Single button toggled at once*/ } lv_btnmatrix_t; @@ -109,12 +108,6 @@ void lv_btnmatrix_set_ctrl_map(lv_obj_t * obj, const lv_btnmatrix_ctrl_t ctrl_ma */ void lv_btnmatrix_set_selected_btn(lv_obj_t * obj, uint16_t btn_id); -/** - * Enable recoloring of button's texts. E.g. "a #ff0000 red# word" - * @param obj pointer to button matrix object - * @param en true: enable recoloring; false: disable - */ -void lv_btnmatrix_set_recolor(const lv_obj_t * obj, bool en); /** * Set the attributes of a button of the button matrix * @param obj pointer to button matrix object @@ -177,13 +170,6 @@ void lv_btnmatrix_set_one_checked(lv_obj_t * obj, bool en); */ const char ** lv_btnmatrix_get_map(const lv_obj_t * obj); -/** - * Check whether the button's text can use recolor or not - * @param obj pointer to button matrix object - * @return true: text recolor enable; false: disabled - */ -bool lv_btnmatrix_get_recolor(const lv_obj_t * obj); - /** * Get the index of the lastly "activated" button by the user (pressed, released, focused etc) * Useful in the the `event_cb` to get the text of the button, check if hidden etc. diff --git a/src/widgets/lv_canvas.c b/src/widgets/lv_canvas.c index 7066bae8f..fc45cf046 100644 --- a/src/widgets/lv_canvas.c +++ b/src/widgets/lv_canvas.c @@ -6,7 +6,6 @@ /********************* * INCLUDES *********************/ -#include #include "lv_canvas.h" #include "../misc/lv_assert.h" #include "../misc/lv_math.h" @@ -68,7 +67,7 @@ const lv_obj_class_t lv_canvas_class = { lv_obj_t * lv_canvas_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_canvas_class, parent); + return lv_obj_class_create_obj(&lv_canvas_class, parent, NULL); } /*===================== @@ -579,7 +578,10 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord coords.y2 = y + h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -637,7 +639,10 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord coords.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -695,7 +700,10 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi coords.y2 = y + header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -739,7 +747,10 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t points[], uint32_t mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -794,7 +805,10 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32 mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); @@ -847,7 +861,10 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ mask.y2 = dsc->header.h - 1; lv_disp_t disp; + /*Allocate the fake driver on the stack as the entire display doesn't outlive this function*/ + lv_disp_drv_t driver; lv_memset_00(&disp, sizeof(lv_disp_t)); + disp.driver = &driver; lv_disp_draw_buf_t draw_buf; lv_disp_draw_buf_init(&draw_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); diff --git a/src/widgets/lv_checkbox.c b/src/widgets/lv_checkbox.c index dc433e167..95ba6dedc 100644 --- a/src/widgets/lv_checkbox.c +++ b/src/widgets/lv_checkbox.c @@ -28,8 +28,8 @@ **********************/ static void lv_checkbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e); -static void lv_checkbox_draw(lv_obj_t * obj); +static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void lv_checkbox_draw(lv_event_t * e); /********************** * STATIC VARIABLES @@ -56,7 +56,7 @@ const lv_obj_class_t lv_checkbox_class = { lv_obj_t * lv_checkbox_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_checkbox_class, parent); + return lv_obj_class_create_obj(&lv_checkbox_class, parent, NULL); } /*===================== @@ -82,7 +82,7 @@ void lv_checkbox_set_text(lv_obj_t * obj, const char * txt) cb->static_txt = 0; - lv_obj_handle_self_size_chg(obj); + lv_obj_refresh_self_size(obj); } void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt) @@ -94,7 +94,7 @@ void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt) cb->txt = (char*)txt; cb->static_txt = 1; - lv_obj_handle_self_size_chg(obj); + lv_obj_refresh_self_size(obj); } /*===================== @@ -140,18 +140,23 @@ static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob LV_TRACE_OBJ_CREATE("finished"); } -static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) +static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if (e == LV_EVENT_PRESSED || e == LV_EVENT_RELEASED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if (code == LV_EVENT_PRESSED || code == LV_EVENT_RELEASED) { lv_obj_invalidate(obj); } - else if (e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if (code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); lv_checkbox_t * cb = (lv_checkbox_t *)obj; const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); @@ -162,7 +167,6 @@ static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) lv_point_t txt_size; lv_txt_get_size(&txt_size, cb->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE); - lv_coord_t bg_colp = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); lv_coord_t marker_leftp = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); lv_coord_t marker_rightp = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); @@ -175,27 +179,28 @@ static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) p->x = marker_size.x + txt_size.x + bg_colp; p->y = LV_MAX(marker_size.y, txt_size.y); } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t *s = lv_event_get_param();; + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_coord_t *s = lv_event_get_param(e); lv_coord_t m = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); *s = LV_MAX(*s, m); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { uint32_t v = lv_obj_get_state(obj) & LV_STATE_CHECKED ? 1 : 0; res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &v); if(res != LV_RES_OK) return; lv_obj_invalidate(obj); - } else if(e == LV_EVENT_DRAW_MAIN) { - lv_checkbox_draw(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + lv_checkbox_draw(e); } } -static void lv_checkbox_draw(lv_obj_t * obj) +static void lv_checkbox_draw(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_checkbox_t * cb = (lv_checkbox_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); @@ -211,9 +216,9 @@ static void lv_checkbox_draw(lv_obj_t * obj) lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_INDICATOR); lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_INDICATOR); - lv_draw_rect_dsc_t marker_dsc; - lv_draw_rect_dsc_init(&marker_dsc); - lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &marker_dsc); + lv_draw_rect_dsc_t indic_dsc; + lv_draw_rect_dsc_init(&indic_dsc); + lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &indic_dsc); lv_area_t marker_area; marker_area.x1 = obj->coords.x1 + bg_leftp; marker_area.x2 = marker_area.x1 + font_h + marker_leftp + marker_rightp - 1; @@ -227,7 +232,15 @@ static void lv_checkbox_draw(lv_obj_t * obj) marker_area_transf.y1 -= transf_h; marker_area_transf.y2 += transf_h; - lv_draw_rect(&marker_area_transf, clip_area, &marker_dsc); + lv_obj_draw_dsc_t obj_draw_dsc; + lv_obj_draw_dsc_init(&obj_draw_dsc, clip_area); + obj_draw_dsc.rect_dsc = &indic_dsc; + obj_draw_dsc.draw_area = &marker_area_transf; + obj_draw_dsc.part = LV_PART_INDICATOR; + + lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &obj_draw_dsc); + lv_draw_rect(&marker_area_transf, clip_area, &indic_dsc); + lv_event_send(obj, LV_EVENT_DRAW_PART_END, &obj_draw_dsc); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 423b69576..84b0aee83 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -1,12 +1,12 @@ /** - * @file lv_ddlist.c + * @file lv_dropdown.c * */ /********************* * INCLUDES *********************/ -#include +#include "../core/lv_obj.h" #include "lv_dropdown.h" #if LV_USE_DROPDOWN != 0 @@ -39,13 +39,13 @@ static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent); static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdown_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); static void lv_dropdownlist_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t * list_obj); -static void lv_dropdown_list_event(lv_obj_t * list, lv_event_t e); -static void draw_list(lv_obj_t * obj); +static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_list(lv_event_t * e); static void draw_box(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state); static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state); @@ -90,7 +90,7 @@ const lv_obj_class_t lv_dropdownlist_class = { lv_obj_t * lv_dropdown_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_dropdown_class, parent); + return lv_obj_class_create_obj(&lv_dropdown_class, parent, NULL); } /*===================== @@ -289,16 +289,6 @@ void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir) lv_obj_invalidate(obj); } -void lv_dropdown_set_max_height(lv_obj_t * obj, lv_coord_t h) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - - lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - if(dropdown->max_height == h) return; - - dropdown->max_height = h; -} - void lv_dropdown_set_symbol(lv_obj_t * obj, const void * symbol) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -390,13 +380,6 @@ void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf buf[c] = '\0'; } -lv_coord_t lv_dropdown_get_max_height(const lv_obj_t * obj) -{ - LV_ASSERT_OBJ(obj, MY_CLASS); - lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - return dropdown->max_height; -} - const char * lv_dropdown_get_symbol(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -453,7 +436,6 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) lv_coord_t list_fit_h = label_h + top + bottom; lv_coord_t list_h = list_fit_h; - if(list_h > dropdown->max_height) list_h = dropdown->max_height; lv_dir_t dir = dropdown->dir; /*No space on the bottom? See if top is better.*/ @@ -484,8 +466,6 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) } if(list_h > list_fit_h) list_h = list_fit_h; - if(list_h > dropdown->max_height) list_h = dropdown->max_height; - lv_obj_set_height(dropdown->list, list_h); position_to_selected(dropdown_obj); @@ -511,10 +491,10 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) lv_obj_set_x(label, 0); break; case LV_TEXT_ALIGN_RIGHT: - lv_obj_set_x(label, lv_obj_get_width_fit(dropdown->list) - lv_obj_get_width(label)); + lv_obj_set_x(label, lv_obj_get_content_width(dropdown->list) - lv_obj_get_width(label)); break; case LV_TEXT_ALIGN_CENTER: - lv_obj_set_x(label, lv_obj_get_width_fit(dropdown->list) / 2 - lv_obj_get_width(label) / 2); + lv_obj_set_x(label, lv_obj_get_content_width(dropdown->list) / 2 - lv_obj_get_width(label) / 2); break; } @@ -535,7 +515,7 @@ void lv_dropdown_close(lv_obj_t * obj) static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent) { - return lv_obj_create_from_class(&lv_dropdownlist_class, parent); + return lv_obj_class_create_obj(&lv_dropdownlist_class, parent, NULL); } static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) @@ -557,7 +537,6 @@ static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * o dropdown->pr_opt_id = LV_DROPDOWN_PR_NONE; dropdown->option_cnt = 0; dropdown->dir = LV_DIR_BOTTOM; - dropdown->max_height = (3 * lv_disp_get_ver_res(NULL)) / 4; lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_dropdown_set_options_static(obj, "Option 1\nOption 2\nOption 3"); @@ -601,17 +580,21 @@ static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t dropdown->list = NULL; } -static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) +static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - if(e == LV_EVENT_FOCUSED) { + if(code == LV_EVENT_FOCUSED) { lv_group_t * g = lv_obj_get_group(obj); bool editing = lv_group_get_editing(g); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -625,10 +608,10 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_dropdown_close(obj); } } - else if(e == LV_EVENT_DEFOCUSED || e == LV_EVENT_LEAVE) { + else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) { lv_dropdown_close(obj); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_scroll_obj(indev) == NULL) { if(dropdown->list) { @@ -654,16 +637,20 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_obj_invalidate(obj); } } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { + lv_obj_refresh_self_size(obj); + } + else if(code == LV_EVENT_SIZE_CHANGED) { + lv_obj_refresh_self_size(obj); if(dropdown->list) lv_dropdown_close(obj); } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); p->y = lv_font_get_line_height(font); } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) { if(dropdown->list == NULL) { lv_dropdown_open(obj); @@ -688,52 +675,60 @@ static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e) lv_dropdown_close(obj); } } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void lv_dropdown_list_event(lv_obj_t * list, lv_event_t e) +static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS_LIST, list, e); - if(res != LV_RES_OK) return; - + lv_event_code_t code = lv_event_get_code(e); + if(code != LV_EVENT_DRAW_POST) { + res = lv_obj_event_base(MY_CLASS_LIST, e); + if(res != LV_RES_OK) return; + } + lv_obj_t * list = lv_event_get_target(e); lv_obj_t * dropdown_obj = ((lv_dropdown_list_t *)list)->dropdown; lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; - if(e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_RELEASED) { if(lv_indev_get_scroll_obj(lv_indev_get_act()) == NULL) { list_release_handler(list); } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { page_press_handler(list); } - else if(e == LV_EVENT_SCROLL_BEGIN) { + else if(code == LV_EVENT_SCROLL_BEGIN) { dropdown->pr_opt_id = LV_DROPDOWN_PR_NONE; lv_obj_invalidate(list); } - else if(e == LV_EVENT_DRAW_POST) { - draw_list(list); + else if(code == LV_EVENT_DRAW_POST) { + draw_list(e); + res = lv_obj_event_base(MY_CLASS_LIST, e); + if(res != LV_RES_OK) return; } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_draw_label_dsc_t label_dsc; - lv_draw_label_dsc_init(&label_dsc); - lv_obj_init_draw_label_dsc(obj, LV_PART_MAIN, &label_dsc); + lv_draw_label_dsc_t symbol_dsc; + lv_draw_label_dsc_init(&symbol_dsc); + lv_obj_init_draw_label_dsc(obj, LV_PART_INDICATOR, &symbol_dsc); /*If no text specified use the selected option*/ const char * opt_txt; @@ -754,7 +749,7 @@ static void draw_main(lv_obj_t * obj) lv_coord_t symbol_h; if(symbol_type == LV_IMG_SRC_SYMBOL) { lv_point_t size; - lv_txt_get_size(&size, dropdown->symbol, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag); + lv_txt_get_size(&size, dropdown->symbol, symbol_dsc.font, symbol_dsc.letter_space, symbol_dsc.line_space, LV_COORD_MAX, symbol_dsc.flag); symbol_w = size.x; symbol_h = size.y; } else { @@ -781,54 +776,59 @@ static void draw_main(lv_obj_t * obj) if(symbol_type == LV_IMG_SRC_SYMBOL) { symbol_area.y1 = obj->coords.y1 + top; symbol_area.y2 = symbol_area.y1 + symbol_h - 1; - lv_draw_label(&symbol_area, clip_area, &label_dsc, dropdown->symbol, NULL); + lv_draw_label(&symbol_area, clip_area, &symbol_dsc, dropdown->symbol, NULL); } else { symbol_area.y1 = obj->coords.y1 + (lv_obj_get_height(obj) - symbol_h) / 2; symbol_area.y2 = symbol_area.y1 + symbol_h - 1; lv_draw_img_dsc_t img_dsc; lv_draw_img_dsc_init(&img_dsc); - lv_obj_init_draw_img_dsc(obj, LV_PART_MAIN, &img_dsc); + lv_obj_init_draw_img_dsc(obj, LV_PART_INDICATOR, &img_dsc); img_dsc.pivot.x = symbol_w / 2; img_dsc.pivot.y = symbol_h / 2; - img_dsc.angle = lv_obj_get_style_transform_angle(obj, LV_PART_MAIN); + img_dsc.angle = lv_obj_get_style_transform_angle(obj, LV_PART_INDICATOR); lv_draw_img(&symbol_area, clip_area, dropdown->symbol, &img_dsc); } + } - lv_point_t size; - lv_txt_get_size(&size, opt_txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag); + lv_draw_label_dsc_t label_dsc; + lv_draw_label_dsc_init(&label_dsc); + lv_obj_init_draw_label_dsc(obj, LV_PART_MAIN, &label_dsc); - lv_area_t txt_area; - txt_area.y1 = obj->coords.y1 + top; - txt_area.y2 = txt_area.y1 + size.y; - /*Center align the text if no symbol*/ - if(dropdown->symbol == NULL) { - txt_area.x1 = obj->coords.x1 + (lv_obj_get_width(obj) - size.x) / 2; + lv_point_t size; + lv_txt_get_size(&size, opt_txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag); + + lv_area_t txt_area; + txt_area.y1 = obj->coords.y1 + top; + txt_area.y2 = txt_area.y1 + size.y; + /*Center align the text if no symbol*/ + if(dropdown->symbol == NULL) { + txt_area.x1 = obj->coords.x1 + (lv_obj_get_width(obj) - size.x) / 2; + txt_area.x2 = txt_area.x1 + size.x; + } + else { + /*Text to the right*/ + if(symbol_to_left) { + txt_area.x1 = obj->coords.x2 - right - size.x; + txt_area.x2 = txt_area.x1 + size.x; + } else { + txt_area.x1 = obj->coords.x1 + left; txt_area.x2 = txt_area.x1 + size.x; } - else { - /*Text to the right*/ - if(symbol_to_left) { - txt_area.x1 = obj->coords.x2 - right - size.x; - txt_area.x2 = txt_area.x1 + size.x; - } else { - txt_area.x1 = obj->coords.x1 + left; - txt_area.x2 = txt_area.x1 + size.x; - } - } - lv_draw_label(&txt_area, clip_area, &label_dsc, opt_txt, NULL); } + lv_draw_label(&txt_area, clip_area, &label_dsc, opt_txt, NULL); if(dropdown->text == NULL) { lv_mem_buf_release((char *)opt_txt); } } -static void draw_list(lv_obj_t * list_obj) +static void draw_list(lv_event_t * e) { + lv_obj_t * list_obj = lv_event_get_target(e); lv_dropdown_list_t * list = (lv_dropdown_list_t *)list_obj; lv_obj_t * dropdown_obj = list->dropdown; lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); /*Draw the box labels if the list is not being deleted*/ if(dropdown->list) { @@ -1023,7 +1023,7 @@ static void position_to_selected(lv_obj_t * dropdown_obj) lv_obj_t * label = get_label(dropdown_obj); if(label == NULL) return; - if(lv_obj_get_height(label) <= lv_obj_get_height_fit(dropdown_obj)) return; + if(lv_obj_get_height(label) <= lv_obj_get_content_height(dropdown_obj)) return; const lv_font_t * font = lv_obj_get_style_text_font(label, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); diff --git a/src/widgets/lv_dropdown.h b/src/widgets/lv_dropdown.h index f1bb10eba..9cf81a047 100644 --- a/src/widgets/lv_dropdown.h +++ b/src/widgets/lv_dropdown.h @@ -1,5 +1,5 @@ /** - * @file lv_ddlist.h + * @file lv_dropdown.h * */ @@ -20,7 +20,7 @@ extern "C" { /*Testing of dependencies*/ #if LV_USE_LABEL == 0 -#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" +#error "lv_dropdown: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif #include "../widgets/lv_label.h" @@ -38,10 +38,9 @@ LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST); typedef struct { lv_obj_t obj; lv_obj_t * list; /**< The dropped down list*/ - const char * text; /**< Text to display on the ddlist's button*/ + const char * text; /**< Text to display on the dropdown's button*/ const void * symbol; /**< Arrow or other icon when the drop-down list is closed*/ char * options; /**< Options in a a '\n' separated list*/ - lv_coord_t max_height; /**< Maximal height of the list when opened. (0: no max. height)*/ uint16_t option_cnt; /**< Number of options*/ uint16_t sel_opt_id; /**< Index of the currently selected option*/ uint16_t sel_opt_id_orig; /**< Store the original index on focus*/ @@ -127,13 +126,6 @@ void lv_dropdown_set_selected(lv_obj_t * obj, uint16_t sel_opt); */ void lv_dropdown_set_dir(lv_obj_t * obj, lv_dir_t dir); -/** - * Set the maximal height for the drop-down list - * @param obj pointer to a drop-down list - * @param h the maximal height - */ -void lv_dropdown_set_max_height(lv_obj_t * obj, lv_coord_t h); - /** * Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow. * @param obj pointer to drop-down list object @@ -197,13 +189,6 @@ uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * obj); */ void lv_dropdown_get_selected_str(const lv_obj_t * obj, char * buf, uint32_t buf_size); -/** - * Get the maximal height of the list. - * @param obj pointer to a drop-down list object - * @return the maximal height of the list - */ -lv_coord_t lv_dropdown_get_max_height(const lv_obj_t * obj); - /** * Get the symbol on the drop-down list. Typically a down caret or arrow. * @param obj pointer to drop-down list object diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index fcc55f37b..abf995018 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -30,8 +30,8 @@ **********************/ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_img_event(lv_obj_t * obj, lv_event_t e); -static void draw_img(lv_obj_t * obj, lv_event_t e); +static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_img(lv_event_t * e); /********************** * STATIC VARIABLES @@ -57,7 +57,7 @@ const lv_obj_class_t lv_img_class = { lv_obj_t * lv_img_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_img_class, parent); + return lv_obj_class_create_obj(&lv_img_class, parent, NULL); } /*===================== @@ -149,7 +149,7 @@ void lv_img_set_src(lv_obj_t * obj, const void * src) img->pivot.x = header.w / 2; img->pivot.y = header.h / 2; - lv_obj_handle_self_size_chg(obj); + lv_obj_refresh_self_size(obj); /*Provide enough room for the rotated corners*/ if(img->angle || img->zoom != LV_IMG_ZOOM_NONE) lv_obj_refresh_ext_draw_size(obj); @@ -397,26 +397,31 @@ static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) } } -static void lv_img_event(lv_obj_t * obj, lv_event_t e) +static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + + lv_event_code_t code = lv_event_get_code(e); + /*Ancestor events will be called during drawing*/ - if(e != LV_EVENT_DRAW_MAIN && e != LV_EVENT_DRAW_POST) { + if(code != LV_EVENT_DRAW_MAIN && code != LV_EVENT_DRAW_POST) { /*Call the ancestor's event handler*/ - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; } - lv_img_t * img = (lv_img_t *)obj; + lv_obj_t * obj = lv_event_get_target(e); + lv_img_t * img = (lv_img_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { /*Refresh the file name to refresh the symbol text size*/ if(img->src_type == LV_IMG_SRC_SYMBOL) { lv_img_set_src(obj, img->src); } } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); lv_coord_t transf_zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); transf_zoom = (transf_zoom * img->zoom) >> 8; @@ -436,8 +441,8 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) *s = LV_MAX(*s, pad_ori + a.y2 - h); } } - else if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param(); + else if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e); lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); zoom = (zoom * img->zoom) >> 8; @@ -447,7 +452,7 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) /*If the object is exactly image sized (not cropped, not mosaic) and transformed *perform hit test on it's transformed area*/ if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) && - (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { + (zoom != LV_IMG_ZOOM_NONE || angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { lv_coord_t w = lv_obj_get_width(obj); lv_coord_t h = lv_obj_get_height(obj); @@ -466,21 +471,23 @@ static void lv_img_event(lv_obj_t * obj, lv_event_t e) info->result = _lv_area_is_point_on(&a, info->point, 0); } } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param();; + else if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e);; p->x = img->w; p->y = img->h; } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST || e == LV_EVENT_COVER_CHECK) { - draw_img(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) { + draw_img(e); } } -static void draw_img(lv_obj_t * obj, lv_event_t e) +static void draw_img(lv_event_t * e) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_img_t * img = (lv_img_t *)obj; - if(e == LV_EVENT_COVER_CHECK) { - lv_cover_check_info_t * info = lv_event_get_param(); + if(code == LV_EVENT_COVER_CHECK) { + lv_cover_check_info_t * info = lv_event_get_param(e); if(info->res == LV_DRAW_RES_MASKED) return; if(img->src_type == LV_IMG_SRC_UNKNOWN || img->src_type == LV_IMG_SRC_SYMBOL) { info->res = LV_DRAW_RES_NOT_COVER; @@ -511,7 +518,7 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) zoom_final = (zoom_final * img->zoom) >> 8; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); if(zoom_final == LV_IMG_ZOOM_NONE) { if(_lv_area_is_in(clip_area, &obj->coords, 0) == false) { info->res = LV_DRAW_RES_NOT_COVER; @@ -532,7 +539,7 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST) { + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { int32_t zoom_final = lv_obj_get_style_transform_zoom(obj, LV_PART_MAIN); zoom_final = (zoom_final * img->zoom) >> 8; @@ -565,16 +572,16 @@ static void draw_img(lv_obj_t * obj, lv_event_t e) lv_area_copy(&ori_coords, &obj->coords); lv_area_copy(&obj->coords, &bg_coords); - lv_res_t res = lv_obj_event_base(MY_CLASS, obj, e); + lv_res_t res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; lv_area_copy(&obj->coords, &ori_coords); - if(e == LV_EVENT_DRAW_MAIN) { + if(code == LV_EVENT_DRAW_MAIN) { if(img->h == 0 || img->w == 0) return; if(zoom_final == 0) return; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t img_max_area; lv_area_copy(&img_max_area, &obj->coords); diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index 25edcc164..be0e7c1f6 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -23,7 +23,8 @@ *********************/ #define MY_CLASS &lv_label_class -#define LV_LABEL_DEF_SCROLL_SPEED 25 +#define LV_LABEL_DEF_SCROLL_SPEED (lv_disp_get_dpi(lv_obj_get_disp(obj)) / 3) +#define LV_LABEL_SCROLL_DELAY 300 #define LV_LABEL_DOT_END_INV 0xFFFFFFFF #define LV_LABEL_HINT_HEIGHT_LIMIT 1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up drawing)*/ @@ -36,8 +37,8 @@ **********************/ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_label_event_cb(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); static void lv_label_refr_text(lv_obj_t * obj); static void lv_label_revert_dots(lv_obj_t * label); @@ -55,7 +56,9 @@ static void set_ofs_y_anim(void * obj, int32_t v); const lv_obj_class_t lv_label_class = { .constructor_cb = lv_label_constructor, .destructor_cb = lv_label_destructor, - .event_cb = lv_label_event_cb, + .event_cb = lv_label_event, + .width_def = LV_SIZE_CONTENT, + .height_def = LV_SIZE_CONTENT, .instance_size = sizeof(lv_label_t), .base_class = &lv_obj_class }; @@ -71,7 +74,7 @@ const lv_obj_class_t lv_label_class = { lv_obj_t * lv_label_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_label_class, parent); + return lv_obj_class_create_obj(&lv_label_class, parent, NULL); } /*===================== @@ -294,10 +297,10 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t pos->x = 0; break; case LV_TEXT_ALIGN_RIGHT: - pos->x = lv_obj_get_width_fit(obj); + pos->x = lv_obj_get_content_width(obj); break; case LV_TEXT_ALIGN_CENTER: - pos->x = lv_obj_get_width_fit(obj) / 2; + pos->x = lv_obj_get_content_width(obj) / 2; break; } return; @@ -319,7 +322,7 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - if(label->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TEXT_FLAG_FIT; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; uint32_t byte_id = _lv_txt_encoded_get_byte_id(txt, char_id); @@ -417,7 +420,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - if(label->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TEXT_FLAG_FIT; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; lv_text_align_t align = lv_obj_get_style_text_align(obj, LV_PART_MAIN); @@ -505,8 +508,8 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL, txt_len, lv_obj_get_base_dir(obj), cid, &is_rtl); if(is_rtl) logical_pos++; - lv_mem_buf_release(bidi_txt); } + lv_mem_buf_release(bidi_txt); #else logical_pos = _lv_txt_encoded_get_char_id(bidi_txt, i); #endif @@ -536,7 +539,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos) if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - if(label->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TEXT_FLAG_FIT; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; /*Search the line of the index letter*/; while(txt[line_start] != '\0') { @@ -703,7 +706,7 @@ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) label->static_txt = 0; label->recolor = 0; label->dot_end = LV_LABEL_DOT_END_INV; - label->long_mode = LV_LABEL_LONG_EXPAND; + label->long_mode = LV_LABEL_LONG_WRAP; label->offset.x = 0; label->offset.y = 0; @@ -721,7 +724,7 @@ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) label->dot_tmp_alloc = 0; lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE); - lv_label_set_long_mode(obj, LV_LABEL_LONG_EXPAND); + lv_label_set_long_mode(obj, LV_LABEL_LONG_WRAP); lv_label_set_text(obj, "Text"); @@ -738,39 +741,66 @@ static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) label->text = NULL; } -static void lv_label_event_cb(lv_obj_t * obj, lv_event_t e) +static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_STYLE_CHANGED) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_STYLE_CHANGED) { /*Revert dots for proper refresh*/ lv_label_revert_dots(obj); lv_label_refr_text(obj); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_label_revert_dots(obj); lv_label_refr_text(obj); } - else if(e == LV_EVENT_BASE_DIR_CHANGED) { + else if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t size; + lv_label_t * label = (lv_label_t *)obj; + const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); + lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + lv_text_flag_t flag = LV_TEXT_FLAG_NONE; + if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; + if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; + + lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN); + if(w == LV_SIZE_CONTENT) w = LV_COORD_MAX; + else w = lv_obj_get_width(obj); + + lv_txt_get_size(&size, label->text, font, letter_space, line_space, w, flag); + + lv_point_t * self_size = lv_event_get_param(e); + self_size->x = LV_MAX(self_size->x, size.x); + self_size->y = LV_MAX(self_size->y, size.y); + } + else if(code == LV_EVENT_BASE_DIR_CHANGED) { #if LV_USE_BIDI lv_label_t * label = (lv_label_t *)obj; if(label->static_txt == 0) lv_label_set_text(obj, NULL); #endif } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_label_t * label = (lv_label_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t txt_coords; get_txt_coords(obj, &txt_coords); @@ -783,7 +813,7 @@ static void draw_main(lv_obj_t * obj) lv_text_flag_t flag = LV_TEXT_FLAG_NONE; if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - if(label->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TEXT_FLAG_FIT; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; lv_draw_label_dsc_t label_draw_dsc; lv_draw_label_dsc_init(&label_draw_dsc); @@ -871,26 +901,21 @@ static void lv_label_refr_text(lv_obj_t * obj) lv_text_flag_t flag = LV_TEXT_FLAG_NONE; if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - if(label->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TEXT_FLAG_FIT; + if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) flag |= LV_TEXT_FLAG_FIT; + lv_txt_get_size(&size, label->text, font, letter_space, line_space, max_w, flag); - /*Set the full size in expand mode*/ - if(label->long_mode == LV_LABEL_LONG_EXPAND) { - size.x += lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - size.y += lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_obj_set_size(obj, size.x, size.y); - } - /*In roll mode keep the size but start offset animations*/ - else if(label->long_mode == LV_LABEL_LONG_SCROLL) { - uint16_t anim_speed = lv_obj_get_style_anim_time(obj, LV_PART_MAIN); + lv_obj_refresh_self_size(obj); + + /*In scroll mode start an offset animations*/ + if(label->long_mode == LV_LABEL_LONG_SCROLL) { + uint16_t anim_speed = lv_obj_get_style_anim_speed(obj, LV_PART_MAIN); if(anim_speed == 0) anim_speed = LV_LABEL_DEF_SCROLL_SPEED; lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, obj); lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); - lv_anim_set_playback_delay(&a, (((lv_font_get_glyph_width(font, ' ', ' ') + letter_space) * 1000) / - anim_speed) * - LV_LABEL_WAIT_CHAR_COUNT); + lv_anim_set_playback_delay(&a, LV_LABEL_SCROLL_DELAY); lv_anim_set_repeat_delay(&a, a.playback_delay); bool hor_anim = false; @@ -915,7 +940,6 @@ static void lv_label_refr_text(lv_obj_t * obj) #else lv_anim_set_values(&a, 0, lv_area_get_width(&txt_coords) - size.x); lv_anim_set_exec_cb(&a, set_ofs_x_anim); - lv_anim_set_time(&a, lv_anim_speed_to_time(anim_speed, a.start_value, a.end_value)); #endif lv_anim_set_exec_cb(&a, set_ofs_x_anim); @@ -939,6 +963,8 @@ static void lv_label_refr_text(lv_obj_t * obj) } } + lv_anim_set_time(&a, lv_anim_speed_to_time(anim_speed, a.start_value, a.end_value)); + lv_anim_set_playback_time(&a, a.time); lv_anim_start(&a); hor_anim = true; } @@ -951,8 +977,6 @@ static void lv_label_refr_text(lv_obj_t * obj) if(size.y > lv_area_get_height(&txt_coords) && hor_anim == false) { lv_anim_set_values(&a, 0, lv_area_get_height(&txt_coords) - size.y - (lv_font_get_line_height(font))); lv_anim_set_exec_cb(&a, set_ofs_y_anim); - lv_anim_set_time(&a, lv_anim_speed_to_time(anim_speed, a.start_value, a.end_value)); - lv_anim_set_playback_time(&a, a.time); lv_anim_t * anim_cur = lv_anim_get(obj, set_ofs_y_anim); int32_t act_time = 0; @@ -974,6 +998,8 @@ static void lv_label_refr_text(lv_obj_t * obj) } } + lv_anim_set_time(&a, lv_anim_speed_to_time(anim_speed, a.start_value, a.end_value)); + lv_anim_set_playback_time(&a, a.time); lv_anim_start(&a); } else { @@ -984,7 +1010,7 @@ static void lv_label_refr_text(lv_obj_t * obj) } /*In roll inf. mode keep the size but start offset animations*/ else if(label->long_mode == LV_LABEL_LONG_SCROLL_CIRCULAR) { - uint16_t anim_speed = lv_obj_get_style_anim_time(obj, LV_PART_MAIN); + uint16_t anim_speed = lv_obj_get_style_anim_speed(obj, LV_PART_MAIN); if(anim_speed == 0) anim_speed = LV_LABEL_DEF_SCROLL_SPEED; lv_anim_t a; lv_anim_init(&a); @@ -1012,9 +1038,9 @@ static void lv_label_refr_text(lv_obj_t * obj) lv_anim_set_values(&a, start, end); #else lv_anim_set_values(&a, 0, -size.x - lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT); +#endif lv_anim_set_exec_cb(&a, set_ofs_x_anim); lv_anim_set_time(&a, lv_anim_speed_to_time(anim_speed, a.start_value, a.end_value)); -#endif lv_anim_t * anim_cur = lv_anim_get(obj, set_ofs_x_anim); int32_t act_time = anim_cur ? anim_cur->act_time : 0; @@ -1053,6 +1079,7 @@ static void lv_label_refr_text(lv_obj_t * obj) } } else if(label->long_mode == LV_LABEL_LONG_DOT) { + lv_obj_refresh_self_size(obj); if(size.y <= lv_area_get_height(&txt_coords)) { /*No dots are required, the text is short enough*/ label->dot_end = LV_LABEL_DOT_END_INV; } @@ -1105,12 +1132,6 @@ static void lv_label_refr_text(lv_obj_t * obj) } } } - /*In break mode only the height can change*/ - else if(label->long_mode == LV_LABEL_LONG_WRAP) { - size.y += lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_obj_set_height(obj, size.y); - } - /*Do not set the size in Clip mode*/ else if(label->long_mode == LV_LABEL_LONG_CLIP) { /*Do nothing*/ } diff --git a/src/widgets/lv_label.h b/src/widgets/lv_label.h index 7aad87620..57c881e63 100644 --- a/src/widgets/lv_label.h +++ b/src/widgets/lv_label.h @@ -42,7 +42,6 @@ LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SEL_OFF); /** Long mode behaviors. Used in 'lv_label_ext_t'*/ enum { - LV_LABEL_LONG_EXPAND, /**< Expand the object size to the text size*/ LV_LABEL_LONG_WRAP, /**< Keep the object width, wrap the too long lines and expand the object height*/ LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/ LV_LABEL_LONG_SCROLL, /**< Keep the size and roll the text back and forth*/ @@ -159,20 +158,8 @@ char * lv_label_get_text(const lv_obj_t * obj); /** * Get the long mode of a label -<<<<<<< HEAD * @param obj pointer to a label object * @return the current long mode -======= - * @param label pointer to a label object - * @return the long mode - */ -lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label); - -/** - * Get the align attribute - * @param label pointer to a label object - * @return LV_LABEL_ALIGN_LEFT/RIGHT/CENTER ->>>>>>> master */ lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * obj); diff --git a/src/widgets/lv_line.c b/src/widgets/lv_line.c index fddef75f1..5e941fa77 100644 --- a/src/widgets/lv_line.c +++ b/src/widgets/lv_line.c @@ -29,7 +29,7 @@ * STATIC PROTOTYPES **********************/ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_line_event(lv_obj_t * obj, lv_event_t e); +static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e); /********************** * STATIC VARIABLES @@ -54,7 +54,7 @@ const lv_obj_class_t lv_line_class = { lv_obj_t * lv_line_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_line_class, parent); + return lv_obj_class_create_obj(&lv_line_class, parent, NULL); } /*===================== @@ -69,7 +69,7 @@ void lv_line_set_points(lv_obj_t * obj, const lv_point_t points[], uint16_t poin line->point_array = points; line->point_num = point_num; - lv_obj_handle_self_size_chg(obj); + lv_obj_refresh_self_size(obj); lv_obj_invalidate(obj); } @@ -119,24 +119,29 @@ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_line_event(lv_obj_t * obj, lv_event_t e) +static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*The corner of the skew lines is out of the intended area*/ lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_MAIN); - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); if(*s < line_width) *s = line_width; } - else if(e == LV_EVENT_GET_SELF_SIZE) { + else if(code == LV_EVENT_REFR_SELF_SIZE) { lv_line_t * line = (lv_line_t *)obj; - lv_point_t * p = lv_event_get_param(); + lv_point_t * p = lv_event_get_param(e); lv_coord_t w = 0; lv_coord_t h = 0; if(line->point_num > 0) { @@ -152,9 +157,9 @@ static void lv_line_event(lv_obj_t * obj, lv_event_t e) p->x = w; p->y = h; } - } else if(e == LV_EVENT_DRAW_MAIN) { + } else if(code == LV_EVENT_DRAW_MAIN) { lv_line_t * line = (lv_line_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); if(line->point_num == 0 || line->point_array == NULL) return; diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index 3fcc384d8..d36d875cd 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -29,10 +29,10 @@ * STATIC PROTOTYPES **********************/ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_roller_event(lv_obj_t * obj, lv_event_t e); -static void lv_roller_label_event(lv_obj_t * label, lv_event_t e); -static void draw_main(lv_obj_t * obj, lv_event_t e); -static void draw_label(lv_obj_t * label_obj); +static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); +static void draw_label(lv_event_t * e); static void refr_position(lv_obj_t * obj, lv_anim_enable_t animen); static lv_res_t release_handler(lv_obj_t * obj); static void inf_normalize(lv_obj_t * obj_scrl); @@ -51,6 +51,7 @@ const lv_obj_class_t lv_roller_class = { .height_def = LV_DPI_DEF, .instance_size = sizeof(lv_roller_t), .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .base_class = &lv_obj_class }; @@ -76,7 +77,7 @@ const lv_obj_class_t lv_roller_label_class = { lv_obj_t * lv_roller_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_roller_class, parent); + return lv_obj_class_create_obj(&lv_roller_class, parent, NULL); } /*===================== @@ -296,41 +297,45 @@ static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); - lv_obj_create_from_class(&lv_roller_label_class, obj); + lv_obj_class_create_obj(&lv_roller_label_class, obj, NULL); lv_roller_set_options(obj, "Option 1\nOption 2\nOption 3\nOption 4\nOption 5", LV_ROLLER_MODE_NORMAL); LV_LOG_TRACE("finshed"); } -static void lv_roller_event(lv_obj_t * obj, lv_event_t e) +static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_roller_t * roller = (lv_roller_t*)obj; - if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); p->x = get_selected_label_width(obj); } - else if(e == LV_EVENT_STYLE_CHANGED) { + else if(code == LV_EVENT_STYLE_CHANGED) { lv_obj_t * label = get_label(obj); /*Be sure the label's style is updated before processing the roller*/ if(label) lv_event_send(label, LV_EVENT_STYLE_CHANGED, NULL); - lv_obj_handle_self_size_chg(obj); + lv_obj_refresh_self_size(obj); refr_position(obj, false); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { refr_position(obj, false); } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { roller->moved = 0; lv_anim_del(get_label(obj), set_y_anim); } - else if(e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSING) { lv_indev_t * indev = lv_indev_get_act(); lv_point_t p; lv_indev_get_vect(indev, &p); @@ -340,10 +345,10 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) roller->moved = 1; } } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { release_handler(obj); } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_group_t * g = lv_obj_get_group(obj); bool editing = lv_group_get_editing(g); lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); @@ -367,15 +372,15 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) ENTER won't be pressed*/ } } - else if(e == LV_EVENT_DEFOCUSED) { + else if(code == LV_EVENT_DEFOCUSED) { /*Revert the original state*/ if(roller->sel_opt_id != roller->sel_opt_id_ori) { roller->sel_opt_id = roller->sel_opt_id_ori; refr_position(obj, true); } } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) { if(roller->sel_opt_id + 1 < roller->option_cnt) { uint16_t ori_id = roller->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/ @@ -392,44 +397,50 @@ static void lv_roller_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_DRAW_MAIN || e == LV_EVENT_DRAW_POST) { - draw_main(obj, e); + else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { + draw_main(e); } } -static void lv_roller_label_event(lv_obj_t * label, lv_event_t e) +static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; + lv_event_code_t code = lv_event_get_code(e); /*LV_EVENT_DRAW_MAIN will be called in the draw function*/ - if(e != LV_EVENT_DRAW_MAIN) { + if(code != LV_EVENT_DRAW_MAIN) { /* Call the ancestor's event handler */ - res = lv_obj_event_base(MY_CLASS_LABEL, label, e); + res = lv_obj_event_base(MY_CLASS_LABEL, e); if(res != LV_RES_OK) return; } - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_obj_t * label = lv_event_get_target(e); + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*If the selected text has a larger font it needs some extra space to draw it*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); lv_obj_t * obj = lv_obj_get_parent(label); lv_coord_t sel_w = get_selected_label_width(obj); lv_coord_t label_w = lv_obj_get_width(label); *s = LV_MAX(*s, sel_w - label_w); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { refr_position(lv_obj_get_parent(label), LV_ANIM_OFF); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_label(label); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_label(e); } } -static void draw_main(lv_obj_t * obj, lv_event_t e) +static void draw_main(lv_event_t * e) { - if(e == LV_EVENT_DRAW_MAIN) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + if(code == LV_EVENT_DRAW_MAIN) { /*Draw the selected rectangle*/ - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); @@ -448,8 +459,8 @@ static void draw_main(lv_obj_t * obj, lv_event_t e) lv_draw_rect(&rect_area, clip_area, &sel_dsc); } /*Post draw when the children are drawn*/ - else if(e == LV_EVENT_DRAW_POST) { - const lv_area_t * clip_area = lv_event_get_param(); + else if(code == LV_EVENT_DRAW_POST) { + const lv_area_t * clip_area = lv_event_get_param(e); lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_init(&label_dsc); @@ -478,8 +489,8 @@ static void draw_main(lv_obj_t * obj, lv_event_t e) lv_coord_t roller_h = lv_obj_get_height(obj); int32_t label_y_prop = label->coords.y1 - (roller_h / 2 + obj->coords.y1); /*label offset from the middle line of the roller*/ - label_y_prop = (label_y_prop << 14) / lv_obj_get_height( - label); /*Proportional position from the middle line (upscaled)*/ + label_y_prop = (label_y_prop * 16384) / lv_obj_get_height( + label); /*Proportional position from the middle line (upscaled by << 14)*/ /*Apply a correction with different line heights*/ const lv_font_t * normal_label_font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); @@ -504,10 +515,11 @@ static void draw_main(lv_obj_t * obj, lv_event_t e) } } -static void draw_label(lv_obj_t * label_obj) +static void draw_label(lv_event_t * e) { /* Split the drawing of the label into an upper (above the selected area) * and a lower (below the selected area)*/ + lv_obj_t * label_obj = lv_event_get_target(e); lv_obj_t * roller = lv_obj_get_parent(label_obj); lv_draw_label_dsc_t label_draw_dsc; lv_draw_label_dsc_init(&label_draw_dsc); @@ -515,7 +527,7 @@ static void draw_label(lv_obj_t * label_obj) const lv_font_t * font = label_draw_dsc.font; lv_coord_t line_space = label_draw_dsc.line_space; lv_coord_t font_h = lv_font_get_line_height(font); - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_area_t rect_area; rect_area.y1 = roller->coords.y1 + (lv_obj_get_height(roller) - font_h - line_space) / 2; @@ -559,10 +571,10 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_text_align_t align = lv_obj_get_style_text_align(label, LV_PART_MAIN); switch(align) { case LV_TEXT_ALIGN_CENTER: - lv_obj_set_x(label, (lv_obj_get_width_fit(obj) - lv_obj_get_width(label)) / 2); + lv_obj_set_x(label, (lv_obj_get_content_width(obj) - lv_obj_get_width(label)) / 2); break; case LV_TEXT_ALIGN_RIGHT: - lv_obj_set_x(label, lv_obj_get_width_fit(obj) - lv_obj_get_width(label)); + lv_obj_set_x(label, lv_obj_get_content_width(obj) - lv_obj_get_width(label)); break; case LV_TEXT_ALIGN_LEFT: lv_obj_set_x(label, 0); @@ -574,7 +586,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t h = lv_obj_get_height_fit(obj); + lv_coord_t h = lv_obj_get_content_height(obj); uint16_t anim_time = lv_obj_get_style_anim_time(obj, LV_PART_MAIN); /*Normally the animation's `end_cb` sets correct position of the roller if infinite. @@ -583,7 +595,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) inf_normalize(obj); } - int32_t id = roller->sel_opt_id; lv_coord_t sel_y1 = id * (font_h + line_space); lv_coord_t mid_y1 = h / 2 - font_h / 2; @@ -595,9 +606,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_obj_set_y(label, new_y); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_ease_out); lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, label); @@ -605,7 +613,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_anim_set_values(&a, lv_obj_get_y(label), new_y); lv_anim_set_time(&a, anim_time); lv_anim_set_ready_cb(&a, scroll_anim_ready_cb); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_start(&a); } } @@ -703,7 +711,7 @@ static void inf_normalize(lv_obj_t * obj) const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t h = lv_obj_get_height_fit(obj); + lv_coord_t h = lv_obj_get_content_height(obj); lv_obj_t * label = get_label(obj); diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index 62927c5f9..2203691eb 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -32,9 +32,9 @@ * STATIC PROTOTYPES **********************/ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_slider_event(lv_obj_t * obj, lv_event_t e); +static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e); static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); -static void draw_knob(lv_obj_t * obj); +static void draw_knob(lv_event_t * e); /********************** * STATIC VARIABLES @@ -59,7 +59,7 @@ const lv_obj_class_t lv_slider_class = { lv_obj_t * lv_slider_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_slider_class, parent); + return lv_obj_class_create_obj(&lv_slider_class, parent, NULL); } bool lv_slider_is_dragged(const lv_obj_t * obj) @@ -90,20 +90,24 @@ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj lv_obj_set_height(obj, LV_DPX(10)); } -static void lv_slider_event(lv_obj_t * obj, lv_event_t e) +static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_slider_t * slider = (lv_slider_t *)obj; lv_slider_mode_t type = lv_slider_get_mode(obj); /*Advanced hit testing: react only on dragging the knob(s)*/ - if(e == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param(); + if(code == LV_EVENT_HIT_TEST) { + lv_hit_test_info_t * info = lv_event_get_param(e); /*Ordinary slider: was the knob area hit?*/ info->result = _lv_area_is_point_on(&slider->right_knob_area, info->point, 0); @@ -113,7 +117,10 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) info->result = _lv_area_is_point_on(&slider->left_knob_area, info->point, 0); } } - else if(e == LV_EVENT_PRESSED) { + else if(code == LV_EVENT_PRESSED) { + lv_obj_invalidate_area(obj, &slider->right_knob_area); + if(slider->bar.mode == LV_SLIDER_MODE_SYMMETRICAL) lv_obj_invalidate_area(obj, &slider->left_knob_area); + lv_point_t p; slider->dragging = true; if(type == LV_SLIDER_MODE_NORMAL || type == LV_SLIDER_MODE_SYMMETRICAL) { @@ -175,7 +182,7 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } } - else if(e == LV_EVENT_PRESSING && slider->value_to_set != NULL) { + else if(code == LV_EVENT_PRESSING && slider->value_to_set != NULL) { lv_indev_t * indev = lv_indev_get_act(); if(lv_indev_get_type(indev) != LV_INDEV_TYPE_POINTER) return; @@ -192,9 +199,9 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); int32_t range = slider->bar.max_value - slider->bar.min_value; - int16_t new_value = 0; - int16_t real_max_value = slider->bar.max_value; - int16_t real_min_value = slider->bar.min_value; + int32_t new_value = 0; + int32_t real_max_value = slider->bar.max_value; + int32_t real_min_value = slider->bar.min_value; if(w >= h) { lv_coord_t indic_w = w - bg_left - bg_right; @@ -233,10 +240,13 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_RELEASED || e == LV_EVENT_PRESS_LOST) { + else if(code == LV_EVENT_RELEASED || code == LV_EVENT_PRESS_LOST) { slider->dragging = false; slider->value_to_set = NULL; + lv_obj_invalidate_area(obj, &slider->right_knob_area); + if(slider->bar.mode == LV_SLIDER_MODE_SYMMETRICAL) lv_obj_invalidate_area(obj, &slider->left_knob_area); + /*Leave edit mode if released. (No need to wait for LONG_PRESS)*/ lv_group_t * g = lv_obj_get_group(obj); bool editing = lv_group_get_editing(g); @@ -257,37 +267,38 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) { slider->left_knob_focus = 0; } } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { lv_obj_refresh_ext_draw_size(obj); } - else if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj,LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); /*The smaller size is the knob diameter*/ - lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + lv_coord_t zoom = lv_obj_get_style_transform_zoom(obj, LV_PART_KNOB); + lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); + lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); lv_coord_t knob_size = LV_MIN(lv_obj_get_width(obj) + 2 * trans_w, lv_obj_get_height(obj) + 2 * trans_h) >> 1; + knob_size = (knob_size * zoom) >> 8; knob_size += LV_MAX(LV_MAX(knob_left, knob_right), LV_MAX(knob_bottom, knob_top)); knob_size += 2; /*For rounding error*/ - knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); /*Indic. size is handled by bar*/ - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); } - else if(e == LV_EVENT_KEY) { - char c = *((char *)lv_event_get_param()); + else if(code == LV_EVENT_KEY) { + char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_RIGHT || c == LV_KEY_UP) { if(!slider->left_knob_focus) lv_slider_set_value(obj, lv_slider_get_value(obj) + 1, LV_ANIM_ON); @@ -303,15 +314,16 @@ static void lv_slider_event(lv_obj_t * obj, lv_event_t e) res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; } - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_knob(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_knob(e); } } -static void draw_knob(lv_obj_t * obj) +static void draw_knob(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_slider_t * slider = (lv_slider_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj); lv_coord_t objw = lv_obj_get_width(obj); @@ -398,7 +410,6 @@ static void draw_knob(lv_obj_t * obj) lv_draw_rect(&slider->left_knob_area, clip_area, &knob_rect_dsc); lv_event_send(obj, LV_EVENT_DRAW_PART_END, &dsc); } - } static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor) diff --git a/src/widgets/lv_slider.h b/src/widgets/lv_slider.h index 12b147ab2..2cf44d4c1 100644 --- a/src/widgets/lv_slider.h +++ b/src/widgets/lv_slider.h @@ -44,7 +44,7 @@ typedef struct { lv_bar_t bar; /*Add the ancestor's type first*/ lv_area_t left_knob_area; lv_area_t right_knob_area; - int16_t * value_to_set; /*Which bar value to set*/ + int32_t * value_to_set; /*Which bar value to set*/ uint8_t dragging : 1; /*1: the slider is being dragged*/ uint8_t left_knob_focus : 1; /*1: with encoder now the right knob can be adjusted*/ }lv_slider_t; @@ -72,7 +72,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * parent); * @param value the new value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -static inline void lv_slider_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) +static inline void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) { lv_bar_set_value(obj, value, anim); } @@ -83,7 +83,7 @@ static inline void lv_slider_set_value(lv_obj_t * obj, int16_t value, lv_anim_en * @param value new value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -static inline void lv_slider_set_left_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) +static inline void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) { lv_bar_set_start_value(obj, value, anim); } @@ -94,7 +94,7 @@ static inline void lv_slider_set_left_value(lv_obj_t * obj, int16_t value, lv_an * @param min minimum value * @param max maximum value */ -static inline void lv_slider_set_range(lv_obj_t * obj, int16_t min, int16_t max) +static inline void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max) { lv_bar_set_range(obj, min, max); } @@ -118,7 +118,7 @@ static inline void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode) * @param obj pointer to a slider object * @return the value of the main knob of the slider */ -static inline int16_t lv_slider_get_value(const lv_obj_t * obj) +static inline int32_t lv_slider_get_value(const lv_obj_t * obj) { return lv_bar_get_value(obj); } @@ -128,7 +128,7 @@ static inline int16_t lv_slider_get_value(const lv_obj_t * obj) * @param obj pointer to a slider object * @return the value of the left knob of the slider */ -static inline int16_t lv_slider_get_left_value(const lv_obj_t * obj) +static inline int32_t lv_slider_get_left_value(const lv_obj_t * obj) { return lv_bar_get_start_value(obj); } @@ -138,7 +138,7 @@ static inline int16_t lv_slider_get_left_value(const lv_obj_t * obj) * @param obj pointer to a slider object * @return the minimum value of the slider */ -static inline int16_t lv_slider_get_min_value(const lv_obj_t * obj) +static inline int32_t lv_slider_get_min_value(const lv_obj_t * obj) { return lv_bar_get_min_value(obj); } @@ -148,7 +148,7 @@ static inline int16_t lv_slider_get_min_value(const lv_obj_t * obj) * @param obj pointer to a slider object * @return the maximum value of the slider */ -static inline int16_t lv_slider_get_max_value(const lv_obj_t * obj) +static inline int32_t lv_slider_get_max_value(const lv_obj_t * obj) { return lv_bar_get_max_value(obj); } diff --git a/src/widgets/lv_switch.c b/src/widgets/lv_switch.c index 62887a92b..62d0a07e1 100644 --- a/src/widgets/lv_switch.c +++ b/src/widgets/lv_switch.c @@ -34,8 +34,8 @@ * STATIC PROTOTYPES **********************/ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_switch_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); /********************** * STATIC VARIABLES @@ -43,8 +43,8 @@ static void draw_main(lv_obj_t * obj); const lv_obj_class_t lv_switch_class = { .constructor_cb = lv_switch_constructor, .event_cb = lv_switch_event, - .width_def = (5 * LV_DPI_DEF) / 11, - .height_def = LV_DPI_DEF / 4, + .width_def = (4 * LV_DPI_DEF) / 10, + .height_def = (4 * LV_DPI_DEF) / 17, .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_switch_t), .base_class = &lv_obj_class @@ -61,7 +61,7 @@ const lv_obj_class_t lv_switch_class = { lv_obj_t * lv_switch_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_switch_class, parent); + return lv_obj_class_create_obj(&lv_switch_class, parent, NULL); } /********************** @@ -80,15 +80,20 @@ static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj } -static void lv_switch_event(lv_obj_t * obj, lv_event_t e) +static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; - if(e == LV_EVENT_REFR_EXT_DRAW_SIZE) { + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); + + if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); @@ -99,25 +104,26 @@ static void lv_switch_event(lv_obj_t * obj, lv_event_t e) knob_size += 2; /*For rounding error*/ knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); - lv_coord_t * s = lv_event_get_param(); + lv_coord_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); *s = LV_MAX(*s, lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR)); } - else if(e == LV_EVENT_CLICKED) { + else if(code == LV_EVENT_CLICKED) { uint32_t v = lv_obj_get_state(obj) & LV_STATE_CHECKED ? 1 : 0; res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, &v); if(res != LV_RES_OK) return; lv_obj_invalidate(obj); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { - const lv_area_t * clip_area = lv_event_get_param(); + lv_obj_t * obj = lv_event_get_target(e); + const lv_area_t * clip_area = lv_event_get_param(e); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj); /*Calculate the indicator area*/ diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 7de7e0518..af6998f02 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -31,8 +31,8 @@ **********************/ static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_table_event(lv_obj_t * obj, lv_event_t e); -static void draw_main(lv_obj_t * obj); +static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e); +static void draw_main(lv_event_t * e); static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t line_space, lv_coord_t cell_left, lv_coord_t cell_right, lv_coord_t cell_top, lv_coord_t cell_bottom); @@ -50,6 +50,7 @@ const lv_obj_class_t lv_table_class = { .height_def = LV_SIZE_CONTENT, .base_class = &lv_obj_class, .editable = LV_OBJ_CLASS_EDITABLE_TRUE, + .group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE, .instance_size = sizeof(lv_table_t), }; /********************** @@ -63,7 +64,7 @@ const lv_obj_class_t lv_table_class = { lv_obj_t * lv_table_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_table_class, parent); + return lv_obj_class_create_obj(&lv_table_class, parent, NULL); } /*===================== @@ -207,6 +208,16 @@ void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt) LV_ASSERT_MALLOC(table->row_h); if(table->row_h == NULL) return; + /*Free the unused cells*/ + if(old_row_cnt > row_cnt) { + uint16_t old_cell_cnt = old_row_cnt * table->col_cnt; + uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; + uint32_t i; + for(i = new_cell_cnt; i < old_cell_cnt; i++) { + lv_mem_free(table->cell_data[i]); + } + } + table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(char *)); LV_ASSERT_MALLOC(table->cell_data); if(table->cell_data == NULL) return; @@ -232,6 +243,16 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt) LV_ASSERT_MALLOC(table->col_w); if(table->col_w == NULL) return; + /*Free the unused cells*/ + if(old_col_cnt > col_cnt) { + uint16_t old_cell_cnt = old_col_cnt * table->row_cnt; + uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; + uint32_t i; + for(i = new_cell_cnt; i < old_cell_cnt; i++) { + lv_mem_free(table->cell_data[i]); + } + } + char ** new_cell_data = lv_mem_alloc(table->row_cnt * table->col_cnt * sizeof(char *)); LV_ASSERT_MALLOC(new_cell_data); if(new_cell_data == NULL) return; @@ -438,21 +459,25 @@ static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) if(table->row_h) lv_mem_free(table->row_h); } -static void lv_table_event(lv_obj_t * obj, lv_event_t e) +static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_table_t * table = (lv_table_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { refr_size(obj, 0); } - else if(e == LV_EVENT_GET_SELF_SIZE) { - lv_point_t * p = lv_event_get_param(); + else if(code == LV_EVENT_REFR_SELF_SIZE) { + lv_point_t * p = lv_event_get_param(e); uint32_t i; lv_coord_t w = 0; for(i = 0; i < table->col_cnt; i++) w += table->col_w[i]; @@ -463,7 +488,7 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) p->x = w; p->y = h; } - else if(e == LV_EVENT_PRESSED || e == LV_EVENT_PRESSING) { + else if(code == LV_EVENT_PRESSED || code == LV_EVENT_PRESSING) { uint16_t col; uint16_t row; lv_res_t pr_res = get_pressed_cell(obj, &row, &col); @@ -474,7 +499,7 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) } lv_obj_invalidate(obj); } - else if(e == LV_EVENT_RELEASED) { + else if(code == LV_EVENT_RELEASED) { lv_obj_invalidate(obj); lv_indev_t * indev = lv_indev_get_act(); lv_obj_t * scroll_obj = lv_indev_get_scroll_obj(indev); @@ -489,10 +514,10 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) table->row_act = LV_TABLE_CELL_NONE; } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { lv_obj_invalidate(obj); - } else if(e == LV_EVENT_KEY) { - int32_t c = *((int32_t *)lv_event_get_param()); + } else if(code == LV_EVENT_KEY) { + int32_t c = *((int32_t *)lv_event_get_param(e)); int32_t col = table->col_act; int32_t row = table->row_act; if(col == LV_TABLE_CELL_NONE || row == LV_TABLE_CELL_NONE) { @@ -541,16 +566,17 @@ static void lv_table_event(lv_obj_t * obj, lv_event_t e) res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; } - } else if(e == LV_EVENT_DRAW_MAIN) { - draw_main(obj); + } else if(code == LV_EVENT_DRAW_MAIN) { + draw_main(e); } } -static void draw_main(lv_obj_t * obj) +static void draw_main(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_table_t * table = (lv_table_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); lv_point_t txt_size; lv_area_t cell_area; @@ -753,7 +779,7 @@ static void refr_size(lv_obj_t * obj, uint32_t strat_row) table->row_h[i] = LV_CLAMP(minh, table->row_h[i], maxh); } - lv_obj_handle_self_size_chg(obj) ; + lv_obj_refresh_self_size(obj) ; } static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font, diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index d68c45eb9..7ed2e5be7 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -44,7 +44,7 @@ **********************/ static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static void lv_textarea_event(lv_obj_t * obj, lv_event_t e); +static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e); static void cursor_blink_anim_cb(void * obj, int32_t show); static void pwd_char_hider_anim(void * obj, int32_t x); static void pwd_char_hider_anim_ready(lv_anim_t * a); @@ -52,10 +52,10 @@ static void pwd_char_hider(lv_obj_t * obj); static bool char_is_accepted(lv_obj_t * obj, uint32_t c); static void start_cursor_blink(lv_obj_t * obj); static void refr_cursor_area(lv_obj_t * obj); -static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e); +static void update_cursor_position_on_click(lv_event_t * e); static lv_res_t insert_handler(lv_obj_t * obj, const char * txt); -static void draw_placeholder(lv_obj_t * obj); -static void draw_cursor(lv_obj_t * obj); +static void draw_placeholder(lv_event_t * e); +static void draw_cursor(lv_event_t * e); /********************** * STATIC VARIABLES @@ -84,7 +84,7 @@ static const char * ta_insert_replace; lv_obj_t * lv_textarea_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_textarea_class, parent); + return lv_obj_class_create_obj(&lv_textarea_class, parent, NULL); } /*====================== @@ -147,17 +147,13 @@ void lv_textarea_add_char(lv_obj_t * obj, uint32_t c) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -213,17 +209,13 @@ void lv_textarea_add_text(lv_obj_t * obj, const char * txt) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -337,17 +329,13 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt) pwd_char_hider(obj); } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); lv_anim_set_exec_cb(&a, pwd_char_hider_anim); lv_anim_set_time(&a, ta->pwd_show_time); lv_anim_set_values(&a, 0, 1); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready); lv_anim_start(&a); } @@ -407,24 +395,29 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) ta->cursor.pos = pos; - /*Position the label to make the cursor show*/ - lv_point_t cur_pos; - const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_area_t label_cords; - lv_area_t ta_cords; - lv_label_get_letter_pos(ta->label, pos, &cur_pos); - lv_obj_get_coords(obj, &ta_cords); - lv_obj_get_coords(ta->label, &label_cords); + /*Position the label to make the cursor visible*/ + lv_point_t cur_pos; + const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); + lv_area_t label_cords; + lv_area_t ta_cords; + lv_label_get_letter_pos(ta->label, pos, &cur_pos); + lv_obj_get_coords(obj, &ta_cords); + lv_obj_get_coords(ta->label, &label_cords); - /*Check the top*/ - lv_coord_t font_h = lv_font_get_line_height(font); - if(cur_pos.y < lv_obj_get_scroll_top(obj)) { - lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); - } - /*Check the bottom*/ - lv_coord_t h = lv_obj_get_height_fit(obj); - if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { - lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); + if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE)) { + /*The text area needs to have it's final size to see if the cursor is out of the area or not*/ + lv_obj_update_layout(obj); + + /*Check the top*/ + lv_coord_t font_h = lv_font_get_line_height(font); + if(cur_pos.y < lv_obj_get_scroll_top(obj)) { + lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); + } + /*Check the bottom*/ + lv_coord_t h = lv_obj_get_content_height(obj); + if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { + lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); + } } ta->cursor.valid_x = cur_pos.x; @@ -487,13 +480,14 @@ void lv_textarea_set_one_line(lv_obj_t * obj, bool en) lv_coord_t font_h = lv_font_get_line_height(font); ta->one_line = 1; + lv_obj_set_width(ta->label, LV_SIZE_CONTENT); + lv_obj_set_content_height(obj, font_h); - lv_label_set_long_mode(ta->label, LV_LABEL_LONG_EXPAND); lv_obj_scroll_to(obj, 0, 0, LV_ANIM_OFF); } else { ta->one_line = 0; - lv_label_set_long_mode(ta->label, LV_LABEL_LONG_WRAP); + lv_obj_set_width(ta->label, lv_pct(100)); lv_obj_set_height(obj, LV_DPI_DEF); lv_obj_scroll_to(obj, 0, 0, LV_ANIM_OFF); @@ -819,8 +813,9 @@ static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * o ta->placeholder_txt = NULL; ta->label = lv_label_create(obj); - lv_label_set_long_mode(ta->label, LV_LABEL_LONG_WRAP); + lv_obj_set_width(ta->label, lv_pct(100)); lv_label_set_text(ta->label, ""); + lv_label_set_long_mode(ta->label, LV_LABEL_LONG_WRAP); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); start_cursor_blink(obj); @@ -843,37 +838,40 @@ static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob } } -static void lv_textarea_event(lv_obj_t * obj, lv_event_t e) +static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e) { + LV_UNUSED(class_p); + lv_res_t res; /*Call the ancestor's event handler*/ - res = lv_obj_event_base(MY_CLASS, obj, e); + res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - if(e == LV_EVENT_STYLE_CHANGED) { + if(code == LV_EVENT_STYLE_CHANGED) { if(ta->label) { lv_label_set_text(ta->label, NULL); refr_cursor_area(obj); start_cursor_blink(obj); } } - else if(e == LV_EVENT_FOCUSED) { + else if(code == LV_EVENT_FOCUSED) { start_cursor_blink(obj); } - else if(e == LV_EVENT_SIZE_CHANGED) { + else if(code == LV_EVENT_SIZE_CHANGED) { /*Set the label width according to the text area width*/ if(ta->label) { - lv_obj_set_width(ta->label, lv_obj_get_width_fit(obj)); lv_obj_set_pos(ta->label, 0, 0); lv_label_set_text(ta->label, NULL); /*Refresh the label*/ refr_cursor_area(obj); } } - else if(e == LV_EVENT_KEY) { - uint32_t c = *((uint32_t *)lv_event_get_param()); /*uint32_t because can be UTF-8*/ + else if(code == LV_EVENT_KEY) { + uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/ if(c == LV_KEY_RIGHT) lv_textarea_cursor_right(obj); else if(c == LV_KEY_LEFT) @@ -896,15 +894,15 @@ static void lv_textarea_event(lv_obj_t * obj, lv_event_t e) lv_textarea_add_char(obj, c); } } - else if(e == LV_EVENT_PRESSED || e == LV_EVENT_PRESSING || e == LV_EVENT_PRESS_LOST || - e == LV_EVENT_RELEASED) { - update_cursor_position_on_click(obj, e); + else if(code == LV_EVENT_PRESSED || code == LV_EVENT_PRESSING || code == LV_EVENT_PRESS_LOST || + code == LV_EVENT_RELEASED) { + update_cursor_position_on_click(e); } - else if(e == LV_EVENT_DRAW_MAIN) { - draw_placeholder(obj); + else if(code == LV_EVENT_DRAW_MAIN) { + draw_placeholder(e); } - else if(e == LV_EVENT_DRAW_POST) { - draw_cursor(obj); + else if(code == LV_EVENT_DRAW_POST) { + draw_cursor(e); } } @@ -1029,10 +1027,6 @@ static void start_cursor_blink(lv_obj_t * obj) lv_anim_del(obj, cursor_blink_anim_cb); ta->cursor.show = 1; } else { - lv_anim_path_t path; - lv_anim_path_init(&path); - lv_anim_path_set_cb(&path, lv_anim_path_step); - lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, ta); @@ -1040,7 +1034,7 @@ static void start_cursor_blink(lv_obj_t * obj) lv_anim_set_time(&a, blink_time); lv_anim_set_playback_time(&a, blink_time); lv_anim_set_values(&a, 1, 0); - lv_anim_set_path(&a, &path); + lv_anim_set_path_cb(&a, lv_anim_path_step); lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); lv_anim_start(&a); } @@ -1129,11 +1123,13 @@ static void refr_cursor_area(lv_obj_t * obj) lv_obj_invalidate_area(obj, &area_tmp); } -static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) +static void update_cursor_position_on_click(lv_event_t * e) { lv_indev_t * click_source = lv_indev_get_act(); if(click_source == NULL) return; + lv_event_code_t code = lv_event_get_code(e); + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; if(ta->cursor.click_pos == 0) return; @@ -1177,24 +1173,24 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) } if(ta->text_sel_en) { - if(!ta->text_sel_in_prog && !click_outside_label && e == LV_EVENT_PRESSED) { + if(!ta->text_sel_in_prog && !click_outside_label && code == LV_EVENT_PRESSED) { /*Input device just went down. Store the selection start position*/ ta->sel_start = char_id_at_click; ta->sel_end = LV_LABEL_TEXT_SEL_OFF; ta->text_sel_in_prog = 1; lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); } - else if(ta->text_sel_in_prog && e == LV_EVENT_PRESSING) { + else if(ta->text_sel_in_prog && code == LV_EVENT_PRESSING) { /*Input device may be moving. Store the end position*/ ta->sel_end = char_id_at_click; } - else if(ta->text_sel_in_prog && (e == LV_EVENT_PRESS_LOST || e == LV_EVENT_RELEASED)) { + else if(ta->text_sel_in_prog && (code == LV_EVENT_PRESS_LOST || code == LV_EVENT_RELEASED)) { /*Input device is released. Check if anything was selected.*/ lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); } } - if(ta->text_sel_in_prog || e == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); + if(ta->text_sel_in_prog || code == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); if(ta->text_sel_in_prog) { /*If the selected area has changed then update the real values and*/ @@ -1222,7 +1218,7 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) } } /*Finish selection if necessary*/ - if(e == LV_EVENT_PRESS_LOST || e == LV_EVENT_RELEASED) { + if(code == LV_EVENT_PRESS_LOST || code == LV_EVENT_RELEASED) { ta->text_sel_in_prog = 0; } } @@ -1239,7 +1235,7 @@ static void update_cursor_position_on_click(lv_obj_t * obj, lv_event_t e) char_id_at_click = lv_label_get_letter_on(ta->label, &rel_pos); } - if(e == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); + if(code == LV_EVENT_PRESSED) lv_textarea_set_cursor_pos(obj, char_id_at_click); #endif } @@ -1260,10 +1256,11 @@ static lv_res_t insert_handler(lv_obj_t * obj, const char * txt) return LV_RES_OK; } -static void draw_placeholder(lv_obj_t * obj) +static void draw_placeholder(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const char * txt = lv_label_get_text(ta->label); /*Draw the place holder*/ @@ -1286,10 +1283,11 @@ static void draw_placeholder(lv_obj_t * obj) } } -static void draw_cursor(lv_obj_t * obj) +static void draw_cursor(lv_event_t * e) { + lv_obj_t * obj = lv_event_get_target(e); lv_textarea_t * ta = (lv_textarea_t *)obj; - const lv_area_t * clip_area = lv_event_get_param(); + const lv_area_t * clip_area = lv_event_get_param(e); const char * txt = lv_label_get_text(ta->label); if(ta->cursor.show == 0) return; diff --git a/src/widgets/lv_widgets.mk b/src/widgets/lv_widgets.mk index 2ce351461..4e62dc583 100644 --- a/src/widgets/lv_widgets.mk +++ b/src/widgets/lv_widgets.mk @@ -3,13 +3,11 @@ CSRCS += lv_bar.c CSRCS += lv_btn.c CSRCS += lv_btnmatrix.c CSRCS += lv_canvas.c -CSRCS += lv_chart.c CSRCS += lv_checkbox.c CSRCS += lv_dropdown.c CSRCS += lv_img.c CSRCS += lv_label.c CSRCS += lv_line.c -CSRCS += lv_meter.c CSRCS += lv_roller.c CSRCS += lv_slider.c CSRCS += lv_switch.c diff --git a/tests/build.py b/tests/build.py index da8116d3e..101611a43 100755 --- a/tests/build.py +++ b/tests/build.py @@ -197,6 +197,7 @@ full_32bit = { "LV_USE_PERF_MONITOR":1, "LV_USE_MEM_MONITOR":1, + "LV_LABEL_TEXT_SEL":1, "LV_BUILD_EXAMPLES":1, diff --git a/tests/lv_test_core/lv_test_style.c b/tests/lv_test_core/lv_test_style.c index ed220b02c..46336c96b 100644 --- a/tests/lv_test_core/lv_test_style.c +++ b/tests/lv_test_core/lv_test_style.c @@ -128,7 +128,7 @@ typedef int _keep_pedantic_happy; // _lv_style_set_int(&style, LV_STYLE_TEXT_LINE_SPACE, 5); // _lv_style_set_opa(&style, LV_STYLE_BG_OPA, LV_OPA_50); // _lv_style_set_ptr(&style, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL); -// _lv_style_set_color(&style, LV_STYLE_BG_COLOR, lv_color_red()); +// _lv_style_set_color(&style, LV_STYLE_BG_COLOR, lv_palette_main(LV_PALETTE_RED)); // // found = _lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'int' property"); @@ -144,7 +144,7 @@ typedef int _keep_pedantic_happy; // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'color' property"); -// lv_test_assert_color_eq(lv_color_red(), color, "Get the value of a 'color' property"); +// lv_test_assert_color_eq(lv_palette_main(LV_PALETTE_RED), color, "Get the value of a 'color' property"); // // lv_test_print("Reset the style"); // lv_style_reset(&style); @@ -192,7 +192,7 @@ typedef int _keep_pedantic_happy; // _lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5); // _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); // _lv_style_set_ptr(&style_first, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL); -// _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, lv_color_red()); +// _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, lv_palette_main(LV_PALETTE_RED)); // // found = _lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property"); @@ -208,14 +208,14 @@ typedef int _keep_pedantic_happy; // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'color' property"); -// lv_test_assert_color_eq(lv_color_red(), color, "Get the value of a 'color' property"); +// lv_test_assert_color_eq(lv_palette_main(LV_PALETTE_RED), color, "Get the value of a 'color' property"); // // lv_test_print("Overwrite the properties from the second style"); // // _lv_style_set_int(&style_second, LV_STYLE_TEXT_LINE_SPACE, 10); // _lv_style_set_opa(&style_second, LV_STYLE_BG_OPA, LV_OPA_60); // _lv_style_set_ptr(&style_second, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 1); -// _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR, lv_color_blue()); +// _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR, lv_palette_main(LV_PALETTE_BLUE)); // // found = _lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'int' property"); @@ -231,7 +231,7 @@ typedef int _keep_pedantic_happy; // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'color' property"); -// lv_test_assert_color_eq(lv_color_blue(), color, "Get the value of an overwritten 'color' property"); +// lv_test_assert_color_eq(lv_palette_main(LV_PALETTE_BLUE), color, "Get the value of an overwritten 'color' property"); // // lv_test_print("Overwrite the properties with the local style"); // _lv_style_list_set_local_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, 20); @@ -375,9 +375,9 @@ typedef int _keep_pedantic_happy; // // lv_test_print("Test state precedence in 2 styles"); // _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_YELLOW); -// _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, lv_color_red()); +// _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, lv_palette_main(LV_PALETTE_RED)); // _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, LV_COLOR_LIME); -// _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, lv_color_blue()); +// _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, lv_palette_main(LV_PALETTE_BLUE)); // // lv_color_t color; // @@ -387,7 +387,7 @@ typedef int _keep_pedantic_happy; // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in hovered state"); -// lv_test_assert_color_eq(lv_color_red(), color, "Get the value of a 'color' in hovered state"); +// lv_test_assert_color_eq(lv_palette_main(LV_PALETTE_RED), color, "Get the value of a 'color' in hovered state"); // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in checked state"); @@ -395,7 +395,7 @@ typedef int _keep_pedantic_happy; // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in hover pressed state"); -// lv_test_assert_color_eq(lv_color_blue(), color, "Get the value of a 'color' in hover pressed state"); +// lv_test_assert_color_eq(lv_palette_main(LV_PALETTE_BLUE), color, "Get the value of a 'color' in hover pressed state"); // // found = _lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, &color); // lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in edit (unspecified) state"); @@ -436,16 +436,16 @@ typedef int _keep_pedantic_happy; // lv_test_print("Set style properties"); // lv_mem_monitor(&mon_start); // for(i = 0; i < 100; i++) { -// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_color_red()); +// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); // -// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, lv_color_blue()); -// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_color_blue()); +// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, lv_palette_main(LV_PALETTE_BLUE)); +// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_BLUE)); // _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED | LV_STATE_FOCUSED) << LV_STYLE_STATE_POS, LV_COLOR_GREEN); // -// _lv_style_set_color(&style3, LV_STYLE_BG_COLOR, lv_color_red()); +// _lv_style_set_color(&style3, LV_STYLE_BG_COLOR, lv_palette_main(LV_PALETTE_RED)); // -// _lv_style_set_color(&style3, LV_STYLE_IMAGE_RECOLOR, lv_color_red()); +// _lv_style_set_color(&style3, LV_STYLE_IMAGE_RECOLOR, lv_palette_main(LV_PALETTE_RED)); // // lv_style_reset(&style1); // lv_style_reset(&style2); @@ -483,9 +483,9 @@ typedef int _keep_pedantic_happy; // lv_test_print("Add styles"); // lv_mem_monitor(&mon_start); // for(i = 0; i < 100; i++) { -// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_color_red()); +// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); // // _lv_style_list_add_style(&style_list, &style1); // _lv_style_list_remove_style(&style_list, &style1); @@ -509,11 +509,11 @@ typedef int _keep_pedantic_happy; // lv_test_print("Add styles and use local style"); // lv_mem_monitor(&mon_start); // for(i = 0; i < 100; i++) { -// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_color_red()); +// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); // -// if(i % 2 == 0) _lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, lv_color_red()); +// if(i % 2 == 0) _lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); // // _lv_style_list_add_style(&style_list, &style1); // _lv_style_list_remove_style(&style_list, &style1); @@ -524,7 +524,7 @@ typedef int _keep_pedantic_happy; // _lv_style_list_remove_style(&style_list, &style2); // _lv_style_list_add_style(&style_list, &style1); // -// if(i % 2 != 0) _lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, lv_color_red()); +// if(i % 2 != 0) _lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); // // _lv_style_list_reset(&style_list); // lv_style_reset(&style1); @@ -545,9 +545,9 @@ typedef int _keep_pedantic_happy; // _lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE); // } // -// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_color_red()); -// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, lv_color_blue()); -// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_color_blue()); +// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_RED)); +// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, lv_palette_main(LV_PALETTE_BLUE)); +// _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, lv_palette_main(LV_PALETTE_BLUE)); // _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED | LV_STATE_FOCUSED) << LV_STYLE_STATE_POS, LV_COLOR_GREEN); // // _lv_style_list_add_style(&style_list, &style1);