diff --git a/gui/Main.hs b/gui/Main.hs index d9dab8b..b959285 100644 --- a/gui/Main.hs +++ b/gui/Main.hs @@ -405,7 +405,7 @@ clickOnNode :: (Double, Double) -> -- Click position where (0,0) is top left of element AppState -> AppState -clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory, _asElements} = +clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory, _asElements, _asCurrentEdge, _asEdges} = let portClicked = case IntMap.lookup (_unElemId elemId) _asElements of Nothing -> Nothing Just element -> @@ -413,7 +413,13 @@ clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory in case _asMovingNode of Nothing -> case portClicked of Nothing -> oldState {_asMovingNode = Just elemId} - _ -> oldState + Just _port -> case _asCurrentEdge of + Nothing -> oldState {_asCurrentEdge = Just elemId} + Just edgeElemId -> + oldState + { _asEdges = (edgeElemId, elemId) : _asEdges, + _asCurrentEdge = Nothing + } Just _ -> addHistoryEvent MovedNode $ oldState {_asMovingNode = Nothing} diff --git a/todo.md b/todo.md index 23e41ba..72c275f 100644 --- a/todo.md +++ b/todo.md @@ -9,12 +9,21 @@ * Add wiki pages discussing: Why a visual language?, History of Glance, How to contribute, Code guide [code style, ...], etc.. ## GUI Todo Later -* Connect nodes with lines +* Connect edges to specific ports +* Select areas by clicking the vertices of the selection area. +* Have a way to delete nodes and edges * Display the undo state in the app [Bug #14](https://github.com/rgleichman/glance/issues/14) * Scale based on mouse position +* Add edge creation to history. * Extract out GUI interface code (GTK and GDK) into a module. * Refactor to make code extensible (e.g. records of functions instead of enums) * Click a button that shows an image of the mouse and keyboard controls in a new window. +* Consider a way to keep the currentEdge after creating an edge. May + be useful where a variable is used mulitple times (e.g. a big struct + parameter). +* Create functions by connecting a second edge to an apply argument + port and then selecting the second output (or maybe just the select + the output of the function and connect the function up later?) ### Testing todos * Fix the arrowheads being too big for SyntaxGraph drawings.