Commit graph

5695 commits

Author SHA1 Message Date
fa4a9014a1 Timeline: nail the problem with calculating overall vertical space
In the end, I used the profile building pass to also calculate and sum up the vertical offsets.
Seems to be the only sane approach to get really precise values, since adjacent
upwards slopes can be combined at various places (and I do not want to use the
actual drawing code for this calculation)
2019-08-29 23:02:44 +02:00
4d2766963b Timeline: size allocation is not yet correct...
need to investigate and probably need to store per track offset values
already while building the track profile. The primary reason for the
observed discrepancy seems to be the rather flexible combination of
slope borders.
2019-08-29 16:19:47 +02:00
360209a381 Timeline: verify visible track structure (and fix a bug with header placement) 2019-08-29 16:19:40 +02:00
737505979b Timeline: also observe additional space for decorations added via CSS 2019-08-23 03:56:38 +02:00
346b5ae769 Timeline: now settle the drawing code with the insights gained thus far
Especially note the tricks we need to play in order to allow for (limited) usage of CSS3 box-shadows.
The reason is, all these CSS3 effects are rendered in one shot and combinend on the StyleContext::render_background() call
Thus we need to ensure that the background is properly aligned with the frames
2019-08-23 03:04:22 +02:00
fc5eaf857c Timeline: find a workaround to cause the Box to reflow the rulerCanvas
seemingly, the Box with PACK_SHRINK allocates a zero height to the rulerCanvas initally,
which is correct at that point, since the widgets are not yet realised.
However, when we later set_size() on the rulerCanvas, the enclosing Box should reflow.
It does indeed if the child widget is a button or something similar, however,
somehow this reflowing does not work when we set_size on the canvas.

A workaround is to place a new set_size_request().

TODO: do this more precisely, and only on the rulerCanvas. To the contrary,
the mainCanvas is placed into a scolling-pane and thus does not need a size-Request.
Moreover, the latter automatically communicates with the hadjustment() / vadjustment() of
the enclosing scrollbars.
2019-08-22 17:34:32 +02:00
2390385dc5 Timeline: implement function to set the drawing canvas size
as can be verified with the debugger, it sets the correct sizes now.
And it is called only once (unless the content size actually changes).

TODO: however, the visible display of the GTK widgets is not adjusted
2019-08-21 19:13:55 +02:00
8c0b3258cb Timeline: investigate details of CSS box-shadow and dawing strategy
- decide upon the actual drawing strategy
- document our approach chosen thus far
- add a new function to fill in the overall canvas size (TODO)
2019-08-21 17:48:25 +02:00
81253cb152 Timeline: some analysis and planning regarding space allocation 2019-08-08 19:08:04 +02:00
a508ad751f Investigation: clarify handling of CSS3 box-shadow for custom drawing
- CSS3 effects like box-shadow are applied with the StyleContext::render_background() function
  * first, an outset box-shadow is rendered _outside_ the box given as parameter to `render_background()`
  * then the box is filled with the background colour
  * and last, an inset box-shadow is rendered _inside_ the area of a would-be border,
    without rendering the border itself.
  * consequently we can not shade the border itself and we can not shade the content
2019-08-08 19:08:04 +02:00
7bf7c51375 Investigation: inconclusive further research (context_save/restore)
Indeed I had missed to connect the new "free standing" StyleContext to
some Gdk::Screen, typically the default screen (connected to the current
top level window). But seemingly this was not really necessary, since,
somehow magically, the style context must have connected itself to some
screen, otherwise it wouldn't be able to access the CSS cascade.

Anyhow, fixing this omission does not resolve our problem.
Nor does any combination of re-connecting, invalidating etc.

I poked around in the GTK (C) code a lot, but could not spot any obvious
missing initialisation step. To much magic around here. Without massive
debugging into GTK internals, I don't see any way to further this
investigation. And, moreover there is a viable workaround
(namely to set and remove the classes explicitly, which works as intended)

I posted a question on Stackoverflow and for now
I'll file this topic as "inconclusive"
https://stackoverflow.com/q/57342478
2019-08-08 19:08:04 +02:00
ec3c49f612 Investigation: can reproduce the problematic behaviour with minimal setup
when we create a new Gtk::StyleContext and just apply a path,
then the style context looses its styling properties on context_save()
2019-08-08 19:08:04 +02:00
e5371f66b8 UI-Style: reorganise style constants and introduce some BEM notation
Note however, we will not plaster our UI code and CSS with mangled-out selectors
on each and every single element. This is what cascading was meant to be used for.
2019-08-08 19:08:04 +02:00
8824be440a Investigation: integrate findings thus far into our timeline drawing code
DONE
 - can now control the border size through a set of modifier classes

OPEN
 - but context_save()/restore() does not work; seem to loose all styling
 - not clear how to deal with CSS3 effects like box-shadow
