GUI: hide the quad tree path entry widget by default

This commit is contained in:
hasufell 2014-11-15 00:32:16 +01:00
parent d5741d3839
commit c964afee10
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 60 additions and 34 deletions

View File

@ -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

View File

@ -786,35 +786,58 @@ Public License instead of this License.
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox5">
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkLabel" id="pathlabel">
<widget class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">QuadTree Path</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<child>
<widget class="GtkLabel" id="pathlabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">QuadTree Path</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
@ -825,18 +848,6 @@ Public License instead of this License.
<property name="position">6</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">7</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="comboalgo">
<property name="visible">True</property>
@ -850,7 +861,7 @@ Show quad tree squares</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">8</property>
<property name="position">7</property>
</packing>
</child>
</widget>