Update of /cvsroot/htoolkit/gio/src/examples/life
In directory sc8-pr-cvs1:/tmp/cvs-serv6742
Modified Files:
Main.hs
Log Message:
update
Index: Main.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/life/Main.hs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Main.hs 13 Jul 2003 10:32:12 -0000 1.1
--- Main.hs 3 Oct 2003 12:54:39 -0000 1.2
***************
*** 33,41 ****
mopts <- menu [title =: "Options"] mainMenu
msizes <- menu [title =: "Cell Size"] mopts
! rg <- menuRadioGroup [] msizes
! sequence [menuRadioItem [ title =: mkTitle size
! , on command =: onNewSize size w ref] rg
| size <- [1..8]]
! set rg [selected =: 7]
mcmd <- menu [title =: "Commands"] mainMenu
--- 33,41 ----
mopts <- menu [title =: "Options"] mainMenu
msizes <- menu [title =: "Cell Size"] mopts
! items <- sequence [menuRadioItem [ title =: mkTitle size
! , on command =: onNewSize size w ref] msizes
| size <- [1..8]]
! setMenuRadioGroup items
! set (items !! 6) [checked =: True]
mcmd <- menu [title =: "Commands"] mainMenu
***************
*** 60,64 ****
let render can = drawCells (drawCell size) next can >> drawCells (eraseCell size) died can
writeIORef ref (life{gen=next})
! drawInWindow UnBuffered w render
onAbout = do
--- 60,64 ----
let render can = drawCells (drawCell size) next can >> drawCells (eraseCell size) died can
writeIORef ref (life{gen=next})
! paintIn w UnBuffered render
onAbout = do
***************
*** 74,88 ****
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=removeCell cell (gen life)})
! drawInWindow UnBuffered w (eraseCell (cellSize life) cell)
| mods == noModifiers = do
life <- readIORef ref
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=insertCell cell (gen life)})
! drawInWindow UnBuffered w (drawCell (cellSize life) cell)
onMouse w ref (MouseDrag pos mods) = do
life <- readIORef ref
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=insertCell cell (gen life)})
! drawInWindow UnBuffered w (drawCell (cellSize life) cell)
onMouse w ref _ = return ()
--- 74,88 ----
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=removeCell cell (gen life)})
! paintIn w UnBuffered (eraseCell (cellSize life) cell)
| mods == noModifiers = do
life <- readIORef ref
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=insertCell cell (gen life)})
! paintIn w UnBuffered (drawCell (cellSize life) cell)
onMouse w ref (MouseDrag pos mods) = do
life <- readIORef ref
let cell = makeLifeCell pos (cellSize life)
writeIORef ref (life{gen=insertCell cell (gen life)})
! paintIn w UnBuffered (drawCell (cellSize life) cell)
onMouse w ref _ = return ()
***************
*** 103,116 ****
set mplay [enabled =: False]
set mstep [enabled =: False]
! set mhalt [enabled =: True ]
! set timer [enabled =: True ]
-- onHalt stops the computation of successive generations, but does not change the current generation.
onHalt :: MenuItem -> MenuItem -> MenuItem -> Timer -> IO ()
onHalt mplay mstep mhalt timer = do
! set mplay [enabled =: True]
! set mstep [enabled =: True]
! set mhalt [enabled =: False]
! set timer [enabled =: False]
-- onNewSize changes the size in which life cells are rendered and redraws the window.
--- 103,116 ----
set mplay [enabled =: False]
set mstep [enabled =: False]
! set mhalt [enabled =: True ]
! set timer [enabled =: True ]
-- onHalt stops the computation of successive generations, but does not change the current generation.
onHalt :: MenuItem -> MenuItem -> MenuItem -> Timer -> IO ()
onHalt mplay mstep mhalt timer = do
! set mplay [enabled =: True ]
! set mstep [enabled =: True ]
! set mhalt [enabled =: False]
! set timer [enabled =: False]
-- onNewSize changes the size in which life cells are rendered and redraws the window.
|