2019-08-03 16:41:46 +02:00
06aa5c4c8c Investigation: get the border resizing to work
...as it turns out, a problem with Cascading prevented the additional classes to become effective
2019-08-03 15:45:36 +02:00
1b3cc73d07 Investigation: rebuild the problematic situation in this controlled environment
Within the timeline drawing code, adding a class to the Gtk::StyleContext on the fly seemingly did not work.
Now we're doing basically the same here in this small Gtk test application,
and it does not work either :-)
2019-08-03 13:34:56 +02:00
3921a9d41c Investigation: use a StyleContext for custom drawing
- add a separate dummy Gtk::Frame widget
- apply custom styling to that frame, by virtue of a CSS class '.experiment'
- pick up the Gtk::StyleContext of that testFrame
- use this style context to draw a custom frame onto the canvas
- control extension of that custom frame through the top margin of testFrame
2019-08-01 01:07:22 +02:00
aacc4ca041 Investigation: install a custom stylesheet 2019-08-01 00:48:04 +02:00
0280000854 Investigation: setup a minimal standalone GTK application
...to find out about GTK's implementation of some aspects of CSS
through Gtk::StyleContext and friends

Basically this is a clone of the existing gtk-canvas-experiment application
2019-08-01 00:02:56 +02:00
e6e68e2e68 Timeline: investigate options to build a suitable ramp style
...somehow does not yet work as intended...

- unable to control the border-width from code
- Gtk::StyleContext::add_class(name) does not seem to have any effect
2019-07-30 19:20:58 +02:00
b5c2009933 Timeline: first attempt at drawing ramps and borders
...does not work out as expected
 - frames are painted solid, not inset/outset
 - unable to manipulate the border width from code
2019-07-20 17:39:49 +02:00
b2c2787ddc Timeline: populate additional Style-Advice for nested ruler tracks 2019-07-20 01:24:17 +02:00
e3cde9b78d Timeline: fabricate a (test/dummy) population diff for a more complex track
The population message is just made up, in order to create more interesting structures
in the UI and so to further the development of the timeline display.

For the actual structure I choose to mirror my example drawing in draw/UI-TimelineLayout-1.png
which is also used in the TiddlyWiki, on the #GuiTimelineView tiddler

https://lumiera.org/wiki/renderengine.html#GuiTimelineView
2019-07-20 01:24:17 +02:00
3102de9d8a Timeline: inject sub-track into the header pane structure 2019-07-20 01:24:17 +02:00
eca09e3ab5 Timeline: work out how Ruler tracks can be managed 2019-07-20 01:24:17 +02:00
d1e2ddc56e Timeline: refactor common drawing code into an abstract baseclass 2019-07-15 00:25:08 +02:00
713178aecd Timeline: better save the number of pinned elements as dedicated field
...within the Profile object, instead of sneaking this info into the prelude verb
2019-07-15 00:06:59 +02:00
ec50407167 Timeline: start implementing some bits of the drawing code
Use a "catchy" style definition with lime background to make the drawing visible
2019-07-14 17:53:21 +02:00
bc4f7604a2 Timeline: draft a scheme to use custom class names within CSS selectors
We can add our custom classes to custom widgets, and we can set the
widget name, which can be used as #id selector from CSS

Unfortunately we can not set the main CSS node name for CustomWidgets defined through GTKmm (C++)
The latter is only possible when deriving the custom widget in plain-C, which is quite tedious.
On a second thought, this limitation is not so severe as it might seem, because
most of the time you actually do *not* want to change the CSS node name,
because you want to match against existing rules in the theme (e.g. box, or paned)

The actual case here would have been an exception to this rule, since here
it would be nice to anchor the whole custom timeline drawing in an "body.timeline" element


NOTE: Current state for the selector path is now:

window.background box.vertical box[2/3].horizontal widget[2/2] widget paned.vertical widget box.vertical notebook[1/1].frame paned.horizontal.timeline-page box.vertical.timeline.timeline-body fork.timeline
2019-07-13 21:04:33 +02:00
826df93955 Timeline: publish virtual CSS path and style context via Advice system
...and perform the initialisation once, when attaching the first timeline to the UI
Now our code produces the following Gtk::WidgetPath (note the last node, which our code added)

window:backdrop:dir-ltr.background box:backdrop:dir-ltr.vertical box:backdrop:dir-ltr[2/3].horizontal widget:backdrop:dir-ltr[2/2] widget:backdrop:dir-ltr paned:backdrop:dir-ltr.vertical widget:backdrop:dir-ltr box:backdrop:dir-ltr.vertical notebook:backdrop:dir-ltr[1/1].frame paned:backdrop:dir-ltr.horizontal box:backdrop:dir-ltr.vertical fork.timeline
2019-07-13 18:04:02 +02:00
6b4bf0a6ea Library: allow to check if Advice was explicitly given
For context: The »Advice System« was coined a long time ago, in 2010,
based on the vague impression that it might be useful for that kind of application
we are about to build here. And, as can be expected, none of the usage situations
envisioned at that time was brought to bear. Non the less, the facility came in
handy at times, precisely because it is cross-cutting and allows to pass
information without imposing any systematic relationship between the
communication partners.

And now we've got again such a situation.
The global style manager in the UI has to build a virtual CSS path,
which is needed by drawing code somewhere deep down, and we absolutely
do not want to pass a reference to the style manager over 20 recursive calls.

