-##         from wxd import wx_
-##         self.wxdocs = Filling(parent=self.notebook, 
-##                               rootObject=wx_,
-##                               rootLabel='wx', 
-##                               rootIsNamespace=False,
-##                               static=True)
-##         self.notebook.AddPage(page=self.wxdocs, text='wxPython Docs')
-##         from wxd import stc_
-##         self.stcdocs = Filling(parent=self.notebook, 
-##                                rootObject=stc_.StyledTextCtrl,
-##                                rootLabel='StyledTextCtrl', 
-##                                rootIsNamespace=False,
-##                                static=True)
-##         self.notebook.AddPage(page=self.stcdocs, text='StyledTextCtrl Docs')
-        self.SplitHorizontally(self.shell, self.notebook, 300)
-        self.SetMinimumPaneSize(1)
+        
+        self.SplitHorizontally(self.shell, self.notebook, -self.sashoffset)
+        self.SetMinimumPaneSize(100)
+
+        self.Bind(wx.EVT_SIZE, self.SplitterOnSize)
+        self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnChanged)
+
+    
+    def OnChanged(self, event):
+        """update sash offset from the bottom of the window"""
+        self.sashoffset = self.GetSize().height - event.GetSashPosition()
+        event.Skip()
+        
+
+    # Make the splitter expand the top window when resized
+    def SplitterOnSize(self, event):
+        splitter = event.GetEventObject()
+        sz = splitter.GetSize()
+        splitter.SetSashPosition(sz.height - self.sashoffset, True)
+        event.Skip()
+
+
+    def LoadSettings(self, config):
+        self.shell.LoadSettings(config)
+        self.filling.LoadSettings(config)
+
+        pos = config.ReadInt('Sash/CrustPos', 400)
+        wx.CallAfter(self.SetSashPosition, pos)
+        def _updateSashPosValue():
+            sz = self.GetSize()
+            self.sashoffset = sz.height - self.GetSashPosition()
+        wx.CallAfter(_updateSashPosValue)
+        zoom = config.ReadInt('View/Zoom/Display', -99)
+        if zoom != -99:
+            self.display.SetZoom(zoom)
+
+
+    def SaveSettings(self, config):
+        self.shell.SaveSettings(config)
+        self.filling.SaveSettings(config)
+
+        config.WriteInt('Sash/CrustPos', self.GetSashPosition())
+        config.WriteInt('View/Zoom/Display', self.display.GetZoom())
+        
+
+