diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-25 21:48:12 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-25 21:48:12 -0700 |
commit | 4e2f8eb3db3d16b9ad66db63fcc1503b6181cadd (patch) | |
tree | 4e01ef825d2b4546024cb71c8b6ae631d552bf13 | |
parent | b0e243bb860e86aef02d10515c0548f8e3817ffb (diff) | |
download | sscan-4e2f8eb3db3d16b9ad66db63fcc1503b6181cadd.tar.gz |
don't permit changing settings during a session
-rw-r--r-- | Main.hs | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -78,14 +78,23 @@ handleSPC st = undefined handleHotKey :: St -> Char -> EventM () (Next St) handleHotKey st 'q' = handleQ st handleHotKey st ' ' = handleSPC st -handleHotKey st 'o' = continue $ st & stOCR .~ (not $ st^.stOCR) +handleHotKey st 'o' = continue $ + if isJust $ st^.stScanningSession + then st + else st & stOCR .~ (not $ st^.stOCR) handleHotKey st 'c' = continue $ - st & stColour .~ (cycleColour $ st^.stColour) + if isJust $ st^.stScanningSession + then st + else st & stColour .~ (cycleColour $ st^.stColour) handleHotKey st 'p' = continue $ - st & stPaper .~ (cyclePaper $ st^.stPaper) -handleHotKey st c = case lookupPreset c of - Just (Preset _ _ f) -> continue $ f st - _ -> continue st + if isJust $ st^.stScanningSession + then st + else st & stPaper .~ (cyclePaper $ st^.stPaper) +handleHotKey st c = continue $ if isJust $ st^.stScanningSession + then st + else case lookupPreset c of + Just (Preset _ _ f) -> f st + _ -> st appEvent :: St -> BrickEvent () e -> EventM () (Next St) appEvent st (VtyEvent e) = |