Commit graph

152 commits

Author SHA1 Message Date
Daniel Eklöf
21e28315e3 particle/progress-bar: expose info through the new struct particle_info struct 2019-01-13 10:38:25 +01:00
Daniel Eklöf
73b8bf1346 particle/map: expose info through the new struct particle_info struct 2019-01-13 10:34:15 +01:00
Daniel Eklöf
6379b1939f particle/list: expose info through the new struct particle_info struct 2019-01-12 22:56:00 +01:00
Daniel Eklöf
0f8f21510a particle/empty: expose info through the new struct particle_info struct 2019-01-12 22:48:23 +01:00
Daniel Eklöf
75bdd2ad3c config: use dashes, '-', instead of underscores, '_' in attribute names 2019-01-12 10:32:52 +01:00
Daniel Eklöf
558f75a54b module/particle: remove cairo context from begin_expose() 2019-01-09 18:50:26 +01:00
Daniel Eklöf
f6977417e0 font: use font-config to load font
This allows us to a) move away from cairo's "toy" API, and b) let the
user specify font options in a single font "name" string:

  Serif:size=10:weight=bold:slant=italic

This also allows us to simplify the font code significantly (except
for the fontconfig parts...); the font no longer sets itself in a
cairo surface - font users do that; the font simply returns a
cairo_scaled_font_t.

Furthermore, font_clone() has now been simplified to basically just
refcount the scaled font. I.e. there's no need to run the full
constructor and lookup and instantiate the cairo scaled font again.
2019-01-09 18:50:16 +01:00
Daniel Eklöf
52f13dec3d dynlist: move to particles folder 2018-12-29 22:13:00 +01:00
Daniel Eklöf
86425fbe48 config: all particles now take a 'on_click_template' argument 2018-12-29 21:23:27 +01:00
Daniel Eklöf
3eebdbb5b0 particle/ramp: fix on_mouse() regression
Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
2018-12-29 21:18:07 +01:00
Daniel Eklöf
e4fab9a20b particle/map: fix on_mouse() regression
Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
2018-12-29 21:17:08 +01:00
Daniel Eklöf
22507ae26c particle: add utility function to render a particle's decoration 2018-12-29 21:00:03 +01:00
Daniel Eklöf
6f5572ff6b particle/map: implement left/right margin
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
2018-12-29 20:54:41 +01:00
Daniel Eklöf
a3322b0a8a particle/ramp: implement left/right margin
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
2018-12-29 20:50:23 +01:00
Daniel Eklöf
5fc29f7bbe particles: name private structs and variables consistently 2018-12-29 20:40:25 +01:00
Daniel Eklöf
3135f1d36d particle: all particles now take margin arguments
Ramp and map however, doesn't allow any values other than 0 (yet).
2018-12-29 20:33:38 +01:00
Daniel Eklöf
1f182b862e particle/progress-bar: allow user to configure an on-click handler
Since we're typically interrested in *where* (on the progress-bar) the
user clicked, we need a way to pass the clicked position to the
handler.

Normally, the on-click handler is expanded when a particle
instantiates its exposable. At this point, we (obviously) don't have
the click position.

This is solved by expanding the handler a second time, when the bar is
clicked.

Thus, the user can use the "{where}" tag in the click handler. "where"
will be expanded to a percentage value (0-100).
2018-12-29 17:36:34 +01:00
Daniel Eklöf
bd365405d7 particle/list: remove excessive debug output 2018-12-29 17:14:49 +01:00
Daniel Eklöf
7da09530b8 particle/string: tags_expand_template() now returns NULL if template is NULL 2018-12-29 17:12:11 +01:00
Daniel Eklöf
6857b99c56 particle/list: tags_expand_template() now returns NULL if template is NULL 2018-12-29 17:11:54 +01:00
Daniel Eklöf
85801a5deb particle/string: expand on_click handler before passing to exposable 2018-12-29 17:10:10 +01:00
Daniel Eklöf
aee4805df8 particle/list: expand on_click handler before passing to exposable 2018-12-29 17:09:57 +01:00
Daniel Eklöf
ab67d036ae tags: break out string formatting from particle/string 2018-12-29 17:03:41 +01:00
Daniel Eklöf
88bcf425bf particle/list: on_click handler 2018-12-29 16:15:37 +01:00
Daniel Eklöf
36e3bdd9fd particle/list: override on_mouse()
If we have our own on_click handler, call the default
implementation. Otherwise, check which sub-particle the mouse is over,
and delegate the on_mouse() call.
2018-12-29 14:46:29 +01:00
Daniel Eklöf
9e5dbfe27d particle/string: constructor now takes an 'on_click_template' 2018-12-29 14:38:10 +01:00
Daniel Eklöf
5164d1d6ea particle: add an 'on_click_template' to base constructor.
This is intended to be a format-like string, with the possibility to
use tag formatters.

