Safe Haskell | Safe-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.
Synopsis
- get_screens :: IO [Rect.Rect]
- create_view :: ViewId -> Text -> Rect.Rect -> Block.Config -> Fltk.Fltk ()
- destroy_view :: ViewId -> Fltk.Fltk ()
- get_view_status :: ViewId -> Fltk.Fltk (Rect.Rect, Zoom.Zoom, Int, Int)
- set_size :: ViewId -> Rect.Rect -> Fltk.Fltk ()
- set_zoom :: ViewId -> Zoom.Zoom -> Fltk.Fltk ()
- set_track_scroll :: ViewId -> Types.Width -> Fltk.Fltk ()
- data Selection = Selection {}
- data SelectionOrientation
- set_selection :: ViewId -> Sel.Num -> [Types.TrackNum] -> [Selection] -> Fltk.Fltk ()
- bring_to_front :: ViewId -> Fltk.Fltk ()
- set_config :: ViewId -> Block.Config -> Fltk.Fltk ()
- set_skeleton :: ViewId -> Skeleton.Skeleton -> [(Color.Color, [(Types.TrackNum, Types.TrackNum)])] -> Fltk.Fltk ()
- set_title :: ViewId -> Text -> Fltk.Fltk ()
- set_status :: ViewId -> Text -> Color.Color -> Fltk.Fltk ()
- set_display_track :: ViewId -> Types.TrackNum -> Block.DisplayTrack -> Fltk.Fltk ()
- floating_open :: ViewId -> Types.TrackNum -> ScoreTime.ScoreTime -> Text -> (Int, Int) -> Fltk.Fltk ()
- floating_insert :: [ViewId] -> Text -> Fltk.Fltk ()
- tracks :: ViewId -> Fltk.Fltk Types.TrackNum
- insert_track :: ViewId -> Types.TrackNum -> Block.Tracklike -> [Events.Events] -> Track.SetStyle -> Types.Width -> Fltk.Fltk ()
- remove_track :: ViewId -> Types.TrackNum -> Fltk.Fltk ()
- update_track :: Bool -> ViewId -> Types.TrackNum -> Block.Tracklike -> [Events.Events] -> Track.SetStyle -> ScoreTime.ScoreTime -> ScoreTime.ScoreTime -> Fltk.Fltk ()
- update_entire_track :: Bool -> ViewId -> Types.TrackNum -> Block.Tracklike -> [Events.Events] -> Track.SetStyle -> Fltk.Fltk ()
- set_track_signal :: ViewId -> Types.TrackNum -> Track.TrackSignal -> Fltk.Fltk ()
- set_waveform :: ViewId -> Types.TrackNum -> Track.WaveformChunk -> Fltk.Fltk ()
- clear_waveforms :: ViewId -> Fltk.Fltk ()
- gc_waveforms :: Fltk.Fltk ()
- set_track_title :: ViewId -> Types.TrackNum -> Text -> Fltk.Fltk ()
- set_track_title_focus :: ViewId -> Types.TrackNum -> Fltk.Fltk ()
- set_block_title_focus :: ViewId -> Fltk.Fltk ()
- print_debug :: ViewId -> Fltk.Fltk ()
- dump :: IO [(ViewId, String)]
query
get_screens :: IO [Rect.Rect] Source #
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.
destroy_view :: ViewId -> Fltk.Fltk () Source #
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.
This is the low level version of Sel.Selection
. It only applies to
a single track, and has an explicit color.
Instances
Show Selection Source # | |
CStorable Selection Source # | |
Eq Selection Source # | |
Ord Selection Source # | |
Defined in Ui.BlockC | |
Pretty Selection Source # | |
data SelectionOrientation Source #
Instances
set_selection :: ViewId -> Sel.Num -> [Types.TrackNum] -> [Selection] -> Fltk.Fltk () Source #
bring_to_front :: ViewId -> Fltk.Fltk () Source #
Block operations
set_config :: ViewId -> Block.Config -> Fltk.Fltk () Source #
set_skeleton :: ViewId -> Skeleton.Skeleton -> [(Color.Color, [(Types.TrackNum, Types.TrackNum)])] -> Fltk.Fltk () Source #
set_status :: ViewId -> Text -> Color.Color -> Fltk.Fltk () Source #
set_display_track :: ViewId -> Types.TrackNum -> Block.DisplayTrack -> Fltk.Fltk () Source #
Set block-local track status.
floating input
floating_open :: ViewId -> Types.TrackNum -> ScoreTime.ScoreTime -> Text -> (Int, Int) -> Fltk.Fltk () Source #
Track operations
insert_track :: ViewId -> Types.TrackNum -> Block.Tracklike -> [Events.Events] -> Track.SetStyle -> Types.Width -> Fltk.Fltk () Source #
remove_track :: ViewId -> Types.TrackNum -> Fltk.Fltk () 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 () |
update_entire_track :: Bool -> ViewId -> Types.TrackNum -> Block.Tracklike -> [Events.Events] -> Track.SetStyle -> Fltk.Fltk () Source #
Like update_track
except update everywhere.
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.
set_waveform :: ViewId -> Types.TrackNum -> Track.WaveformChunk -> Fltk.Fltk () Source #
clear_waveforms :: ViewId -> Fltk.Fltk () Source #
gc_waveforms :: Fltk.Fltk () Source #
set_track_title :: ViewId -> Types.TrackNum -> Text -> Fltk.Fltk () Source #
set_track_title_focus :: ViewId -> Types.TrackNum -> Fltk.Fltk () Source #
set_block_title_focus :: ViewId -> Fltk.Fltk () Source #
debugging
print_debug :: ViewId -> Fltk.Fltk () Source #
Print debugging info about the UI state.