csound-expression-5.2.2: library to make electronic music

Safe HaskellNone
LanguageHaskell98

Csound.Control.Gui.Layout

Description

The functions from this module specify the geometry of the GUI-elements. They tell where to render the elements.

Every element is rectangular. To know where to place the element is to know the parameters of the bounding rectangle. All rectangles are relative and automatically aligned.

We have two functions for grouping. They construct horizontal and vertical groups of the elements. Within the group we can change the relative size of the rectangles (by scaling one side of the rectangle). In place of rectangle we can put an empty space.

Synopsis

Documentation

hor :: [Gui] -> Gui #

Horizontal groupping of the elements. All elements are placed in the stright horizontal line and aligned by Y-coordinate and height.

ver :: [Gui] -> Gui #

Vertical groupping of the elements. All elements are placed in the stright vertical line and aligned by X-coordinate and width.

space :: Gui #

An empty space.

sca :: Double -> Gui -> Gui #

Scales an element within the group. It depends on the type of the alignment (horizontal or vertical) which side of the bounding box is scaled. If it's a horizontal group then the width is scaled and height is scaled otherwise.

Every element in the group has a scaling factor. By default it equals to one. During rendering all scaling factors are summed and divided on the sum of all factors. So that factors become weights or proportions. This process is called normalization. Scaling one element affects not only this element but all other elements in the group!

An example:

One element is twice as large as the other two:

hor [a, b, sca 2 c]

Why is it so? Let's look at the hidden scaling factors:

hor [sca 1 a, sca 1 b, sca 2 c]

During rendering we scale all the scaling fators so that total sum equals to one:

hor [sca 0.25 a, sca 0.25 b, sca 0.5 c]

horSca :: [(Double, Gui)] -> Gui #

Weighted horizontal grouping. It takes a list of scaling factors and elements.

verSca :: [(Double, Gui)] -> Gui #

Weighted vertical grouping. It takes a list of scaling factors and elements.

grid :: Int -> [Gui] -> Gui Source #

Layouts the widgets in grid. The first argument is the number of widgets in the row.

grid rowLength widgets

padding :: Int -> Gui -> Gui #

Sets the padding of the element. How much empty space to reserve outside the element.

margin :: Int -> Gui -> Gui #

Sets the margin of the element. How much empty space to reserve between the elements within the group. It affects only compound elements.

resizeGui :: ScaleFactor -> Gui -> Gui #

Rescales the default sizes for the UI elements.