Safe Haskell | None |
---|
Functions for drawing grid and table structure common in music theory and in compositions such as Morton Feldman's durational grid music of the 1950's.
- type R = Double
- type P = (R, R)
- type C = (R, R, R)
- type L = (Int, Int)
- type Cell = (L, C, String)
- type Grid = [Cell]
- grid :: P -> (R, R) -> (Int, Int) -> [P]
- grid_pt :: (R, R) -> (R, R) -> L -> P
- displace :: (R, R) -> P -> P
- mk_bbox :: (Int, Int) -> (R, R)
- type Table_Cell = ([Attr], [Content])
- type Caption = [Content]
- type Table = (Caption, [[Table_Cell]])
- simple_table :: Caption -> [[Content]] -> Table
- simple_table_class :: Caption -> [[(String, Content)]] -> Table
- type Build_F = (Int, Int) -> Maybe Table_Cell
- build_table_m :: Caption -> (Int, Int) -> Build_F -> Table
- build_table :: Caption -> (Int, Int) -> ((Int, Int) -> Table_Cell) -> Table
- table :: Table -> Content
- type Table_Set = [Table]
- table_set :: Table_Set -> Content
- page :: Maybe FilePath -> [Table_Set] -> String
- to_html :: FilePath -> Maybe FilePath -> [Table_Set] -> IO ()
Grid
grid :: P -> (R, R) -> (Int, Int) -> [P]Source
Given (x,y) upper-left co-ordinate of grid, (w,h) cell dimensions, and (r,c) grid dimensions, make list of upper-left co-ordinates of cells.
grid (10,10) (50,10) (2,2) == [(10,10),(60,10),(10,20),(60,20)]
grid_pt :: (R, R) -> (R, R) -> L -> PSource
Variant on grid
that constructs a single point.
map (grid_pt (10,10) (50,10)) [(0,0),(1,1)] == [(10,10),(60,20)]
Table
type Table = (Caption, [[Table_Cell]])Source
Table of row order Table_Cell
s.
build_table_m :: Caption -> (Int, Int) -> Build_F -> TableSource
Build a table of (rows,columns)
dimensions given a function
from (row,column)
to Maybe
Table_Cell
. If the function is
Nothing
the cell is skipped, becase another cell has claimed it's
locations with colspan
or rowspan
.
build_table :: Caption -> (Int, Int) -> ((Int, Int) -> Table_Cell) -> TableSource
Build a table of (rows,columns)
dimensions given a function
from (row,column)
to Table_Cell
.