Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Implementation of drawing code to indicate the structure of nested tracks.
The design of the drawing is inspired by classical score notation, where braces are used to group the staves (or stems) for one instrument (e.g. grand piano, organ), while brackets are used to group the staves of an ensemble (e.g. string quartet, symphony orchestra) The usual typesetting of musical notation relies much on classical design principles, based on the golden ratio Φ, which is known to be perceived as balanced, neutral and unobtrusive.
The design implemented here is built around a vertical double bar line, and the width of this line is used as reference for size calculations; the curved top and bottom cap is enclosed within a bounding box of size Φ², when defining the base width to be 1. The inner tangent of the curved cap will point towards the end of the smaller (inner) vertical line. While this design is quite simple in structure, and rather easy to construct geometrically, deriving all necessary coordinates numerically can be a challenge. To build this implementation, the constraint system of FreeCAD was used to define the relations, and the resulting numbers were picked directly from the resulting XML document, and used both to build a SVG for documentation, and for the constants in this source file. Using the Gtk::StyleContext and the given Cairo::Context, the drawing code derives the size of the defined standard font in device units, and uses this em size as reference to derive a scale factor, which is then applied to the drawing as a whole — taking into account any given vertical size limitations as imposed by the general nested trade head structure.
doc/devel/draw/StaveBracket.FCStd
doc/devel/draw/StaveBracket.svg
for explanation of geometry Definition in file stave-bracket-widget.cpp.
#include "stage/timeline/stave-bracket-widget.hpp"
#include "stage/style-scheme.hpp"
#include "lib/util.hpp"
#include <cmath>
Functions | |
double | anchorLeft (StyleC style, double scale) |
place left anchor reference line to right side of bold bar. More... | |
double | anchorLower (StyleC style, double scale, int canvasHeight) |
place bottom cap vertical anchor, mirroring top cap More... | |
double | anchorUpper (StyleC style, double scale) |
place top cap vertical anchor, down from canvas upside. More... | |
double | baseWidth (StyleC style) |
Setup the base metric for this bracket drawing based on CSS styling. More... | |
int | calcDesiredWidth (StyleC style) |
int | calcRequiredWidth (StyleC style, int givenHeight) |
void | connect (CairoC cox, Gdk::RGBA colour, double leftX, double upperY, double lowerY, double width, double scale, std::vector< uint > connectors) |
Indicate connection to nested sub-Track scopes. More... | |
double | determineScale (StyleC style, int givenHeight) |
determine the base metric, taking into account the available canvas size. More... | |
void | drawBar (CairoC cox, Gdk::RGBA colour, double leftX, double upperY, double lowerY, double scale) |
draw the double bar to fit between upper and lower cap | |
void | drawCap (CairoC cox, Gdk::RGBA colour, double ox, double oy, double scale, bool upside=true) |
Draw the curved end cap of the bracket, inspired by musical notation. More... | |
double | getAbsoluteFontSize (StyleC style) |
Use contextual CSS style information to find out about the standard font size More... | |
Namespaces | |
stage | |
Lumiera GTK UI implementation root. | |
stage::timeline | |
The timeline display and editing operations. | |