mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-06 07:13:37 +00:00
110 lines
2.2 KiB
Plaintext
110 lines
2.2 KiB
Plaintext
|
module MetaBrush.Action where
|
||
|
|
||
|
-- base
|
||
|
import Data.Word
|
||
|
( Word32 )
|
||
|
|
||
|
-- gi-gtk
|
||
|
import qualified GI.Gtk as GTK
|
||
|
|
||
|
-- MetaBrush
|
||
|
import Math.Vector2D
|
||
|
( Point2D, Vector2D )
|
||
|
import {-# SOURCE #-} MetaBrush.Context
|
||
|
( UIElements, Variables )
|
||
|
import {-# SOURCE #-} MetaBrush.UI.FileBar
|
||
|
( TabLocation(..) )
|
||
|
import MetaBrush.UI.Viewport
|
||
|
( Ruler(..) )
|
||
|
import MetaBrush.Unique
|
||
|
( Unique )
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
class HandleAction action where
|
||
|
handleAction :: UIElements -> Variables -> action -> IO ()
|
||
|
|
||
|
instance HandleAction ()
|
||
|
|
||
|
data NewFile = NewFile TabLocation
|
||
|
instance HandleAction NewFile
|
||
|
|
||
|
data OpenFile = OpenFile TabLocation
|
||
|
instance HandleAction OpenFile
|
||
|
|
||
|
data OpenFolder = OpenFolder TabLocation
|
||
|
instance HandleAction OpenFolder
|
||
|
|
||
|
data Save = Save
|
||
|
instance HandleAction Save
|
||
|
|
||
|
data SaveAs = SaveAs
|
||
|
instance HandleAction SaveAs
|
||
|
|
||
|
data Close
|
||
|
= CloseActive
|
||
|
| CloseThis
|
||
|
{ docToClose :: Unique }
|
||
|
instance HandleAction Close
|
||
|
|
||
|
data SwitchTo = SwitchTo Unique
|
||
|
instance HandleAction SwitchTo
|
||
|
|
||
|
data Quit = Quit
|
||
|
instance HandleAction Quit
|
||
|
quitEverything :: GTK.Window -> IO ()
|
||
|
|
||
|
data Undo = Undo
|
||
|
instance HandleAction Undo
|
||
|
|
||
|
data Redo = Redo
|
||
|
instance HandleAction Redo
|
||
|
|
||
|
data Cut = Cut
|
||
|
instance HandleAction Cut
|
||
|
|
||
|
data Copy = Copy
|
||
|
instance HandleAction Copy
|
||
|
|
||
|
data Paste = Paste
|
||
|
instance HandleAction Paste
|
||
|
|
||
|
data Duplicate = Duplicate
|
||
|
instance HandleAction Duplicate
|
||
|
|
||
|
data Delete = Delete
|
||
|
instance HandleAction Delete
|
||
|
|
||
|
data ToggleGuides = ToggleGuides
|
||
|
instance HandleAction ToggleGuides
|
||
|
|
||
|
data Confirm = Confirm
|
||
|
instance HandleAction Confirm
|
||
|
|
||
|
data About = About
|
||
|
instance HandleAction About
|
||
|
|
||
|
data MouseMove = MouseMove ( Point2D Double )
|
||
|
instance HandleAction MouseMove
|
||
|
|
||
|
data ActionOrigin
|
||
|
= ViewportOrigin
|
||
|
| RulerOrigin Ruler
|
||
|
data MouseClickType
|
||
|
= SingleClick
|
||
|
| DoubleClick
|
||
|
data MouseClick = MouseClick ActionOrigin MouseClickType Word32 ( Point2D Double )
|
||
|
instance HandleAction MouseClick
|
||
|
|
||
|
data MouseRelease = MouseRelease Word32 ( Point2D Double )
|
||
|
instance HandleAction MouseRelease
|
||
|
|
||
|
data Scroll = Scroll ( Point2D Double ) ( Vector2D Double )
|
||
|
instance HandleAction Scroll
|
||
|
|
||
|
data KeyboardPress = KeyboardPress Word32
|
||
|
instance HandleAction KeyboardPress
|
||
|
|
||
|
data KeyboardRelease = KeyboardRelease Word32
|
||
|
instance HandleAction KeyboardRelease
|