Commit Graph

39 Commits

Author SHA1 Message Date
Patrick Ziegler
fd556525a8
New Tag Parser (#2303)
* refactor(color): Use enum class for color type

* Add testcases for tag parser

* Make tag parser a pull-style parser

Being able to parse single elements at a time gives us more fine-grained
error messages, we can also parse as much as possible and only stop
after an exception.

* fix(color): Parser did not check for invalid chars

* tag parser: First full implementation

* tag parser: Fix remaining failing tests

* tag parser: Replace old parser

* tag parser: Treat alignment as formatting tag

Makes the structure less complex and the alignment tags really are
formatting tags, they are structurally no different from the %{R} tag.

* tag parser: Cleanup type definitions

All type definitions for tags now live in tags/types.hpp, the parser.hpp
only contains the definitions necessary for actually calling the parser,
this shouldn't be included in many places (only places that actually do
parsing). But many places need the definitions for the tags themselves.

* Rename components/parser to tags/dispatch

* tag parser: Cleanup

* Add changelog
2020-12-17 20:37:28 +01:00
patrick96
477189e443 Cleanup 2020-11-27 22:08:03 +01:00
patrick96
c9efd09f71 Load rgba from config instead of strings. 2020-11-27 22:08:03 +01:00
patrick96
191fb2972c actions: Integrate input_handler into module
Only modules can now be action handlers.
This also slightly simplifies the controller because we don't need to
keep track of input handlers, we can just use the module list.
2020-11-26 20:53:53 +01:00
patrick96
bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96
ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96
816b73a95f actions: Add utility functions to produce action tags 2020-11-26 20:53:53 +01:00
patrick96
22d0f0a38c refactor(builder): Remove unused arguments 2020-11-26 20:53:53 +01:00
patrick96
4bc7a09c7e refactor(builder): Remove unused condition parameter
Same as in #1952, the methods are never called with the optional
parameter, except once where it is called with the default value.

Ref: #1952
2019-12-18 21:22:47 +01:00
patrick96
37628f8691 refactor(builder): Remove unused add_space parameter
the `node` and `node_repeat` were never called with the optional
parameter add_space. And its default value is false, so the
corresponding code was never used.

