11{-# LANGUAGE RecordWildCards #-}
22{-# LANGUAGE RecursiveDo #-}
3+ {-# OPTIONS_GHC -fno-warn-orphans #-}
34
45module Potato.Flow.Vty.Params (
56 ParamsWidgetConfig (.. )
@@ -15,17 +16,12 @@ module Potato.Flow.Vty.Params (
1516import Relude
1617
1718import Potato.Flow
18- import Potato.Flow.OwlHelpers
1919import Potato.Flow.Vty.Common
2020import Potato.Reflex.Vty.Helpers
2121import Potato.Flow.Vty.PotatoReader
22- import Potato.Flow.Vty.Attrs
2322import Potato.Reflex.Vty.Widget.TextInputHelpers
2423
25- import Control.Monad.Fix
26- import Control.Monad.NodeId
2724import Data.Align
28- import Data.Char (isNumber )
2925import Data.Dependent.Sum (DSum ((:=>) ))
3026import qualified Data.IntMap as IM
3127import qualified Data.List.Extra as L
@@ -35,7 +31,6 @@ import qualified Data.Text as T
3531import qualified Data.Text.Zipper as TZ
3632import Data.These
3733import Data.Tuple.Extra
38- import qualified Data.List as List
3934
4035import qualified Graphics.Vty as V
4136import Reflex
@@ -105,7 +100,7 @@ selectParamsFromSelection ps (SuperOwlParliament selection) = r where
105100 subSelection = SuperOwlParliament $ Seq. fromList $ fmap fst params
106101 r = case values of
107102 [] -> Nothing
108- x: xs -> if L. allSame values
103+ x: _ -> if L. allSame values
109104 then Just (subSelection, Just x)
110105 else Just (subSelection, Nothing )
111106
@@ -121,9 +116,9 @@ makeLineStyleInputDyn :: Tool -> Selection -> PotatoDefaultParameters -> Maybe (
121116makeLineStyleInputDyn tool selection pdp = r where
122117
123118 selectLineStyleFromSelection :: Selection -> Maybe (Selection , Maybe (Maybe LineStyle , Maybe LineStyle ))
124- selectLineStyleFromSelection (SuperOwlParliament selection ) = r_d1 where
119+ selectLineStyleFromSelection (SuperOwlParliament sel ) = r_d1 where
125120 ps = (\ x -> (getSEltLineStyle x, getSEltLineStyleEnd x)) . superOwl_toSElt_hack
126- rawparams = ffilter (\ (_,(x,y)) -> isJust x || isJust y) . fmap (\ sowl -> (sowl, ps sowl)) $ selection
121+ rawparams = ffilter (\ (_,(x,y)) -> isJust x || isJust y) . fmap (\ sowl -> (sowl, ps sowl)) $ sel
127122 startvalues = catMaybes . toList . fmap fst . fmap snd $ rawparams
128123 endvalues = catMaybes . toList . fmap snd . fmap snd $ rawparams
129124 subSelection = SuperOwlParliament $ fmap fst rawparams
@@ -290,13 +285,13 @@ holdSuperStyleWidget pdpDyn inputDyn = constDyn $ mdo
290285 setStyleEv' = makeSuperStyleEvent tl v bl h f tr br (void $ updated focusDynUnique)
291286 captureEv' = leftmost [void setStyleEv', captureEv1]
292287 return (5 , captureEv', setStyleEv')
288+ _ -> error " radioList returned invalid index"
293289
294290 setStyleEv <- switchHold never (fmap thd3 setStyleEvEv)
295291 captureEv <- switchHold never (fmap snd3 setStyleEvEv)
296292 heightDyn <- holdDyn 0 (fmap fst3 setStyleEvEv)
297293
298294 let
299- selectionDyn = fmap fst3 inputDyn
300295 pushSuperStyleFn :: SuperStyle -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters ))
301296 pushSuperStyleFn ss = do
302297 (SuperOwlParliament selection, _, tool) <- sample . current $ inputDyn
@@ -411,6 +406,7 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
411406 0 -> if start == end then start else Nothing
412407 1 -> start
413408 2 -> end
409+ _ -> error " radioList returned invalid index"
414410
415411 (focusDyn,wasChangeDyn,l,r,u,d) <- do
416412 -- (tile . fixed) 1 $ text (fmap (T.pack . superStyle_toListFormat . Data.Maybe.fromJust) $ current mssDyn)
@@ -439,13 +435,13 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
439435 setStyleEv' = makeLineStyleEvent (current l) (current r) (current u) (current d) (void $ gate (current wasChangeDyn) (updated focusDynUnique))
440436 captureEv' = leftmost [void setStyleEv', captureEv'']
441437 return (7 , captureEv', setStyleEv')
438+ _ -> error " radioList returned invalid index"
442439
443440 setStyleEv <- switchHold never (fmap thd3 setStyleEvEv)
444441 captureEv <- switchHold never (fmap snd3 setStyleEvEv)
445442 heightDyn <- holdDyn 0 (fmap fst3 setStyleEvEv)
446443
447444 let
448- selectionDyn = fmap fst3 inputDyn
449445 pushLineStyleFn :: Either () LineStyle -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters ))
450446 pushLineStyleFn eflipss = do
451447 pdp <- sample . current $ pdpDyn
@@ -456,6 +452,7 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
456452 0 -> SetLineStyleEnd_Both
457453 1 -> SetLineStyleEnd_Start
458454 2 -> SetLineStyleEnd_End
455+ _ -> error " radioList returned invalid index"
459456 (setstart, setend) = case whichEnd of
460457 SetLineStyleEnd_Start -> (True , False )
461458 SetLineStyleEnd_End -> (False , True )
@@ -501,7 +498,6 @@ holdTextAlignmentWidget :: forall t m. (MonadLayoutWidget t m, HasPotato t m) =>
501498holdTextAlignmentWidget _ inputDyn = constDyn $ do
502499 let
503500 mtaDyn = fmap snd3 inputDyn
504- selectionDyn = fmap fst3 inputDyn
505501
506502 let
507503
@@ -521,6 +517,7 @@ holdTextAlignmentWidget _ inputDyn = constDyn $ do
521517 0 -> TextAlign_Left
522518 1 -> TextAlign_Center
523519 2 -> TextAlign_Right
520+ _ -> error " radioList returned invalid index"
524521 ) $ setAlignmentEv'
525522 pushAlignmentFn :: TextAlign -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters ))
526523 pushAlignmentFn ta = do
@@ -544,8 +541,6 @@ holdSBoxTypeWidget :: forall t m. (MonadLayoutWidget t m) => ParamsWidgetFn t m
544541holdSBoxTypeWidget _ inputDyn = constDyn $ do
545542 let
546543 mBoxType = fmap snd3 inputDyn
547- selectionDyn = fmap fst3 inputDyn
548- mbt0 <- sample . current $ mBoxType
549544
550545 let
551546 stateDyn = ffor mBoxType $ \ case
@@ -584,14 +579,14 @@ holdSBoxTypeWidget _ inputDyn = constDyn $ do
584579 where
585580 newbt = case bt of
586581 This border -> make_sBoxType border (sBoxType_isText oldbt)
587- That text -> make_sBoxType (sBoxType_hasBorder oldbt) text
588- These border text -> make_sBoxType border text
582+ That txt -> make_sBoxType (sBoxType_hasBorder oldbt) txt
583+ These border txt -> make_sBoxType border txt
589584 return $ if toolOverrideSBoxType tool
590585 -- UNTESTED, it's probably currect but the tool overrides this default so I never actually tested it
591586 then Just . Right $ def { _setPotatoDefaultParameters_sBoxType = Just $ case bt of
592587 This border -> make_sBoxType border (snd curState)
593- That text -> make_sBoxType (fst curState) text
594- These border text -> make_sBoxType border text
588+ That txt -> make_sBoxType (fst curState) txt
589+ These border txt -> make_sBoxType border txt
595590 }
596591 else case Data.Maybe. mapMaybe fmapfn . toList $ selection of
597592 [] -> Nothing
@@ -636,10 +631,6 @@ holdCanvasSizeWidget canvasDyn _ _ = constDyn $ do
636631 captureEv = leftmost [void outputEv, captureEv1]
637632 return (3 , captureEv, outputEv)
638633
639- data SEltParams = SEltParams {
640- -- _sEltParams_sBox =
641- }
642-
643634data ParamsWidgetConfig t = ParamsWidgetConfig {
644635 _paramsWidgetConfig_selectionDyn :: Dynamic t Selection
645636 , _paramsWidgetConfig_canvasDyn :: Dynamic t SCanvas
0 commit comments