ui: note JD layout tips, issues

This commit is contained in:
Simon Michael 2015-08-24 16:22:09 -07:00
parent 455c71c9ab
commit 5822380719
2 changed files with 19 additions and 4 deletions

View File

@ -97,7 +97,8 @@ drawRegisterScreen2 AppState{aopts=_opts, aScreen=RegisterScreen2{rs2State=l}} =
-- calculate column widths, based on current available width
c <- getContext
let
totalwidth = c^.availWidthL - 2 -- XXX trimmed.. for the margin ?
totalwidth = c^.availWidthL
- 2 -- XXX due to margin ? shouldn't be necessary (cf UIUtils)
-- the date column is fixed width
datewidth = 10

View File

@ -5,7 +5,7 @@ module Hledger.UI.UIUtils (
,popScreen
,screenEnter
,getViewportSize
,margin
-- ,margin
,withBorderAttr
,topBottomBorderWithLabel
,defaultLayout
@ -61,7 +61,9 @@ getViewportSize name = do
defaultLayout label =
topBottomBorderWithLabel label .
margin 1 0 Nothing
-- margin 1 0 (Just white)
-- topBottomBorderWithLabel2 label .
-- padLeftRight 1 -- XXX should reduce inner widget's width by 2, but doesn't
-- "the layout adjusts... if you use the core combinators"
topBottomBorderWithLabel label = \wrapped ->
Widget Greedy Greedy $ do
@ -79,9 +81,21 @@ topBottomBorderWithLabel label = \wrapped ->
<=>
hBorder
-- XXX should be equivalent to the above, but isn't (page down goes offscreen)
_topBottomBorderWithLabel2 label = \wrapped ->
let debugmsg = ""
in hBorderWithLabel (label <+> str debugmsg)
<=>
wrapped
<=>
hBorder
-- XXX superseded by pad, in theory
-- | Wrap a widget in a margin with the given horizontal and vertical
-- thickness, using the current background colour or the specified
-- colour. XXX May disrupt border style of inner widgets.
-- colour.
-- XXX May disrupt border style of inner widgets.
-- XXX Should reduce the available size visible to inner widget, but doesn't seem to (cf drawRegisterScreen2).
margin :: Int -> Int -> Maybe Color -> Widget -> Widget
margin h v mcolour = \w ->
Widget Greedy Greedy $ do