Skip to content

Commit

Permalink
renamed MenuTypes (forgot in the previous commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqu4le committed Apr 27, 2018
1 parent 036c32f commit fe2fe53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Widgets/Manager.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ handlePrompt ev pr state = do
handleMain :: BrickEvent Name (ThreadEvent Tab.Tab) -> State -> EventM Name (Next State)
handleMain (VtyEvent ev) = case ev of
EvKey KEsc [] -> halt
EvKey KBS [] -> updateMenu Menu.MainMenu
EvKey (KChar 'l') [] -> updateMenu Menu.SelectionMenu
EvKey (KChar 'a') [] -> updateMenu Menu.TabMenu
EvKey (KChar 'p') [] -> updateMenu Menu.PaneMenu
EvKey KBS [] -> updateMenu Menu.Main
EvKey (KChar 'l') [] -> updateMenu Menu.Selection
EvKey (KChar 'a') [] -> updateMenu Menu.Tab
EvKey (KChar 'p') [] -> updateMenu Menu.Pane
EvKey (KChar 'q') [] -> halt
EvKey (KChar 'x') [MCtrl] -> updateClipboard Menu.makeCutBoard
EvKey (KChar 'c') [MCtrl] -> updateClipboard Menu.makeCopyBoard
Expand Down
12 changes: 6 additions & 6 deletions src/Widgets/Menu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Brick.Widgets.Border (borderWithLabel, border)
import Graphics.Vty (Event(EvKey), Key(..), Modifier(MCtrl))

data Menu = Menu {clipboard :: Clipboard, menuType :: MenuType}
data MenuType = MainMenu | SelectionMenu | TabMenu | PaneMenu
data MenuType = Main | Selection | Tab | Pane
data Clipboard = CopyBoard {fromEntry :: Entry.Entry} | CutBoard {fromEntry :: Entry.Entry} | EmptyBoard

instance Show Clipboard where
Expand All @@ -21,7 +21,7 @@ instance Show Clipboard where

-- creation functions
make :: Menu
make = Menu {clipboard = EmptyBoard, menuType = MainMenu}
make = Menu {clipboard = EmptyBoard, menuType = Main}

makeCopyBoard :: Entry.Entry -> Clipboard
makeCopyBoard = CopyBoard
Expand All @@ -35,10 +35,10 @@ render m = hBox . (renderClipboard (clipboard m) :) . renderButtons (menuType m)

renderButtons :: MenuType -> Pane.Pane -> [Widget Name]
renderButtons tp pane = map renderButton $ case tp of
MainMenu -> mainButtons
SelectionMenu -> (backButton :) . selectionButtons $ Pane.selectedEntry pane
TabMenu -> (backButton :) . tabButtons $ Pane.currentTab pane
PaneMenu -> backButton : paneButtons
Main -> mainButtons
Selection -> (backButton :) . selectionButtons $ Pane.selectedEntry pane
Tab -> (backButton :) . tabButtons $ Pane.currentTab pane
Pane -> backButton : paneButtons

renderButton :: (Widget Name, Maybe String, Name) -> Widget Name
renderButton (bContent, bLabel, bName) = clickable bName $ case bLabel of
Expand Down

0 comments on commit fe2fe53

Please sign in to comment.