aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-25 21:48:12 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-25 21:48:12 -0700
commit4e2f8eb3db3d16b9ad66db63fcc1503b6181cadd (patch)
tree4e01ef825d2b4546024cb71c8b6ae631d552bf13
parentb0e243bb860e86aef02d10515c0548f8e3817ffb (diff)
downloadsscan-4e2f8eb3db3d16b9ad66db63fcc1503b6181cadd.tar.gz
don't permit changing settings during a session
-rw-r--r--Main.hs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Main.hs b/Main.hs
index b166ba2..1dc04e2 100644
--- a/Main.hs
+++ b/Main.hs
@@ -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) =