point = Point
pt = Point
-runTina :: TinaProgram -> IO ()
-runTina p = return ()
-
data Request
= GfxLines Color [Point] -- coloured line through a list of points
| GfxPolygon Color [Point] -- filled polygon of given colour
, usrState :: IORef s
, usrProg :: TinaStep s
}
-{-
-dbgLog IS {..} s = do
- return ()
processPostponed :: IState -> IO ()
processPostponed s@IS {..} = do
runTina Main {..} = do
usrState <- newIORef initialState
postponed <- newIORef (GfxText (rgb 0 0 0) (pt 50 50) "foo" : GfxClear :initialRequests)
- let state = IS { sFrame = undefined, sPanel = undefined, buffer = undefined, usrProg = eventHandler, .. }
- run $ runGUI (sz windowWidth windowHeight) state
- putStrLn "XX"
- runGUI (sz windowWidth windowHeight) state
+ let state = IS { usrProg = eventHandler, .. }
+ runGUI {-(sz windowWidth windowHeight) -}state
-runGUI :: Size -> IState -> IO ()
+runGUI :: {-Size ->-} IState -> IO ()
+runGUI s = do return ()
+{-
runGUI s IS {..} = do
sFrame <- frame
[ text := "FP Practicum"
]
windowSetFocus sFrame
processPostponed state
-
onPaint :: IState -> DC a -> Rect -> IO ()
onPaint IS {..} dest va = do
dcBlit dest va buffer (Point 0 0) wxCOPY False >> return ()
transKey prod KeyTab = prod '\t'
transKey _ _ = return ()
+-}
-
-
+{-
miscHandler s@IS {..} (FRead fn ) = Just $ readFile fn >>= post s . FileContents fn
miscHandler IS {..} (FWrite fn cnts) = Just $ writeFile fn cnts
miscHandler IS {..} ReqQuit = Just $ putStrLn "Quiting" >> wxcAppExit
+-}
miscHandler IS {..} _ = Nothing
+{-
winHandler s@IS {..} (WinPrompt st1 st2 st3) = Just $ textDialog sFrame st1 st2 st3 >>= post s . PromptResponse st1 st2
winHandler IS {..} (WinTitle st) = Just $ sFrame `set` [text := st]
winHandler s@IS {..} (WinMenu ms) = Just $ mkMenu >>= \ms' -> sFrame `set` [menuBar := ms']
| item <- items ]
return p
| (name,items) <- ms ]
+-}
winHandler _ _ = Nothing
+{-
gfxHandler IS {..} (GfxLines col ps) = Just $ polyline buffer ps [penColor := col] >> dirtyPts sPanel ps
gfxHandler IS {..} (GfxPolygon col ps) = Just $ polygon buffer ps [penColor := col, brushColor := col] >> dirtyPts sPanel ps
gfxHandler IS {..} (GfxText col xy st) = Just $ drawText buffer st xy [textColor := col] >> getTextExtent buffer st >>= dirtyRect' sPanel xy
gfxHandler IS {..} (GfxFont st sz) = Just $ buffer `set` [ fontSize := sz, fontFace := st ]
gfxHandler IS {..} GfxClear = Just $ dcClear buffer >> windowRefresh sPanel False
gfxHandler IS {..} (GfxPicture fd pt) = Just $ bitmapCreateFromFile fd >>= \bm -> drawBitmap buffer bm pt False [] >> bitmapGetSize bm >>= dirtyRect' sPanel pt
+-}
gfxHandler _ _ = Nothing
+{-
dirtyPts :: Window a -> [Point] -> IO ()
dirtyPts dc ps = dirtyRect' dc (pt x y) Size {..}
where