change colour representation
Mon Aug 22 16:55:46 WEST 2005 Malcolm.Wallace@cs.york.ac.uk
* change colour representation
Introduce a local algebraic type "Colour" for colours, and convert to the
WX type "Color" when necessary. This is purely so we can Read and Show them.
{
hunk ./src/Colors.hs 5
+-- Different spelling of colour/color to distinguish local/wx datatypes.
+data Colour = RGB !Int !Int !Int deriving (Eq,Show,Read)
+
+-- translate local to wx
+wxcolor :: Colour -> Color
+wxcolor (RGB r g b) = rgb r g b
+
hunk ./src/Colors.hs 14
- inactiveSelectionColor :: Color
+ inactiveSelectionColor :: Colour
hunk ./src/Colors.hs 17
-evidenceHatchColor = black
+evidenceHatchColor = licorice
hunk ./src/Colors.hs 19
-paneBackgroundColor = white
-activeSelectionColor = black
+paneBackgroundColor = coconut
+activeSelectionColor = licorice
hunk ./src/Colors.hs 24
-testSelectionTestColor, testSelectionTargetColor :: Color
-testSelectionTestColor = rgb 0 255 0
-testSelectionTargetColor = rgb 255 0 0
+testSelectionTestColor, testSelectionTargetColor :: Colour
+testSelectionTestColor = RGB 0 255 0
+testSelectionTargetColor = RGB 255 0 0
hunk ./src/Colors.hs 28
-lightYellow, lightBlue, lightRed, lightGrey, systemGrey, pink :: Color
-lightYellow = rgb 236 236 169
-lightBlue = rgb 200 255 255
-lightGrey = rgb 150 150 150
-lightRed = rgb 255 200 200
+lightYellow, lightBlue, lightRed, lightGrey, pink :: Colour
+lightYellow = RGB 236 236 169
+lightBlue = RGB 200 255 255
+lightGrey = RGB 150 150 150
+lightRed = RGB 255 200 200
+pink = RGB 255 200 200
+
+systemGrey :: Color -- wx type
hunk ./src/Colors.hs 37
-pink = rgb 255 200 200
hunk ./src/Colors.hs 38
+licorice, coconut :: Colour -- names black and white already taken by wx
+licorice = RGB 0 0 0
+coconut = RGB 255 255 255
hunk ./src/Colors.hs 45
- olive, sienna, brown, fuchsia, turquoise, orangeRed, gold,darkSlateGray :: Color
-darkGreen = rgb 0 100 0
-darkBlue = rgb 0 0 139
-violet = rgb 238 130 238
-indigo = rgb 75 0 130
-darkRed = rgb 139 0 0
-darkMagenta = rgb 139 0 139
-darkOrange = rgb 255 140 0
-orange = rgb 255 165 0
-lightPink = rgb 255 182 193
-purple = rgb 128 0 128
-lightGreen = rgb 144 238 144
-mediumPurple = rgb 147 112 219
-darkViolet = rgb 148 0 211
+ olive, sienna, brown, fuchsia, turquoise, orangeRed, gold,darkSlateGray :: Colour
+darkGreen = RGB 0 100 0
+darkBlue = RGB 0 0 139
+violet = RGB 238 130 238
+indigo = RGB 75 0 130
+darkRed = RGB 139 0 0
+darkMagenta = RGB 139 0 139
+darkOrange = RGB 255 140 0
+orange = RGB 255 165 0
+lightPink = RGB 255 182 193
+purple = RGB 128 0 128
+lightGreen = RGB 144 238 144
+mediumPurple = RGB 147 112 219
+darkViolet = RGB 148 0 211
hunk ./src/Colors.hs 60
-gray = rgb 128 128 128
-darkGrey = rgb 169 169 169 -- ligher than grey?
-darkGray = rgb 169 169 169
-lightGray = rgb 211 211 211
-silver = rgb 192 192 192
-whiteSmoke = rgb 245 245 245
+gray = RGB 128 128 128
+darkGrey = RGB 169 169 169 -- lighter than grey?
+darkGray = RGB 169 169 169
+lightGray = RGB 211 211 211
+silver = RGB 192 192 192
+whiteSmoke = RGB 245 245 245
hunk ./src/Colors.hs 67
-aqua = rgb 0 255 255
-teal = rgb 0 128 128
-maroon = rgb 128 0 0
-olive = rgb 128 128 0
-sienna = rgb 160 82 45
-brown = rgb 165 42 42
-fuchsia = rgb 255 0 255
-turquoise = rgb 64 224 208
-orangeRed = rgb 255 69 0
-gold = rgb 255 215 0
-darkSlateGray = rgb 47 79 79
+aqua = RGB 0 255 255
+teal = RGB 0 128 128
+maroon = RGB 128 0 0
+olive = RGB 128 128 0
+sienna = RGB 160 82 45
+brown = RGB 165 42 42
+fuchsia = RGB 255 0 255
+turquoise = RGB 64 224 208
+orangeRed = RGB 255 69 0
+gold = RGB 255 215 0
+darkSlateGray = RGB 47 79 79
hunk ./src/NetworkUI.hs 64
- , bgcolor := paneBackgroundColor
+ , bgcolor := wxcolor paneBackgroundColor
hunk ./src/NetworkView.hs 19
-import Graphics.UI.WXCore hiding (Document, screenPPI)
+import Graphics.UI.WXCore hiding (Document, screenPPI, Colour)
hunk ./src/NetworkView.hs 64
- drawNode nodeNr ( kSELECTED_OPTIONS ++ [ penColor := activeSelectionColor ])
+ drawNode nodeNr ( kSELECTED_OPTIONS ++ [ penColor := wxcolor activeSelectionColor ])
hunk ./src/NetworkView.hs 110
- ; logicalPoly ppi dc [pt2, tr1, tr2] (options ++ solidFill black)
+ ; logicalPoly ppi dc [pt2, tr1, tr2] (options ++ solidFill licorice)
hunk ./src/NetworkView.hs 141
-solidFill :: Color -> [Prop (DC ())]
-solidFill colour = [ brushKind := BrushSolid, brushColor := colour ]
+solidFill :: Colour -> [Prop (DC ())]
+solidFill colour = [ brushKind := BrushSolid, brushColor := wxcolor colour ]
hunk ./src/Shape.hs 5
-import Graphics.UI.WXCore -- hiding (Document, screenPPI)
+import Graphics.UI.WXCore hiding (Colour)
hunk ./src/Shape.hs 9
+import Colors
hunk ./src/Shape.hs 23
- { styleStrokeWidth :: Double
- , styleStrokeColour :: Color
- , styleFill :: Color
+ { styleStrokeWidth :: Int
+ , styleStrokeColour :: Colour
+ , styleFill :: Colour
}