summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-11-01 17:17:25 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2010-11-01 17:17:25 +0000
commita5e66e1179416ca31e4a4b47078c17dd32d65021 (patch)
treeb9cdb1776c2b31ceddecaf651e29f33ea3396a0e
parenta1019d10e5dde1368438874492d88faf59436d20 (diff)
De-magic number the initial columns
-rw-r--r--Bustle/Diagram.hs26
-rw-r--r--Bustle/Renderer.hs7
2 files changed, 24 insertions, 9 deletions
diff --git a/Bustle/Diagram.hs b/Bustle/Diagram.hs
index bec29d2..eb0eadc 100644
--- a/Bustle/Diagram.hs
+++ b/Bustle/Diagram.hs
@@ -18,22 +18,31 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-}
{-# LANGUAGE CPP #-}
module Bustle.Diagram
- ( Shape(..)
+ ( Diagram
+
+ -- Shapes, and smart constructors therefore
+ , Shape(..)
, memberLabel
, timestampLabel
- , Diagram
+ , headers
+ , headerHeight
+
+ -- Attributes of shapes
, Arrowhead(..)
, Side(..)
, Colour(..)
, Rect
+
+ -- Annoying constants that users of this module need.
+ , columnWidth
+ , timestampAndMemberWidth
+ , firstColumnOffset
+
+ -- Displaying diagrams
, diagramDimensions
, topLeftJustifyDiagram
, drawDiagram
, drawRegion
- , headers
- , headerHeight
- , columnWidth
- , timestampAndMemberWidth
)
where
@@ -168,6 +177,11 @@ timestampAndMemberWidth = timestampWidth + memberWidth
columnWidth :: Double
columnWidth = 90
+-- Method return arcs can go outside the first column. Empirically, 20 is
+-- enough to stop the arc (or the duration text) overlapping the object path
+-- etc.
+firstColumnOffset :: Double
+firstColumnOffset = 20 + columnWidth / 2
--
-- Calculating bounds of shapes
diff --git a/Bustle/Renderer.hs b/Bustle/Renderer.hs
index 527d928..9d13d85 100644
--- a/Bustle/Renderer.hs
+++ b/Bustle/Renderer.hs
@@ -129,10 +129,11 @@ initialBusState first =
, pending = Map.empty
}
--- FIXME: magic numbers :'(
initialSessionBusState, initialSystemBusState :: BusState
-initialSessionBusState = initialBusState 470
-initialSystemBusState = initialBusState (-70) -- FIXME
+initialSessionBusState =
+ initialBusState $ timestampAndMemberWidth + firstColumnOffset
+initialSystemBusState =
+ initialBusState $ negate firstColumnOffset
initialState :: Milliseconds -> RendererState
initialState t = RendererState