sifflet-2.3.0: Simple, visual, functional language for learning about recursion.

Safe HaskellNone
LanguageHaskell2010

Graphics.UI.Sifflet.Canvas

Synopsis

Documentation

atLeastSize :: Size -> VCanvas -> VCanvas Source

Return a canvas of at least the specified size and otherwise like the given canvas.

connect :: VCanvas -> Node -> WEdge -> Node -> WEdge -> IO VCanvas Source

Connect nodes. If parent and child are different, connect the i-th inlet of node parent to the o-th outlet of node child UNLESS doing so would create a cycle parent -> child -> ... -> parent AND UNLESS something is already connected to the ith inlet of the parent node.

disconnect :: VCanvas -> Node -> WEdge -> Node -> WEdge -> IO VCanvas Source

Disconnect nodes. Disconnect wouldn't need to be in the IO monad, except that it needs the same type signature as connect.

drawCanvas :: VCanvas -> Rectangle -> IO () Source

Draw the canvas in its window, on screen

editFunction :: VCanvas -> CanvFrame -> IO VCanvas Source

editFunction: reverse of defineFunction: replace the call frame by an edit frame; does not change the VPUI (global env.), just the canvas..

pointSelection :: WGraph -> CanvFrame -> Position -> Maybe Selection Source

What is selected (if anything) at a point

renderCanvas :: VCanvas -> BBox -> Bool -> Render () Source

Render the canvas in Cairo (use with renderWith to provide an alternate surface, such as an SVG file).

vcAddFrame :: VCanvas -> Functoid -> Maybe [Value] -> FrameType -> Env -> Double -> Double -> Double -> Maybe Node -> IO VCanvas Source

Add a frame representing a functoid to the canvas.

Use mvalues = Nothing if you do not want the frame to be evaluated as a function call, otherwise mvalues = Just values.

prevEnv is *supposed* to be the previous environment, i.e., that of the "parent" frame or the canvas, not of the new frame, because vcAddFrame itself will extend the environment with the new (vars, values). But this is odd, because openNode calls vcAddFrame apparently with the *new* environment as prevEnv, and yet it works correctly.

Caution: I think it is necessary for the canvas to have been realized before calling this function!

vcClearSelection :: VCanvas -> IO VCanvas Source

Make nothing be selected

vcClearFrame :: VCanvas -> CanvFrame -> IO VCanvas Source

vcClearFrame - clear a frame in a canvas; not yet implemented What does this mean?

vcCloseFrame :: VCanvas -> CanvFrame -> IO VCanvas Source

Close a frame and any subframes of it

vcFrameDeleteTree :: VCanvas -> CanvFrame -> Node -> IO VCanvas Source

Remove the (sub)tree rooted at the given node. Removes it from the graph of the canvas and from the FunctoidParts of the frame.

vcFrameSubframes :: VCanvas -> CanvFrame -> [CanvFrame] Source

Find a frame's subframes, i.e., those that were expanded to trace the execution of a function call. Cannot be in an edit frame.

vcUpdateFrameAndGraph :: VCanvas -> CanvFrame -> WGraph -> VCanvas Source

Ask the vcanvas to update the frame and install a new graph. Frames are identified by their frame nodes, so the new frame must have the same frame node as the old. It is an unreported error if there is not exactly one match.

vcanvasNodeAt :: VCanvas -> Position -> Maybe Node Source

Find the node, if any, at a given position on the canvas.

callFrames :: VCanvas -> String -> [CanvFrame] Source

Find the frames that are calling the named function