@@ -15,50 +15,50 @@ main = start gui
15
15
-- TODO: Investigate using a Panel
16
16
gui :: IO ()
17
17
gui = do -- Application frame
18
- f <- frame [text := " Prolog in Haskell" ]
19
- sw <- scrolledWindow f [ style := wxVSCROLL
20
- , scrollRate := sz 20 20
21
- , clientSize := sz 800 500 ]
22
- vlogic <- variable [ value := [] ]
23
- rows <- variable [ value := [] ]
24
- file <- variable [ value := " " ]
25
- rules <- textCtrl f []
26
- query <- textEntry f [ text := " ouder(X,ama)" ]
27
- output <- textCtrl f []
28
- rbox <- singleListBox f []
29
- -- TODO: Get rid of cvas completely. Figure out how the positioning stuff
30
- -- works first.
31
- cvas <- panel sw [ clientSize := sz 800 500 ]
32
- mfile <- menuPane [text := " &File" ]
33
- mopen <- menuItem mfile [ text := " &Open\t Ctrl+O"
34
- , help := " Open a Prolog file"
35
- , on command := onOpen f rules file ]
36
- msave <- menuItem mfile [ text := " &Save\t Ctrl+S"
37
- , help := " Save a Prolog file"
38
- , on command := onSave f rules file ]
39
- msaveas <- menuItem mfile [ text := " &Save As\t Ctrl+Shift+S"
40
- , help := " Save As a Prolog file"
41
- , on command := onSaveAs f rules file ]
42
- mquit <- menuQuit mfile [ text := " &Quit"
43
- , help := " Quit the program"
44
- , on command := close f ]
45
- mquery <- menuPane [text := " Query" ]
46
- mrun <- menuItem mquery [ text := " &Run\t Ctrl+R"
47
- , help := " Run the query"
48
- , on command := onRun vlogic rules query output ]
49
- addbtn <- button f [ text := " Add"
50
- , on command := onAdd sw rows vlogic
51
- ]
52
- run <- button f [ text := " Run!"
53
- , on command := onRun vlogic rules query output ]
54
- set sw [ layout := column 5 [hfill $ widget cvas]
55
- , clientSize := sz 500 300 ]
56
- set f [ menuBar := [mfile, mquery]
57
- , layout := column 5 [ boxed " Enter rules and queries, press Run and be amazed!"
58
- (overGrid sw rules query output run rbox)
59
- ]
60
- , clientSize := sz 1000 700 ]
61
- onAdd sw rows vlogic -- Adds initial text field
18
+ f <- frame [text := " Prolog in Haskell" ]
19
+ sw <- scrolledWindow f [ style := wxVSCROLL
20
+ , scrollRate := sz 20 20
21
+ , clientSize := sz 800 500 ]
22
+ vlogic <- variable [ value := [] ]
23
+ rows <- variable [ value := [] ]
24
+ file <- variable [ value := " " ]
25
+ rules <- textCtrl f []
26
+ query <- textEntry f [ text := " ouder(X,ama)" ]
27
+ output <- textCtrl f []
28
+ rbox <- singleListBox f []
29
+ -- TODO: Get rid of cvas completely. Figure out how the positioning stuff
30
+ -- works first.
31
+ cvas <- panel sw [ clientSize := sz 800 500 ]
32
+ mfile <- menuPane [text := " &File" ]
33
+ mopen <- menuItem mfile [ text := " &Open\t Ctrl+O"
34
+ , help := " Open a Prolog file"
35
+ , on command := onOpen f rules file ]
36
+ msave <- menuItem mfile [ text := " &Save\t Ctrl+S"
37
+ , help := " Save a Prolog file"
38
+ , on command := onSave f rules file ]
39
+ msaveas <- menuItem mfile [ text := " &Save As\t Ctrl+Shift+S"
40
+ , help := " Save As a Prolog file"
41
+ , on command := onSaveAs f rules file ]
42
+ mquit <- menuQuit mfile [ text := " &Quit"
43
+ , help := " Quit the program"
44
+ , on command := close f ]
45
+ mquery <- menuPane [text := " Query" ]
46
+ mrun <- menuItem mquery [ text := " &Run\t Ctrl+R"
47
+ , help := " Run the query"
48
+ , on command := onRun vlogic rules query output ]
49
+ addbtn <- button f [ text := " Add"
50
+ , on command := onAdd sw rows vlogic
51
+ ]
52
+ run <- button f [ text := " Run!"
53
+ , on command := onRun vlogic rules query output ]
54
+ set sw [ layout := column 5 [hfill $ widget cvas]
55
+ , clientSize := sz 500 300 ]
56
+ set f [ menuBar := [mfile, mquery]
57
+ , layout := column 5 [ boxed " Enter rules and queries, press Run and be amazed!"
58
+ (overGrid sw rules query output run rbox)
59
+ ]
60
+ , clientSize := sz 1000 700 ]
61
+ onAdd sw rows vlogic -- Adds initial text field
62
62
63
63
drawRows :: (Form w1 , Valued w , Dimensions w1 ) => w1 -> w [LogicRow ] -> IO ()
64
64
drawRows sw rows = do
@@ -78,10 +78,10 @@ onAdd sw rows vlogic = do
78
78
79
79
disableRow :: LogicRow -> IO ()
80
80
disableRow (LogicRow _ _ (RowControls t o h d)) = do
81
- set t [enabled := False ]
82
- set o [enabled := False ]
83
- set h [enabled := False ]
84
- set d [enabled := False ]
81
+ set t [enabled := False ]
82
+ set o [enabled := False ]
83
+ set h [enabled := False ]
84
+ set d [enabled := False ]
85
85
86
86
data RowType = TermRow | RuleRow
87
87
@@ -168,17 +168,17 @@ popRow sw rows = do
168
168
169
169
enableRow :: LogicRow -> IO ()
170
170
enableRow (LogicRow _ _ (RowControls t o h d)) = do
171
- set t [enabled := True ]
172
- set o [enabled := True ]
173
- set h [enabled := True ]
174
- set d [enabled := True ]
171
+ set t [enabled := True ]
172
+ set o [enabled := True ]
173
+ set h [enabled := True ]
174
+ set d [enabled := True ]
175
175
176
176
hideCtrls :: LogicRow -> IO ()
177
177
hideCtrls (LogicRow _ _ (RowControls t o h d)) = do
178
- set t [visible := False ]
179
- set o [visible := False ]
180
- set h [visible := False ]
181
- set d [visible := False ]
178
+ set t [visible := False ]
179
+ set o [visible := False ]
180
+ set h [visible := False ]
181
+ set d [visible := False ]
182
182
183
183
-- TODO: See if we can use container instead of widget for the inner bunch of
184
184
-- fields. This might enable actual scrolling.
0 commit comments