csound-expression-typed-0.2.4: typed core for the library csound-expression
Safe HaskellNone
LanguageHaskell2010

Csound.Typed.Gui

Synopsis

Documentation

data Win Source #

Constructors

Win 

data GuiNode Source #

Constructors

GuiNode 

newtype GuiHandle Source #

Constructors

GuiHandle 

Fields

newtype Gui Source #

A visual representation of the GUI-element.

Constructors

Gui 

Fields

data InitMe Source #

Constructors

InitMe 

restoreTree :: GuiMap -> Gui -> Gui Source #

guiMap :: [GuiNode] -> GuiMap Source #

fromElem :: ElemOuts -> [InitMe] -> Elem -> Gui Source #

guiStmt :: Monad m => ScaleFactor -> [Panel] -> DepT m () Source #

Layout

hor :: [Gui] -> Gui Source #

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

ver :: [Gui] -> Gui Source #

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

space :: Gui Source #

An empty space.

sca :: Double -> Gui -> Gui Source #

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 Source #

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

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

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

padding :: Int -> Gui -> Gui Source #

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

margin :: Int -> Gui -> Gui Source #

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 Source #

Rescales the default sizes for the UI elements.

Props

props :: [Prop] -> Gui -> Gui Source #

Sets the properties for a GUI element.

forceProps :: [Prop] -> Gui -> Gui Source #

Sets the properties for a GUI element on all levels.

type Color = Colour Double Source #

The Csound colours.

data Rect Source #

A rectangle.

Constructors

Rect 

Fields

Instances

Instances details
Show Rect Source # 
Instance details

Defined in Csound.Typed.Gui.BoxModel

Methods

showsPrec :: Int -> Rect -> ShowS #

show :: Rect -> String #

showList :: [Rect] -> ShowS #

data FontType Source #

Instances

Instances details
Default FontType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: FontType #

data Emphasis Source #

Constructors

NoEmphasis 
Italic 
Bold 
BoldItalic 

Instances

Instances details
Default Emphasis Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: Emphasis #

data Material Source #

The type of the material of the element. It affects sliders and buttons.

Constructors

NoPlastic 
Plastic 

Instances

Instances details
Default Material Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: Material #

data Orient Source #

The orientation of the widget (slider, roller). This property is never needs to be set in practice. If this property is not set then default orientation is calculated from the bounding box of the widget. If the width is greater than the height then we need to use a horizontal widget otherwise it should be a vertical one.

Constructors

Hor 
Ver 

data LabelType Source #

Some values are not implemented on the Csound level.

Instances

Instances details
Default LabelType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: LabelType #

Setters

Handy short-cuts for the function props.

Widgets

data ValDiap Source #

The diapason of the continuous value.

Constructors

ValDiap 

data ValSpan Source #

A value span is a diapason of the value and a type of the scale (can be linear or exponential).

linSpan :: Double -> Double -> ValSpan Source #

Makes a linear ValSpan with specified boundaries.

linSpan minVal maxVal

expSpan :: Double -> Double -> ValSpan Source #

Makes an exponential ValSpan with specified boundaries.

expSpan minVal maxVal

uspan :: ValSpan Source #

Unit span. A special case:

uspan = linSpan 0 1

bspan :: ValSpan Source #

Bipolar unit span. A special case:

uspan = linSpan (-1) 1

uspanExp :: ValSpan Source #

An exponential unit span. A special case:

uspan = expSpan 0 1

data KnobType Source #

Constructors

ThreeD (Maybe Int) 
Pie 
Clock 
Flat 

Instances

Instances details
Default KnobType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: KnobType #

data SliderType Source #

Constructors

Fill 
Engraved 
Nice 

Instances

Instances details
Default SliderType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: SliderType #

data TextType Source #

Constructors

NormalText 
NoDrag 
NoEdit 

Instances

Instances details
Default TextType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: TextType #

data ButtonType Source #

The type of the button. It affects toggle buttons and button banks.

