-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A different take on an IO system. Based on Amanda's IO loop, this eventloop takes a function that maps input events to output events. It can easily be extended by modules that represent IO devices or join multiple modules together. -- -- A different take on an IO system. Based on Amanda's IO loop, this -- eventloop takes a function that maps input events to output events. It -- can easily be extended by modules that represent IO devices or join -- multiple modules together. Each module exists of a initialize and -- teardown function that are both called once at startup and shutting -- down. During run-time, a module can provice a preprocessor function -- (which transforms input events before they get to the eventloop), and -- a postprocessor function (which transforms output events after they -- are received from the eventloop but before they are send off). Next to -- these bookkeeping functions, a module can exist of a (check for events -- and an event retrieve) function pair which result in input events and -- an addition to the event sender function which handles output events. -- This results in the following states: |Start|: initialize -> -- |Run-Time| -> teardown |Run-Time|: eventCheckers - Yes > -- preprocessors -> eventloop -> postprocessors -> event sender -- -> |Run-Time| |- No > |Run-Time| Each module has a piece of -- "memory"state which is defined by the module itself and all of the -- module states are combined in the IO state. When writinginstalling -- a module, modifications has to be made at certain points in the code -- due to the poor modularity of Haskell. @package eventloop @version 0.8.2.7 module Eventloop.Types.Common type EventloopModuleIdentifier = [Char] type ProcessingDescription = [Char] type NamedId = [Char] type NumericId = Int module Eventloop.Utility.Vectors type Angle = Float In degrees type Radians = Float type Length = Float type X = Float type Y = Float type Offset = (X, Y) data PolarCoord PolarCoord :: (Length, Radians) -> PolarCoord data Point Point :: (X, Y) -> Point class Coord a x :: Coord a => a -> X y :: Coord a => a -> Y class ExtremaCoord a xMin :: ExtremaCoord a => a -> X xMax :: ExtremaCoord a => a -> X yMin :: ExtremaCoord a => a -> Y yMax :: ExtremaCoord a => a -> Y degreesToRadians :: Angle -> Radians radiansToDegrees :: Radians -> Angle lengthToPoint :: Point -> Length lengthBetweenPoints :: Point -> Point -> Length differenceBetweenPoints :: Point -> Point -> (X, Y) averagePoint :: [Point] -> Point -- | Returns the vector perpendicular on the given vector between the 2 -- points. Always has positive y and vector length 1; y is inverted in -- canvas downPerpendicular :: Point -> Point -> Point -- | Returns the vector perpendicular on the given vector between the 2 -- points. Always has negative y and vector length 1; y is inverted in -- canvas upPerpendicular :: Point -> Point -> Point followVector :: Float -> Point -> Point -> Point intersectVector :: Point -> Point -> Point -> Point -> Maybe Point turnToVector :: Point -> Radians -> Point -> Point originPoint :: Point class Translate a translate :: Translate a => Point -> a -> a class (Coord a) => Vector2D a (|+|) :: Vector2D a => a -> a -> a (|-|) :: Vector2D a => a -> a -> a (|/) :: (Vector2D a, (Real b)) => a -> b -> a (|*) :: (Vector2D a, (Real b)) => a -> b -> a negateVector :: Vector2D a => a -> a angleBetween :: Vector2D a => a -> a -> Radians class ToPoint a toPoint :: ToPoint a => a -> Point class ToPolarCoord a toPolarCoord :: ToPolarCoord a => a -> PolarCoord class RotateLeftAround a rotateLeftAround :: RotateLeftAround a => Point -> Angle -> a -> a instance Control.DeepSeq.NFData Eventloop.Utility.Vectors.Point instance GHC.Generics.Generic Eventloop.Utility.Vectors.Point instance GHC.Classes.Eq Eventloop.Utility.Vectors.Point instance GHC.Show.Show Eventloop.Utility.Vectors.Point instance GHC.Classes.Eq Eventloop.Utility.Vectors.PolarCoord instance GHC.Show.Show Eventloop.Utility.Vectors.PolarCoord instance Eventloop.Utility.Vectors.Vector2D Eventloop.Utility.Vectors.PolarCoord instance Eventloop.Utility.Vectors.RotateLeftAround Eventloop.Utility.Vectors.PolarCoord instance Eventloop.Utility.Vectors.RotateLeftAround Eventloop.Utility.Vectors.Point instance Eventloop.Utility.Vectors.ToPolarCoord Eventloop.Utility.Vectors.Point instance Eventloop.Utility.Vectors.Coord Eventloop.Utility.Vectors.PolarCoord instance Eventloop.Utility.Vectors.ToPoint Eventloop.Utility.Vectors.PolarCoord instance Eventloop.Utility.Vectors.Vector2D Eventloop.Utility.Vectors.Point instance Eventloop.Utility.Vectors.ExtremaCoord [Eventloop.Utility.Vectors.Point] instance Eventloop.Utility.Vectors.Coord Eventloop.Utility.Vectors.Point module Eventloop.Utility.Trees.GeneralTree data GeneralTree GeneralTreeBox :: [GeneralNodeContent] -> [(GeneralLine, GeneralTree)] -> GeneralTree data GeneralNodeContent GeneralNodeText :: FillColor -> String -> GeneralNodeContent GeneralNode :: FillColor -> Radius -> GeneralNodeContent data GeneralLine GeneralLine :: StrokeColor -> GeneralLine type LeftOffset = X type TopOffset = Y type RightOffset = X type BottomOffset = Y type Middle = GraphicalNumeric type Pos = (X, Y) class GeneralizeTree a generalizeTree :: GeneralizeTree a => a -> GeneralTree textFont :: [Char] textHeight :: Float charWidth :: Float marginBetweenTrees :: Float marginBetweenNodeContent :: Float marginBetweenNodeRows :: Float marginBetweenNodeColumns :: Float generalNodeDimension :: GeneralTree -> Dimensions flattenDimensions :: [Dimensions] -> Dimensions generalNodeContentDimension :: GeneralNodeContent -> Dimensions layoutGeneralTree :: LeftOffset -> TopOffset -> GeneralTree -> (LayoutTree, RightOffset, BottomOffset) layoutGeneralTreeChildren :: LeftOffset -> TopOffset -> [(GeneralLine, GeneralTree)] -> ([(LayoutLine, LayoutTree)], RightOffset, BottomOffset) layoutLine :: GeneralLine -> LayoutLine layoutGeneralTrees :: LeftOffset -> TopOffset -> [GeneralTree] -> ([LayoutTree], RightOffset, BottomOffset) layoutGeneralNodeContentList :: Middle -> Height -> [GeneralNodeContent] -> [LayoutNodeContent] layoutGeneralNodeContent :: Pos -> GeneralNodeContent -> LayoutNodeContent textSize :: [Char] -> (Float, Float) treeIndex :: Int -> Offset -> (Shape, LeftOffset) instance Control.DeepSeq.NFData Eventloop.Utility.Trees.GeneralTree.GeneralTree instance GHC.Generics.Generic Eventloop.Utility.Trees.GeneralTree.GeneralTree instance GHC.Classes.Eq Eventloop.Utility.Trees.GeneralTree.GeneralTree instance GHC.Show.Show Eventloop.Utility.Trees.GeneralTree.GeneralTree instance Control.DeepSeq.NFData Eventloop.Utility.Trees.GeneralTree.GeneralLine instance GHC.Generics.Generic Eventloop.Utility.Trees.GeneralTree.GeneralLine instance GHC.Classes.Eq Eventloop.Utility.Trees.GeneralTree.GeneralLine instance GHC.Show.Show Eventloop.Utility.Trees.GeneralTree.GeneralLine instance Control.DeepSeq.NFData Eventloop.Utility.Trees.GeneralTree.GeneralNodeContent instance GHC.Generics.Generic Eventloop.Utility.Trees.GeneralTree.GeneralNodeContent instance GHC.Classes.Eq Eventloop.Utility.Trees.GeneralTree.GeneralNodeContent instance GHC.Show.Show Eventloop.Utility.Trees.GeneralTree.GeneralNodeContent instance Eventloop.Utility.Trees.GeneralTree.GeneralizeTree Eventloop.Utility.Trees.GeneralTree.GeneralTree module Eventloop.Types.Events data In Start :: In InKeyboard :: Keyboard -> In InMouse :: MouseIn -> In InFile :: FileIn -> In InTimer :: TimerIn -> In InStdIn :: StdInIn -> In InCanvas :: CanvasIn -> In InGraphs :: GraphsIn -> In data Out OutFile :: FileOut -> Out OutTimer :: TimerOut -> Out OutStdOut :: StdOutOut -> Out OutStdIn :: StdInOut -> Out OutCanvas :: CanvasOut -> Out OutBasicShapes :: BasicShapesOut -> Out OutDrawTrees :: DrawTreesOut -> Out OutGraphs :: GraphsOut -> Out OutStatefulGraphics :: CanvasId -> [StatefulGraphicsOut] -> Out Stop :: Out instance Control.DeepSeq.NFData Eventloop.Types.Events.Out instance GHC.Generics.Generic Eventloop.Types.Events.Out instance GHC.Show.Show Eventloop.Types.Events.Out instance GHC.Classes.Eq Eventloop.Types.Events.Out instance GHC.Show.Show Eventloop.Types.Events.In instance GHC.Classes.Eq Eventloop.Types.Events.In module Eventloop.Types.System type Initializer = SharedIOConstants -> SharedIOState -> IO (SharedIOConstants, SharedIOState, IOConstants, IOState) type EventRetriever = SharedIOConstants -> TVar SharedIOState -> IOConstants -> TVar IOState -> IO [In] type PreProcessor = SharedIOConstants -> TVar SharedIOState -> IOConstants -> TVar IOState -> In -> IO [In] type PostProcessor = SharedIOConstants -> TVar SharedIOState -> IOConstants -> TVar IOState -> Out -> IO [Out] type EventSender = SharedIOConstants -> TVar SharedIOState -> IOConstants -> TVar IOState -> Out -> IO () type Teardown = SharedIOConstants -> SharedIOState -> IOConstants -> IOState -> IO SharedIOState type OutEventRouter = Out -> EventloopModuleIdentifier type InEventQueue = BlockingConcurrentQueue In type OutEventQueue = BlockingConcurrentQueue Out type SenderEventQueue = BlockingConcurrentQueue Out data EventloopModuleConfiguration EventloopModuleConfiguration :: EventloopModuleIdentifier -> IOConstants -> TVar IOState -> Maybe Initializer -> Maybe EventRetriever -> Maybe PreProcessor -> Maybe PostProcessor -> Maybe EventloopModuleSenderConfiguration -> Maybe Teardown -> EventloopModuleConfiguration [moduleId] :: EventloopModuleConfiguration -> EventloopModuleIdentifier [ioConstants] :: EventloopModuleConfiguration -> IOConstants [ioStateT] :: EventloopModuleConfiguration -> TVar IOState [initializerM] :: EventloopModuleConfiguration -> Maybe Initializer [retrieverM] :: EventloopModuleConfiguration -> Maybe EventRetriever [preprocessorM] :: EventloopModuleConfiguration -> Maybe PreProcessor [postprocessorM] :: EventloopModuleConfiguration -> Maybe PostProcessor [senderConfigM] :: EventloopModuleConfiguration -> Maybe EventloopModuleSenderConfiguration [teardownM] :: EventloopModuleConfiguration -> Maybe Teardown data EventloopModuleSenderConfiguration EventloopModuleSenderConfiguration :: EventSender -> BlockingConcurrentQueue Out -> EventloopModuleSenderConfiguration [sender] :: EventloopModuleSenderConfiguration -> EventSender [senderEventQueue] :: EventloopModuleSenderConfiguration -> BlockingConcurrentQueue Out data EventloopConfiguration progstateT EventloopConfiguration :: TVar progstateT -> (progstateT -> In -> (progstateT, [Out])) -> InEventQueue -> OutEventQueue -> EventloopConfiguration progstateT [progstateT] :: EventloopConfiguration progstateT -> TVar progstateT [eventloopFunc] :: EventloopConfiguration progstateT -> progstateT -> In -> (progstateT, [Out]) [inEventQueue] :: EventloopConfiguration progstateT -> InEventQueue [outEventQueue] :: EventloopConfiguration progstateT -> OutEventQueue data EventloopSystemConfiguration progstateT EventloopSystemConfiguration :: EventloopConfiguration progstateT -> [EventloopModuleConfiguration] -> SharedIOConstants -> TVar SharedIOState -> ThreadId -> MVar [Thread] -> MVar Thread -> MVar [Thread] -> ExceptionCollection SomeException -> MVar Bool -> EventloopSystemConfiguration progstateT [eventloopConfig] :: EventloopSystemConfiguration progstateT -> EventloopConfiguration progstateT [moduleConfigs] :: EventloopSystemConfiguration progstateT -> [EventloopModuleConfiguration] [sharedIOConstants] :: EventloopSystemConfiguration progstateT -> SharedIOConstants [sharedIOStateT] :: EventloopSystemConfiguration progstateT -> TVar SharedIOState [systemThreadId] :: EventloopSystemConfiguration progstateT -> ThreadId [retrieverThreadsM] :: EventloopSystemConfiguration progstateT -> MVar [Thread] [outRouterThreadM] :: EventloopSystemConfiguration progstateT -> MVar Thread [senderThreadsM] :: EventloopSystemConfiguration progstateT -> MVar [Thread] [exceptions] :: EventloopSystemConfiguration progstateT -> ExceptionCollection SomeException [isStoppingM] :: EventloopSystemConfiguration progstateT -> MVar Bool data EventloopSetupConfiguration progstateT EventloopSetupConfiguration :: progstateT -> (progstateT -> In -> (progstateT, [Out])) -> [EventloopSetupModuleConfiguration] -> EventloopSetupConfiguration progstateT [beginProgstate] :: EventloopSetupConfiguration progstateT -> progstateT [eventloopF] :: EventloopSetupConfiguration progstateT -> progstateT -> In -> (progstateT, [Out]) [setupModuleConfigurations] :: EventloopSetupConfiguration progstateT -> [EventloopSetupModuleConfiguration] data EventloopSetupModuleConfiguration EventloopSetupModuleConfiguration :: EventloopModuleIdentifier -> Maybe Initializer -> Maybe EventRetriever -> Maybe PreProcessor -> Maybe PostProcessor -> Maybe EventSender -> Maybe Teardown -> EventloopSetupModuleConfiguration [moduleIdentifier] :: EventloopSetupModuleConfiguration -> EventloopModuleIdentifier [initializerF] :: EventloopSetupModuleConfiguration -> Maybe Initializer [eventRetrieverF] :: EventloopSetupModuleConfiguration -> Maybe EventRetriever [preprocessorF] :: EventloopSetupModuleConfiguration -> Maybe PreProcessor [postprocessorF] :: EventloopSetupModuleConfiguration -> Maybe PostProcessor [eventSenderF] :: EventloopSetupModuleConfiguration -> Maybe EventSender [teardownF] :: EventloopSetupModuleConfiguration -> Maybe Teardown data SharedIOConstants SharedIOConstants :: SafePrintToken -> (CanvasText -> IO ScreenDimensions) -> SharedIOConstants [safePrintToken] :: SharedIOConstants -> SafePrintToken [measureText] :: SharedIOConstants -> CanvasText -> IO ScreenDimensions data SharedIOState SharedIOState :: SharedIOState data IOConstants MouseConstants :: ClientSocket -> Connection -> ServerSocket -> IOConstants [clientSocket] :: IOConstants -> ClientSocket [clientConnection] :: IOConstants -> Connection [serverSocket] :: IOConstants -> ServerSocket KeyboardConstants :: ClientSocket -> Connection -> ServerSocket -> IOConstants [clientSocket] :: IOConstants -> ClientSocket [clientConnection] :: IOConstants -> Connection [serverSocket] :: IOConstants -> ServerSocket CanvasConstants :: CanvasSystemReceiveBuffer -> ClientSocket -> Connection -> ServerSocket -> IOConstants [canvasSystemReceiveBuffer] :: IOConstants -> CanvasSystemReceiveBuffer [clientSocket] :: IOConstants -> ClientSocket [clientConnection] :: IOConstants -> Connection [serverSocket] :: IOConstants -> ServerSocket StdInConstants :: BlockingConcurrentQueue StdInIn -> IOConstants [stdInInQueue] :: IOConstants -> BlockingConcurrentQueue StdInIn TimerConstants :: BlockingConcurrentQueue TimerIn -> IOConstants [tickInQueue] :: IOConstants -> BlockingConcurrentQueue TimerIn FileConstants :: BlockingConcurrentQueue FileIn -> IOConstants [fileInQueue] :: IOConstants -> BlockingConcurrentQueue FileIn NoConstants :: IOConstants data IOState TimerState :: [StartedTimer] -> [StartedTimer] -> IOState [startedIntervalTimers] :: IOState -> [StartedTimer] [startedTimers] :: IOState -> [StartedTimer] FileState :: [OpenFile] -> IOState [opened] :: IOState -> [OpenFile] StatefulGraphicsState :: GraphicsStates -> IOState [states] :: IOState -> GraphicsStates NoState :: IOState instance GHC.Show.Show Eventloop.Types.System.IOConstants module Eventloop.Module.Timer setupTimerModuleConfiguration :: EventloopSetupModuleConfiguration timerModuleIdentifier :: EventloopModuleIdentifier timerInitializer :: Initializer timerEventRetriever :: EventRetriever timerEventSender :: EventSender timerTeardown :: Teardown type MicroSecondDelay = Int type TimerId = [Char] type TickBuffer = BlockingConcurrentQueue TimerIn type StartedTimer = (TimerId, TimerIO) type TimerStartFunction = (TimerIO -> IO () -> Delay -> IO Bool) data TimerIn Tick :: TimerId -> TimerIn data TimerOut SetTimer :: TimerId -> MicroSecondDelay -> TimerOut SetIntervalTimer :: TimerId -> MicroSecondDelay -> TimerOut UnsetTimer :: TimerId -> TimerOut module Eventloop.Module.StdOut setupStdOutModuleConfiguration :: EventloopSetupModuleConfiguration stdOutModuleIdentifier :: EventloopModuleIdentifier stdOutEventSender :: EventSender data StdOutOut StdOutMessage :: [Char] -> StdOutOut module Eventloop.Module.StdIn setupStdInModuleConfiguration :: EventloopSetupModuleConfiguration stdInModuleIdentifier :: EventloopModuleIdentifier stdInInitializer :: Initializer stdInEventRetriever :: EventRetriever stdInEventSender :: EventSender data StdInIn StdInReceivedContents :: [[Char]] -> StdInIn StdInReceivedLine :: [Char] -> StdInIn StdInReceivedChar :: Char -> StdInIn data StdInOut StdInReceiveContents :: StdInOut StdInReceiveLine :: StdInOut StdInReceiveChar :: StdInOut module Eventloop.Module.File setupFileModuleConfiguration :: EventloopSetupModuleConfiguration fileModuleIdentifier :: EventloopModuleIdentifier fileEventRetriever :: EventRetriever fileEventSender :: EventSender fileTeardown :: Teardown type OpenFile = (FilePath, Handle, IOMode) data FileIn FileOpened :: FilePath -> Bool -> FileIn FileClosed :: FilePath -> Bool -> FileIn RetrievedContents :: FilePath -> [[Char]] -> FileIn RetrievedLine :: FilePath -> [Char] -> FileIn RetrievedChar :: FilePath -> Char -> FileIn IsEOF :: FilePath -> Bool -> FileIn WroteTo :: FilePath -> Bool -> FileIn data FileOut OpenFile :: FilePath -> IOMode -> FileOut CloseFile :: FilePath -> FileOut RetrieveContents :: FilePath -> FileOut RetrieveLine :: FilePath -> FileOut RetrieveChar :: FilePath -> FileOut IfEOF :: FilePath -> FileOut WriteTo :: FilePath -> [Char] -> FileOut module Eventloop.Module.DrawTrees data DrawTreesOut DrawTrees :: CanvasId -> [GeneralTree] -> DrawTreesOut data NodeColor NodeRed :: NodeColor NodeBlack :: NodeColor NodeGrey :: NodeColor data RBTree RBNode :: NodeColor -> String -> [RBTree] -> RBTree data RoseTree RoseNode :: String -> [RoseTree] -> RoseTree setupDrawTreesModuleConfiguration :: EventloopSetupModuleConfiguration drawTreesModuleIdentifier :: EventloopModuleIdentifier drawTreesPostProcessor :: PostProcessor showGeneralTreeList :: [GeneralTree] -> (Shape, RightOffset, BottomOffset) rbExampleTree :: RBTree roseExampleTree :: RoseTree -- | Convert to a RoseTree class ToRoseTree a -- | Convert to a RoseTree toRoseTree :: ToRoseTree a => a -> RoseTree -- | Convert to a RoseTree toRoseTree :: (ToRoseTree a, Generic a, GToRoseTree (Rep a)) => a -> RoseTree -- | A version of toRoseTree that works for any data type that has -- an instance for Generic genericToRoseTree :: (Generic a, GToRoseTree (Rep a)) => a -> RoseTree module Eventloop.Module.BasicShapes setupBasicShapesModuleConfiguration :: EventloopSetupModuleConfiguration basicShapesModuleIdentifier :: EventloopModuleIdentifier basicShapesPostProcessor :: PostProcessor type GraphicalNumeric = Float type Position = Point type Width = GraphicalNumeric type Height = GraphicalNumeric type Dimensions = (Width, Height) type Radius = GraphicalNumeric type Red = GraphicalNumeric type Green = GraphicalNumeric type Blue = GraphicalNumeric type Alpha = GraphicalNumeric type Color = (Red, Green, Blue, Alpha) type FillColor = Color type StrokeColor = Color type FillThickness = GraphicalNumeric type StrokeLineThickness = GraphicalNumeric type UpperLeft = Point type UpperRight = Point type LowerLeft = Point type LowerRight = Point type NumberOfPoints = Int type FontFamily = [Char] type FontSize = GraphicalNumeric data BasicShapesOut DrawShapes :: CanvasId -> [Shape] -> BasicShapesOut data Shape -- | Should contain atleast 1 shape. Rotation before Position CompositeShape :: [Shape] -> Maybe Position -> Maybe Rotation -> Shape [shapes] :: Shape -> [Shape] [positionM] :: Shape -> Maybe Position [rotationM] :: Shape -> Maybe Rotation -- | | Position is upperleftcorner. Position is the corner closes to -- origin. Visually in canvas, this is top left. In a Cartesian -- coördinate system, this is bottom left. Rectangle :: Position -> Dimensions -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape [position] :: Shape -> Position [dimensions] :: Shape -> Dimensions [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation -- | | Position is center Circle :: Position -> Radius -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape [position] :: Shape -> Position [radius] :: Shape -> Radius [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation -- | The first point of the regular polygon, always starts in the direction -- from the x-axis.(Towards x-infinity). Position is the the centre of -- the regular polygon RegularPolygon :: Position -> NumberOfPoints -> Radius -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape [position] :: Shape -> Position [numberOfPoints] :: Shape -> NumberOfPoints [radius] :: Shape -> Radius [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation Text :: [Char] -> FontFamily -> FontSize -> Position -> Alignment -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape [text] :: Shape -> [Char] [fontFamily] :: Shape -> FontFamily [fontSize] :: Shape -> FontSize [position] :: Shape -> Position [alignment] :: Shape -> Alignment [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation Line :: Point -> Point -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape [point1] :: Shape -> Point [point2] :: Shape -> Point [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation MultiLine :: [Point] -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape -- | | Can contain any number of points [points] :: Shape -> [Point] [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation FilledMultiLine :: [Point] -> FillThickness -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape -- | | Can contain any number of points [points] :: Shape -> [Point] [fillWidth] :: Shape -> FillThickness [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation Polygon :: [Point] -> FillColor -> StrokeLineThickness -> StrokeColor -> Maybe Rotation -> Shape -- | | Can contain any number of points [points] :: Shape -> [Point] [fillColor] :: Shape -> FillColor [strokeLineThickness] :: Shape -> StrokeLineThickness [strokeColor] :: Shape -> StrokeColor [rotationM] :: Shape -> Maybe Rotation data Rotation -- | | Rotation is around a point on the canvas. May be the centre of the -- boundingbox (enclosing rectangle) or an arbitrary point. Angle is in -- degrees and counter-clockwise in the coördinate system(from the x-axis -- to the y-axis) and visually on canvas clock-wise. Rotation :: RotatePoint -> Angle -> Rotation data RotatePoint AroundCenter :: RotatePoint AroundPoint :: Point -> RotatePoint data BoundingBox -- | | The point indications are from the perspective of a regular -- Cartesian coördinate system. BoundingBox :: LowerLeft -> UpperLeft -> UpperRight -> LowerRight -> BoundingBox type CanvasId = NumericId -- | Opcode: 1500 data Alignment -- | Opcode: 1501 AlignLeft :: Alignment -- | Opcode: 1502 AlignRight :: Alignment -- | Opcode: 1503 AlignCenter :: Alignment data GeometricPrimitive Points :: [Point] -> GeometricPrimitive CircleArea :: Point -> Radius -> GeometricPrimitive opOnBoundingBox :: (Point -> Point) -> BoundingBox -> BoundingBox allRegularPolygonPoints :: NumberOfPoints -> Point -> Radius -> [Point] boundingBoxFromPrimitives :: [GeometricPrimitive] -> BoundingBox normalizeBBox :: BoundingBox -> BoundingBox roundPoint :: Point -> ScreenPoint roundColor :: Color -> ScreenColor strokePointsForLine :: StrokeLineThickness -> Point -> Point -> [Point] strokePointsForConnection :: StrokeLineThickness -> Point -> Point -> Point -> [Point] strokePoints :: StrokeLineThickness -> [Point] -> [Point] strokePointsClosedPath :: StrokeLineThickness -> [Point] -> [Point] class ToPrimitives a toPrimitives :: ToPrimitives a => a -> [GeometricPrimitive] class ToCenter a toCenter :: ToCenter a => a -> Point class (ToPrimitives a) => ToBoundingBox a toBoundingBox :: ToBoundingBox a => a -> BoundingBox class (ToBoundingBox a) => Overlaps a overlaps :: (Overlaps a, (Overlaps b)) => a -> b -> Bool contains :: (Overlaps a, (Overlaps b)) => a -> b -> Bool touches :: (Overlaps a, (Overlaps b)) => a -> b -> Bool findRotationPoint :: (ToCenter a) => a -> Rotation -> Point class ToCanvasOut a toCanvasOut :: ToCanvasOut a => a -> CanvasOut class ToCanvasOperations a toCanvasOperations :: ToCanvasOperations a => a -> [CanvasOperation] toCanvasText :: Shape -> CanvasText class ToScreenPathPart a toScreenPathParts :: ToScreenPathPart a => a -> Maybe ([ScreenPathPart], ScreenStartingPoint) toCanvasPathFill :: Shape -> PathFill hasCanvasPathFill :: Shape -> Bool allScreenPolygonPoints :: Shape -> [Point] module Eventloop.Module.Websocket.Mouse setupMouseModuleConfiguration :: EventloopSetupModuleConfiguration mouseModuleIdentifier :: EventloopModuleIdentifier mouseInitializer :: Initializer mouseEventRetriever :: EventRetriever mouseEventSender :: EventSender data MouseIn Mouse :: MouseType -> NumericId -> MouseEvent -> Point -> MouseIn data MouseType MouseCanvas :: MouseType MouseSVG :: MouseType data MouseEvent Click :: MouseButton -> MouseEvent DoubleClick :: MouseButton -> MouseEvent MouseMove :: MouseEvent MouseDown :: MouseButton -> MouseEvent MouseUp :: MouseButton -> MouseEvent MouseEnter :: MouseEvent MouseLeave :: MouseEvent data MouseButton MouseLeft :: MouseButton MouseRight :: MouseButton MouseMiddle :: MouseButton module Eventloop.Module.Websocket.Keyboard setupKeyboardModuleConfiguration :: EventloopSetupModuleConfiguration keyboardModuleIdentifier :: EventloopModuleIdentifier keyboardInitializer :: Initializer keyboardEventRetriever :: EventRetriever keyboardEventSender :: EventSender -- | Almost all key presses are registered including modifier keys. Expect -- character keys to come in as their character. Press a c, get a "c". If -- a modifier is used and a different character is expected, it will be -- that instead. Press shift + c, get a C. Modifiers are also sent -- as their string representation: "shift", "ctrl" or "alt". Space is -- expected as "space". data Keyboard Key :: [Char] -> Keyboard module Eventloop.DefaultConfiguration allModulesEventloopSetupConfiguration :: progstateT -> (progstateT -> In -> (progstateT, [Out])) -> EventloopSetupConfiguration progstateT setupSharedIOConstants :: IO SharedIOConstants setupSharedIOState :: IO SharedIOState module Eventloop.Module.Websocket.Canvas setupCanvasModuleConfiguration :: EventloopSetupModuleConfiguration canvasModuleIdentifier :: EventloopModuleIdentifier canvasInitializer :: Initializer canvasEventRetriever :: EventRetriever canvasEventSender :: EventSender type CanvasSystemReceiveBuffer = MVar SystemCanvasIn type Opcode = Int type ScreenMetric = Int type ScreenX = ScreenMetric type ScreenY = ScreenMetric type ScreenWidth = ScreenMetric type ScreenHeight = ScreenMetric type ScreenRadius = ScreenMetric type ScreenAngle = ScreenMetric In degrees type ScreenPoint = (ScreenX, ScreenY) type ScreenDimensions = (ScreenWidth, ScreenHeight) type ScreenStartingPoint = ScreenPoint type ScreenControlPoint = ScreenPoint type ScreenEndPoint = ScreenPoint type ScreenStartingAngle = ScreenAngle type ScreenEndAngle = ScreenAngle type CanvasId = NumericId type ZIndex = Int type ScreenColorMetric = Int type ScreenRed = ScreenColorMetric type ScreenGreen = ScreenColorMetric type ScreenBlue = ScreenColorMetric type ScreenAlpha = Float type ScreenColor = (ScreenRed, ScreenGreen, ScreenBlue, ScreenAlpha) type ScreenPixel = ScreenColor type ColorStopOffset = Float type ScreenCircle = (ScreenPoint, ScreenRadius) type ScaleUnit = Float type ScaleX = ScaleUnit type ScaleY = ScaleUnit type ScreenLineThickness = Float type FontFamily = [Char] type FontSize = Int data RoutedMessageIn InUserCanvas :: CanvasIn -> RoutedMessageIn InSystemCanvas :: SystemCanvasIn -> RoutedMessageIn data RoutedMessageOut OutUserCanvas :: CanvasOut -> RoutedMessageOut OutSystemCanvas :: SystemCanvasOut -> RoutedMessageOut -- | Opcode: 2100 data SystemCanvasIn -- | Opcode: 2101 SystemMeasuredText :: CanvasText -> ScreenDimensions -> SystemCanvasIn -- | Opcode: 2000 data SystemCanvasOut -- | Opcode: 2001 SystemMeasureText :: CanvasText -> SystemCanvasOut -- | Opcode: 0100 data CanvasIn -- | Opcode: 0101 MeasuredText :: CanvasText -> ScreenDimensions -> CanvasIn -- | Reserved type words Type: t | Opcode Arguments: a | List of arguments -- for that data type Route: r | Either s for system or -- u for user Object: o | The object that is beneath -- -- Example: {r: s, o: {SystemMeasuredText -- object}} -- -- SystemMeasuredText object: {t:2102, a:[CanvasId, -- CanvasText object, ScreenDimensions]} -- -- Opcode: 0200 data CanvasOut -- | Opcode: 0201 SetupCanvas :: CanvasId -> ZIndex -> ScreenDimensions -> CSSPosition -> CanvasOut -- | Opcode: 0202 TeardownCanvas :: CanvasId -> CanvasOut -- | Opcode: 0203 CanvasOperations :: CanvasId -> [CanvasOperation] -> CanvasOut -- | Opcode: 0204 MeasureText :: CanvasText -> CanvasOut -- | Opcode: 0300 data CanvasOperation -- | Opcode: 0301 DrawPath :: ScreenStartingPoint -> [ScreenPathPart] -> PathStroke -> PathFill -> CanvasOperation -- | Opcode: 0302 DrawText :: CanvasText -> ScreenPoint -> TextStroke -> TextFill -> CanvasOperation -- | Opcode: 0303 DoTransform :: CanvasTransform -> CanvasOperation -- | Opcode: 0304 Clear :: ClearPart -> CanvasOperation -- | Opcode: 0305 Frame :: CanvasOperation -- | Opcode: 0400 data ScreenPathPart -- | Opcode: 0401 MoveTo :: ScreenPoint -> ScreenPathPart -- | Opcode: 0402 LineTo :: ScreenPoint -> ScreenPathPart -- | Opcode: 0403 BezierCurveTo :: ScreenControlPoint -> ScreenControlPoint -> ScreenEndPoint -> ScreenPathPart -- | Opcode: 0404 QuadraticCurveTo :: ScreenControlPoint -> ScreenEndPoint -> ScreenPathPart -- | Opcode: 0405 ArcTo :: ScreenControlPoint -> ScreenControlPoint -> ScreenRadius -> ScreenPathPart -- | Opcode: 0406 Arc :: ScreenCircle -> ScreenStartingAngle -> ScreenEndAngle -> ScreenPathPart -- | Opcode: 0407 Rectangle :: ScreenPoint -> ScreenDimensions -> ScreenPathPart -- | Opcode: 0408 ClosePath :: ScreenPathPart -- | Opcode: 0500 type PathRenderStrokeStyle = RenderStyle data PathStroke -- | Opcode: 0501 PathStroke :: ScreenLineThickness -> PathRenderStrokeStyle -> PathStroke -- | Opcode: 0502 NoPathStroke :: PathStroke -- | Opcode: 0600 type PathRenderFillStyle = RenderStyle data PathFill -- | Opcode: 0601 PathFill :: PathRenderFillStyle -> PathFill -- | Opcode: 0602 NoPathFill :: PathFill -- | Opcode: 0700 type CanvasColorStop = (ColorStopOffset, ScreenColor) data RenderStyle -- | Opcode: 0701 CanvasColor :: ScreenColor -> RenderStyle -- | Opcode:0702 CanvasGradient :: CanvasGradientType -> [CanvasColorStop] -> RenderStyle -- | Opcode: 0703 CanvasPattern :: CanvasImage -> PatternRepetition -> RenderStyle -- | Opcode: 0800 data CanvasImage -- | Opcode: 0801 CanvasElement :: CanvasId -> ScreenPoint -> ScreenDimensions -> CanvasImage -- | Opcode: 0802 [ScreenPixel] should be as long as width * height * 4. -- Each quad is red,green,blue,alpha ImageData :: ScreenDimensions -> [ScreenPixel] -> CanvasImage -- | Opcode: 0900 data PatternRepetition -- | Opcode: 0901 Repeat :: PatternRepetition -- | Opcode: 0902 RepeatX :: PatternRepetition -- | Opcode: 0903 RepeatY :: PatternRepetition -- | Opcode: 0904 NoRepeat :: PatternRepetition -- | Opcode: 1000 data CanvasGradientType -- | Opcode: 1001 First circle = inner circle, Second circle is enclosing -- circle RadialGradient :: ScreenCircle -> ScreenCircle -> CanvasGradientType -- | Opcode: 1002 LinearGradient :: ScreenPoint -> ScreenPoint -> CanvasGradientType -- | Opcode: 1200 data CanvasText -- | Opcode: 1201 CanvasText :: [Char] -> Font -> Alignment -> CanvasText -- | Opcode: 1300 data Font -- | Opcode: 1301 Font :: FontFamily -> FontSize -> Font -- | Opcode: 1400 type TextStrokeRenderStyle = RenderStyle type TextFillRenderStyle = RenderStyle data TextStroke -- | Opcode: 1401 TextStroke :: ScreenLineThickness -> TextStrokeRenderStyle -> TextStroke -- | Opcode: 1402 NoTextStroke :: TextStroke -- | Opcode: 2400 data TextFill -- | Opcode: 2401 TextFill :: TextFillRenderStyle -> TextFill -- | Opcode: 2402 NoTextFill :: TextFill -- | Opcode: 1500 data Alignment -- | Opcode: 1501 AlignLeft :: Alignment -- | Opcode: 1502 AlignRight :: Alignment -- | Opcode: 1503 AlignCenter :: Alignment -- | Opcode: 1600 type TransformUnit = Float type TransformationMatrix = (TransformUnit, TransformUnit, TransformUnit, TransformUnit, TransformUnit, TransformUnit) data CanvasTransform -- | Opcode: 1601 Save :: CanvasTransform -- | Opcode: 1602 Restore :: CanvasTransform -- | Opcode: 1603 Translate :: ScreenPoint -> CanvasTransform -- | Opcode: 1604 Rotate :: ScreenAngle -> CanvasTransform -- | Opcode: 1605 Scale :: ScaleX -> ScaleY -> CanvasTransform -- | Opcode: 1606 Transform :: TransformationMatrix -> CanvasTransform -- | Opcode: 1607 SetTransform :: TransformationMatrix -> CanvasTransform -- | Opcode: 1608 ResetTransform :: CanvasTransform -- | Opcode: 2200 type CSSLeftOffset = CSSUnit type CSSTopOffset = CSSUnit type CSSMeasurements = (CSSLeftOffset, CSSTopOffset) data CSSPosition -- | Opcode: 2201 CSSPosition :: CSSBindPoint -> CSSMeasurements -> CSSPosition -- | Opcode: 2300 data CSSBindPoint -- | Opcode: 2301 CSSFromCenter :: CSSBindPoint -- | Opcode: 2302 Usually this is the top left corner of the element CSSFromDefault :: CSSBindPoint -- | Opcode: 1800 data CSSUnit -- | Opcode: 1801 CSSPixels :: Int -> CSSUnit -- | Opcode: 1802 CSSPercentage :: Int -> CSSUnit -- | Opcode: 1900 data ClearPart -- | Opcode: 1901 ClearRectangle :: ScreenPoint -> ScreenDimensions -> ClearPart -- | Opcode: 1902 ClearCanvas :: ClearPart module Eventloop.Module.StatefulGraphics setupStatefulGraphicsModuleConfiguration :: EventloopSetupModuleConfiguration statefulGraphicsModuleIdentifier :: EventloopModuleIdentifier statefulGraphicsInitializer :: Initializer statefulGraphicsPostProcessor :: PostProcessor type CanvasSystemReceiveBuffer = MVar SystemCanvasIn type Opcode = Int type ScreenMetric = Int type ScreenX = ScreenMetric type ScreenY = ScreenMetric type ScreenWidth = ScreenMetric type ScreenHeight = ScreenMetric type ScreenRadius = ScreenMetric type ScreenAngle = ScreenMetric In degrees type ScreenPoint = (ScreenX, ScreenY) type ScreenDimensions = (ScreenWidth, ScreenHeight) type ScreenStartingPoint = ScreenPoint type ScreenControlPoint = ScreenPoint type ScreenEndPoint = ScreenPoint type ScreenStartingAngle = ScreenAngle type ScreenEndAngle = ScreenAngle type CanvasId = NumericId type ZIndex = Int type ScreenColorMetric = Int type ScreenRed = ScreenColorMetric type ScreenGreen = ScreenColorMetric type ScreenBlue = ScreenColorMetric type ScreenAlpha = Float type ScreenColor = (ScreenRed, ScreenGreen, ScreenBlue, ScreenAlpha) type ScreenPixel = ScreenColor type ColorStopOffset = Float type ScreenCircle = (ScreenPoint, ScreenRadius) type ScaleUnit = Float type ScaleX = ScaleUnit type ScaleY = ScaleUnit type ScreenLineThickness = Float type FontFamily = [Char] type FontSize = Int data RoutedMessageIn InUserCanvas :: CanvasIn -> RoutedMessageIn InSystemCanvas :: SystemCanvasIn -> RoutedMessageIn data RoutedMessageOut OutUserCanvas :: CanvasOut -> RoutedMessageOut OutSystemCanvas :: SystemCanvasOut -> RoutedMessageOut -- | Opcode: 2100 data SystemCanvasIn -- | Opcode: 2101 SystemMeasuredText :: CanvasText -> ScreenDimensions -> SystemCanvasIn -- | Opcode: 2000 data SystemCanvasOut -- | Opcode: 2001 SystemMeasureText :: CanvasText -> SystemCanvasOut -- | Opcode: 0100 data CanvasIn -- | Opcode: 0101 MeasuredText :: CanvasText -> ScreenDimensions -> CanvasIn -- | Reserved type words Type: t | Opcode Arguments: a | List of arguments -- for that data type Route: r | Either s for system or -- u for user Object: o | The object that is beneath -- -- Example: {r: s, o: {SystemMeasuredText -- object}} -- -- SystemMeasuredText object: {t:2102, a:[CanvasId, -- CanvasText object, ScreenDimensions]} -- -- Opcode: 0200 data CanvasOut -- | Opcode: 0201 SetupCanvas :: CanvasId -> ZIndex -> ScreenDimensions -> CSSPosition -> CanvasOut -- | Opcode: 0202 TeardownCanvas :: CanvasId -> CanvasOut -- | Opcode: 0203 CanvasOperations :: CanvasId -> [CanvasOperation] -> CanvasOut -- | Opcode: 0204 MeasureText :: CanvasText -> CanvasOut -- | Opcode: 0300 data CanvasOperation -- | Opcode: 0301 DrawPath :: ScreenStartingPoint -> [ScreenPathPart] -> PathStroke -> PathFill -> CanvasOperation -- | Opcode: 0302 DrawText :: CanvasText -> ScreenPoint -> TextStroke -> TextFill -> CanvasOperation -- | Opcode: 0303 DoTransform :: CanvasTransform -> CanvasOperation -- | Opcode: 0304 Clear :: ClearPart -> CanvasOperation -- | Opcode: 0305 Frame :: CanvasOperation -- | Opcode: 0400 data ScreenPathPart -- | Opcode: 0401 MoveTo :: ScreenPoint -> ScreenPathPart -- | Opcode: 0402 LineTo :: ScreenPoint -> ScreenPathPart -- | Opcode: 0403 BezierCurveTo :: ScreenControlPoint -> ScreenControlPoint -> ScreenEndPoint -> ScreenPathPart -- | Opcode: 0404 QuadraticCurveTo :: ScreenControlPoint -> ScreenEndPoint -> ScreenPathPart -- | Opcode: 0405 ArcTo :: ScreenControlPoint -> ScreenControlPoint -> ScreenRadius -> ScreenPathPart -- | Opcode: 0406 Arc :: ScreenCircle -> ScreenStartingAngle -> ScreenEndAngle -> ScreenPathPart -- | Opcode: 0407 Rectangle :: ScreenPoint -> ScreenDimensions -> ScreenPathPart -- | Opcode: 0408 ClosePath :: ScreenPathPart -- | Opcode: 0500 type PathRenderStrokeStyle = RenderStyle data PathStroke -- | Opcode: 0501 PathStroke :: ScreenLineThickness -> PathRenderStrokeStyle -> PathStroke -- | Opcode: 0502 NoPathStroke :: PathStroke -- | Opcode: 0600 type PathRenderFillStyle = RenderStyle data PathFill -- | Opcode: 0601 PathFill :: PathRenderFillStyle -> PathFill -- | Opcode: 0602 NoPathFill :: PathFill -- | Opcode: 0700 type CanvasColorStop = (ColorStopOffset, ScreenColor) data RenderStyle -- | Opcode: 0701 CanvasColor :: ScreenColor -> RenderStyle -- | Opcode:0702 CanvasGradient :: CanvasGradientType -> [CanvasColorStop] -> RenderStyle -- | Opcode: 0703 CanvasPattern :: CanvasImage -> PatternRepetition -> RenderStyle -- | Opcode: 0800 data CanvasImage -- | Opcode: 0801 CanvasElement :: CanvasId -> ScreenPoint -> ScreenDimensions -> CanvasImage -- | Opcode: 0802 [ScreenPixel] should be as long as width * height * 4. -- Each quad is red,green,blue,alpha ImageData :: ScreenDimensions -> [ScreenPixel] -> CanvasImage -- | Opcode: 0900 data PatternRepetition -- | Opcode: 0901 Repeat :: PatternRepetition -- | Opcode: 0902 RepeatX :: PatternRepetition -- | Opcode: 0903 RepeatY :: PatternRepetition -- | Opcode: 0904 NoRepeat :: PatternRepetition -- | Opcode: 1000 data CanvasGradientType -- | Opcode: 1001 First circle = inner circle, Second circle is enclosing -- circle RadialGradient :: ScreenCircle -> ScreenCircle -> CanvasGradientType -- | Opcode: 1002 LinearGradient :: ScreenPoint -> ScreenPoint -> CanvasGradientType -- | Opcode: 1200 data CanvasText -- | Opcode: 1201 CanvasText :: [Char] -> Font -> Alignment -> CanvasText -- | Opcode: 1300 data Font -- | Opcode: 1301 Font :: FontFamily -> FontSize -> Font -- | Opcode: 1400 type TextStrokeRenderStyle = RenderStyle type TextFillRenderStyle = RenderStyle data TextStroke -- | Opcode: 1401 TextStroke :: ScreenLineThickness -> TextStrokeRenderStyle -> TextStroke -- | Opcode: 1402 NoTextStroke :: TextStroke -- | Opcode: 2400 data TextFill -- | Opcode: 2401 TextFill :: TextFillRenderStyle -> TextFill -- | Opcode: 2402 NoTextFill :: TextFill -- | Opcode: 1500 data Alignment -- | Opcode: 1501 AlignLeft :: Alignment -- | Opcode: 1502 AlignRight :: Alignment -- | Opcode: 1503 AlignCenter :: Alignment -- | Opcode: 1600 type TransformUnit = Float type TransformationMatrix = (TransformUnit, TransformUnit, TransformUnit, TransformUnit, TransformUnit, TransformUnit) data CanvasTransform -- | Opcode: 1601 Save :: CanvasTransform -- | Opcode: 1602 Restore :: CanvasTransform -- | Opcode: 1603 Translate :: ScreenPoint -> CanvasTransform -- | Opcode: 1604 Rotate :: ScreenAngle -> CanvasTransform -- | Opcode: 1605 Scale :: ScaleX -> ScaleY -> CanvasTransform -- | Opcode: 1606 Transform :: TransformationMatrix -> CanvasTransform -- | Opcode: 1607 SetTransform :: TransformationMatrix -> CanvasTransform -- | Opcode: 1608 ResetTransform :: CanvasTransform -- | Opcode: 2200 type CSSLeftOffset = CSSUnit type CSSTopOffset = CSSUnit type CSSMeasurements = (CSSLeftOffset, CSSTopOffset) data CSSPosition -- | Opcode: 2201 CSSPosition :: CSSBindPoint -> CSSMeasurements -> CSSPosition -- | Opcode: 2300 data CSSBindPoint -- | Opcode: 2301 CSSFromCenter :: CSSBindPoint -- | Opcode: 2302 Usually this is the top left corner of the element CSSFromDefault :: CSSBindPoint -- | Opcode: 1800 data CSSUnit -- | Opcode: 1801 CSSPixels :: Int -> CSSUnit -- | Opcode: 1802 CSSPercentage :: Int -> CSSUnit -- | Opcode: 1900 data ClearPart -- | Opcode: 1901 ClearRectangle :: ScreenPoint -> ScreenDimensions -> ClearPart -- | Opcode: 1902 ClearCanvas :: ClearPart data StatefulGraphicsOut Draw :: StatefulGraphic -> StatefulGraphicsOut Remove :: NamedId -> StatefulGraphicsOut data GraphicPerformed Drawn :: StatefulBB -> GraphicPerformed Modified :: StatefulBB -> StatefulBB -> GraphicPerformed Removed :: StatefulBB -> GraphicPerformed NoOp :: GraphicPerformed data StatefulGraphic Stateful :: NamedId -> ZIndex -> Shape -> StatefulGraphic data StatefulBB StatefulBB :: StatefulGraphic -> BoundingBox -> StatefulBB type GraphicsState = [StatefulBB] type GraphicsStates = [(CanvasId, GraphicsState)] class NoDimChange a noDimChange :: NoDimChange a => a -> a -> Bool module Eventloop.Core -- | Starts the entire system. First the setup phase is handled to setup -- the different concurrent resources. This is followed by the -- initialization phase where all modules are initialised. Than, the -- different worker threads are spawned and finally the system thread -- will go to work as the eventloop thread. -- -- Shutting down is handled centrally through the system thread (main -- thread). If any of the threads(including the system thread) receive an -- exception, only the first exception is thrown to the system thread -- which will try to shutdown immediately. This exception is logged by -- the system thread. All other exceptions are logged by their respective -- threads. The system thread will than shutdown the worker threads. This -- is done by throwing exceptions to all workerthreads except sender -- threads. These are sent a Stop event. If they take longer than 1 -- second, to finish up, they will also be thrown an exception. startEventloopSystem :: EventloopSetupConfiguration progstateT -> IO () terminateWithinOrThrowException :: Int -> SomeException -> Thread -> IO TimerIO -- | Utility function in order to create the different thread actions in -- the system. Assumed is that the action requires the system -- configuration, the module configuration and some resource that may be -- available in the module configuration. threadActionsBasedOnModule :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> (EventloopModuleConfiguration, resource) -> IO ()) -> (EventloopModuleConfiguration -> Maybe resource) -> [EventloopModuleConfiguration] -> [IO ()] spawnWorkerThread :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> Thread -> IO ()) -> IO () -> IO () registerRetrieverThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () registerOutRouterThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () registerSenderThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () throwShutdownExceptionToThread :: Thread -> IO () allWorkerThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] retrieverThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] outRouterThread :: EventloopSystemConfiguration progstateT -> IO [Thread] senderThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] module Eventloop.Module.Graphs setupGraphsModuleConfiguration :: EventloopSetupModuleConfiguration graphsModuleIdentifier :: EventloopModuleIdentifier nodeRadius :: Float textSize :: Float textFont :: [Char] xArrowSize :: Float yArrowSize :: Float weightHeight :: Float dimCanvasGraphs :: (Float, Float) roundDimCanvasGraphs :: (Int, Int) canvasGraphsWidth :: Float canvasGraphsHeight :: Float instructionsHeight :: Float instructionsBeginAt :: Float canvasInstrWidth :: Float canvasInstrHeight :: Float dimCanvasInstr :: (Float, Float) roundDimCanvasInstr :: (Int, Int) canvasIdGraphs :: CanvasId canvasIdInstructions :: CanvasId -- | Checkes to see if there is a node on a certain position onNode :: [Node] -> Pos -> Maybe Node -- | Abstracts the standardized EventTypes to GraphsIn graphsPreProcessor :: PreProcessor -- | Abstracts GraphsOut back to BasicShapes and -- Canvas events graphsPostProcessor :: PostProcessor -- | Translates color datatype to RGBA codes colorToRGBAColor :: Color -> Color -- | Translates the thickness to a float thicknessToFloat :: Thickness -> StrokeLineThickness findNode :: [Node] -> Label -> Node graphToShapes :: Graph -> [Shape] nodeToShapes :: Node -> [Shape] edgeToShapes :: Node -> Node -> Edge -> Directed -> Weighted -> [Shape] -- | Returns the point when making a step f long from the point start in -- the direction of the vector. The length between start pos and result -- pos is always f. posOnVector :: Float -> Vector -> Pos -> Pos -- | Vector from p1 to p2 vectorize :: Pos -> Pos -> Vector -- | Returns the vector perpendicular on the given vector between the 2 -- points. Always has positive y and vector length 1; y is inverted in -- canvas downPerpendicularTo :: Pos -> Pos -> Vector -- | Returns the vector perpendicular on the given vector between the 2 -- points. Always has negative y and vector length 1; y is inverted in -- canvas upPerpendicularTo :: Pos -> Pos -> Vector -- | Returns the size of the vector vectorSize :: Vector -> Float type Pos = (Float, Float) type Vector = (Float, Float) data GraphsIn Mouse :: MouseEvent -> Pos -> GraphsIn Key :: [Char] -> GraphsIn data GraphsOut SetupGraphs :: GraphsOut DrawGraph :: Graph -> GraphsOut Instructions :: [String] -> GraphsOut type Label = Char type Weight = Float type Node = (Label, Pos, Color) type Edge = (Label, Label, Color, Weight, Thickness) data Graph Graph :: [Node] -> [Edge] -> Directed -> Weighted -> Graph [nodes] :: Graph -> [Node] [edges] :: Graph -> [Edge] [directed] :: Graph -> Directed [weighted] :: Graph -> Weighted data Color Red :: Color Blue :: Color Green :: Color Purple :: Color Grey :: Color Yellow :: Color Orange :: Color Black :: Color White :: Color data Thickness Thin :: Thickness Thick :: Thickness data Directed Directed :: Directed Undirected :: Directed data Weighted Weighted :: Weighted Unweighted :: Weighted data MouseEvent Click :: MouseButton -> MouseEvent DoubleClick :: MouseButton -> MouseEvent MouseMove :: MouseEvent MouseDown :: MouseButton -> MouseEvent MouseUp :: MouseButton -> MouseEvent MouseEnter :: MouseEvent MouseLeave :: MouseEvent data MouseButton MouseLeft :: MouseButton MouseRight :: MouseButton MouseMiddle :: MouseButton