-- | 
makeContinuousArrangement :: ZoomMode 
                          -> CanvasDimension 
                          -> Hoodle EditMode 
                          -> (PageNum,PageCoordinate) 
                          -> PageArrangement ContinuousPage
makeContinuousArrangement zmode cdim@(CanvasDimension (Dim cw ch)) 
                                hdl (pnum,PageCoord (xpos,ypos)) = 
  let dim = view gdimension . head . toList . view gpages $ hdl
      (sinvx,sinvy) = getRatioPageCanvas zmode (PageDimension dim) cdim 
      cnstrnt = DesktopWidthConstrained (cw/sinvx)     
      -- default to zero if error 
      (PageOrigin (x0,y0),_) = maybe (PageOrigin (0,0),PageDimension (Dim cw ch)) 
                                     id (pageArrFuncCont cnstrnt hdl pnum)
      ddim@(DesktopDimension iddim) = deskDimCont cnstrnt hdl 
      (x1,y1) = (xpos+x0,ypos+y0) 
      (x2,y2) = (xpos+x0+cw/sinvx,ypos+y0+ch/sinvy) 
      ovport =ViewPortBBox (BBox (x1,y1) (x2,y2))
      vport = xformViewPortFitInSize iddim id ovport
  in ContinuousArrangement cdim ddim (pageArrFuncCont cnstrnt hdl) vport
makeContinuousArrangement :: ZoomMode 
                          -> CanvasDimension 
                          -> Hoodle EditMode 
                          -> (PageNum,PageCoordinate) 
                          -> PageArrangement ContinuousPage
makeContinuousArrangement zmode cdim@(CanvasDimension (Dim cw ch)) 
                                hdl (pnum,PageCoord (xpos,ypos)) = 
  let dim = view gdimension . head . toList . view gpages $ hdl
      (sinvx,sinvy) = getRatioPageCanvas zmode (PageDimension dim) cdim 
      cnstrnt = DesktopWidthConstrained (cw/sinvx)     
      -- default to zero if error 
      (PageOrigin (x0,y0),_) = maybe (PageOrigin (0,0),PageDimension (Dim cw ch)) 
                                     id (pageArrFuncCont cnstrnt hdl pnum)
      ddim@(DesktopDimension iddim) = deskDimCont cnstrnt hdl 
      (x1,y1) = (xpos+x0,ypos+y0) 
      (x2,y2) = (xpos+x0+cw/sinvx,ypos+y0+ch/sinvy) 
      ovport =ViewPortBBox (BBox (x1,y1) (x2,y2))
      vport = xformViewPortFitInSize iddim id ovport
  in ContinuousArrangement cdim ddim (pageArrFuncCont cnstrnt hdl) vport
makeContinuousArrangement zmode cdim@(CanvasDimension (Dim cw ch)) 
                                hdl (pnum,PageCoord (xpos,ypos)) = 
  let dim = view gdimension . head . toList . view gpages $ hdl
      (sinvx,sinvy) = getRatioPageCanvas zmode (PageDimension dim) cdim 
      cnstrnt = DesktopWidthConstrained (cw/sinvx)     
      -- default to zero if error 
      (PageOrigin (x0,y0),_) = maybe (PageOrigin (0,0),PageDimension (Dim cw ch)) 
                                     id (pageArrFuncCont cnstrnt hdl pnum)
      ddim@(DesktopDimension iddim) = deskDimCont cnstrnt hdl 
      (x1,y1) = (xpos+x0,ypos+y0) 
      (x2,y2) = (xpos+x0+cw/sinvx,ypos+y0+ch/sinvy) 
      ovport =ViewPortBBox (BBox (x1,y1) (x2,y2))
      vport = xformViewPortFitInSize iddim id ovport
  in ContinuousArrangement cdim ddim (pageArrFuncCont cnstrnt hdl) vport