In Csound buttons and toggle buttons are constructed with the same function (but with different button types). But in this library they are contructed by different functions (button and toggle). Normal button is a plain old button, but other values specify toggle buttons. So this property doesn't affect the buttons (since they could be only normal buttons).

Instances

Instances details
Default ButtonType Source # 
Instance details

Defined in Csound.Typed.Gui.Types

Methods

def :: ButtonType #

Panels

panel :: Gui -> SE () Source #

Renders the GUI elements on the window. Rectangle is calculated automatically (window doesn't listens for keyboard events).

keyPanel :: Gui -> SE () Source #

Renders the GUI elements on the window. Rectangle is calculated automatically (window listens for keyboard events).

tabs :: [(String, Gui)] -> SE () Source #

Renders the GUI elements with tabs. Rectangles are calculated automatically.

keyTabs :: [(String, Gui)] -> SE () Source #

Renders the GUI elements with tabs. Rectangles are calculated automatically.

panels :: [Gui] -> SE () Source #

Renders a list of panels.

keyPanels :: [Gui] -> SE () Source #

Renders a list of panels. Panels are sensitive to keyboard events.

panelBy :: String -> Maybe Rect -> Gui -> SE () Source #

Renders the GUI elements on the window. We can specify the window title and rectangle of the window.

keyPanelBy :: String -> Maybe Rect -> Gui -> SE () Source #

Renders the GUI elements on the window. We can specify the window title and rectangle of the window. Panesls are sensitive to keyboard events.

tabsBy :: String -> Maybe Rect -> [(String, Maybe Rect, Gui)] -> SE () Source #

Renders the GUI elements with tabs. We can specify the window title and rectangles for all tabs and for the main window.

keyTabsBy :: String -> Maybe Rect -> [(String, Maybe Rect, Gui)] -> SE () Source #

Renders the GUI elements with tabs. We can specify the window title and rectangles for all tabs and for the main window. Tabs are sensitive to keyboard events.

Types

type Input a = a Source #

Widgets that produce something has inputs.

type Output a = a -> SE () Source #

Widgets that consume something has outputs.

type Inner = SE () Source #

Widgets that just do something inside them or have an inner state.

noInput :: Input () Source #

A value for widgets that produce nothing.

noOutput :: Output () Source #

A value for widgets that consume nothing.

noInner :: Inner Source #

A value for stateless widgets.

type Widget a b = SE (Gui, Output a, Input b, Inner) Source #

A widget consists of visible element (Gui), value consumer (Output) and producer (Input) and an inner state (Inner).

widget :: SE (Gui, Output a, Input b, Inner) -> Widget a b Source #

A widget constructor.

type Source a = SE (Gui, Input a) Source #

A producer of the values.

source :: SE (Gui, Input a) -> Source a Source #

A producer constructor.

type Sink a = SE (Gui, Output a) Source #

A consumer of the values.

sink :: SE (Gui, Output a) -> Sink a Source #

A consumer constructor.

type Display = SE Gui Source #

A static element. We can only look at it.

display :: SE Gui -> Display Source #

A display constructor.

type SinkSource a = SE (Gui, Output a, Input a) Source #

mapSource :: (a -> b) -> Source a -> Source b Source #

A handy function for transforming the value of producers.

mapGuiSource :: (Gui -> Gui) -> Source a -> Source a Source #

A handy function for transforming the GUIs of producers.

mhor :: Monoid a => [Source a] -> Source a Source #

Horizontal grouping of widgets that can produce monoidal values.

mver :: Monoid a => [Source a] -> Source a Source #

Vertical grouping of widgets that can produce monoidal values.

msca :: Double -> Source a -> Source a Source #

Scaling of widgets that can produce values.

Widgets

count :: ValDiap -> ValStep -> Maybe ValStep -> Double -> Source (Evt D) Source #

Allows the user to increase/decrease a value with mouse clicks on a corresponding arrow button. Output is an event stream that contains values when counter changes.

count diapason fineValStep maybeCoarseValStep initValue

doc: http://www.csounds.com/manual/html/FLcount.html

countSig :: ValDiap -> ValStep -> Maybe ValStep -> Double -> Source Sig Source #

A variance on the function count, but it produces a signal of piecewise constant function.

joy :: ValSpan -> ValSpan -> (Double, Double) -> Source (Sig, Sig) Source #

It is a squared area that allows the user to modify two output values at the same time. It acts like a joystick.

joy valueSpanX valueSpanY (initX, initY)

doc: http://www.csounds.com/manual/html/FLjoy.html

knob :: String -> ValSpan -> Double -> Source Sig Source #

A FLTK widget opcode that creates a knob.

knob valueSpan initValue

doc: http://www.csounds.com/manual/html/FLknob.html

roller :: String -> ValSpan -> ValStep -> Double -> Source Sig Source #

FLroller is a sort of knob, but put transversally.

roller valueSpan step initVal

doc: http://www.csounds.com/manual/html/FLroller.html

slider :: String -> ValSpan -> Double -> Source Sig Source #

FLslider puts a slider into the corresponding container.

slider valueSpan initVal

doc: http://www.csounds.com/manual/html/FLslider.html

sliderBank :: String -> [Double] -> Source [Sig] Source #

Constructs a list of linear unit sliders (ranges in [0, 1]). It takes a list of init values.

numeric :: String -> ValDiap -> ValStep -> Double -> Source Sig Source #

numeric (originally FLtext in the Csound) allows the user to modify a parameter value by directly typing it into a text field.

numeric diapason step initValue

doc: http://www.csounds.com/manual/html/FLtext.html

meter :: String -> ValSpan -> Double -> Sink Sig Source #

A slider that serves as indicator. It consumes values instead of producing.

meter valueSpan initValue

box :: String -> Display Source #

A FLTK widget that displays text inside of a box. If the text is longer than 255 characters the text is split on several parts (Csound limitations).

box text

doc: http://www.csounds.com/manual/html/FLbox.html

button :: String -> Source (Evt Unit) Source #

A FLTK widget opcode that creates a button.

button text

doc: http://www.csounds.com/manual/html/FLbutton.html

butBank :: String -> Int -> Int -> (Int, Int) -> Source (Evt (D, D)) Source #

A FLTK widget opcode that creates a bank of buttons. Result is (x, y) coordinate of the triggered button.

butBank xNumOfButtons yNumOfButtons

doc: http://www.csounds.com/manual/html/FLbutBank.html

butBankSig :: String -> Int -> Int -> (Int, Int) -> Source (Sig, Sig) Source #

A variance on the function butBank, but it produces a signal of piecewise constant function. Result is (x, y) coordinate of the triggered button.

butBank1 :: String -> Int -> Int -> (Int, Int) -> Source (Evt D) Source #

A FLTK widget opcode that creates a bank of buttons.

butBank xNumOfButtons yNumOfButtons

doc: http://www.csounds.com/manual/html/FLbutBank.html

toggle :: String -> Bool -> Source (Evt D) Source #

A FLTK widget opcode that creates a toggle button.

button text

doc: http://www.csounds.com/manual/html/FLbutton.html

toggleSig :: String -> Bool -> Source Sig Source #

A variance on the function toggle, but it produces a signal of piecewise constant function.

setNumeric :: String -> ValDiap -> ValStep -> Double -> Sink Sig Source #

FLtext that is sink shows current the value of a valuator in a text field.

Transformers

setTitle :: String -> Gui -> SE Gui Source #

Appends a title to a group of widgets.

Keyboard

data KeyEvt Source #

Keyboard events.

Constructors

Press Key 
Release Key 

Instances

Instances details
Eq KeyEvt Source # 
Instance details

Defined in Csound.Typed.GlobalState.GE

Methods

(==) :: KeyEvt -> KeyEvt -> Bool #

(/=) :: KeyEvt -> KeyEvt -> Bool #

Show KeyEvt Source # 
Instance details

Defined in Csound.Typed.GlobalState.GE

keyIn :: KeyEvt -> Evt Unit Source #

The stream of keyboard press/release events.