ui: reg: increase post-date and inter-amt space

This commit is contained in:
Simon Michael 2015-08-24 15:02:13 -07:00
parent efb3a154da
commit b6e98499ef

View File

@ -107,17 +107,18 @@ drawRegisterScreen2 AppState{aopts=_opts, aScreen=RegisterScreen2{rs2State=l}} =
-- they need, while reserving a minimum of space for other -- they need, while reserving a minimum of space for other
-- columns and whitespace. If they don't get all they need, -- columns and whitespace. If they don't get all they need,
-- allocate it to them proportionally to their maximum widths. -- allocate it to them proportionally to their maximum widths.
maxamtswidth = max 0 (totalwidth - 21) whitespacewidth = 23
changewidth' = maximum' $ map (length . fourth5) displayitems maxamtswidth = max 0 (totalwidth - whitespacewidth)
balwidth' = maximum' $ map (length . fifth5) displayitems maxchangewidthseen = maximum' $ map (length . fourth5) displayitems
changewidthproportion = fromIntegral (changewidth' + balwidth') / fromIntegral changewidth' maxbalwidthseen = maximum' $ map (length . fifth5) displayitems
changewidthproportion = fromIntegral (maxchangewidthseen + maxbalwidthseen) / fromIntegral maxchangewidthseen
maxchangewidth = round $ fromIntegral maxamtswidth / changewidthproportion maxchangewidth = round $ fromIntegral maxamtswidth / changewidthproportion
maxbalwidth = maxamtswidth - maxchangewidth maxbalwidth = maxamtswidth - maxchangewidth
changewidth = min maxchangewidth changewidth' changewidth = min maxchangewidth maxchangewidthseen
balwidth = min maxbalwidth balwidth' balwidth = min maxbalwidth maxbalwidthseen
-- assign the remaining space to the description and accounts columns -- assign the remaining space to the description and accounts columns
maxdescacctswidth = totalwidth - 17 - changewidth - balwidth maxdescacctswidth = totalwidth - (whitespacewidth - 4) - changewidth - balwidth
-- allocating proportionally. -- allocating proportionally.
-- descwidth' = maximum' $ map (length . second5) displayitems -- descwidth' = maximum' $ map (length . second5) displayitems
-- acctswidth' = maximum' $ map (length . third5) displayitems -- acctswidth' = maximum' $ map (length . third5) displayitems
@ -141,13 +142,13 @@ drawRegisterItem (datewidth,descwidth,acctswidth,changewidth,balwidth) _sel (dat
Widget Greedy Fixed $ do Widget Greedy Fixed $ do
render $ render $
str (padright datewidth $ elideRight datewidth date) <+> str (padright datewidth $ elideRight datewidth date) <+>
str " " <+> str " " <+>
str (padright descwidth $ elideRight descwidth desc) <+> str (padright descwidth $ elideRight descwidth desc) <+>
str " " <+> str " " <+>
str (padright acctswidth $ elideLeft acctswidth $ accts) <+> str (padright acctswidth $ elideLeft acctswidth $ accts) <+>
str " " <+> str " " <+>
str (padleft changewidth $ elideLeft changewidth change) <+> str (padleft changewidth $ elideLeft changewidth change) <+>
str " " <+> str " " <+>
str (padleft balwidth $ elideLeft balwidth bal) str (padleft balwidth $ elideLeft balwidth bal)
handleRegisterScreen2 :: AppState -> Vty.Event -> EventM (Next AppState) handleRegisterScreen2 :: AppState -> Vty.Event -> EventM (Next AppState)