The alternatives would be
 (1) to turn the style manager into a public service
 (2) to have a static access function somewhere
 (3) to use a global variable.
For rationale, (1) would be overblown, because we do not actually request
a service to do work for us, rather we need some global piece of information.
(2) would be equivalent to (1), just more confusing. And (3) is basically
what the Advice system does, with the added benefit of a clear-cut service
access point and a well defined lifecycle.

This changeset adds the ability to check if actual Advice has been published,
which allows us to invoke the (possibly expensive) GTK path building and
style context building code only once.
2019-07-13 17:00:23 +02:00
dde3778cad UiStyle: fix naming 2019-07-13 14:34:55 +02:00
d5cbeab2d8 Timeline: GTK-Code to construct a "virtal" CSS path (see #1168)
This code was cooked up by following the example of gtk_widget_path_append_for_widget()
See gtkwidget.c, 16413
2019-07-13 00:59:05 +02:00
60d28fea2c Timeline: establish a way to pass a StyleContext via Advice system
- at some (yet to be defined) location, a virtual WidgetPath is constructed
  and used to build a Gtk::StyleContext in accordance to the curren CSS

- within the drawing routine, we use Lumiera's Advice-System to access this info
2019-07-12 23:58:25 +02:00
06163f6016 Timeline: filter to select the pinned prefix part of the profile
...when rendering this part, which shall be always visible.
And the rest of the profile needs to be rendered into a second canvas,
which is placed within a pane with scrollbar.

Implemented as a statefull iterator filter
2019-06-21 23:18:44 +02:00
ac3f1d8bef Timeline: implement access mechanism through getter lambda
works, but not really convinced yet...
2019-06-21 20:00:44 +02:00
6b6ed5e0eb Timeline: need accessor function for profile
TODO / WIP.
We can no longer just grab the profile by reference;
rather we need a sensible way how to activate the recomputation logic
2019-06-20 19:01:15 +02:00
77805a5c8c Timeline: handle notification of structural updates 2019-06-20 18:53:12 +02:00
83c462abc3 Timeline: investigate how to handle profile rebuilding
as it turns out, the core problem is that we need a way to detect and signal
structural changes to the logical UI model
2019-06-20 15:36:09 +02:00
d5af020520 Timeline: possible solution for construction of the TrackProfile
...not yet really convinced though
...how does this relate to the "display evaluation pass" of the Layout Manager?
2019-06-15 21:45:38 +02:00
c87ca5d632 Timeline: generalise unsafe access to embedded profile data
While somewhat ugly, I deem this acceptable in such a context,
where the implementation handles its own embedded storage structure.
2019-06-15 17:41:17 +02:00
371b7a487e Timeline: better parametrisation of timeline renderers
and yes, we indeed need the PixSpan: it defines the *horizontal* extension of what needs drawing...
2019-06-15 16:04:18 +02:00
a105e02b52 Timeline: wire distinct grounding/overlay renderers
TODO:
 - actual draw operations not yet implemented
 - find a way how to select the prelude / body part of the track profile

This is a consequence of subsuming the timeline ruler under the concept of an overview track
2019-06-13 18:17:46 +02:00
3f04bb8698 Timeline: sort out how to link the ProfileInterpreter into the draw function 2019-06-13 17:54:06 +02:00
223113ee44 Timeline: switch TrackProfile to hold a sequence of VerbPack entries
turns out to be mostly a drop-in replacement.
2019-06-12 03:29:00 +02:00
1a8917e60a Timeline: after a long break... reconsider how to integrate the new VerbPack
...into the draft skeleton of timeline drawing
2019-06-11 02:40:20 +02:00
f6e5886348 Library: complete test coverage of VerbPack 2019-06-11 02:40:20 +02:00
3d5a67ed14 Library: finish and clean-up the solution for VerbPack dispatch 2019-06-10 16:08:50 +02:00
8f43c2591e Library: investigate malfunction in metaprogramming
the template lib::PolymorphicValue seemingly picked the wrong
implementation strategy for "virtual copy support": In fact it is possible
to use the optimal strategy here, since our interface inherits from CloneSupport,
yet the metaprogramming logic picked the mix-in-adapter (which requires one additional "slot"
of storage plus a dynamic_cast at runtime).

The reason for this malfunction was the fact that we used META_DETECT_FUNCTION
to detect the presence of a clone-support-function. This is not correct, since
it can only detect a function in the *same* class, not an inherited function.

Thus, switching to META_DETECT_FUNCTION_NAME solves this problem
Well, this solution has some downsides, but since I intend to rewrite the
whole virtual copy support (#1197) anyway, I'll deem this acceptable for now


TODO / WIP: still some diagnostics code to clean up, plus a better solution for the EmptyBase
2019-05-10 02:19:01 +02:00
23c9da7c62 Library: solve the dilemma by inheriting from VerbToken
...which, in the end, can even be considered the more logical design choice,
since the "verb visitor" is a more elaborated and sophisiticated Verb-Token,
adding the special twist of embedded storage for variable function arguments
2019-05-09 23:40:47 +02:00