From 2c5796cb19e607b2dfcadcdc3b177ade6c5a17f7 Mon Sep 17 00:00:00 2001 From: Robbie Gleichman Date: Thu, 11 Jun 2020 00:17:50 -0700 Subject: [PATCH] Add GUI skeleton based on gi-gtk-declarative. --- README.md | 2 +- glance.cabal | 20 +++++++++++++++++++- gui/Main.hs | 4 ++++ notes.txt | 5 +++++ stack.yaml | 2 ++ todo.md | 3 +++ 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gui/Main.hs diff --git a/README.md b/README.md index 923ed1e..b63d313 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ sudo apt install graphviz Then build and execute glance: ``` -stack build +stack build :glance-exe stack exec glance-exe -- examples/fact.hs images/fact.svg 500 ``` To see the command line options run diff --git a/glance.cabal b/glance.cabal index 77254c4..231151b 100644 --- a/glance.cabal +++ b/glance.cabal @@ -7,7 +7,7 @@ license: Apache-2.0 license-file: LICENSE author: Robbie Gleichman maintainer: rgleichman@gmail.com -copyright: 2018 Robbie Gleichman +copyright: 2020 Robbie Gleichman category: Visual Programming build-type: Simple -- extra-source-files: @@ -57,6 +57,24 @@ executable glance-exe , SimplifySyntax , Constants +executable glance-gui + hs-source-dirs: gui + main-is: Main.hs + ghc-options: -threaded -rtsopts -with-rtsopts=-N + -Wall + -Wincomplete-record-updates + -Wmissing-export-lists + -Widentities + -Wpartial-fields + build-depends: base + , gi-gtk + , gi-gtk-declarative + , gi-gtk-declarative-app-simple + , text + , pipes + , pipes-extras + default-language: Haskell2010 + test-suite glance-test type: exitcode-stdio-1.0 hs-source-dirs: test, app diff --git a/gui/Main.hs b/gui/Main.hs new file mode 100644 index 0000000..2aac1e1 --- /dev/null +++ b/gui/Main.hs @@ -0,0 +1,4 @@ +module Main (main) where + +main :: IO () +main = putStrLn "Glance GUI!" diff --git a/notes.txt b/notes.txt index ba4299e..a7be5cf 100644 --- a/notes.txt +++ b/notes.txt @@ -24,3 +24,8 @@ stack haddock --open To build and run in a loop watch -n2 stack build --exec \"glance-exe examples/fact.hs examples/fact.svg 500\" + + +GUI: +To build the GUI, first install the system dependencies (follow the directions +here: https://github.com/haskell-gi/haskell-gi#installation) diff --git a/stack.yaml b/stack.yaml index 5c29e1b..181290b 100644 --- a/stack.yaml +++ b/stack.yaml @@ -10,6 +10,8 @@ packages: # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) extra-deps: [ "diagrams-graphviz-1.4.1.1" +, "gi-gtk-declarative-0.6.3" +, "gi-gtk-declarative-app-simple-0.6.3" ] # Override default flag values for local packages and extra-deps diff --git a/todo.md b/todo.md index 5f7ecb7..27c667e 100644 --- a/todo.md +++ b/todo.md @@ -1,6 +1,9 @@ # Todo ## Todo Now +* Make a GUI. One approach is to render individual icons with diagrams using the +Cairo or GTK backend. The rendering would be in a separate process so that +interacting and dragging nodes is not slowed down by rendering. * Redesign case icon to avoid non-locality. * Move @ pattern circles so that they are on the same side as the variables. * Add command line flags for color style, embedding, and whether to draw arrowheads.