From c964afee10a397fe5ea07dbb1cfbd49839604eee Mon Sep 17 00:00:00 2001 From: hasufell Date: Sat, 15 Nov 2014 00:32:16 +0100 Subject: [PATCH] GUI: hide the quad tree path entry widget by default --- GUI/Gtk.hs | 17 ++++++++++- GUI/gtk2.glade | 77 ++++++++++++++++++++++++++++---------------------- 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/GUI/Gtk.hs b/GUI/Gtk.hs index 7d27e59..2f36da0 100644 --- a/GUI/Gtk.hs +++ b/GUI/Gtk.hs @@ -54,7 +54,9 @@ data MyGUI = MkMyGUI { -- |coord check button cC :: CheckButton, -- |Path entry widget for the quad tree. - pE :: Entry + pE :: Entry, + -- |Horizontal box containing the path entry widget. + vbox7 :: Box } @@ -87,6 +89,7 @@ makeMyGladeGUI = do <*> xmlGetWidget xml castToCheckButton "gridcheckbutton" <*> xmlGetWidget xml castToCheckButton "coordcheckbutton" <*> xmlGetWidget xml castToEntry "path" + <*> xmlGetWidget xml castToBox "vbox7" -- |Main entry point for the GTK GUI routines. @@ -122,6 +125,7 @@ makeGUI startFile = do _ <- onExpose (da mygui) (\_ -> drawDiag mygui >>= (\_ -> return True)) _ <- on (cB mygui) changed (drawDiag mygui) + _ <- on (cB mygui) changed (showPathWidget mygui) _ <- on (gC mygui) toggled (drawDiag mygui) _ <- on (cC mygui) toggled (drawDiag mygui) @@ -145,6 +149,7 @@ makeGUI startFile = do -- draw widgets and start main loop widgetShowAll (win mygui) + widgetHide (vbox7 mygui) mainGUI @@ -160,6 +165,16 @@ showErrorDialog str = do widgetDestroy errorDialog +-- |May hide or show the widget that holds the quad tree path entry, +-- depending on the context. +showPathWidget :: MyGUI + -> IO () +showPathWidget mygui = do + item <- comboBoxGetActive (cB mygui) + if item == 4 then widgetShow (vbox7 mygui) else widgetHide (vbox7 mygui) + return () + + -- |Draws a Diagram which is built from a given file to -- the gtk DrawingArea. drawDiag :: MyGUI diff --git a/GUI/gtk2.glade b/GUI/gtk2.glade index 8d68d0e..716ca9f 100644 --- a/GUI/gtk2.glade +++ b/GUI/gtk2.glade @@ -786,35 +786,58 @@ Public License instead of this License. - + True False - + True False - QuadTree Path - - - False - False - 5 - 0 - - - - - True - True - - False - False - True - True + + + True + False + QuadTree Path + + + False + False + 5 + 0 + + + + + True + True + + False + False + True + True + + + True + True + 1 + + True True + 0 + + + + + True + False + + + False + True + 5 1 @@ -825,18 +848,6 @@ Public License instead of this License. 6 - - - True - False - - - False - True - 5 - 7 - - True @@ -850,7 +861,7 @@ Show quad tree squares False False - 8 + 7