I think in general it is better to just have the user of those functions
call `builder::space` when they need to instead of adding more
complexity to the `node*` functions.
2019-12-12 22:08:34 +01:00
infokiller
fb6e874235 feat(label): Add minlen with alignment (#1546)
* Add label minlen and alignment.

Fix build

* Update src/drawtypes/label.cpp

Co-Authored-By: infokiller <infokiller@users.noreply.github.com>

* Use existing alignment type.

* Remove redundant max_len handling in label::get.

* Fix shadowing.

* Add label alignment tests.

* Handle minlen/maxlen and alignment in same function.

Also add a test for a test case brought up in the PR discussion.

* Format files with clang-format

* Move builder::get_label_text tests into label tests

builder::get_label_text doesn't really do anything anymore

* builder: remove get_label_text

* label: Clean up label::get()

* Fix comment style.

* Set default label alignment to left.

* Update src/drawtypes/label.cpp

Co-Authored-By: Patrick Ziegler <p.ziegler96@gmail.com>

* Update include/drawtypes/label.hpp

Co-Authored-By: Patrick Ziegler <p.ziegler96@gmail.com>
2019-12-01 01:28:41 +01:00
patrick96
587dc6c84d bar: Make module separator a label
Some people use text modules instead of the `separator` key in the bar
section to better configure the separator (colors, fonts).
Since we disallowed the same module being used multiple times in #1534,
this will now print an error message.

This should help with this a bit.

Ref #1913
2019-10-27 16:02:33 +01:00
patrick96
211b0bbfd8 Incorporate Reviews 2019-08-06 21:36:20 +02:00
patrick96
57d364a2fc Reset all tags at the end of a module
The %{PR} tag is introduced for this. It resets all colors as well as
the activation of the underline and overline and font.

This has become necessary because we don't track what raw tags a user
injects into the formatting string and otherwise their raw tags could
bleed through.

This doesn't touch action tags because even before raw action tags
weren't being tracked. Action tags also have the requirement that they
have to be used in pairs, so closing them prematurely could break things
(for example with click actions for the entire bar)
2019-08-06 21:36:20 +02:00
patrick96
3ebb0b0b03 builder: Simplify open tag tracking
Using a bit vector to track the active attributes does not really give a
significant speed increase, especially for only two attributes

Checking if a syntaxtag or an attribute exists in the map just adds
unnecessary code
2019-08-06 21:36:20 +02:00
patrick96
0ab9fcdc38 refactor: Remove all mentions of icon_t
Is exactly the same label_t
2019-04-08 09:01:48 +02:00
patrick96
4b83468eb9 refactor(builder): Add failing test for ellipsis
Adds failing tests for the bug described in #1194
2018-07-22 14:02:15 -07:00
Michael Carlberg
452afcdc68 refactor: Integral types 2017-01-24 07:11:14 +01:00
Michael Carlberg
22140f7db9 refactor(builder): Action wrapped labels 2017-01-13 13:01:46 +01:00
Michael Carlberg
e3a51b235a refactor(clang-tidy): Apply fixes 2016-12-31 04:32:11 +01:00
Michael Carlberg
7b780a3201 refactor(builder): Cleanup 2016-12-26 17:06:28 +01:00
Michael Carlberg
b9f9092bbe refactor: Cleanup 2016-12-26 10:37:14 +01:00
Michael Carlberg
f9062d031c refactor(clang-tidy): Apply fixes 2016-12-15 03:30:41 +01:00
Michael Carlberg
08be86fbe1 wip(refactor): Improve signal and event handling 2016-12-14 11:01:44 +01:00
Michael Carlberg
3854515521 fix: Wrap format pre/suffix within cmd 2016-12-05 05:32:10 +01:00
Michael Carlberg
44da14755d refactor(clang-tidy): Apply fixes 2016-12-04 04:11:47 +01:00
Michael Carlberg
d34263d850 fix(progressbar): Generate less data
Build the format sub-strings (%fill%, %indicator%, %empty%)
before adding it to the builder to avoid having it generate
alot of duplicate content (tags, etc)
2016-11-30 22:17:55 +01:00
Michael Carlberg
ff9be848c7 refactor(clang-tidy): Apply fixes 2016-11-25 21:58:49 +01:00
Michael Carlberg
8db3e79919 refactor(clang-format): Apply fixes 2016-11-25 14:17:41 +01:00
Michael Carlberg
84d58e7619 refactor: Cleanup handling of syntax tags 2016-11-25 04:34:24 +01:00
Michael Carlberg
ad510eb768 fix(builder): Default to non-lazy mode
Ref #181
2016-11-22 23:31:08 +01:00
Michael Carlberg
ebf1bd1129 feat: Support different under-/overline
Make it possible to set different size
and color values for the two properties.

`overline-size = 2`
`overline-color = #f00`
`underline-size = 5`
`underline-size = #00f`
2016-11-21 16:16:06 +01:00
Michael Carlberg
88c8bbd940 refactor: Fwd declare drawtypes
Ref #164
2016-11-19 15:49:06 +01:00
Michael Carlberg
fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg
e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg
efba06dc2d fix(xft): Allocate xft color by value
- Solves the issue with transparency using Xft.
- X11 fonts are still affected by the alpha issue.

Closes jaagr/lemonbuddy#119
2016-10-30 02:37:56 +01:00
Michael Carlberg
eac65cdabb fix(cmake): Make specific c++lib linking optional
- Do not enforce linking against libc++
- Fix various linter warnings
2016-10-25 20:47:53 +02:00
Michael Carlberg
68f72d69cc refactor: Drop tokenized labels
Handle placeholder tokens inside each label
instead of cloning into a new instance each time
2016-10-19 01:31:17 +02:00
Michael Carlberg
d359ab6057 refactor: Application rewrite 2016-10-10 14:52:57 +02:00