Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone




This layer gives direct wrapped access to the fltk API.

It maintains a map from ViewIds to window pointers, which represents the on screen state. All functions here take ViewIds, and will throw an exception if the view_id isn't in the pointer map. C++ exceptions coming from FLTK should be converted and thrown as haskell exceptions.

TODO exceptions are not implemented yet

There are three methods for sharing data with C++:

  • Note tracks pass a callback, that will return events in the given ScoreTime range. This means the complete map of events exists only on the Haskell side, and changing events means passing a new callback to C++. This is because events change a lot, and it seems wasteful to copy over a whole track of events just because one was added.
  • Rulers have marklists, which are like events but much denser. They're entirely marshalled to a C array so C++ has direct access to the marks. Because many tracks will share the same ruler, marklists use a reference counting scheme so Haskell can allocate the array once, and then C++ and Haskell can cooperate on the memory management.
  • Control signals are just copied, and ownership is given to C++. This is because control signals are large but are already dense arrays so they can be copied very quickly with memcpy. They could use a refcounting scheme like ruler marklists, but they're rarely shared so it's probably not worth it.

view creation

create_view :: ViewId -> Text -> Rect.Rect -> Block.Config -> Fltk.Fltk () Source #

Create an empty block view with the given configs. Tracks must be inserted separately.

get_view_status Source #


:: ViewId 
-> Fltk.Fltk (Rect.Rect, Zoom.Zoom, Int, Int)

(rect, zoom, time_padding, track_padding)

Get various position metrics of the window.

This is unused because I sync this with UI msgs, but if they prove unreliable I could use this to verify or just replace them.

set other attributes

set_track_scroll :: ViewId -> Types.Width -> Fltk.Fltk () Source #

Set the scroll along the track dimension, in pixels.

data Selection Source #

This is the low level version of Sel.Selection. It only applies to a single track, and has an explicit color.

Eq Selection # 
Instance details

Defined in Ui.BlockC

Ord Selection # 
Instance details

Defined in Ui.BlockC

Show Selection # 
Instance details

Defined in Ui.BlockC

CStorable Selection # 
Instance details

Defined in Ui.BlockC

Pretty Selection # 
Instance details

Defined in Ui.BlockC

Block operations

set_display_track :: ViewId -> Types.TrackNum -> Block.DisplayTrack -> Fltk.Fltk () Source #

Set block-local track status.

floating input

Track operations

tracks :: ViewId -> Fltk.Fltk Types.TrackNum Source #

Get the number of tracks on the block.

update_track Source #


:: Bool

True if the ruler has changed and should be copied over. It's a bit of a hack to be a separate flag, but rulers are updated rarely and copied over entirely for efficiency.

-> ViewId 
-> Types.TrackNum 
-> Block.Tracklike 
-> [Events.Events] 
-> Track.SetStyle 
-> ScoreTime.ScoreTime 
-> ScoreTime.ScoreTime 
-> Fltk.Fltk () 

set_track_signal :: ViewId -> Types.TrackNum -> Track.TrackSignal -> Fltk.Fltk () Source #

Unlike other Fltk functions, this doesn't throw if the ViewId is not found. That's because it's called asynchronously when derivation is complete.


Orphan instances

CStorable Block.Divider # 
Instance details

CStorable Block.Status # 
Instance details

CStorable Block.DisplayTrack # 
Instance details

CStorable Block.Box # 
Instance details

CStorable Block.Config # 
Instance details