The expanded string will later be passed to the system() call.
2018-12-29 14:36:18 +01:00
Daniel Eklöf
e8d8bf70d3 exposable: add a "common" constructor and default destructor 2018-12-29 12:51:31 +01:00
Daniel Eklöf
4d173326e4 particle: remove 'parent' (it wasn't used anyway) 2018-12-29 12:49:00 +01:00
Daniel Eklöf
f2a3deb362 particle/progress-bar: disable debug logging 2018-12-28 14:14:31 +01:00
Daniel Eklöf
3027b6cd9e particle/progress-bar: add debug log 2018-12-28 14:05:17 +01:00
Daniel Eklöf
13cc11e200 tag: refresh_in() *must* use the realtime unit 2018-12-28 14:04:35 +01:00
Daniel Eklöf
adb70e9f35 particle/progress-bar: force-refresh realtime tags
When we're tracking a realtime tag, calculate the time left until the
next segment in the progress bar will get filled, and schedule a force
refresh.
2018-12-28 12:43:54 +01:00
Daniel Eklöf
8d94202057 particle/progress-bar: renders a progrss-bar-like thingy 2018-12-27 14:22:05 +01:00
Daniel Eklöf
ce895ac44f particle/empty: placeholder particle, renders nothing
But may have margins.
2018-12-27 14:21:33 +01:00
Daniel Eklöf
3aa6b21056 particle/string: call particle_default_destroy() 2018-12-26 21:35:39 +01:00
Daniel Eklöf
ce85ccda56 particle/ramp: call particle_default_destroy() 2018-12-26 21:35:24 +01:00
Daniel Eklöf
20fb0c37b5 particle/map: call particle_default_destroy() 2018-12-26 21:35:05 +01:00
Daniel Eklöf
f5123afc72 particle/list: call particle_default_destroy() 2018-12-26 21:34:53 +01:00
Daniel Eklöf
ce68bdb59d exposable: add a 'width' member, set (at latest) in begin_expose() 2018-12-26 16:37:11 +01:00
Daniel Eklöf
1c9a908a8f particle/string: draw decoration, if available 2018-12-26 15:31:49 +01:00
Daniel Eklöf
052513c736 particle/ramp: don't use floating point arithmetic 2018-12-26 12:44:26 +01:00
Daniel Eklöf
a588c78e57 particle/ramp: use log framework 2018-12-18 19:37:37 +01:00
Daniel Eklöf
a9681dd19c cleanup 2018-12-16 17:08:38 +01:00
Daniel Eklöf
47b36bdd35 particle/ramp: new particle, selects one particle from a list
The ramp particle is configured with a tag name and a list of
particles.

At instantiation time, a single particle is selected from the list,
depending on the tag value and it's minimum and maximum values.

I.e. this particle acts kind of like a progress bar.
2018-12-16 16:20:45 +01:00
Daniel Eklöf
be6429c852 particle/map: left/right margin on a map doesn't make any sense 2018-12-15 19:16:55 +01:00
Daniel Eklöf
92c9593ff5 particle/map: new particle; maps a tag value to a particle
This particle is basically a dictionary mapping tag values to
particles.
2018-12-13 19:05:52 +01:00
Daniel Eklöf
44a2dbb201 tag: rename tag.value() -> tag.as_string() 2018-11-18 11:02:21 +01:00
Daniel Eklöf
6bd698fbc8 Revert "particle/list: optionally destroy sub particles"
This reverts commit c5d3e934b4.
2018-11-17 22:43:11 +01:00
Daniel Eklöf
c5d3e934b4 particle/list: optionally destroy sub particles
This was always done before. Now that it is optional, one can for
example generate lists dynamically, using the same set of base
particles over and over again.
2018-11-17 17:13:45 +01:00