Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



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.


Instances details
Show Selection Source # 
Instance details

Defined in Ui.BlockC

CStorable Selection Source # 
Instance details

Defined in Ui.BlockC

Eq Selection Source # 
Instance details

Defined in Ui.BlockC

Ord Selection Source # 
Instance details

Defined in Ui.BlockC

Pretty Selection Source # 
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.


print_debug :: ViewId -> Fltk.Fltk () Source #

Print debugging info about the UI state.

Orphan instances

CStorable Block.Box Source # 
Instance details

CStorable Block.Config Source # 
Instance details

CStorable Block.DisplayTrack Source # 
Instance details

CStorable Block.Divider Source # 
Instance details

CStorable Block.Status Source # 
Instance details