From 00a8d88b26818c1dd3a8a5fa7e73fcabecf27f62 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 5 Apr 2014 01:53:44 -0400 Subject: change default to 2 keyboards; minor reorg --- axis.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'axis.hs') diff --git a/axis.hs b/axis.hs index f4a2032..e51b6cb 100644 --- a/axis.hs +++ b/axis.hs @@ -42,7 +42,7 @@ _LABEL_ALL_KEYS = False _AXIS_ROWS = 7 + 4 _AXIS_UNIQUE_COLS = 7 -_AXIS_COLS_REPEAT = 1 +_AXIS_COLS_REPEAT = 2 _AXIS_TOPLEFT_PITCH = 81 + (7 * (_AXIS_ROWS - 7) `div` 2) _AXIS_BOTTOMLEFT_PITCH = _AXIS_TOPLEFT_PITCH - (_AXIS_ROWS * 7) _AXIS_TOPRIGHT_PITCH = _AXIS_TOPLEFT_PITCH + _AXIS_UNIQUE_COLS `div` 2 @@ -117,7 +117,7 @@ pitchToColor p = x | inMajorC x -> (SDL.Color 0xE0 0xE0 0xE0) -- _CGA !! 7 _ -> _CGA !! 8 ---smartDrawKeys :: (Integral a, Integral a2, Integral a1) => Bool -> Set.Set (Event.Channel, Event.Pitch) -> Set.Set (Event.Channel, Event.Pitch) -> SDL.Surface -> SDL.TTF.Font -> [(a1, a2)] -> a -> IO () +smartDrawKeys :: (Enum a, Integral a1, Integral a3, Integral a2, Num a) => a -> Bool -> Set.Set (Event.Channel, Event.Pitch) -> Set.Set (Event.Channel, Event.Pitch) -> SDL.Surface -> SDL.TTF.Font -> [(a2, a3)] -> a1 -> IO () smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis_key_locations axis_key_size = do let chanfilter = Set.filter (\ (c, _) -> c /= (Event.Channel 9)) @@ -131,8 +131,10 @@ smartDrawKeys colsRepeat reallyErase beforeKeys_ nowKeys_ videoSurface font axis forM_ actions $ \ (n, chans) -> do let text = smartShowPitch (unPitch n) pitch = unPitch n - forM_ (elemIndices pitch $ pitchIndex colsRepeat) $ \idx -> do - let showLabel = (not reallyErase) && (_LABEL_ALL_KEYS || (_LABEL_WHILE_PLAYING && (length chans /= 0))) + indices = elemIndices pitch $ pitchIndex colsRepeat + off = length chans == 0 + forM_ indices $ \idx -> do + let showLabel = (not reallyErase) && (_LABEL_ALL_KEYS || (_LABEL_WHILE_PLAYING && (not off))) drawKey idx videoSurface font axis_key_locations axis_key_size (if reallyErase then _KB_BG_COLOR else pitchToColor pitch) (if showLabel then (Just text) else Nothing) -- cgit v1.2.3