[GRASS-SVN] r49362 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 25 16:32:28 EST 2011


Author: annakrat
Date: 2011-11-25 13:32:28 -0800 (Fri, 25 Nov 2011)
New Revision: 49362

Added:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_statusbar.py
Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/__init__.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
Log:
wxGUI: backport of MapFrameBase and related changes (co-author V. Petras)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/__init__.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/__init__.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/__init__.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -20,6 +20,7 @@
     "mapdisp_command.py",
     "mapdisp_window.py",
     "mapdisp.py",
+    "mapdisp_statusbar.py",
     "mcalc_builder.py",
     "menu.py",
     "menudata.py",

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -725,14 +725,14 @@
         else:
             wx.FindWindowById(wx.ID_FORWARD).Enable(True)
 
-class GCP(MapFrame, wx.Frame, ColumnSorterMixin):
+class GCP(MapFrame, ColumnSorterMixin):
     """!
     Manages ground control points for georectifying. Calculates RMS statics.
     Calls i.rectify or v.transform to georectify map.
     """
     def __init__(self, parent, grwiz = None, id = wx.ID_ANY,
                  title = _("Manage Ground Control Points"),
-                 size = (700, 300), toolbars=["gcpdisp"], Map=None, lmgr=None):
+                 size = (700, 300), toolbars = ["gcpdisp"], Map = None, lmgr = None):
 
         self.grwiz = grwiz # GR Wizard
 
@@ -742,8 +742,8 @@
             self.show_target = True
         
         #wx.Frame.__init__(self, parent, id, title, size = size, name = "GCPFrame")
-        MapFrame.__init__(self, parent, id, title, size = size,
-                            Map=Map, toolbars=["gcpdisp"], lmgr=lmgr, name='GCPMapWindow')
+        MapFrame.__init__(self, parent = parent, title = title, size = size,
+                            Map = Map, toolbars = toolbars, lmgr = lmgr, name = 'GCPMapWindow')
 
         #
         # init variables
@@ -894,11 +894,20 @@
     # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
     def GetListCtrl(self):
         return self.list
+        
+    def GetMapCoordList(self):
+        return self.mapcoordlist
 
     # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
     def GetSortImages(self):
         return (self.sm_dn, self.sm_up)
 
+    def GetFwdError(self):
+        return self.fwd_rmserror
+        
+    def GetBkwError(self):
+        return self.bkw_rmserror
+                
     def InitMapDisplay(self):
         self.list.LoadData()
         
@@ -942,7 +951,7 @@
                                    0.0,                # forward error
                                    0.0 ] )             # backward error
 
-        if self.statusbarWin['toggle'].GetSelection() == 7: # go to
+        if self.statusbarManager.GetMode() == 8: # go to
             self.StatusbarUpdate()
 
     def DeleteGCP(self, event):
@@ -983,11 +992,10 @@
 
         self.UpdateColours()
 
-        if self.statusbarWin['toggle'].GetSelection() == 7: # go to
+        if self.statusbarManager.GetMode() == 8: # go to
             self.StatusbarUpdate()
             if self.list.selectedkey > 0:
-                self.statusbarWin['goto'].SetValue(self.list.selectedkey)
-            #self.statusbarWin['goto'].SetValue(0)
+                self.statusbarManager.SetProperty('gotoGCP', self.list.selectedkey)
 
     def ClearGCP(self, event):
         """
@@ -1783,7 +1791,7 @@
     def UpdateActive(self, win):
 
         # optionally disable tool zoomback tool
-        self.toolbars['gcpdisp'].Enable('zoomback', enable = (len(self.MapWindow.zoomhistory) > 1))
+        self.GetMapToolbar().Enable('zoomback', enable = (len(self.MapWindow.zoomhistory) > 1))
 
         if self.activemap.GetSelection() != (win == self.TgtMapWindow):
             self.activemap.SetSelection(win == self.TgtMapWindow)
@@ -1879,7 +1887,7 @@
     def OnDispResize(self, event):
         """!GCP Map Display resized, adjust Map Windows
         """
-        if self.toolbars['gcpdisp']:
+        if self.GetMapToolbar():
             srcwidth, srcheight = self.SrcMapWindow.GetSize()
             tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
             srcwidth = (srcwidth + tgtwidth) / 2
@@ -2752,7 +2760,7 @@
                     self.parent.show_target = True
                     self.parent._mgr.GetPane("target").Show()
                     self.parent._mgr.Update()
-                    self.parent.toolbars['gcpdisp'].Enable('zoommenu', enable = True)
+                    self.parent.GetMapToolbar().Enable('zoommenu', enable = True)
                     self.parent.activemap.Enable()
                     self.parent.TgtMapWindow.ZoomToMap(layers = self.parent.TgtMap.GetListOfLayers())
             else: # tgt_map == ''
@@ -2762,7 +2770,7 @@
                     self.parent._mgr.Update()
                     self.parent.activemap.SetSelection(0)
                     self.parent.activemap.Enable(False)
-                    self.parent.toolbars['gcpdisp'].Enable('zoommenu', enable = False)
+                    self.parent.GetMapToolbar().Enable('zoommenu', enable = False)
 
         self.parent.UpdateColours(srcrender, srcrenderVector, tgtrender, tgtrenderVector)
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmapdisp.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -53,6 +53,8 @@
 import globalvar
 import utils
 import gdialogs
+import mapdisp_statusbar as sb
+from mapdisp import MapFrameBase
 from grass.script import core as grass
 from debug import Debug
 from icon  import Icons
@@ -64,14 +66,13 @@
 # for standalone app
 cmdfilename = None
 
-class MapFrame(wx.Frame):
+class MapFrame(MapFrameBase):
     """!Main frame for map display window. Drawing takes place in
     child double buffered drawing window.
     """
-    def __init__(self, parent=None, id=wx.ID_ANY, title=_("GRASS GIS Manage Ground Control Points"),
-                 style=wx.DEFAULT_FRAME_STYLE, toolbars=["gcpdisp"],
-                 tree=None, notebook=None, lmgr=None, page=None,
-                 Map=None, auimgr=None, **kwargs):
+    def __init__(self, parent=None, title=_("GRASS GIS Manage Ground Control Points"),
+                 toolbars=["gcpdisp"], tree=None, notebook=None, lmgr=None,
+                 page=None, Map=None, auimgr=None, name = 'GCPMapWindow', **kwargs):
         """!Main map display window with toolbars, statusbar and
         DrawWindow
 
@@ -84,56 +85,23 @@
         @param auimgs AUI manager
         @param kwargs wx.Frame attribures
         """
+        
+        MapFrameBase.__init__(self, parent = parent, title = title, toolbars = toolbars,
+                              Map = Map, auimgr = auimgr, name = name, **kwargs)
+        
         self._layerManager = lmgr   # Layer Manager object
-        self.Map        = Map       # instance of render.Map
         self.tree       = tree      # Layer Manager layer tree object
         self.page       = page      # Notebook page holding the layer tree
         self.layerbook  = notebook  # Layer Manager layer tree notebook
-        self.parent     = parent
-        
-        if 'name' not in kwargs:
-            kwargs['name'] = 'GCPMapWindow'
-        wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
-        
-        # available cursors
-        self.cursors = {
-            # default: cross
-            # "default" : wx.StockCursor(wx.CURSOR_DEFAULT),
-            "default" : wx.StockCursor(wx.CURSOR_ARROW),
-            "cross"   : wx.StockCursor(wx.CURSOR_CROSS),
-            "hand"    : wx.StockCursor(wx.CURSOR_HAND),
-            "pencil"  : wx.StockCursor(wx.CURSOR_PENCIL),
-            "sizenwse": wx.StockCursor(wx.CURSOR_SIZENWSE)
-            }
-        
         #
-        # set the size & system icon
-        #
-        self.SetClientSize(self.GetSize())
-        self.iconsize = (16, 16)
-
-        self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass_map.ico'), wx.BITMAP_TYPE_ICO))
-
-        #
-        # Fancy gui
-        #
-        self._mgr = wx.aui.AuiManager(self)
-
-        #
         # Add toolbars
         #
-        self.toolbars = { 'map' : None,
-                          'vdigit' : None,
-                          'georect' : None, 
-                          'gcpdisp' : None, 
-                          'gcpman' : None, 
-                          'nviz' : None }
-
         for toolb in toolbars:
             self.AddToolbar(toolb)
 
         self.activemap = self.toolbars['gcpdisp'].togglemap
         self.activemap.SetSelection(0)
+        
         self.SrcMap        = self.grwiz.SrcMap       # instance of render.Map
         self.TgtMap        = self.grwiz.TgtMap       # instance of render.Map
         self._mgr.SetDockSizeConstraint(0.5, 0.5)
@@ -141,103 +109,33 @@
         #
         # Add statusbar
         #
-        self.statusbar = self.CreateStatusBar(number=4, style=0)
-        self.statusbar.SetStatusWidths([-5, -2, -1, -1])
-        self.statusbarWin = dict()
-        self.statusbarWin['toggle'] = wx.Choice(self.statusbar, wx.ID_ANY,
-                                  choices = [_("Coordinates"),
-                                             _("Extent"),
-                                             _("Comp. region"),
-                                             _("Show comp. extent"),
-                                             _("Display mode"),
-                                             _("Display geometry"),
-                                             _("Map scale"),
-                                             _("Go to GCP No."),
-                                             _("RMS error")])
-        # set StatusBar to Go to GCP No.
-        self.statusbarWin['toggle'].SetSelection(7)
-
-        self.statusbar.Bind(wx.EVT_CHOICE, self.OnToggleStatus, self.statusbarWin['toggle'])
-        # auto-rendering checkbox
-        self.statusbarWin['render'] = wx.CheckBox(parent=self.statusbar, id=wx.ID_ANY,
-                                                  label=_("Render"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleRender, self.statusbarWin['render'])
-        self.statusbarWin['render'].SetValue(UserSettings.Get(group='display',
-                                                              key='autoRendering',
-                                                              subkey='enabled'))
-        self.statusbarWin['render'].SetToolTip(wx.ToolTip (_("Enable/disable auto-rendering")))
-        # show region
-        self.statusbarWin['region'] = wx.CheckBox(parent=self.statusbar, id=wx.ID_ANY,
-                                                  label=_("Show computational extent"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleShowRegion, self.statusbarWin['region'])
         
-        self.statusbarWin['region'].SetValue(False)
-        self.statusbarWin['region'].Hide()
-        self.statusbarWin['region'].SetToolTip(wx.ToolTip (_("Show/hide computational "
-                                                             "region extent (set with g.region). "
-                                                             "Display region drawn as a blue box inside the "
-                                                             "computational region, "
-                                                             "computational region inside a display region "
-                                                             "as a red box).")))
-        # set resolution
-        self.statusbarWin['resolution'] = wx.CheckBox(parent=self.statusbar, id=wx.ID_ANY,
-                                                      label=_("Constrain display resolution to computational settings"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleResolution, self.statusbarWin['resolution'])
-        self.statusbarWin['resolution'].SetValue(UserSettings.Get(group='display', key='compResolution', subkey='enabled'))
-        self.statusbarWin['resolution'].Hide()
-        self.statusbarWin['resolution'].SetToolTip(wx.ToolTip (_("Constrain display resolution "
-                                                                 "to computational region settings. "
-                                                                 "Default value for new map displays can "
-                                                                 "be set up in 'User GUI settings' dialog.")))
-        # map scale
-        self.statusbarWin['mapscale'] = wx.ComboBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                    style = wx.TE_PROCESS_ENTER,
-                                                    size=(150, -1))
-        self.statusbarWin['mapscale'].SetItems(['1:1000',
-                                                '1:5000',
-                                                '1:10000',
-                                                '1:25000',
-                                                '1:50000',
-                                                '1:100000',
-                                                '1:1000000'])
-        self.statusbarWin['mapscale'].Hide()
-        self.statusbarWin['mapscale'].SetToolTip(wx.ToolTip (_("As everyone's monitors and resolutions "
-                                                              "are set differently these values are not "
-                                                              "true map scales, but should get you into "
-                                                              "the right neighborhood.")))
-        self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnChangeMapScale, self.statusbarWin['mapscale'])
-        self.statusbar.Bind(wx.EVT_COMBOBOX, self.OnChangeMapScale, self.statusbarWin['mapscale'])
-
-        # go to
-        self.statusbarWin['goto'] = wx.SpinCtrl(parent=self.statusbar, id=wx.ID_ANY,
-                             min=0)
-        self.statusbar.Bind(wx.EVT_SPINCTRL, self.OnGoTo, self.statusbarWin['goto'])
-        self.statusbarWin['goto'].Hide()
-        self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnGoTo, self.statusbarWin['goto'])
-
-        # projection, unused but BufferedWindow checks for it
-        self.statusbarWin['projection'] = wx.CheckBox(parent=self.statusbar, id=wx.ID_ANY,
-                                                      label=_("Use defined projection"))
-        self.statusbarWin['projection'].SetValue(False)
-        size = self.statusbarWin['projection'].GetSize()
-        self.statusbarWin['projection'].SetMinSize((size[0] + 150, size[1]))
-        self.statusbarWin['projection'].SetToolTip(wx.ToolTip (_("Reproject coordinates displayed "
-                                                                 "in the statusbar. Projection can be "
-                                                                 "defined in GUI preferences dialog "
-                                                                 "(tab 'Display')")))
-        self.statusbarWin['projection'].Hide()
-
-        # mask
-        self.statusbarWin['mask'] = wx.StaticText(parent = self.statusbar, id = wx.ID_ANY,
-                                                  label = '')
-        self.statusbarWin['mask'].SetForegroundColour(wx.Colour(255, 0, 0))
+        # items for choice
+        self.statusbarItems = [sb.SbCoordinates,
+                               sb.SbRegionExtent,
+                               sb.SbCompRegionExtent,
+                               sb.SbShowRegion,
+                               sb.SbResolution,
+                               sb.SbDisplayGeometry,
+                               sb.SbMapScale,
+                               sb.SbProjection,
+                               sb.SbGoToGCP,
+                               sb.SbRMSError]
+                            
         
-        # on-render gauge
-        self.statusbarWin['progress'] = wx.Gauge(parent=self.statusbar, id=wx.ID_ANY,
-                                      range=0, style=wx.GA_HORIZONTAL)
-        self.statusbarWin['progress'].Hide()
+        # create statusbar and its manager
+        statusbar = self.CreateStatusBar(number = 4, style = 0)
+        statusbar.SetStatusWidths([-5, -2, -1, -1])
+        self.statusbarManager = sb.SbManager(mapframe = self, statusbar = statusbar)
         
-        self.StatusbarReposition() # reposition statusbar
+        # fill statusbar manager
+        self.statusbarManager.AddStatusbarItemsByClass(self.statusbarItems, mapframe = self, statusbar = statusbar)
+        self.statusbarManager.AddStatusbarItem(sb.SbMask(self, statusbar = statusbar, position = 2))
+        self.statusbarManager.AddStatusbarItem(sb.SbRender(self, statusbar = statusbar, position = 3))
+        
+        self.statusbarManager.SetMode(8) # goto GCP
+        self.statusbarManager.Update()
+        
 
         #
         # Init map display (buffered DC & set default cursor)
@@ -257,7 +155,8 @@
         #
         # initialize region values
         #
-        self.__InitDisplay() 
+        self._initMap(map = self.SrcMap) 
+        self._initMap(map = self.TgtMap) 
 
         #
         # Bind various events
@@ -340,7 +239,6 @@
          - 'vdigit'  - vector digitizer
          - 'gcpdisp' - GCP Manager, Display
          - 'gcpman'  - GCP Manager, points management
-         - 'georect' - georectifier
          - 'nviz'    - 3D view mode
         """
         # default toolbar
@@ -383,27 +281,11 @@
             
         self._mgr.Update()
 
-    def __InitDisplay(self):
-        """
-        Initialize map display, set dimensions and map region
-        """
-        self.width, self.height = self.GetClientSize()
-
-        Debug.msg(2, "MapFrame.__InitDisplay():")
-        self.grwiz.SwitchEnv('source')
-        self.SrcMap.ChangeMapSize(self.GetClientSize())
-        self.SrcMap.region = self.SrcMap.GetRegion() # g.region -upgc
-        self.grwiz.SwitchEnv('target')
-        self.TgtMap.ChangeMapSize(self.GetClientSize())
-        self.TgtMap.region = self.TgtMap.GetRegion() # g.region -upgc
-        # self.SrcMap.SetRegion() # adjust region to match display window
-        # self.TgtMap.SetRegion() # adjust region to match display window
-
     def OnUpdateProgress(self, event):
         """
         Update progress bar info
         """
-        self.statusbarWin['progress'].SetValue(event.value)
+        self.GetProgressBar().SetValue(event.value)
         
         event.Skip()
         
@@ -463,7 +345,7 @@
         Zoom in the map.
         Set mouse cursor, zoombox attributes, and zoom direction
         """
-        if self.toolbars['map']:
+        if self.GetToolbar('map'):
             self.toolbars['map'].OnTool(event)
             self.toolbars['map'].action['desc'] = ''
         
@@ -493,7 +375,7 @@
         Zoom out the map.
         Set mouse cursor, zoombox attributes, and zoom direction
         """
-        if self.toolbars['map']:
+        if self.GetToolbar('map'):
             self.toolbars['map'].OnTool(event)
             self.toolbars['map'].action['desc'] = ''
         
@@ -518,17 +400,11 @@
         # change the cursor
         win.SetCursor(self.cursors["cross"])
 
-    def OnZoomBack(self, event):
-        """
-        Zoom last (previously stored position)
-        """
-        self.MapWindow.ZoomBack()
-
     def OnPan(self, event):
         """
         Panning, set mouse to drag
         """
-        if self.toolbars['map']:
+        if self.GetToolbar('map'):
             self.toolbars['map'].OnTool(event)
             self.toolbars['map'].action['desc'] = ''
         
@@ -582,309 +458,7 @@
         else:
             self.Map.alignRegion = False
         # event.Skip()
-
-    def OnToggleRender(self, event):
-        """
-        Enable/disable auto-rendering
-        """
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
-
-    def OnToggleShowRegion(self, event):
-        """
-        Show/Hide extent in map canvas
-        """
-        if self.statusbarWin['region'].GetValue():
-            # show extent
-            self.MapWindow.regionCoords = []
-        else:
-            del self.MapWindow.regionCoords
-
-        # redraw map if auto-rendering is enabled
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
-
-    def OnToggleResolution(self, event):
-        """
-        Use resolution of computation region settings
-        for redering image instead of display resolution
-        """
-        # redraw map if auto-rendering is enabled
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
-        
-    def OnToggleStatus(self, event):
-        """
-        Toggle status text
-        """
-        self.StatusbarUpdate()
-
-    def OnChangeMapScale(self, event):
-        """
-        Map scale changed by user
-        """
-        scale = event.GetString()
-
-        try:
-            if scale[:2] != '1:':
-                raise ValueError
-            value = int(scale[2:])
-        except ValueError:
-            self.statusbarWin['mapscale'].SetValue('1:%ld' % int(self.mapScaleValue))
-            return
-
-        dEW = value * (self.Map.region['cols'] / self.ppm[0])
-        dNS = value * (self.Map.region['rows'] / self.ppm[1])
-        self.Map.region['n'] = self.Map.region['center_northing'] + dNS / 2.
-        self.Map.region['s'] = self.Map.region['center_northing'] - dNS / 2.
-        self.Map.region['w'] = self.Map.region['center_easting']  - dEW / 2.
-        self.Map.region['e'] = self.Map.region['center_easting']  + dEW / 2.
-        
-        # add to zoom history
-        self.MapWindow.ZoomHistory(self.Map.region['n'], self.Map.region['s'],
-                                   self.Map.region['e'], self.Map.region['w'])
-        
-        # redraw a map
-        self.MapWindow.UpdateMap()
-        self.statusbarWin['mapscale'].SetFocus()
-        
-    def OnGoTo(self, event):
-        """
-        Go to position
-        """
-        #GCPNo = int(event.GetString())
-        GCPNo = self.statusbarWin['goto'].GetValue()
-
-        if GCPNo < 0 or GCPNo > len(self.mapcoordlist):
-            wx.MessageBox(parent=self,
-                  message="%s 1 - %s." % (_("Valid Range:"),
-                                 len(self.mapcoordlist)),
-                  caption=_("Invalid GCP Number"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            return
-
-        if GCPNo == 0:
-            return
-
-        self.list.selectedkey = GCPNo
-        self.list.selected = self.list.FindItemData(-1, GCPNo)
-        self.list.render = False
-        self.list.SetItemState(self.list.selected,
-                          wx.LIST_STATE_SELECTED,
-                          wx.LIST_STATE_SELECTED)
-        self.list.render = True
-        
-        # Source MapWindow:
-        begin = (self.mapcoordlist[GCPNo][1], self.mapcoordlist[GCPNo][2])
-        begin = self.SrcMapWindow.Cell2Pixel(begin)
-        end = begin
-        self.SrcMapWindow.Zoom(begin, end, 0)
-
-        # redraw map
-        self.SrcMapWindow.UpdateMap()
-
-        if self.show_target:
-            # Target MapWindow:
-            begin = (self.mapcoordlist[GCPNo][3], self.mapcoordlist[GCPNo][4])
-            begin = self.TgtMapWindow.Cell2Pixel(begin)
-            end = begin
-            self.TgtMapWindow.Zoom(begin, end, 0)
-
-            # redraw map
-            self.TgtMapWindow.UpdateMap()
-
-        self.statusbarWin['goto'].SetFocus()
-        
-    def StatusbarUpdate(self):
-        """!Update statusbar content"""
-
-        self.statusbarWin['region'].Hide()
-        self.statusbarWin['resolution'].Hide()
-        self.statusbarWin['mapscale'].Hide()
-        self.statusbarWin['goto'].Hide()
-        self.mapScaleValue = self.ppm = None
-
-        if self.statusbarWin['toggle'].GetSelection() == 0: # Coordinates
-            self.statusbar.SetStatusText("", 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetSelection() in (1, 2): # Extent
-            sel = self.statusbarWin['toggle'].GetSelection()
-            if sel == 1:
-                region = self.Map.region
-            else:
-                region = self.Map.GetRegion() # computation region
-
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
-            
-            if self.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                w, s = utils.Deg2DMS(region["w"], region["s"],
-                                     string = False, precision = precision)
-                e, n = utils.Deg2DMS(region["e"], region["n"],
-                                     string = False, precision = precision)
-                if sel == 1:
-                    self.statusbar.SetStatusText("%s - %s, %s - %s" %
-                                                 (w, e, s, n), 0)
-                else:
-                    ewres, nsres = utils.Deg2DMS(region['ewres'], region['nsres'],
-                                                 string = False, precision = precision)
-                    self.statusbar.SetStatusText("%s - %s, %s - %s (%s, %s)" %
-                                                 (w, e, s, n, ewres, nsres), 0)
-            else:
-                w, s = region["w"], region["s"]
-                e, n = region["e"], region["n"]
-                if sel == 1:
-                    self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f" %
-                                                 (precision, w, precision, e,
-                                                  precision, s, precision, n), 0)
-                else:
-                    ewres, nsres = region['ewres'], region['nsres']
-                    self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f (%.*f, %.*f)" %
-                                                 (precision, w, precision, e,
-                                                  precision, s, precision, n,
-                                                  precision, ewres, precision, nsres), 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetSelection() == 3: # Show comp. extent
-            self.statusbar.SetStatusText("", 0)
-            self.statusbarWin['region'].Show()
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetSelection() == 4: # Display mode
-            self.statusbar.SetStatusText("", 0)
-            self.statusbarWin['resolution'].Show()
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetSelection() == 5: # Display geometry
-            self.statusbar.SetStatusText("rows=%d; cols=%d; nsres=%.2f; ewres=%.2f" %
-                                         (self.Map.region["rows"], self.Map.region["cols"],
-                                          self.Map.region["nsres"], self.Map.region["ewres"]), 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetSelection() == 6: # Map scale
-            # TODO: need to be fixed...
-            ### screen X region problem
-            ### user should specify ppm
-            dc = wx.ScreenDC()
-            dpSizePx = wx.DisplaySize()   # display size in pixels
-            dpSizeMM = wx.DisplaySizeMM() # display size in mm (system)
-            dpSizeIn = (dpSizeMM[0] / 25.4, dpSizeMM[1] / 25.4) # inches
-            sysPpi  = dc.GetPPI()
-            comPpi = (dpSizePx[0] / dpSizeIn[0],
-                      dpSizePx[1] / dpSizeIn[1])
-
-            ppi = comPpi                  # pixel per inch
-            self.ppm = ((ppi[0] / 2.54) * 100, # pixel per meter
-                        (ppi[1] / 2.54) * 100)
-
-            Debug.msg(4, "MapFrame.StatusbarUpdate(mapscale): size: px=%d,%d mm=%f,%f "
-                      "in=%f,%f ppi: sys=%d,%d com=%d,%d; ppm=%f,%f" % \
-                          (dpSizePx[0], dpSizePx[1], dpSizeMM[0], dpSizeMM[1],
-                           dpSizeIn[0], dpSizeIn[1],
-                           sysPpi[0], sysPpi[1], comPpi[0], comPpi[1],
-                           self.ppm[0], self.ppm[1]))
-
-            region = self.Map.region
-
-            heightCm = region['rows'] / self.ppm[1] * 100
-            widthCm  = region['cols'] / self.ppm[0] * 100
-
-            Debug.msg(4, "MapFrame.StatusbarUpdate(mapscale): width_cm=%f, height_cm=%f" %
-                      (widthCm, heightCm))
-
-            xscale = (region['e'] - region['w']) / (region['cols'] / self.ppm[0])
-            yscale = (region['n'] - region['s']) / (region['rows'] / self.ppm[1])
-            scale = (xscale + yscale) / 2.
-            
-            Debug.msg(3, "MapFrame.StatusbarUpdate(mapscale): xscale=%f, yscale=%f -> scale=%f" % \
-                          (xscale, yscale, scale))
-
-            self.statusbar.SetStatusText("")
-            try:
-                self.statusbarWin['mapscale'].SetValue("1:%ld" % (scale + 0.5))
-            except TypeError:
-                pass
-            self.mapScaleValue = scale
-            self.statusbarWin['mapscale'].Show()
-
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetSelection() == 7: # go to
-
-            self.statusbar.SetStatusText("")
-            max = self.list.GetItemCount()
-            if max < 1:
-                max = 1
-            self.statusbarWin['goto'].SetRange(0, max)
-
-            self.statusbarWin['goto'].Show()
-
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-        
-        elif self.statusbarWin['toggle'].GetSelection() == 8: # RMS error
-            self.statusbar.SetStatusText(_("Forward: %(forw)s, Backward: %(back)s") %
-                                         { 'forw' : self.fwd_rmserror,
-                                           'back' : self.bkw_rmserror })
-            # disable long help
-            # self.StatusbarEnableLongHelp(False)
-            
-        else:
-            self.statusbar.SetStatusText("", 1)
-
-    def StatusbarEnableLongHelp(self, enable=True):
-        """!Enable/disable toolbars long help"""
-        for toolbar in self.toolbars.itervalues():
-            if toolbar:
-                toolbar.EnableLongHelp(enable)
-                
-    def StatusbarReposition(self):
-        """!Reposition checkbox in statusbar"""
-        # reposition checkbox
-        widgets = [(0, self.statusbarWin['region']),
-                   (0, self.statusbarWin['resolution']),
-                   (0, self.statusbarWin['mapscale']),
-                   (0, self.statusbarWin['progress']),
-                   (0, self.statusbarWin['goto']),
-                   (1, self.statusbarWin['toggle']),
-                   (2, self.statusbarWin['mask']),
-                   (3, self.statusbarWin['render'])]
-        for idx, win in widgets:
-            rect = self.statusbar.GetFieldRect(idx)
-            wWin, hWin = win.GetBestSize()
-            if idx == 0: # show region / mapscale / process bar
-                # -> size
-                if win == self.statusbarWin['progress']:
-                    wWin = rect.width - 6
-                # -> position
-                # if win == self.statusbarWin['region']:
-                # x, y = rect.x + rect.width - wWin, rect.y - 1
-                # align left
-                # else:
-                x, y = rect.x + 3, rect.y - 1
-                w, h = wWin, rect.height + 2
-            else: # choice || auto-rendering
-                x, y = rect.x, rect.y - 1
-                w, h = rect.width, rect.height + 2
-                if idx == 1: # choice
-                    h = hWin
-                elif idx == 2: # mask
-                    x += 5
-                    y += 4
-                elif idx == 3: # render
-                    x += 5
-
-            win.SetPosition((x, y))
-            win.SetSize((w, h))
-
+    
     def SaveToFile(self, event):
         """!Save map to image
         """
@@ -951,15 +525,6 @@
         # will be called before PopupMenu returns.
         self.PopupMenu(printmenu)
         printmenu.Destroy()
-
-    def GetMap(self):
-        """!Returns current instance of render.Map()
-        """
-        return self.Map
-
-    def GetWindow(self):
-        """!Get map window"""
-        return self.MapWindow
     
     def FormatDist(self, dist):
         """!Format length numbers and units in a nice way,
@@ -1007,30 +572,12 @@
 
         return (outdist, outunits)
 
-    def OnZoomToMap(self, event):
-        """!
-        Set display extents to match selected raster (including NULLs)
-        or vector map.
-        """
-        self.MapWindow.ZoomToMap(layers = self.Map.GetListOfLayers())
-
     def OnZoomToRaster(self, event):
         """!
         Set display extents to match selected raster map (ignore NULLs)
         """
         self.MapWindow.ZoomToMap(ignoreNulls = True)
-
-    def OnZoomToWind(self, event):
-        """!Set display geometry to match computational region
-        settings (set with g.region)
-        """
-        self.MapWindow.ZoomToWind()
         
-    def OnZoomToDefault(self, event):
-        """!Set display geometry to match default region settings
-        """
-        self.MapWindow.ZoomToDefault()
-        
     def OnZoomToSaved(self, event):
         """!Set display geometry to match extents in
         saved region file
@@ -1080,16 +627,6 @@
         self.PopupMenu(zoommenu)
         zoommenu.Destroy()
         
-    def SetProperties(self, render=False, mode=0, showCompExtent=False,
-                      constrainRes=False, projection=False):
-        """!Set properies of map display window"""
-        self.statusbarWin['render'].SetValue(render)
-        self.statusbarWin['toggle'].SetSelection(mode)
-        self.StatusbarUpdate()
-        self.statusbarWin['region'].SetValue(showCompExtent)
-        self.statusbarWin['resolution'].SetValue(constrainRes)
-        if showCompExtent:
-            self.MapWindow.regionCoords = []
         
     def IsStandalone(self):
         """!Check if Map display is standalone"""
@@ -1106,4 +643,17 @@
         """
         return self._layerManager
     
+    def GetSrcWindow(self):
+        return self.SrcMapWindow
+        
+    def GetTgtWindow(self):
+        return self.TgtMapWindow
+    
+    def GetShowTarget(self):
+        return self.show_target
+        
+    def GetMapToolbar(self):
+        """!Returns toolbar with zooming tools"""
+        return self.toolbars['gcpdisp']
+        
 # end of class MapFrame

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -105,17 +105,6 @@
 HIST_WINDOW_SIZE = (500, 350)
 GM_WINDOW_SIZE = (500, 600)
 
-MAP_DISPLAY_STATUSBAR_MODE = [_("Coordinates"),
-                              _("Extent"),
-                              _("Comp. region"),
-                              _("Show comp. extent"),
-                              _("Display mode"),
-                              _("Display resolution"),
-                              _("Display geometry"),
-                              _("Map scale"),
-                              _("Go to"),
-                              _("Projection"),]
-
 """!File name extension binaries/scripts"""
 if sys.platform == 'win32':
     EXT_BIN = '.exe'

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -228,11 +228,11 @@
         idle time instead of multiple times during layer changing.
         """
         if self.rerender:
-            if self.mapdisplay.toolbars['vdigit']:
+            if self.mapdisplay.GetToolbar('vdigit'):
                 vector = True
             else:
                 vector = False
-            if self.mapdisplay.statusbarWin['render'].GetValue():
+            if self.mapdisplay.IsAutoRendered():
                 self.mapdisplay.MapWindow2D.UpdateMap(render = True, renderVector = vector)
                 if self.lmgr.IsPaneShown('toolbarNviz'): # nviz
                     self.mapdisplay.MapWindow3D.UpdateMap(render = True)
@@ -336,7 +336,7 @@
             
             layer = self.GetPyData(self.layer_selected)[0]['maplayer']
             # enable editing only for vector map layers available in the current mapset
-            digitToolbar = self.mapdisplay.toolbars['vdigit']
+            digitToolbar = self.mapdisplay.GetToolbar('vdigit')
             if digitToolbar:
                 # background vector map
                 self.popupMenu.Append(self.popupID['bgmap'],
@@ -556,7 +556,7 @@
             event.Skip()
             return
         
-        if not self.mapdisplay.toolbars['vdigit']: # enable tool
+        if not self.mapdisplay.GetToolbar('vdigit'): # enable tool
             self.mapdisplay.AddToolbar('vdigit')
         
         if not self.mapdisplay.toolbars['vdigit']:
@@ -620,8 +620,8 @@
                              self._getLayerName(self.layer_selected))
             
             # vector layer currently edited
-            if self.mapdisplay.toolbars['vdigit'] and \
-                    self.mapdisplay.toolbars['vdigit'].GetLayer() == maplayer:   
+            if self.mapdisplay.GetToolbar('vdigit') and \
+                    self.mapdisplay.GetToolbar('vdigit').GetLayer() == maplayer:   
                 alpha = int(new_opacity * 255)
                 self.mapdisplay.GetWindow().digit.GetDisplay().UpdateSettings(alpha = alpha)
                 
@@ -877,7 +877,7 @@
         
         # updated progress bar range (mapwindow statusbar)
         if checked is True:
-            self.mapdisplay.statusbarWin['progress'].SetRange(len(self.Map.GetListOfLayers(l_active = True)))
+            self.mapdisplay.GetProgressBar().SetRange(len(self.Map.GetListOfLayers(l_active = True)))
             
         return layer
 
@@ -1029,11 +1029,11 @@
         self.rerender = True
         self.reorder = True
         
-        if self.mapdisplay.toolbars['vdigit']:
+        if self.mapdisplay.GetToolbar('vdigit'):
             self.mapdisplay.toolbars['vdigit'].UpdateListOfLayers (updateTool = True)
 
         # update progress bar range (mapwindow statusbar)
-        self.mapdisplay.statusbarWin['progress'].SetRange(len(self.Map.GetListOfLayers(l_active = True)))
+        self.mapdisplay.GetProgressBar().SetRange(len(self.Map.GetListOfLayers(l_active = True)))
 
         #
         # nviz
@@ -1060,7 +1060,7 @@
         item    = event.GetItem()
         checked = item.IsChecked()
         
-        digitToolbar = self.mapdisplay.toolbars['vdigit']
+        digitToolbar = self.mapdisplay.GetToolbar('vdigit')
         if not self.first:
             # change active parameter for item in layers list in render.Map
             if self.GetPyData(item)[0]['type'] == 'group':
@@ -1083,7 +1083,7 @@
         self.Unselect()
         
         # update progress bar range (mapwindow statusbar)
-        self.mapdisplay.statusbarWin['progress'].SetRange(len(self.Map.GetListOfLayers(l_active = True)))
+        self.mapdisplay.GetProgressBar().SetRange(len(self.Map.GetListOfLayers(l_active = True)))
         
         # nviz
         if self.lmgr.IsPaneShown('toolbarNviz') and \
@@ -1145,7 +1145,7 @@
             event.Veto()
             return
         
-        digitToolbar = self.mapdisplay.toolbars['vdigit']
+        digitToolbar = self.mapdisplay.GetToolbar('vdigit')
         if digitToolbar:
             mapLayer = self.GetPyData(layer)[0]['maplayer']
             bgmap = UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
@@ -1192,7 +1192,7 @@
                UserSettings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'):
             mapLayer = self.GetPyData(layer)[0]['maplayer']
             if mapLayer.GetType() in ('raster', 'vector'):
-                render = self.mapdisplay.statusbarWin['render'].IsChecked()
+                render = self.mapdisplay.IsAutoRendered()
                 self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
                                                     render = render)
         
@@ -1503,8 +1503,8 @@
         self.GetPyData(item)[0]['maplayer'] = maplayer
         
         # if digitization tool enabled -> update list of available vector map layers
-        if self.mapdisplay.toolbars['vdigit']:
-            self.mapdisplay.toolbars['vdigit'].UpdateListOfLayers(updateTool = True)
+        if self.mapdisplay.GetToolbar('vdigit'):
+            self.mapdisplay.GetToolbar('vdigit').UpdateListOfLayers(updateTool = True)
         
         # redraw map if auto-rendering is enabled
         self.rerender = True

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -8,8 +8,9 @@
 Can be used either from Layer Manager or as p.mon backend.
 
 Classes:
-- MapFrame
-- MapApp
+ - MapFrameBase
+ - MapFrame
+ - MapApp
 
 Usage:
 python mapdisp.py monitor-identifier /path/to/command/file
@@ -22,6 +23,8 @@
 @author Michael Barton
 @author Jachym Cepicky
 @author Martin Landa <landa.martin gmail.com>
+ at author Vaclav Petras <wenzeslaus gmail.com> (MapFrameBase)
+ at author Anna Kratochvilova <kratochanna gmail.com> (MapFrameBase)
 """
 
 import os
@@ -49,6 +52,7 @@
 sys.path.append(grassPath)
 
 import render
+import mapdisp_statusbar as sb
 import toolbars
 import menuform
 import gselect
@@ -74,36 +78,30 @@
 
 haveCtypes = False
 
-class MapFrame(wx.Frame):
-    """!Main frame for map display window. Drawing takes place in
-    child double buffered drawing window.
+class MapFrameBase(wx.Frame):
+    """!Base class for map display window
+    
+    Derived class must use statusbarManager or override
+    GetProperty, SetProperty and HasProperty methods.
+    If derived class enables and disables auto-rendering,
+    it should override IsAutoRendered method.
     """
-    def __init__(self, parent = None, id = wx.ID_ANY, title = _("GRASS GIS - Map display"),
-                 style = wx.DEFAULT_FRAME_STYLE, toolbars = ["map"],
-                 tree = None, notebook = None, lmgr = None, page = None,
-                 Map = None, auimgr = None, **kwargs):
-        """!Main map display window with toolbars, statusbar and
-        DrawWindow
-
+    def __init__(self, parent = None, id = wx.ID_ANY, title = None,
+                 style = wx.DEFAULT_FRAME_STYLE, toolbars = None,
+                 Map = None, auimgr = None, name = None, **kwargs):
+        """!
         @param toolbars array of activated toolbars, e.g. ['map', 'digit']
-        @param tree reference to layer tree
-        @param notebook control book ID in Layer Manager
-        @param lmgr Layer Manager
-        @param page notebook page with layer tree
         @param Map instance of render.Map
         @param auimgs AUI manager
-        @param kwargs wx.Frame attribures
+        @param name frame name
+        @param kwargs wx.Frame attributes
         """
-        self._layerManager = lmgr   # Layer Manager object
+        
+
         self.Map        = Map       # instance of render.Map
-        self.tree       = tree      # Layer Manager layer tree object
-        self.page       = page      # Notebook page holding the layer tree
-        self.layerbook  = notebook  # Layer Manager layer tree notebook
         self.parent     = parent
         
-        if 'name' not in kwargs:
-            kwargs['name'] = 'MapWindow'
-        wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
+        wx.Frame.__init__(self, parent, id, title, style = style, name = name, **kwargs)
         
         # available cursors
         self.cursors = {
@@ -115,7 +113,7 @@
             "pencil"  : wx.StockCursor(wx.CURSOR_PENCIL),
             "sizenwse": wx.StockCursor(wx.CURSOR_SIZENWSE)
             }
-        
+                
         #
         # set the size & system icon
         #
@@ -123,124 +121,341 @@
         self.iconsize = (16, 16)
 
         self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass_map.ico'), wx.BITMAP_TYPE_ICO))
-
+        
+        # toolbars
+        self.toolbars = {}
+        
         #
         # Fancy gui
         #
         self._mgr = wx.aui.AuiManager(self)
+        
+    def _initMap(self, map):
+        """!Initialize map display, set dimensions and map region
+        """
+        if not grass.find_program('g.region', ['--help']):
+            sys.exit(_("GRASS module '%s' not found. Unable to start map "
+                       "display window.") % 'g.region')
+        
+        self.width, self.height = self.GetClientSize()
+        
+        Debug.msg(2, "MapFrame._initMap():")
+        map.ChangeMapSize(self.GetClientSize())
+        map.region = map.GetRegion() # g.region -upgc
+        # self.Map.SetRegion() # adjust region to match display window
+        
+    def SetProperty(self, name, value):
+        """!Sets property"""
+        self.statusbarManager.SetProperty(name, value)
+        
+    def GetProperty(self, name):
+        """!Returns property"""
+        return self.statusbarManager.GetProperty(name)
+        
+    def HasProperty(self, name):
+        """!Checks whether object has property"""
+        return self.statusbarManager.HasProperty(name)
+    
+    def GetPPM(self):
+        """! Get pixel per meter
+        
+        @todo now computed every time, is it necessary?
+        @todo enable user to specify ppm (and store it in UserSettings)
+        """
+        # TODO: need to be fixed...
+        ### screen X region problem
+        ### user should specify ppm
+        dc = wx.ScreenDC()
+        dpSizePx = wx.DisplaySize()   # display size in pixels
+        dpSizeMM = wx.DisplaySizeMM() # display size in mm (system)
+        dpSizeIn = (dpSizeMM[0] / 25.4, dpSizeMM[1] / 25.4) # inches
+        sysPpi  = dc.GetPPI()
+        comPpi = (dpSizePx[0] / dpSizeIn[0],
+                  dpSizePx[1] / dpSizeIn[1])
 
+        ppi = comPpi                  # pixel per inch
+        ppm = ((ppi[0] / 2.54) * 100, # pixel per meter
+                    (ppi[1] / 2.54) * 100)
+        
+        Debug.msg(4, "MapFrameBase.GetPPM(): size: px=%d,%d mm=%f,%f "
+                  "in=%f,%f ppi: sys=%d,%d com=%d,%d; ppm=%f,%f" % \
+                  (dpSizePx[0], dpSizePx[1], dpSizeMM[0], dpSizeMM[1],
+                   dpSizeIn[0], dpSizeIn[1],
+                   sysPpi[0], sysPpi[1], comPpi[0], comPpi[1],
+                   ppm[0], ppm[1]))
+        
+        return ppm
+    
+    def SetMapScale(self, value, map = None):
+        """! Set current map scale
+        
+        @param value scale value (n if scale is 1:n)
+        @param map Map instance (if none self.Map is used)
+        """
+        if not map:
+            map = self.Map
+        
+        region = self.Map.region
+        dEW = value * (region['cols'] / self.GetPPM()[0])
+        dNS = value * (region['rows'] / self.GetPPM()[1])
+        region['n'] = region['center_northing'] + dNS / 2.
+        region['s'] = region['center_northing'] - dNS / 2.
+        region['w'] = region['center_easting']  - dEW / 2.
+        region['e'] = region['center_easting']  + dEW / 2.
+        
+        # add to zoom history
+        self.GetWindow().ZoomHistory(region['n'], region['s'],
+                                   region['e'], region['w'])
+    
+    def GetMapScale(self, map = None):
+        """! Get current map scale
+        
+        @param map Map instance (if none self.Map is used)
+        """
+        if not map:
+            map = self.Map
+        
+        region = map.region
+        ppm = self.GetPPM()
+
+        heightCm = region['rows'] / ppm[1] * 100
+        widthCm  = region['cols'] / ppm[0] * 100
+
+        Debug.msg(4, "MapFrame.GetMapScale(): width_cm=%f, height_cm=%f" %
+                  (widthCm, heightCm))
+
+        xscale = (region['e'] - region['w']) / (region['cols'] / ppm[0])
+        yscale = (region['n'] - region['s']) / (region['rows'] / ppm[1])
+        scale = (xscale + yscale) / 2.
+        
+        Debug.msg(3, "MapFrame.GetMapScale(): xscale=%f, yscale=%f -> scale=%f" % \
+                      (xscale, yscale, scale))
+        
+        return scale
+        
+    def GetProgressBar(self):
+        """!Returns progress bar
+        
+        Progress bar can be used by other classes.
+        """
+        return self.statusbarManager.GetProgressBar()
+        
+    def GetMap(self):
+        """!Returns current Map instance
+        """
+        return self.Map
+
+    def GetWindow(self):
+        """!Get map window"""
+        return self.MapWindow
+        
+    def GetMapToolbar(self):
+       """!Returns toolbar with zooming tools"""
+       raise NotImplementedError()
+       
+    def GetToolbar(self, name):
+        """!Returns toolbar if exists else None.
+        
+        Toolbars dictionary contains currently used toolbars only.
+        """
+        if name in self.toolbars:
+            return self.toolbars[name]
+        
+        return None
+       
+    def StatusbarUpdate(self):
+        """!Update statusbar content"""
+        self.statusbarManager.Update()
+        
+    def IsAutoRendered(self):
+        """!Check if auto-rendering is enabled"""
+        return self.GetProperty('render')
+        
+    def CoordinatesChanged(self):
+        """!Shows current coordinates on statusbar.
+        
+        Used in BufferedWindow to report change of map coordinates (under mouse cursor).
+        """
+        self.statusbarManager.ShowItem('coordinates')
+        
+    def StatusbarReposition(self):
+        """!Reposition items in statusbar"""
+        self.statusbarManager.Reposition()
+        
+    def StatusbarEnableLongHelp(self, enable = True):
+        """!Enable/disable toolbars long help"""
+        for toolbar in self.toolbars.itervalues():
+            toolbar.EnableLongHelp(enable)
+        
+    def IsStandalone(self):
+        """!Check if Map display is standalone"""
+        raise NotImplementedError("IsStandalone")
+   
+    def OnRender(self, event):
+        """!Re-render map composition (each map layer)
+        """
+        raise NotImplementedError("OnRender")
+        
+    def OnDraw(self, event):
+        """!Re-display current map composition
+        """
+        self.MapWindow.UpdateMap(render = False)
+        
+    def OnErase(self, event):
+        """!Erase the canvas
+        """
+        self.MapWindow.EraseMap()
+        
+    def OnZoomIn(self, event):
+        """!Zoom in the map.
+        Set mouse cursor, zoombox attributes, and zoom direction
+        """
+        toolbar = self.GetMapToolbar()
+        self._switchTool(toolbar, event)
+        
+        win = self.GetWindow()
+        self._prepareZoom(mapWindow = win, zoomType = 1)
+        
+    def OnZoomOut(self, event):
+        """!Zoom out the map.
+        Set mouse cursor, zoombox attributes, and zoom direction
+        """
+        toolbar = self.GetMapToolbar()
+        self._switchTool(toolbar, event)
+        
+        win = self.GetWindow()
+        self._prepareZoom(mapWindow = win, zoomType = -1)
+        
+    def _prepareZoom(self, mapWindow, zoomType):
+        """!Prepares MapWindow for zoom, toggles toolbar
+        
+        @param mapWindow MapWindow to prepare
+        @param zoomType 1 for zoom in, -1 for zoom out
+        """
+        mapWindow.mouse['use'] = "zoom"
+        mapWindow.mouse['box'] = "box"
+        mapWindow.zoomtype = zoomType
+        mapWindow.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
+        
+        # change the cursor
+        mapWindow.SetCursor(self.cursors["cross"])
+    
+    def _switchTool(self, toolbar, event):
+        """!Helper function to switch tools"""
+        if toolbar:
+            toolbar.OnTool(event)
+            toolbar.action['desc'] = ''
+            
+    def OnPan(self, event):
+        """!Panning, set mouse to drag
+        """
+        toolbar = self.GetMapToolbar()
+        self._switchTool(toolbar, event)
+        
+        win = self.GetWindow()
+        self._preparePan(mapWindow = win)
+    
+    def _preparePan(self, mapWindow):
+        """!Prepares MapWindow for pan, toggles toolbar
+        
+        @param mapWindow MapWindow to prepare
+        """
+        mapWindow.mouse['use'] = "pan"
+        mapWindow.mouse['box'] = "pan"
+        mapWindow.zoomtype = 0
+        
+        # change the cursor
+        mapWindow.SetCursor(self.cursors["hand"])
+        
+    def OnZoomBack(self, event):
+        """!Zoom last (previously stored position)
+        """
+        self.MapWindow.ZoomBack()
+        
+    def OnZoomToMap(self, event):
+        """!
+        Set display extents to match selected raster (including NULLs)
+        or vector map.
+        """
+        self.MapWindow.ZoomToMap(layers = self.Map.GetListOfLayers())
+    
+    def OnZoomToWind(self, event):
+        """!Set display geometry to match computational region
+        settings (set with g.region)
+        """
+        self.MapWindow.ZoomToWind()
+        
+    def OnZoomToDefault(self, event):
+        """!Set display geometry to match default region settings
+        """
+        self.MapWindow.ZoomToDefault()
+        
+class MapFrame(MapFrameBase):
+    """!Main frame for map display window. Drawing takes place in
+    child double buffered drawing window.
+    """
+    def __init__(self, parent = None, title = _("GRASS GIS - Map display"),
+                 toolbars = ["map"], tree = None, notebook = None, lmgr = None,
+                 page = None, Map = None, auimgr = None, name = 'MapWindow', **kwargs):
+        """!Main map display window with toolbars, statusbar and
+        BufferedWindow (map canvas)
+        
+        @param toolbars array of activated toolbars, e.g. ['map', 'digit']
+        @param tree reference to layer tree
+        @param notebook control book ID in Layer Manager
+        @param lmgr Layer Manager
+        @param page notebook page with layer tree
+        @param Map instance of render.Map
+        @param auimgs AUI manager
+        @param name frame name
+        @param kwargs wx.Frame attributes
+        """
+        MapFrameBase.__init__(self, parent = parent, title = title, toolbars = toolbars,
+                              Map = Map, auimgr = auimgr, name = name, **kwargs)
+        
+        self._layerManager = lmgr   # Layer Manager object
+        self.tree       = tree      # Layer Manager layer tree object
+        self.page       = page      # Notebook page holding the layer tree
+        self.layerbook  = notebook  # Layer Manager layer tree notebook
         #
         # Add toolbars
         #
-        self.toolbars = { 'map' : None,
-                          'vdigit' : None,
-                          'georect' : None, 
-                          'gcpdisp' : None, 
-                          'nviz' : None }
         for toolb in toolbars:
             self.AddToolbar(toolb)
-
+        
         #
         # Add statusbar
         #
-        self.statusbar = self.CreateStatusBar(number = 4, style = 0)
-        self.statusbar.SetStatusWidths([-5, -2, -1, -1])
-        self.statusbarWin = dict()
-        self.statusbarWin['toggle'] = wx.Choice(self.statusbar, wx.ID_ANY,
-                                                choices = globalvar.MAP_DISPLAY_STATUSBAR_MODE)
-        self.statusbarWin['toggle'].SetSelection(UserSettings.Get(group = 'display',
-                                                                  key = 'statusbarMode',
-                                                                  subkey = 'selection'))
-        self.statusbar.Bind(wx.EVT_CHOICE, self.OnToggleStatus, self.statusbarWin['toggle'])
-        # auto-rendering checkbox
-        self.statusbarWin['render'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                  label = _("Render"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleRender, self.statusbarWin['render'])
-        self.statusbarWin['render'].SetValue(UserSettings.Get(group = 'display',
-                                                              key = 'autoRendering',
-                                                              subkey = 'enabled'))
-        self.statusbarWin['render'].SetToolTip(wx.ToolTip (_("Enable/disable auto-rendering")))
-        # show region
-        self.statusbarWin['region'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                  label = _("Show computational extent"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleShowRegion, self.statusbarWin['region'])
         
-        self.statusbarWin['region'].SetValue(False)
-        self.statusbarWin['region'].Hide()
-        self.statusbarWin['region'].SetToolTip(wx.ToolTip (_("Show/hide computational "
-                                                             "region extent (set with g.region). "
-                                                             "Display region drawn as a blue box inside the "
-                                                             "computational region, "
-                                                             "computational region inside a display region "
-                                                             "as a red box).")))
-        # set mode
-        self.statusbarWin['alignExtent'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                       label = _("Align region extent based on display size"))
-        self.statusbarWin['alignExtent'].SetValue(UserSettings.Get(group = 'display', key = 'alignExtent', subkey = 'enabled'))
-        self.statusbarWin['alignExtent'].Hide()
-        self.statusbarWin['alignExtent'].SetToolTip(wx.ToolTip (_("Align region extent based on display "
-                                                                  "size from center point. "
-                                                                  "Default value for new map displays can "
-                                                                  "be set up in 'User GUI settings' dialog.")))
-        # set resolution
-        self.statusbarWin['resolution'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                      label = _("Constrain display resolution to computational settings"))
-        self.statusbar.Bind(wx.EVT_CHECKBOX, self.OnToggleUpdateMap, self.statusbarWin['resolution'])
-        self.statusbarWin['resolution'].SetValue(UserSettings.Get(group = 'display', key = 'compResolution', subkey = 'enabled'))
-        self.statusbarWin['resolution'].Hide()
-        self.statusbarWin['resolution'].SetToolTip(wx.ToolTip (_("Constrain display resolution "
-                                                                 "to computational region settings. "
-                                                                 "Default value for new map displays can "
-                                                                 "be set up in 'User GUI settings' dialog.")))
-        # map scale
-        self.statusbarWin['mapscale'] = wx.ComboBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                    style = wx.TE_PROCESS_ENTER,
-                                                    size = (150, -1))
-        self.statusbarWin['mapscale'].SetItems(['1:1000',
-                                                '1:5000',
-                                                '1:10000',
-                                                '1:25000',
-                                                '1:50000',
-                                                '1:100000',
-                                                '1:1000000'])
-        self.statusbarWin['mapscale'].Hide()
-        self.statusbarWin['mapscale'].SetToolTip(wx.ToolTip (_("As everyone's monitors and resolutions "
-                                                              "are set differently these values are not "
-                                                              "true map scales, but should get you into "
-                                                              "the right neighborhood.")))
-        self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnChangeMapScale, self.statusbarWin['mapscale'])
-        self.statusbar.Bind(wx.EVT_COMBOBOX, self.OnChangeMapScale, self.statusbarWin['mapscale'])
-
-        # go to
-        self.statusbarWin['goto'] = wx.TextCtrl(parent = self.statusbar, id = wx.ID_ANY,
-                                                value = "", style = wx.TE_PROCESS_ENTER,
-                                                size = (300, -1))
-        self.statusbarWin['goto'].Hide()
-        self.statusbar.Bind(wx.EVT_TEXT_ENTER, self.OnGoTo, self.statusbarWin['goto'])
-
-        # projection
-        self.statusbarWin['projection'] = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
-                                                      label = _("Use defined projection"))
-        self.statusbarWin['projection'].SetValue(False)
-        size = self.statusbarWin['projection'].GetSize()
-        self.statusbarWin['projection'].SetMinSize((size[0] + 150, size[1]))
-        self.statusbarWin['projection'].SetToolTip(wx.ToolTip (_("Reproject coordinates displayed "
-                                                                 "in the statusbar. Projection can be "
-                                                                 "defined in GUI preferences dialog "
-                                                                 "(tab 'Projection')")))
-        self.statusbarWin['projection'].Hide()
+        # items for choice
+        self.statusbarItems = [sb.SbCoordinates,
+                               sb.SbRegionExtent,
+                               sb.SbCompRegionExtent,
+                               sb.SbShowRegion,
+                               sb.SbAlignExtent,
+                               sb.SbResolution,
+                               sb.SbDisplayGeometry,
+                               sb.SbMapScale,
+                               sb.SbGoTo,
+                               sb.SbProjection]
+                            
+        self.statusbarItemsHiddenInNviz = (sb.SbAlignExtent,
+                                           sb.SbDisplayGeometry,
+                                           sb.SbShowRegion,
+                                           sb.SbResolution,
+                                           sb.SbMapScale)
         
-        # mask
-        self.statusbarWin['mask'] = wx.StaticText(parent = self.statusbar, id = wx.ID_ANY,
-                                                  label = '')
-        self.statusbarWin['mask'].SetForegroundColour(wx.Colour(255, 0, 0))
+        # create statusbar and its manager
+        statusbar = self.CreateStatusBar(number = 4, style = 0)
+        statusbar.SetStatusWidths([-5, -2, -1, -1])
+        self.statusbarManager = sb.SbManager(mapframe = self, statusbar = statusbar)
         
-        # on-render gauge
-        self.statusbarWin['progress'] = wx.Gauge(parent = self.statusbar, id = wx.ID_ANY,
-                                      range = 0, style = wx.GA_HORIZONTAL)
-        self.statusbarWin['progress'].Hide()
+        # fill statusbar manager
+        self.statusbarManager.AddStatusbarItemsByClass(self.statusbarItems, mapframe = self, statusbar = statusbar)
+        self.statusbarManager.AddStatusbarItem(sb.SbMask(self, statusbar = statusbar, position = 2))
+        self.statusbarManager.AddStatusbarItem(sb.SbRender(self, statusbar = statusbar, position = 3))
         
-        self.StatusbarReposition() # reposition statusbar
+        self.statusbarManager.Update()
 
         #
         # Init map display (buffered DC & set default cursor)
@@ -258,7 +473,7 @@
         #
         # initialize region values
         #
-        self._initDisplay() 
+        self._initMap(map = self.Map) 
 
         #
         # Bind various events
@@ -299,7 +514,8 @@
         self.dialogs['legend'] = None
 
         self.decorationDialog = None # decoration/overlays
-
+        
+        
     def _addToolbarVDigit(self):
         """!Add vector digitizer toolbar
         """
@@ -394,17 +610,16 @@
                                           self.OnFlyThrough, wx.ITEM_CHECK, 8),)) 
         self.toolbars['map'].ChangeToolsDesc(mode2d = False)
         # update status bar
-        choice = globalvar.MAP_DISPLAY_STATUSBAR_MODE
-        self.statusbarWin['toggle'].SetItems((choice[0], choice[1], choice[2],
-                                              choice[8], choice[9]))
-        self.statusbarWin['toggle'].SetSelection(0)
         
+        self.statusbarManager.HideStatusbarChoiceItemsByClass(self.statusbarItemsHiddenInNviz)
+        self.statusbarManager.SetMode(0)
+        
         # erase map window
         self.MapWindow.EraseMap()
         
         self._layerManager.goutput.WriteCmdLog(_("Starting 3D view mode..."),
                                                switchPage = False)
-        self.statusbar.SetStatusText(_("Please wait, loading data..."), 0)
+        self.SetStatusText(_("Please wait, loading data..."), 0)
         
         # create GL window
         if not self.MapWindow3D:
@@ -457,11 +672,11 @@
         self.toolbars['map'].RemoveTool(self.toolbars['map'].rotate)
         self.toolbars['map'].RemoveTool(self.toolbars['map'].flyThrough)
         # update status bar
-        self.statusbarWin['toggle'].SetItems(globalvar.MAP_DISPLAY_STATUSBAR_MODE)
-        self.statusbarWin['toggle'].SetSelection(UserSettings.Get(group = 'display',
-                                                                  key = 'statusbarMode',
-                                                                  subkey = 'selection'))
-        self.statusbar.SetStatusText(_("Please wait, unloading data..."), 0)
+        self.statusbarManager.ShowStatusbarChoiceItemsByClass(self.statusbarItemsHiddenInNviz)
+        self.statusbarManager.SetMode(UserSettings.Get(group = 'display',
+                                                       key = 'statusbarMode',
+                                                       subkey = 'selection'))
+        self.SetStatusText(_("Please wait, unloading data..."), 0)
         self._layerManager.goutput.WriteCmdLog(_("Switching back to 2D view mode..."),
                                                switchPage = False)
         self.MapWindow3D.OnClose(event = None)
@@ -485,7 +700,6 @@
          - 'map'     - basic map toolbar
          - 'vdigit'  - vector digitizer
          - 'gcpdisp' - GCP Manager Display
-         - 'georect' - georectifier
         """
         # default toolbar
         if name == "map":
@@ -503,18 +717,7 @@
         # vector digitizer
         elif name == "vdigit":
             self._addToolbarVDigit()
-        # georectifier
-        elif name == "georect":
-            self.toolbars['georect'] = toolbars.GRToolbar(self, self.Map)
-            
-            self._mgr.AddPane(self.toolbars['georect'],
-                              wx.aui.AuiPaneInfo().
-                              Name("georecttoolbar").Caption(_("Georectification Toolbar")).
-                              ToolbarPane().Top().
-                              LeftDockable(False).RightDockable(False).
-                              BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2).
-                              BestSize((self.toolbars['georect'].GetBestSize())))
+        
         self._mgr.Update()
         
     def RemoveToolbar (self, name):
@@ -528,7 +731,7 @@
         
         self._mgr.DetachPane(self.toolbars[name])
         self.toolbars[name].Destroy()
-        self.toolbars[name] = None
+        self.toolbars.pop(name)
         
         if name == 'vdigit':
             self._mgr.GetPane('vdigit').Hide()
@@ -537,7 +740,6 @@
             
         self.toolbars['map'].combo.SetValue(_("2D view"))
         self.toolbars['map'].Enable2D(True)
-        self.statusbarWin['toggle'].Enable(True)
         
         self._mgr.Update()
     
@@ -547,52 +749,25 @@
             return self._mgr.GetPane(name).IsShown()
         return False
     
-    def _initDisplay(self):
-        """!Initialize map display, set dimensions and map region
-        """
-        if not grass.find_program('g.region', ['--help']):
-            sys.exit(_("GRASS module '%s' not found. Unable to start map "
-                       "display window.") % 'g.region')
-        
-        self.width, self.height = self.GetClientSize()
-        
-        Debug.msg(2, "MapFrame._initDisplay():")
-        self.Map.ChangeMapSize(self.GetClientSize())
-        self.Map.region = self.Map.GetRegion() # g.region -upgc
-        # self.Map.SetRegion() # adjust region to match display window
-
     def OnUpdateProgress(self, event):
         """!Update progress bar info
         """
-        self.statusbarWin['progress'].SetValue(event.value)
+        self.GetProgressBar().SetValue(event.value)
         
         event.Skip()
         
     def OnFocus(self, event):
         """!Change choicebook page to match display.
-        Or set display for georectifying
         """
-        if self._layerManager and \
-                self._layerManager.georectifying:
-            # in georectifying session; display used to get geographic
-            # coordinates for GCPs
-            self.OnPointer(event)
-        else:
-            # change bookcontrol page to page associated with display
-            if self.page:
-                pgnum = self.layerbook.GetPageIndex(self.page)
-                if pgnum > -1:
-                    self.layerbook.SetSelection(pgnum)
-                    self._layerManager.curr_page = self.layerbook.GetCurrentPage()
-                    self.layerbook
+        # change bookcontrol page to page associated with display
+        if self.page:
+            pgnum = self.layerbook.GetPageIndex(self.page)
+            if pgnum > -1:
+                self.layerbook.SetSelection(pgnum)
+                self._layerManager.curr_page = self.layerbook.GetCurrentPage()
         
         event.Skip()
         
-    def OnDraw(self, event):
-        """!Re-display current map composition
-        """
-        self.MapWindow.UpdateMap(render = False)
-        
     def OnRender(self, event):
         """!Re-render map composition (each map layer)
         """
@@ -608,7 +783,7 @@
             self.MapWindow.ClearLines()
         
         # deselect features in vdigit
-        if self.toolbars['vdigit']:
+        if self.GetToolbar('vdigit'):
             self.MapWindow.digit.GetDisplay().SetSelected([])
             self.MapWindow.UpdateMap(render = True, renderVector = True)
         else:
@@ -620,7 +795,7 @@
     def OnPointer(self, event):
         """!Pointer button clicked
         """
-        if self.toolbars['map']:
+        if self.GetMapToolbar():
             if event:
                 self.toolbars['map'].OnTool(event)
             self.toolbars['map'].action['desc'] = ''
@@ -629,7 +804,7 @@
         self.MapWindow.mouse['box'] = "point"
 
         # change the cursor
-        if self.toolbars['vdigit']:
+        if self.GetToolbar('vdigit'):
             # digitization tool activated
             self.MapWindow.SetCursor(self.cursors["cross"])
 
@@ -646,71 +821,13 @@
             else: # moveLine, deleteLine
                 self.MapWindow.mouse['box'] = 'box'
         
-        elif self._layerManager and self._layerManager.georectifying:
-            self.MapWindow.SetCursor(self.cursors["cross"])
-        
         else:
             self.MapWindow.SetCursor(self.cursors["default"])
-
-    def OnZoomIn(self, event):
-        """
-        Zoom in the map.
-        Set mouse cursor, zoombox attributes, and zoom direction
-        """
-        if self.toolbars['map']:
-            self.toolbars['map'].OnTool(event)
-            self.toolbars['map'].action['desc'] = ''
-        
-        self.MapWindow.mouse['use'] = "zoom"
-        self.MapWindow.mouse['box'] = "box"
-        self.MapWindow.zoomtype = 1
-        self.MapWindow.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
-        
-        # change the cursor
-        self.MapWindow.SetCursor(self.cursors["cross"])
-
-    def OnZoomOut(self, event):
-        """
-        Zoom out the map.
-        Set mouse cursor, zoombox attributes, and zoom direction
-        """
-        if self.toolbars['map']:
-            self.toolbars['map'].OnTool(event)
-            self.toolbars['map'].action['desc'] = ''
-        
-        self.MapWindow.mouse['use'] = "zoom"
-        self.MapWindow.mouse['box'] = "box"
-        self.MapWindow.zoomtype = -1
-        self.MapWindow.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
-        
-        # change the cursor
-        self.MapWindow.SetCursor(self.cursors["cross"])
-
-    def OnZoomBack(self, event):
-        """
-        Zoom last (previously stored position)
-        """
-        self.MapWindow.ZoomBack()
-
-    def OnPan(self, event):
-        """
-        Panning, set mouse to drag
-        """
-        if self.toolbars['map']:
-            self.toolbars['map'].OnTool(event)
-            self.toolbars['map'].action['desc'] = ''
-        
-        self.MapWindow.mouse['use'] = "pan"
-        self.MapWindow.mouse['box'] = "pan"
-        self.MapWindow.zoomtype = 0
-        
-        # change the cursor
-        self.MapWindow.SetCursor(self.cursors["hand"])
-    
+            
     def OnRotate(self, event):
         """!Rotate 3D view
         """
-        if self.toolbars['map']:
+        if self.GetMapToolbar():
             self.toolbars['map'].OnTool(event)
             self.toolbars['map'].action['desc'] = ''
         
@@ -718,12 +835,7 @@
         
         # change the cursor
         self.MapWindow.SetCursor(self.cursors["hand"])
-    def OnErase(self, event):
-        """
-        Erase the canvas
-        """
-        self.MapWindow.EraseMap()
-
+        
     def OnFlyThrough(self, event):
         """!Fly-through mode
         """
@@ -754,435 +866,8 @@
             self.Map.alignRegion = True
         else:
             self.Map.alignRegion = False
-        # event.Skip()
-
-    def OnToggleRender(self, event):
-        """!Enable/disable auto-rendering
-        """
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
-
-    def IsAutoRendered(self):
-        """!Check if auto-rendering is enabled"""
-        return self.statusbarWin['render'].IsChecked()
-    
-    def OnToggleShowRegion(self, event):
-        """!Show/Hide extent in map canvas
-        """
-        if self.statusbarWin['region'].GetValue():
-            # show extent
-            self.MapWindow.regionCoords = []
-        else:
-            del self.MapWindow.regionCoords
-
-        # redraw map if auto-rendering is enabled
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
-
-    def OnToggleUpdateMap(self, event):
-        """!Update display when toggle display mode
-        """
-        # redraw map if auto-rendering is enabled
-        if self.statusbarWin['render'].GetValue():
-            self.OnRender(None)
+        # event.Skip()        
         
-    def OnToggleStatus(self, event):
-        """!Toggle status text
-        """
-        self.StatusbarUpdate()
-
-    def OnChangeMapScale(self, event):
-        """!Map scale changed by user
-        """
-        scale = event.GetString()
-
-        try:
-            if scale[:2] != '1:':
-                raise ValueError
-            value = int(scale[2:])
-        except ValueError:
-            self.statusbarWin['mapscale'].SetValue('1:%ld' % int(self.mapScaleValue))
-            return
-
-        dEW = value * (self.Map.region['cols'] / self.ppm[0])
-        dNS = value * (self.Map.region['rows'] / self.ppm[1])
-        self.Map.region['n'] = self.Map.region['center_northing'] + dNS / 2.
-        self.Map.region['s'] = self.Map.region['center_northing'] - dNS / 2.
-        self.Map.region['w'] = self.Map.region['center_easting']  - dEW / 2.
-        self.Map.region['e'] = self.Map.region['center_easting']  + dEW / 2.
-        
-        # add to zoom history
-        self.MapWindow.ZoomHistory(self.Map.region['n'], self.Map.region['s'],
-                                   self.Map.region['e'], self.Map.region['w'])
-        
-        # redraw a map
-        self.MapWindow.UpdateMap()
-        self.statusbarWin['mapscale'].SetFocus()
-        
-    def OnGoTo(self, event):
-        """
-        Go to position
-        """
-        try:
-            if self.statusbarWin['projection'].IsChecked():
-                if not UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4'):
-                    self.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                else:
-                    # reproject values
-                    projIn = UserSettings.Get(group = 'projection',
-                                              key = 'statusbar',
-                                              subkey = 'proj4')
-                    projOut = gcmd.RunCommand('g.proj',
-                                              flags = 'jf',
-                                              read = True)
-                    proj = projIn.split(' ')[0].split('=')[1]
-                    if proj in ('ll', 'latlong', 'longlat'):
-                        e, n = self.statusbarWin['goto'].GetValue().split(';')
-                        e, n = utils.DMS2Deg(e, n)
-                        proj, coord1 = utils.ReprojectCoordinates(coord = (e, n),
-                                                                  projIn = projIn,
-                                                                  projOut = projOut, flags = 'd')
-                        e, n = coord1
-                    else:
-                        e, n = map(float, self.statusbarWin['goto'].GetValue().split(';'))
-                        proj, coord1 = utils.ReprojectCoordinates(coord = (e, n),
-                                                                  projIn = projIn,
-                                                                  projOut = projOut, flags = 'd')
-                        e, n = coord1
-            else:
-                if self.Map.projinfo['proj'] == 'll':
-                    e, n = self.statusbarWin['goto'].GetValue().split(';')
-                else:
-                    e, n = map(float, self.statusbarWin['goto'].GetValue().split(';'))
-                    
-            region = self.Map.GetCurrentRegion()
-            if self.statusbarWin['projection'].IsChecked():
-                if not UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4'):
-                    self.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                else:
-                    region['center_easting'], region['center_northing'] = e, n
-            else:
-                if self.Map.projinfo['proj'] == 'll':
-                    region['center_easting'], region['center_northing'] = utils.DMS2Deg(e, n)
-                else:
-                    region['center_easting'], region['center_northing'] = e, n
-        except ValueError:
-            region = self.Map.GetCurrentRegion()
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
-            if self.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                    self.statusbarWin['goto'].SetValue("%s" % utils.Deg2DMS(region['center_easting'], 
-                                                                            region['center_northing'],
-                                                                            precision = precision))
-            else:
-                self.statusbarWin['goto'].SetValue("%.*f; %.*f" % \
-                                                       (precision, region['center_easting'],
-                                                        precision, region['center_northing']))
-            return
-        
-        if self.IsPaneShown('3d'):
-            self.MapWindow.GoTo(e, n)
-            return
-        
-        dn = (region['nsres'] * region['rows']) / 2.
-        region['n'] = region['center_northing'] + dn
-        region['s'] = region['center_northing'] - dn
-        de = (region['ewres'] * region['cols']) / 2.
-        region['e'] = region['center_easting'] + de
-        region['w'] = region['center_easting'] - de
-        
-        self.Map.AdjustRegion()
-
-        # add to zoom history
-        self.MapWindow.ZoomHistory(region['n'], region['s'],
-                                   region['e'], region['w'])
-        
-        # redraw a map
-        self.MapWindow.UpdateMap()
-        self.statusbarWin['goto'].SetFocus()
-        
-    def StatusbarUpdate(self):
-        """!Update statusbar content"""
-
-        self.statusbarWin['region'].Hide()
-        self.statusbarWin['alignExtent'].Hide()
-        self.statusbarWin['resolution'].Hide()
-        self.statusbarWin['mapscale'].Hide()
-        self.statusbarWin['goto'].Hide()
-        self.statusbarWin['projection'].Hide()
-        self.mapScaleValue = self.ppm = None
-        choice = globalvar.MAP_DISPLAY_STATUSBAR_MODE
-        
-        if self.statusbarWin['toggle'].GetStringSelection() == choice[0]: # Coordinates
-            self.statusbar.SetStatusText("", 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetStringSelection() in (choice[1], choice[2]): # Extent
-            sel = self.statusbarWin['toggle'].GetStringSelection()
-            if sel == choice[1]:
-                region = self.Map.region
-            else:
-                region = self.Map.GetRegion() # computation region
-
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
-            
-            if self.statusbarWin['projection'].IsChecked():
-                if not UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4'):
-                    self.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                else:
-                    projOut = UserSettings.Get(group = 'projection',
-                                               key = 'statusbar',
-                                               subkey = 'proj4')
-                    proj, coord1 = utils.ReprojectCoordinates(coord = (region["w"], region["s"]),
-                                                              projOut = projOut, flags = 'd')
-                    proj, coord2 = utils.ReprojectCoordinates(coord = (region["e"], region["n"]),
-                                                          projOut = projOut, flags = 'd')
-                    if sel == 2:
-                        proj, coord3 = utils.ReprojectCoordinates(coord = (0.0, 0.0),
-                                                                  projOut = projOut, flags = 'd')
-                        proj, coord4 = utils.ReprojectCoordinates(coord = (region["ewres"], region["nsres"]),
-                                                                  projOut = projOut, flags = 'd')
-                    if coord1 and coord2:
-                        if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
-                            w, s = utils.Deg2DMS(coord1[0], coord1[1], string = False,
-                                                 precision = precision)
-                            e, n = utils.Deg2DMS(coord2[0], coord2[1], string = False,
-                                                 precision = precision)
-                            if sel == choice[1]:
-                                self.statusbar.SetStatusText("%s - %s, %s - %s" %
-                                                             (w, e, s, n), 0)
-                            else:
-                                ewres, nsres = utils.Deg2DMS(abs(coord3[0]) - abs(coord4[0]),
-                                                             abs(coord3[1]) - abs(coord4[1]),
-                                                             string = False, hemisphere = False,
-                                                             precision = precision)
-                                self.statusbar.SetStatusText("%s - %s, %s - %s (%s, %s)" %
-                                                             (w, e, s, n, ewres, nsres), 0)
-                        else:
-                            w, s = coord1
-                            e, n = coord2
-                            if sel == choice[1]:
-                                self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f" %
-                                                         (precision, w, precision, e,
-                                                          precision, s, precision, n), 0)
-                            else:
-                                ewres, nsres = coord3
-                                self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f (%.*f, %.*f)" %
-                                                             (precision, w, precision, e,
-                                                              precision, s, precision, n,
-                                                              precision, ewres, precision, nsres), 0)
-                    else:
-                        self.statusbar.SetStatusText(_("Error in projection (check the settings)"), 0)
-            else:
-                if self.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                    w, s = utils.Deg2DMS(region["w"], region["s"],
-                                         string = False, precision = precision)
-                    e, n = utils.Deg2DMS(region["e"], region["n"],
-                                         string = False, precision = precision)
-                    if sel == choice[1]:
-                        self.statusbar.SetStatusText("%s - %s, %s - %s" %
-                                                     (w, e, s, n), 0)
-                    else:
-                        ewres, nsres = utils.Deg2DMS(region['ewres'], region['nsres'],
-                                                     string = False, precision = precision)
-                        self.statusbar.SetStatusText("%s - %s, %s - %s (%s, %s)" %
-                                                     (w, e, s, n, ewres, nsres), 0)
-                else:
-                    w, s = region["w"], region["s"]
-                    e, n = region["e"], region["n"]
-                    if sel == choice[1]:
-                        self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f" %
-                                                     (precision, w, precision, e,
-                                                      precision, s, precision, n), 0)
-                    else:
-                        ewres, nsres = region['ewres'], region['nsres']
-                        self.statusbar.SetStatusText("%.*f - %.*f, %.*f - %.*f (%.*f, %.*f)" %
-                                                     (precision, w, precision, e,
-                                                      precision, s, precision, n,
-                                                      precision, ewres, precision, nsres), 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[3]: # Show comp. extent
-            self.statusbar.SetStatusText("", 0)
-            self.statusbarWin['region'].Show()
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[4]: # Align extent
-            self.statusbar.SetStatusText("", 0)
-            self.statusbarWin['alignExtent'].Show()
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[5]: # Display resolution
-            self.statusbar.SetStatusText("", 0)
-            self.statusbarWin['resolution'].Show()
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[6]: # Display geometry
-            self.statusbar.SetStatusText("rows=%d; cols=%d; nsres=%.2f; ewres=%.2f" %
-                                         (self.Map.region["rows"], self.Map.region["cols"],
-                                          self.Map.region["nsres"], self.Map.region["ewres"]), 0)
-            # enable long help
-            self.StatusbarEnableLongHelp()
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[7]: # Map scale
-            # TODO: need to be fixed...
-            ### screen X region problem
-            ### user should specify ppm
-            dc = wx.ScreenDC()
-            dpSizePx = wx.DisplaySize()   # display size in pixels
-            dpSizeMM = wx.DisplaySizeMM() # display size in mm (system)
-            dpSizeIn = (dpSizeMM[0] / 25.4, dpSizeMM[1] / 25.4) # inches
-            sysPpi  = dc.GetPPI()
-            comPpi = (dpSizePx[0] / dpSizeIn[0],
-                      dpSizePx[1] / dpSizeIn[1])
-
-            ppi = comPpi                  # pixel per inch
-            self.ppm = ((ppi[0] / 2.54) * 100, # pixel per meter
-                        (ppi[1] / 2.54) * 100)
-
-            Debug.msg(4, "MapFrame.StatusbarUpdate(mapscale): size: px=%d,%d mm=%f,%f "
-                      "in=%f,%f ppi: sys=%d,%d com=%d,%d; ppm=%f,%f" % \
-                          (dpSizePx[0], dpSizePx[1], dpSizeMM[0], dpSizeMM[1],
-                           dpSizeIn[0], dpSizeIn[1],
-                           sysPpi[0], sysPpi[1], comPpi[0], comPpi[1],
-                           self.ppm[0], self.ppm[1]))
-
-            region = self.Map.region
-
-            heightCm = region['rows'] / self.ppm[1] * 100
-            widthCm  = region['cols'] / self.ppm[0] * 100
-
-            Debug.msg(4, "MapFrame.StatusbarUpdate(mapscale): width_cm=%f, height_cm=%f" %
-                      (widthCm, heightCm))
-
-            xscale = (region['e'] - region['w']) / (region['cols'] / self.ppm[0])
-            yscale = (region['n'] - region['s']) / (region['rows'] / self.ppm[1])
-            scale = (xscale + yscale) / 2.
-            
-            Debug.msg(3, "MapFrame.StatusbarUpdate(mapscale): xscale=%f, yscale=%f -> scale=%f" % \
-                          (xscale, yscale, scale))
-
-            self.statusbar.SetStatusText("")
-            try:
-                self.statusbarWin['mapscale'].SetValue("1:%ld" % (scale + 0.5))
-            except TypeError:
-                pass
-            self.mapScaleValue = scale
-            self.statusbarWin['mapscale'].Show()
-
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[8]: # go to
-            self.statusbar.SetStatusText("")
-            region = self.Map.GetCurrentRegion()
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
-            
-            if self.statusbarWin['projection'].IsChecked():
-                if not UserSettings.Get(group='projection', key='statusbar', subkey='proj4'):
-                    self.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                else:
-                    proj, coord  = utils.ReprojectCoordinates(coord = (region['center_easting'],
-                                                                       region['center_northing']),
-                                                              projOut = UserSettings.Get(group = 'projection',
-                                                                                         key = 'statusbar',
-                                                                                         subkey = 'proj4'),
-                                                              flags = 'd')
-                    if coord:
-                        if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
-                            self.statusbarWin['goto'].SetValue("%s" % utils.Deg2DMS(coord[0],
-                                                                                    coord[1],
-                                                                                    precision = precision))
-                        else:
-                            self.statusbarWin['goto'].SetValue("%.*f; %.*f" % (precision, coord[0],
-                                                                               precision, coord[1]))
-                    else:
-                        self.statusbar.SetStatusText(_("Error in projection (check the settings)"), 0)
-            else:
-                if self.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                    self.statusbarWin['goto'].SetValue("%s" % utils.Deg2DMS(region['center_easting'], 
-                                                                            region['center_northing'],
-                                                                            precision = precision))
-                else:
-                    self.statusbarWin['goto'].SetValue("%.*f; %.*f" % (precision, region['center_easting'],
-                                                                       precision, region['center_northing']))
-            self.statusbarWin['goto'].Show()
-
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-        
-        elif self.statusbarWin['toggle'].GetStringSelection() == choice[9]: # projection
-            self.statusbar.SetStatusText("")
-            epsg = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'epsg')
-            if epsg:
-                label = '%s (EPSG: %s)' % (_("Use defined projection"), epsg)
-                self.statusbarWin['projection'].SetLabel(label)
-            else:
-                self.statusbarWin['projection'].SetLabel(_("Use defined projection"))
-            self.statusbarWin['projection'].Show()
-            
-            # disable long help
-            self.StatusbarEnableLongHelp(False)
-            
-        else:
-            self.statusbar.SetStatusText("", 1)
-
-    def StatusbarEnableLongHelp(self, enable = True):
-        """!Enable/disable toolbars long help"""
-        for toolbar in self.toolbars.itervalues():
-            if toolbar:
-                toolbar.EnableLongHelp(enable)
-                
-    def StatusbarReposition(self):
-        """!Reposition checkbox in statusbar"""
-        # reposition checkbox
-        widgets = [(0, self.statusbarWin['region']),
-                   (0, self.statusbarWin['alignExtent']),
-                   (0, self.statusbarWin['resolution']),
-                   (0, self.statusbarWin['mapscale']),
-                   (0, self.statusbarWin['progress']),
-                   (0, self.statusbarWin['projection']),
-                   (1, self.statusbarWin['toggle']),
-                   (2, self.statusbarWin['mask']),
-                   (3, self.statusbarWin['render'])]
-        for idx, win in widgets:
-            rect = self.statusbar.GetFieldRect(idx)
-            if idx == 0: # show region / mapscale / process bar
-                # -> size
-                wWin, hWin = win.GetBestSize()
-                if win == self.statusbarWin['progress']:
-                    wWin = rect.width - 6
-                # -> position
-                # if win == self.statusbarWin['region']:
-                # x, y = rect.x + rect.width - wWin, rect.y - 1
-                # align left
-                # else:
-                x, y = rect.x + 3, rect.y - 1
-                w, h = wWin, rect.height + 2
-            else: # choice || auto-rendering
-                x, y = rect.x, rect.y - 1
-                w, h = rect.width, rect.height + 2
-                if idx == 2: # mask
-                    x += 5
-                    y += 4
-                elif idx == 3: # render
-                    x += 5
-            win.SetPosition((x, y))
-            win.SetSize((w, h))
-
     def SaveToFile(self, event):
         """!Save map to image
         """
@@ -1263,7 +948,7 @@
         self.Map.Clean()
         
         # close edited map and 3D tools properly
-        if self.toolbars['vdigit']:
+        if self.GetToolbar('vdigit'):
             maplayer = self.toolbars['vdigit'].GetLayer()
             if maplayer:
                 self.toolbars['vdigit'].OnExit()
@@ -1277,15 +962,6 @@
             if pgnum > -1:
                 self.layerbook.DeletePage(pgnum)
         
-    def GetMap(self):
-        """!Returns current instance of render.Map()
-        """
-        return self.Map
-
-    def GetWindow(self):
-        """!Get map window"""
-        return self.MapWindow
-        
     def QueryMap(self, x, y):
         """!Query raster or vector map layers by r/v.what
         
@@ -1480,7 +1156,7 @@
         
     def OnQuery(self, event):
         """!Query tools menu"""
-        if self.toolbars['map']:
+        if self.GetMapToolbar():
             self.toolbars['map'].OnTool(event)
             action = self.toolbars['map'].GetAction()
             
@@ -1917,18 +1593,7 @@
         """!Set display extents to match selected raster map (ignore NULLs)
         """
         self.MapWindow.ZoomToMap(ignoreNulls = True)
-
-    def OnZoomToWind(self, event):
-        """!Set display geometry to match computational region
-        settings (set with g.region)
-        """
-        self.MapWindow.ZoomToWind()
         
-    def OnZoomToDefault(self, event):
-        """!Set display geometry to match default region settings
-        """
-        self.MapWindow.ZoomToDefault()
-        
     def OnZoomToSaved(self, event):
         """!Set display geometry to match extents in
         saved region file
@@ -1977,19 +1642,17 @@
         # will be called before PopupMenu returns.
         self.PopupMenu(zoommenu)
         zoommenu.Destroy()
-        
+
     def SetProperties(self, render = False, mode = 0, showCompExtent = False,
                       constrainRes = False, projection = False, alignExtent = True):
         """!Set properies of map display window"""
-        self.statusbarWin['render'].SetValue(render)
-        self.statusbarWin['toggle'].SetSelection(mode)
+        self.SetProperty('render', render)
+        self.statusbarManager.SetMode(mode)
         self.StatusbarUpdate()
-        self.statusbarWin['region'].SetValue(showCompExtent)
-        self.statusbarWin['alignExtent'].SetValue(alignExtent)
-        self.statusbarWin['resolution'].SetValue(constrainRes)
-        self.statusbarWin['projection'].SetValue(projection)
-        if showCompExtent:
-            self.MapWindow.regionCoords = []
+        self.SetProperty('region', showCompExtent)
+        self.SetProperty('alignExtent', alignExtent)
+        self.SetProperty('resolution', constrainRes)
+        self.SetProperty('projection', projection)
         
     def IsStandalone(self):
         """!Check if Map display is standalone"""
@@ -2006,6 +1669,10 @@
         """
         return self._layerManager
     
+    def GetMapToolbar(self):
+        """!Returns toolbar with zooming tools"""
+        return self.toolbars['map']
+    
 # end of class MapFrame
 
 class MapApp(wx.App):

Added: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_statusbar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_statusbar.py	                        (rev 0)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_statusbar.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -0,0 +1,1059 @@
+"""!
+ at package mapdisp_statusbar.py
+
+ at brief Classes for statusbar management
+
+Classes:
+ - SbException
+ - SbManager
+ - SbItem
+ - SbRender
+ - SbShowRegion
+ - SbAlignExtent
+ - SbResolution
+ - SbMapScale
+ - SbGoTo
+ - SbProjection
+ - SbMask
+ - SbTextItem
+ - SbDisplayGeometry
+ - SbCoordinates
+ - SbRegionExtent
+ - SbCompRegionExtent
+ - SbProgress
+
+
+(C) 2006-2011 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
+
+ at author Vaclav Petras <wenzeslaus gmail.com>
+ at author Anna Kratochvilova <kratochanna gmail.com>
+"""
+
+import wx
+
+import utils
+import gcmd
+from grass.script import core as grass
+from preferences import globalSettings as UserSettings
+
+class SbException:
+    """! Exception class used in SbManager and SbItems"""
+    def __init__(self, message):
+        self.message = message
+    def __str__(self):
+        return self.message
+
+
+class SbManager:
+    """!Statusbar manager for wx.Statusbar and SbItems.
+    
+    Statusbar manager manages items added by AddStatusbarItem method.
+    Provides progress bar (SbProgress) and choice (wx.Choice).
+    Items with position 0 are shown according to choice selection.
+    Only one item of the same class is supposed to be in statusbar.
+    Manager user have to create statusbar on his own, add items to manager
+    and call Update method to show particular widgets.
+    User settings (group = 'display', key = 'statusbarMode', subkey = 'selection')
+    are taken into account.
+    
+    @todo generalize access to UserSettings (specify group, etc.) 
+    @todo add GetMode method using name instead of index
+    """
+    def __init__(self, mapframe, statusbar):
+        """!Connects manager to statusbar
+        
+        Creates choice and progress bar.
+        """
+        self.mapFrame = mapframe
+        self.statusbar = statusbar
+        
+        self.choice = wx.Choice(self.statusbar, wx.ID_ANY)
+        
+        self.choice.Bind(wx.EVT_CHOICE, self.OnToggleStatus)
+        
+        self.statusbarItems = dict()
+        
+        self._postInitialized = False
+        
+        self.progressbar = SbProgress(self.mapFrame, self.statusbar)
+        
+        self._hiddenItems = {}
+    
+    def SetProperty(self, name, value):
+        """!Sets property represented by one of contained SbItems
+            
+        @param name name of SbItem (from name attribute)
+        @param value value to be set
+        """
+        self.statusbarItems[name].SetValue(value)
+        
+    def GetProperty(self, name):
+        """!Returns property represented by one of contained SbItems
+        
+        @param name name of SbItem (from name attribute)
+        """
+        return self.statusbarItems[name].GetValue()
+        
+    def HasProperty(self, name):
+        """!Checks whether property is represented by one of contained SbItems
+        
+        @param name name of SbItem (from name attribute)
+        
+        @returns True if particular SbItem is contained, False otherwise
+        """
+        if name in self.statusbarItems:
+            return True
+        return False
+    
+    def AddStatusbarItem(self, item):
+        """!Adds item to statusbar
+        
+        If item position is 0, item is managed by choice.
+        
+        @see AddStatusbarItemsByClass
+        """
+        self.statusbarItems[item.name] = item
+        if item.GetPosition() == 0:
+            self.choice.Append(item.label, clientData = item) #attrError?
+            
+    def AddStatusbarItemsByClass(self, itemClasses, **kwargs):
+        """!Adds items to statusbar
+
+        @param itemClasses list of classes of items to be add
+        @param kwargs SbItem constructor parameters
+        
+        @see AddStatusbarItem
+        """
+        for Item in itemClasses:
+            item = Item(**kwargs)
+            self.AddStatusbarItem(item)
+                      
+    def HideStatusbarChoiceItemsByClass(self, itemClasses):
+        """!Hides items showed in choice
+        
+        Hides items with position 0 (items showed in choice) by removing
+        them from choice.
+        
+        @param itemClasses list of classes of items to be hided
+        
+        @see ShowStatusbarChoiceItemsByClass
+        @todo consider adding similar function which would take item names
+        """
+        index = []
+        for itemClass in itemClasses:
+            for i in range(0, self.choice.GetCount() - 1):
+                item = self.choice.GetClientData(i)
+                if item.__class__ == itemClass:
+                    index.append(i)
+                    self._hiddenItems[i] = item
+        # must be sorted in reverse order to be removed correctly
+        for i in sorted(index, reverse = True):
+            self.choice.Delete(i)
+        
+    def ShowStatusbarChoiceItemsByClass(self, itemClasses):
+        """!Shows items showed in choice
+        
+        Shows items with position 0 (items showed in choice) by adding
+        them to choice.
+        Items are restored in their old positions.
+        
+        @param itemClasses list of classes of items to be showed
+        
+        @see HideStatusbarChoiceItemsByClass
+        """
+        # must be sorted to be inserted correctly
+        for pos in sorted(self._hiddenItems.keys()):
+            item = self._hiddenItems[pos]
+            if item.__class__ in itemClasses:
+                self.choice.Insert(item.label, pos, item)
+        
+    def ShowItem(self, itemName):
+        """!Invokes showing of particular item
+        
+        @see Update
+        """
+        self.statusbarItems[itemName].Show()
+        
+    def _postInit(self):
+        """!Post-initialization method
+        
+        It sets internal user settings,
+        set choice's selection (from user settings) and does reposition.
+        It needs choice filled by items.
+        it is called automatically.
+        """
+        UserSettings.Set(group = 'display',
+                         key = 'statusbarMode',
+                         subkey = 'choices',
+                         value = self.choice.GetItems(),
+                         internal = True)
+        
+        self.choice.SetSelection(UserSettings.Get(group = 'display',
+                                                  key = 'statusbarMode',
+                                                  subkey = 'selection')) 
+        self.Reposition()
+        
+        self._postInitialized = True
+        
+    def Update(self):
+        """!Updates statusbar
+
+        It always updates mask.
+        """
+        if not self._postInitialized:
+            self._postInit()
+        
+        for item in self.statusbarItems.values():
+            if item.GetPosition() == 0:
+                item.Hide()
+            else:
+                item.Update() # mask, render
+        
+        if self.choice.GetCount() > 0:
+            item = self.choice.GetClientData(self.choice.GetSelection())
+            item.Update()
+        
+    def Reposition(self):
+        """!Reposition items in statusbar
+        
+        Set positions to all items managed by statusbar manager.
+        It should not be necessary to call it manually.
+        """
+        
+        widgets = []
+        for item in self.statusbarItems.values():
+            widgets.append((item.GetPosition(), item.GetWidget()))
+            
+        widgets.append((1, self.choice))
+        widgets.append((0, self.progressbar.GetWidget()))
+                
+        for idx, win in widgets:
+            if not win:
+                continue
+            rect = self.statusbar.GetFieldRect(idx)
+            if idx == 0: # show region / mapscale / process bar
+                # -> size
+                wWin, hWin = win.GetBestSize()
+                if win == self.progressbar.GetWidget():
+                    wWin = rect.width - 6
+                # -> position
+                # if win == self.statusbarWin['region']:
+                # x, y = rect.x + rect.width - wWin, rect.y - 1
+                # align left
+                # else:
+                x, y = rect.x + 3, rect.y - 1
+                w, h = wWin, rect.height + 2
+            else: # choice || auto-rendering
+                x, y = rect.x, rect.y - 1
+                w, h = rect.width, rect.height + 2
+                if idx == 2: # mask
+                    x += 5
+                    y += 4
+                elif idx == 3: # render
+                    x += 5
+            win.SetPosition((x, y))
+            win.SetSize((w, h))
+        
+    def GetProgressBar(self):
+        """!Returns progress bar"""
+        return self.progressbar
+    
+    def OnToggleStatus(self, event):
+        """!Toggle status text
+        """
+        self.Update()
+        
+    def SetMode(self, modeIndex):
+        """!Sets current mode
+        
+        Mode is usually driven by user through choice.
+        """
+        self.choice.SetSelection(modeIndex)
+    
+    def GetMode(self):
+        """!Returns current mode"""
+        return self.choice.GetSelection()
+
+class SbItem:
+    """!Base class for statusbar items.
+    
+    Each item represents functionality (or action) controlled by statusbar
+    and related to MapFrame.
+    One item is usually connected with one widget but it is not necessary.
+    Item can represent property (depends on manager).
+    Items are not widgets but can provide interface to them.
+    Items usually has requirements to MapFrame instance
+    (specified as MapFrame.methodname or MapWindow.methodname).
+    
+    @todo consider externalizing position (see SbProgress use in SbManager)
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        """!
+        
+        @param mapframe instance of class with MapFrame interface
+        @param statusbar statusbar instance (wx.Statusbar)
+        @param position item position in statusbar
+        
+        @todo rewrite Update also in derived classes to take in account item position
+        """
+        self.mapFrame = mapframe
+        self.statusbar = statusbar
+        self.position = position
+    
+    def Show(self):
+        """!Invokes showing of underlying widget.
+        
+        In derived classes it can do what is appropriate for it,
+        e.g. showing text on statusbar (only).
+        """
+        self.widget.Show()
+        
+    def Hide(self):
+        self.widget.Hide()
+        
+    def SetValue(self, value):
+        self.widget.SetValue(value)
+    
+    def GetValue(self):
+        return self.widget.GetValue()
+        
+    def GetPosition(self):
+        return self.position
+    
+    def GetWidget(self):
+        """!Returns underlaying winget.
+        
+        @return widget or None if doesn't exist
+        """
+        return self.widget
+    
+    def _update(self, longHelp):
+        """!Default implementation for Update method.
+        
+        @param longHelp True to enable long help (help from toolbars)
+        """
+        self.statusbar.SetStatusText("", 0)
+        self.Show()
+        self.mapFrame.StatusbarEnableLongHelp(longHelp)
+        
+    def Update(self):
+        """!Called when statusbar action is activated (e.g. through wx.Choice).
+        """
+        self._update(longHelp = False)
+
+class SbRender(SbItem):
+    """!Checkbox to enable and disable auto-rendering.
+    
+    Requires MapFrame.OnRender method.
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'render'
+        
+        self.widget = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+                                  label = _("Render"))
+        
+        self.widget.SetValue(UserSettings.Get(group = 'display',
+                                              key = 'autoRendering',
+                                              subkey = 'enabled'))
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("Enable/disable auto-rendering")))
+                                            
+        self.widget.Bind(wx.EVT_CHECKBOX, self.OnToggleRender)
+        
+    def OnToggleRender(self, event):
+        # (other items should call self.mapFrame.IsAutoRendered())
+        if self.GetValue():
+            self.mapFrame.OnRender(None)
+
+    def Update(self):
+        self.Show()
+        
+class SbShowRegion(SbItem):
+    """!Checkbox to enable and disable showing of computational region.
+    
+    Requires MapFrame.OnRender, MapFrame.IsAutoRendered, MapFrame.GetWindow.
+    Expects that instance returned by MapFrame.GetWindow will handle
+    regionCoords attribute. 
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'region'
+        self.label = _("Show comp. extent")
+        
+        self.widget = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+                                  label = _("Show computational extent"))
+        
+        self.widget.SetValue(False)
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("Show/hide computational "
+                                             "region extent (set with g.region). "
+                                             "Display region drawn as a blue box inside the "
+                                             "computational region, "
+                                             "computational region inside a display region "
+                                             "as a red box).")))
+                                            
+        self.widget.Bind(wx.EVT_CHECKBOX, self.OnToggleShowRegion)
+    
+    def OnToggleShowRegion(self, event):
+        """!Shows/Hides extent (comp. region) in map canvas.
+        
+        Shows or hides according to checkbox value.
+        """
+        if self.widget.GetValue():
+            # show extent
+            self.mapFrame.GetWindow().regionCoords = []
+        elif hasattr(self.mapFrame.GetWindow(), 'regionCoords'):
+            del self.mapFrame.GetWindow().regionCoords
+
+        # redraw map if auto-rendering is enabled
+        if self.mapFrame.IsAutoRendered():
+            self.mapFrame.OnRender(None)
+
+    def SetValue(self, value):
+        SbItem.SetValue(self, value)
+        if value:
+            self.mapFrame.GetWindow().regionCoords = []
+        elif hasattr(self.mapFrame.GetWindow(), 'regionCoords'):
+            del self.mapFrame.GetWindow().regionCoords
+            
+class SbAlignExtent(SbItem):
+    """!Checkbox to select zoom behavior.
+    
+    Used by BufferedWindow (through MapFrame property).
+    See tooltip for explanation.
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'alignExtent'
+        self.label = _("Display mode")
+        
+        self.widget = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+                                  label = _("Align region extent based on display size"))
+        
+        self.widget.SetValue(UserSettings.Get(group = 'display', key = 'alignExtent', subkey = 'enabled'))
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("Align region extent based on display "
+                                             "size from center point. "
+                                             "Default value for new map displays can "
+                                             "be set up in 'User GUI settings' dialog.")))      
+        
+class SbResolution(SbItem):
+    """!Checkbox to select used display resolution.
+    
+    Requires MapFrame.OnRender method. 
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'resolution'
+        self.label = _("Display resolution")
+        
+        self.widget = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+                                  label = _("Constrain display resolution to computational settings"))
+        
+        self.widget.SetValue(UserSettings.Get(group = 'display', key = 'compResolution', subkey = 'enabled'))
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("Constrain display resolution "
+                                             "to computational region settings. "
+                                             "Default value for new map displays can "
+                                             "be set up in 'User GUI settings' dialog.")))
+                                            
+        self.widget.Bind(wx.EVT_CHECKBOX, self.OnToggleUpdateMap)
+        
+    def OnToggleUpdateMap(self, event):
+        """!Update display when toggle display mode
+        """
+        # redraw map if auto-rendering is enabled
+        if self.mapFrame.IsAutoRendered():
+            self.mapFrame.OnRender(None)
+
+
+class SbMapScale(SbItem):
+    """!Editable combobox to get/set current map scale.
+    
+    Requires MapFrame.GetMapScale, MapFrame.SetMapScale
+    and MapFrame.GetWindow (and GetWindow().UpdateMap()).
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'mapscale'
+        self.label = _("Map scale")
+        
+        self.widget = wx.ComboBox(parent = self.statusbar, id = wx.ID_ANY,
+                                                    style = wx.TE_PROCESS_ENTER,
+                                                    size = (150, -1))
+        
+        self.widget.SetItems(['1:1000',
+                              '1:5000',
+                              '1:10000',
+                              '1:25000',
+                              '1:50000',
+                              '1:100000',
+                              '1:1000000'])
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("As everyone's monitors and resolutions "
+                                            "are set differently these values are not "
+                                            "true map scales, but should get you into "
+                                            "the right neighborhood.")))
+                                            
+        self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnChangeMapScale)
+        self.widget.Bind(wx.EVT_COMBOBOX, self.OnChangeMapScale)
+        
+        self.lastMapScale = None
+
+    def Update(self):
+        scale = self.mapFrame.GetMapScale()
+        self.statusbar.SetStatusText("")
+        try:
+            self.SetValue("1:%ld" % (scale + 0.5))
+        except TypeError:
+            pass # FIXME, why this should happen?
+        
+        self.lastMapScale = scale
+        self.Show()
+
+        # disable long help
+        self.mapFrame.StatusbarEnableLongHelp(False)
+
+    def OnChangeMapScale(self, event):
+        """!Map scale changed by user
+        """
+        scale = event.GetString()
+
+        try:
+            if scale[:2] != '1:':
+                raise ValueError
+            value = int(scale[2:])
+        except ValueError:
+            self.SetValue('1:%ld' % int(self.lastMapScale))
+            return
+        
+        self.mapFrame.SetMapScale(value)
+        
+        # redraw a map
+        self.mapFrame.GetWindow().UpdateMap()
+        self.GetWidget().SetFocus()
+        
+        
+class SbGoTo(SbItem):
+    """!Textctrl to set coordinates which to focus on.
+    
+    Requires MapFrame.GetWindow, MapWindow.GoTo method.
+    """
+    
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'goto'
+        self.label = _("Go to")
+        
+        self.widget = wx.TextCtrl(parent = self.statusbar, id = wx.ID_ANY,
+                                                value = "", style = wx.TE_PROCESS_ENTER,
+                                                size = (300, -1))
+        
+        self.widget.Hide()
+        
+        self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnGoTo)
+    
+    def ReprojectENToMap(self, e, n, useDefinedProjection):
+        """!Reproject east, north from user defined projection
+        
+        @param e,n coordinate (for DMS string, else float or string)
+        @param useDefinedProjection projection defined by user in settings dialog
+        
+        @throws SbException if useDefinedProjection is True and projection is not defined in UserSettings
+        """
+        if useDefinedProjection:
+            settings = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4')
+            if not settings:
+                raise SbException(_("Projection not defined (check the settings)"))
+            else:
+                # reproject values
+                projIn = settings
+                projOut = gcmd.RunCommand('g.proj',
+                                          flags = 'jf',
+                                          read = True)
+                proj = projIn.split(' ')[0].split('=')[1]
+                if proj in ('ll', 'latlong', 'longlat'):
+                    e, n = utils.DMS2Deg(e, n)
+                    proj, coord1 = utils.ReprojectCoordinates(coord = (e, n),
+                                                              projIn = projIn,
+                                                              projOut = projOut, flags = 'd')
+                    e, n = coord1
+                else:
+                    e, n = float(e), float(n)
+                    proj, coord1 = utils.ReprojectCoordinates(coord = (e, n),
+                                                              projIn = projIn,
+                                                              projOut = projOut, flags = 'd')
+                    e, n = coord1
+        elif self.mapFrame.GetMap().projinfo['proj'] == 'll':
+            e, n = utils.DMS2Deg(e, n)
+        else: 
+            e, n = float(e), float(n)
+        return e, n
+
+    def OnGoTo(self, event):
+        """!Go to position
+        """
+        try:
+            e, n = self.GetValue().split(';')
+            e, n = self.ReprojectENToMap(e, n, self.mapFrame.GetProperty('projection'))
+            self.mapFrame.GetWindow().GoTo(e, n)
+            self.widget.SetFocus()
+        except ValueError:
+            # FIXME: move this code to MapWindow/BufferedWindow/MapFrame
+            region = self.mapFrame.GetMap().GetCurrentRegion()
+            precision = int(UserSettings.Get(group = 'projection', key = 'format',
+                                             subkey = 'precision'))
+            format = UserSettings.Get(group = 'projection', key = 'format',
+                                      subkey = 'll')
+            if self.mapFrame.GetMap().projinfo['proj'] == 'll' and format == 'DMS':
+                    self.SetValue("%s" % utils.Deg2DMS(region['center_easting'], 
+                                                                            region['center_northing'],
+                                                                            precision = precision))
+            else:
+                self.SetValue("%.*f; %.*f" % \
+                               (precision, region['center_easting'],
+                                precision, region['center_northing']))
+        except SbException, e:
+            # FIXME: this may be useless since statusbar update checks user defined projection and this exception raises when user def proj does not exists
+            self.statusbar.SetStatusText(str(e), 0)
+
+    def GetCenterString(self, map):
+        """!Get current map center in appropriate format"""
+        region = map.GetCurrentRegion()
+        precision = int(UserSettings.Get(group = 'projection', key = 'format',
+                                         subkey = 'precision'))
+        format = UserSettings.Get(group = 'projection', key = 'format',
+                                  subkey = 'll')
+        projection = UserSettings.Get(group='projection', key='statusbar', subkey='proj4')
+        
+        if self.mapFrame.GetProperty('projection'):
+            if not projection:
+                raise SbException(_("Projection not defined (check the settings)"))
+            else:
+                proj, coord  = utils.ReprojectCoordinates(coord = (region['center_easting'],
+                                                                   region['center_northing']),
+                                                          projOut = projection,
+                                                          flags = 'd')
+                if coord:
+                    if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
+                        return "%s" % utils.Deg2DMS(coord[0],
+                                                                                coord[1],
+                                                                                precision = precision)
+                    else:
+                        return "%.*f; %.*f" % (precision, coord[0], precision, coord[1])
+                else:
+                    raise SbException(_("Error in projection (check the settings)"))
+        else:
+            if self.mapFrame.GetMap().projinfo['proj'] == 'll' and format == 'DMS':
+                return "%s" % utils.Deg2DMS(region['center_easting'], region['center_northing'],
+                                                                      precision = precision)
+            else:
+                return "%.*f; %.*f" % (precision, region['center_easting'], precision, region['center_northing'])
+
+
+    def SetCenter(self):
+        """!Set current map center as item value"""
+        center = self.GetCenterString(self.mapFrame.GetMap())
+        self.SetValue(center)
+        
+    def Update(self):
+        self.statusbar.SetStatusText("")
+        
+        try:
+            self.SetCenter()
+            self.Show()
+        except SbException, e:
+            self.statusbar.SetStatusText(str(e), 0)
+                        
+        # disable long help
+        self.mapFrame.StatusbarEnableLongHelp(False)
+        
+
+class SbProjection(SbItem):
+    """!Checkbox to enable user defined projection (can be set in settings)"""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'projection'
+        self.label = _("Projection")
+        
+        self.defaultLabel = _("Use defined projection")
+        
+        self.widget = wx.CheckBox(parent = self.statusbar, id = wx.ID_ANY,
+                                  label = self.defaultLabel)
+        
+        self.widget.SetValue(False)
+        
+        # necessary?
+        size = self.widget.GetSize()
+        self.widget.SetMinSize((size[0] + 150, size[1]))
+        
+        self.widget.Hide()
+        self.widget.SetToolTip(wx.ToolTip (_("Reproject coordinates displayed "
+                                             "in the statusbar. Projection can be "
+                                             "defined in GUI preferences dialog "
+                                             "(tab 'Projection')")))
+                                            
+    def Update(self):
+        self.statusbar.SetStatusText("")
+        epsg = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'epsg')
+        if epsg:
+            label = '%s (EPSG: %s)' % (self.defaultLabel, epsg)
+            self.widget.SetLabel(label)
+        else:
+            self.widget.SetLabel(self.defaultLabel)
+        self.Show()
+        
+        # disable long help
+        self.mapFrame.StatusbarEnableLongHelp(False)
+        
+
+class SbMask(SbItem):
+    """!StaticText to show whether mask is activated."""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'mask'
+        
+        self.widget = wx.StaticText(parent = self.statusbar, id = wx.ID_ANY, label = _('MASK'))
+        self.widget.SetForegroundColour(wx.Colour(255, 0, 0))
+        self.widget.Hide()
+        
+    def Update(self):
+        if grass.find_file(name = 'MASK', element = 'cell')['name']:
+            self.Show()
+        else:
+            self.Hide()
+        
+class SbTextItem(SbItem):
+    """!Base class for items without widgets.
+    
+    Only sets statusbar text.
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        
+        self.text = None
+        
+    def Show(self):
+        self.statusbar.SetStatusText(self.GetValue(), self.position)
+        
+    def Hide(self):
+        self.statusbar.SetStatusText("", self.position)
+        
+    def SetValue(self, value):
+        self.text = value
+    
+    def GetValue(self):
+        return self.text
+            
+    def GetWidget(self):
+        return None
+    
+    def Update(self):
+        self._update(longHelp = True)
+
+class SbDisplayGeometry(SbTextItem):
+    """!Show current display resolution."""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbTextItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'displayGeometry'
+        self.label = _("Display geometry")
+        
+    def Show(self):
+        region = self.mapFrame.GetMap().GetCurrentRegion()
+        self.SetValue("rows=%d; cols=%d; nsres=%.2f; ewres=%.2f" %
+                     (region["rows"], region["cols"],
+                      region["nsres"], region["ewres"]))
+        SbTextItem.Show(self)
+
+class SbCoordinates(SbTextItem):
+    """!Show map coordinates when mouse moves.
+    
+    Requires MapWindow.GetLastEN method."""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbTextItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'coordinates'
+        self.label = _("Coordinates")
+        
+    def Show(self):
+        precision = int(UserSettings.Get(group = 'projection', key = 'format',
+                             subkey = 'precision'))
+        format = UserSettings.Get(group = 'projection', key = 'format',
+                                       subkey = 'll')
+        projection = self.mapFrame.GetProperty('projection')
+        try:
+            e, n = self.mapFrame.GetWindow().GetLastEN()
+            self.SetValue(self.ReprojectENFromMap(e, n, projection, precision, format))
+        except SbException, e:
+            self.SetValue(e)
+        except TypeError, e:
+            self.SetValue("")
+        except AttributeError:
+            self.SetValue("") # during initialization MapFrame has no MapWindow
+        SbTextItem.Show(self)
+        
+    def ReprojectENFromMap(self, e, n, useDefinedProjection, precision, format):
+        """!Reproject east, north to user defined projection.
+        
+        @param e,n coordinate
+        
+        @throws SbException if useDefinedProjection is True and projection is not defined in UserSettings
+        """
+        if useDefinedProjection:
+            settings = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4')
+            if not settings:
+                raise SbException(_("Projection not defined (check the settings)"))
+            else:
+                # reproject values
+                proj, coord  = utils.ReprojectCoordinates(coord = (e, n),
+                                                          projOut = settings,
+                                                          flags = 'd')
+                if coord:
+                    e, n = coord
+                    if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
+                        return utils.Deg2DMS(e, n, precision = precision)
+                    else:
+                        return "%.*f; %.*f" % (precision, e, precision, n)
+                else:
+                    raise SbException(_("Error in projection (check the settings)"))
+        else:
+            if self.mapFrame.GetMap().projinfo['proj'] == 'll' and format == 'DMS':
+                return utils.Deg2DMS(e, n, precision = precision)
+            else:
+                return "%.*f; %.*f" % (precision, e, precision, n)
+        
+class SbRegionExtent(SbTextItem):
+    """!Shows current display region"""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbTextItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'displayRegion'
+        self.label = _("Extent")
+        
+    def Show(self):
+        precision = int(UserSettings.Get(group = 'projection', key = 'format',
+                             subkey = 'precision'))
+        format = UserSettings.Get(group = 'projection', key = 'format',
+                                       subkey = 'll')
+        projection = self.mapFrame.GetProperty('projection')        
+        region = self._getRegion()
+        try:
+            regionReprojected = self.ReprojectRegionFromMap(region, projection, precision, format)
+            self.SetValue(regionReprojected)
+        except SbException, e:
+            self.SetValue(e)
+        SbTextItem.Show(self)
+    
+    def _getRegion(self):
+        """!Get current display region"""
+        return self.mapFrame.GetMap().GetCurrentRegion() # display region
+        
+    def _formatRegion(self, w, e, s, n, nsres, ewres, precision = None):
+        """!Format display region string for statusbar
+
+        @param nsres,ewres unused
+        """
+        if precision is not None:
+            return "%.*f - %.*f, %.*f - %.*f" % (precision, w, precision, e,
+                                                 precision, s, precision, n)
+        else:
+            return "%s - %s, %s - %s" % (w, e, s, n)
+         
+           
+    def ReprojectRegionFromMap(self, region, useDefinedProjection, precision, format):
+        """!Reproject region values
+        
+        @todo reorganize this method to remove code useful only for derived class SbCompRegionExtent
+        """
+        if useDefinedProjection:
+            settings = UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4')
+            
+            if not settings:
+                raise SbException(_("Projection not defined (check the settings)"))
+            else:
+                projOut = settings
+                proj, coord1 = utils.ReprojectCoordinates(coord = (region["w"], region["s"]),
+                                                          projOut = projOut, flags = 'd')
+                proj, coord2 = utils.ReprojectCoordinates(coord = (region["e"], region["n"]),
+                                                          projOut = projOut, flags = 'd')
+                # useless, used in derived class
+                proj, coord3 = utils.ReprojectCoordinates(coord = (0.0, 0.0),
+                                                          projOut = projOut, flags = 'd')
+                proj, coord4 = utils.ReprojectCoordinates(coord = (region["ewres"], region["nsres"]),
+                                                          projOut = projOut, flags = 'd')
+                if coord1 and coord2:
+                    if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
+                        w, s = utils.Deg2DMS(coord1[0], coord1[1], string = False,
+                                             precision = precision)
+                        e, n = utils.Deg2DMS(coord2[0], coord2[1], string = False,
+                                             precision = precision)
+                        ewres, nsres = utils.Deg2DMS(abs(coord3[0]) - abs(coord4[0]),
+                                                         abs(coord3[1]) - abs(coord4[1]),
+                                                         string = False, hemisphere = False,
+                                                         precision = precision)
+                        return self._formatRegion(w = w, s = s, e = e, n = n, ewres = ewres, nsres = nsres)
+                    else:
+                        w, s = coord1
+                        e, n = coord2
+                        ewres, nsres = coord3
+                        return self._formatRegion(w = w, s = s, e = e, n = n, ewres = ewres,
+                                                  nsres = nsres, precision = precision)
+                else:
+                    raise SbException(_("Error in projection (check the settings)"))
+                
+        else:
+            if self.mapFrame.GetMap().projinfo['proj'] == 'll' and format == 'DMS':
+                w, s = utils.Deg2DMS(region["w"], region["s"],
+                                     string = False, precision = precision)
+                e, n = utils.Deg2DMS(region["e"], region["n"],
+                                     string = False, precision = precision)
+                ewres, nsres = utils.Deg2DMS(region['ewres'], region['nsres'],
+                                             string = False, precision = precision)
+                return self._formatRegion(w = w, s = s, e = e, n = n, ewres = ewres, nsres = nsres)
+            else:
+                w, s = region["w"], region["s"]
+                e, n = region["e"], region["n"]
+                ewres, nsres = region['ewres'], region['nsres']
+                return self._formatRegion(w = w, s = s, e = e, n = n, ewres = ewres,
+                                          nsres = nsres, precision = precision)
+                                
+                                
+class SbCompRegionExtent(SbRegionExtent):
+    """!Shows computational region."""
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbRegionExtent.__init__(self, mapframe, statusbar, position)
+        self.name = 'computationalRegion'
+        self.label = _("Comp. region")
+        
+    def _formatRegion(self, w, e, s, n, ewres, nsres, precision = None):
+        """!Format computational region string for statusbar"""
+        if precision is not None:
+            return "%.*f - %.*f, %.*f - %.*f (%.*f, %.*f)" % (precision, w, precision, e,
+                                                              precision, s, precision, n,
+                                                              precision, ewres, precision, nsres)
+        else:
+            return "%s - %s, %s - %s (%s, %s)" % (w, e, s, n, ewres, nsres)
+        
+    def _getRegion(self):
+        """!Returns computational region."""
+        return self.mapFrame.GetMap().GetRegion() # computational region
+        
+        
+class SbProgress(SbItem):
+    """!General progress bar to show progress.
+    
+    Underlaying widget is wx.Gauge.
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'progress'
+
+        # on-render gauge
+        self.widget = wx.Gauge(parent = self.statusbar, id = wx.ID_ANY,
+                                      range = 0, style = wx.GA_HORIZONTAL)
+        self.widget.Hide()
+        
+    def GetRange(self):
+        """!Returns progress range."""
+        return self.widget.GetRange()
+    
+    def SetRange(self, range):
+        """!Sets progress range."""
+        self.widget.SetRange(range)
+    
+
+class SbGoToGCP(SbItem):
+    """!SpinCtrl to select GCP to focus on
+    
+    Requires MapFrame.GetSrcWindow, MapFrame.GetTgtWindow, MapFrame.GetListCtrl,
+    MapFrame.GetMapCoordList.
+    """
+    
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'gotoGCP'
+        self.label = _("Go to GCP No.")
+
+        self.widget = wx.SpinCtrl(parent = self.statusbar, id = wx.ID_ANY,
+                                                value = "", min = 0)
+        self.widget.Hide()
+        
+        self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnGoToGCP)
+        self.widget.Bind(wx.EVT_SPINCTRL, self.OnGoToGCP)
+    
+    def OnGoToGCP(self, event):
+        """!Zooms to given GCP."""
+        GCPNo = self.GetValue()
+        mapCoords = self.mapFrame.GetMapCoordList()
+        
+        if GCPNo < 0 or GCPNo > len(mapCoords): # always false, spin checks it
+            gcmd.GMessage(parent=self,
+                          message="%s 1 - %s." % (_("Valid Range:"),
+                          len(mapCoords)))
+            return
+
+        if GCPNo == 0:
+            return
+            
+        listCtrl = self.mapFrame.GetListCtrl()
+        
+        listCtrl.selectedkey = GCPNo
+        listCtrl.selected = listCtrl.FindItemData(-1, GCPNo)
+        listCtrl.render = False
+        listCtrl.SetItemState(listCtrl.selected,
+                          wx.LIST_STATE_SELECTED,
+                          wx.LIST_STATE_SELECTED)
+        listCtrl.render = True
+        
+        srcWin = self.mapFrame.GetSrcWindow()
+        tgtWin = self.mapFrame.GetTgtWindow()
+        
+        # Source MapWindow:
+        begin = (mapCoords[GCPNo][1], mapCoords[GCPNo][2])
+        begin = srcWin.Cell2Pixel(begin)
+        end = begin
+        srcWin.Zoom(begin, end, 0)
+
+        # redraw map
+        srcWin.UpdateMap()
+
+        if self.mapFrame.GetShowTarget():
+            # Target MapWindow:
+            begin = (mapCoords[GCPNo][3], mapCoords[GCPNo][4])
+            begin = tgtWin.Cell2Pixel(begin)
+            end = begin
+            tgtWin.Zoom(begin, end, 0)
+
+            # redraw map
+            tgtWin.UpdateMap()
+
+        self.GetWidget().SetFocus()
+    
+    def Update(self):
+        self.statusbar.SetStatusText("")
+        max = self.mapFrame.GetListCtrl().GetItemCount()
+        if max < 1:
+            max = 1
+        self.widget.SetRange(0, max)
+        self.Show()
+                        
+        # disable long help
+        self.mapFrame.StatusbarEnableLongHelp(False)
+        
+class SbRMSError(SbTextItem):
+    """!Shows RMS error.
+    
+    Requires MapFrame.GetFwdError, MapFrame.GetBkwError.
+    """
+    def __init__(self, mapframe, statusbar, position = 0):
+        SbTextItem.__init__(self, mapframe, statusbar, position)
+        self.name = 'RMSError'
+        self.label = _("RMS error")
+        
+    def Show(self):
+        self.SetValue(_("Forward: %(forw)s, Backward: %(back)s") %
+                                   { 'forw' : self.mapFrame.GetFwdError(),
+                                     'back' : self.mapFrame.GetBkwError() })
+        SbTextItem.Show(self)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -40,7 +40,7 @@
                                 style, **kwargs)
         
         self.pdcVector = wx.PseudoDC()
-        self.toolbar   = self.parent.toolbars['vdigit']
+        self.toolbar   = self.parent.GetToolbar('vdigit')
         self.digit     = None # wxvdigit.IVDigit
         
         self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
@@ -71,7 +71,7 @@
             distance_tot += self.Distance(self.polycoords[idx-1],
                                           self.polycoords[idx],
                                           screen = False)[0]
-        self.parent.statusbar.SetStatusText("%.*f, %.*f (seg: %.*f; tot: %.*f)" % \
+        self.parent.SetStatusText("%.*f, %.*f (seg: %.*f; tot: %.*f)" % \
                                                 (precision, e, precision, n,
                                                  precision, distance_seg,
                                                  precision, distance_tot), 0)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -50,8 +50,11 @@
     Superclass for BufferedWindow class (2D display mode), and GLWindow
     (3D display mode).
     
-    Subclasses have to define _bindMouseEvents() method which binds
-    MouseEvent handlers.
+    Subclasses have to define
+     - _bindMouseEvents method which binds MouseEvent handlers
+     - Pixel2Cell
+     - Cell2Pixel (if it is possible)
+    
     """
     def __init__(self, parent, id = wx.ID_ANY,
                  Map = None, tree = None, lmgr = None, **kwargs):
@@ -68,9 +71,11 @@
             'use'  : "pointer",
             'box'  : "point"
             }
+        # last east, north coordinates, changes on mouse motion
+        self.lastEN = None 
         
-        # stores overriden cursor
-        self._overridenCursor = None
+        # stores overridden cursor
+        self._overriddenCursor = None
 
     def RegisterMouseEventHandler(self, event, handler, cursor = None):
         """!Binds event handler
@@ -101,7 +106,7 @@
         @param handler function to handle event
         @param cursor cursor which temporary overrides current cursor
         
-        @return True if successfull
+        @return True if successful
         @return False if event cannot be bind
         """
         
@@ -115,7 +120,7 @@
         self.mouse['use'] = 'genericEvent'
         
         if cursor:
-            self._overridenCursor = self.GetCursor()
+            self._overriddenCursor = self.GetCursor()
             self.SetCursor(cursor)
         
         return True
@@ -129,13 +134,13 @@
         
         @param event event to unbind
         
-        @return True if successfull
+        @return True if successful
         @return False if event cannot be unbind
         """
         if hasattr(self, "digit"):
             return False
         
-        # it is not yet posible in wxPython to unbind exact event
+        # it is not yet possible in wxPython to unbind exact event
         ret = self.Unbind(event)
         
         # restore bind state
@@ -144,63 +149,47 @@
         # restore mouse use (previous state)
         self.mouse['use'] = self.mouse['useBeforeGenericEvent']
         
-        # restore overriden cursor
-        if self._overridenCursor:
-            self.SetCursor(self._overridenCursor)
+        # restore overridden cursor
+        if self._overriddenCursor:
+            self.SetCursor(self._overriddenCursor)
         
         return ret
+    
+    def Pixel2Cell(self, (x, y)):
+        raise NotImplementedError()
+    
+    def Cell2Pixel(self, (east, north)):
+        raise NotImplementedError()
 
-
     def OnMotion(self, event):
-        """!Track mouse motion and update statusbar
+        """!Tracks mouse motion and update statusbar
+        
+        @see GetLastEN
         """
-        if self.parent.statusbarWin['toggle'].GetSelection() == 0: # Coordinates
-            precision = int(UserSettings.Get(group = 'projection', key = 'format',
-                                             subkey = 'precision'))
-            format = UserSettings.Get(group = 'projection', key = 'format',
-                                      subkey = 'll')
-            try:
-                e, n = self.Pixel2Cell(event.GetPositionTuple())
-            except (TypeError, ValueError):
-                self.parent.statusbar.SetStatusText("", 0)
-                event.Skip()
-                return
-            
+        try:
+            self.lastEN = self.Pixel2Cell(event.GetPositionTuple())
+        except (ValueError):
+            self.lastEN = None
+        # FIXME: special case for vdigit and access to statusbarManager
+        if self.parent.statusbarManager.GetMode() == 0: # Coordinates            
             updated = False
             if hasattr(self, "digit"):
-                updated = self._onMotion((e, n), precision)
+                precision = int(UserSettings.Get(group = 'projection', key = 'format',
+                                             subkey = 'precision'))
+                updated = self._onMotion(self.lastEN, precision)
 
             if not updated:
-                if self.parent.statusbarWin['projection'].IsChecked():
-                    if not UserSettings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4'):
-                        self.parent.statusbar.SetStatusText(_("Projection not defined (check the settings)"), 0)
-                    else:
-                        proj, coord  = utils.ReprojectCoordinates(coord = (e, n),
-                                                                  projOut = UserSettings.Get(group = 'projection',
-                                                                                             key = 'statusbar',
-                                                                                             subkey = 'proj4'),
-                                                                  flags = 'd')
-                    
-                        if coord:
-                            e, n = coord
-                            if proj in ('ll', 'latlong', 'longlat') and format == 'DMS':
-                                self.parent.statusbar.SetStatusText(utils.Deg2DMS(e, n, precision = precision),
-                                                                    0)
-                            else:
-                                self.parent.statusbar.SetStatusText("%.*f; %.*f" % \
-                                                                        (precision, e, precision, n), 0)
-                        else:
-                            self.parent.statusbar.SetStatusText(_("Error in projection (check the settings)"), 0)
-                else:
-                    if self.parent.Map.projinfo['proj'] == 'll' and format == 'DMS':
-                        self.parent.statusbar.SetStatusText(utils.Deg2DMS(e, n, precision = precision),
-                                                            0)
-                    else:
-                        self.parent.statusbar.SetStatusText("%.*f; %.*f" % \
-                                                                (precision, e, precision, n), 0)
+                self.parent.CoordinatesChanged()
         
         event.Skip()
 
+    def GetLastEN(self):
+        """!Returns last coordinates of mouse cursor.
+        
+        @see OnMotion
+        """
+        return self.lastEN
+    
     def GetLayerByName(self, name, mapType, dataType = 'layer'):
         """!Get layer from layer tree by nam
         
@@ -227,7 +216,7 @@
             return self.tree.GetPyData(item)[0]['nviz']
         
         return item
-    
+        
     def GetSelectedLayer(self, type = 'layer', multi = False):
         """!Get selected layer from layer tree
         
@@ -748,9 +737,9 @@
         # initialize process bar (only on 'render')
         #
         if render or renderVector:
-            self.parent.statusbarWin['progress'].Show()
-            if self.parent.statusbarWin['progress'].GetRange() > 0:
-                self.parent.statusbarWin['progress'].SetValue(1)
+            self.parent.GetProgressBar().Show()
+            if self.parent.GetProgressBar().GetRange() > 0:
+                self.parent.GetProgressBar().SetValue(1)
         
         #
         # render background image if needed
@@ -767,7 +756,7 @@
             if render:
                 # update display size
                 self.Map.ChangeMapSize(self.GetClientSize())
-                if self.parent.statusbarWin['resolution'].IsChecked():
+                if self.parent.GetProperty('resolution'):
                     # use computation region resolution for rendering
                     windres = True
                 else:
@@ -831,20 +820,11 @@
         #
         if len(self.polycoords) > 0:
             self.DrawLines(self.pdcTmp)
-        
-        if not self.parent.IsStandalone() and \
-                self.parent.GetLayerManager().georectifying:
-            # -> georectifier (redraw GCPs)
-            if self.parent.toolbars['georect']:
-                coordtype = 'gcpcoord'
-            else:
-                coordtype = 'mapcoord'
-            self.parent.GetLayerManager().georectifying.DrawGCP(coordtype)
             
         if not self.parent.IsStandalone() and \
                 self.parent.GetLayerManager().gcpmanagement:
             # -> georectifier (redraw GCPs)
-            if self.parent.toolbars['gcpdisp']:
+            if self.parent.GetMapToolbar():
                 if self == self.parent.TgtMapWindow:
                     coordtype = 'target'
                 else:
@@ -868,18 +848,13 @@
         #
         # hide process bar
         #
-        self.parent.statusbarWin['progress'].Hide()
+        self.parent.GetProgressBar().Hide()
 
         #
         # update statusbar 
         #
         ### self.Map.SetRegion()
         self.parent.StatusbarUpdate()
-        if grass.find_file(name = 'MASK', element = 'cell')['name']:
-            # mask found
-            self.parent.statusbarWin['mask'].SetLabel(_('MASK'))
-        else:
-            self.parent.statusbarWin['mask'].SetLabel('')
         
         Debug.msg (1, "BufferedWindow.UpdateMap(): render=%s, renderVector=%s -> time=%g" % \
                    (render, renderVector, (stop-start)))
@@ -1339,7 +1314,7 @@
         elif self.mouse["use"] == "pointer" and \
                 self.parent.GetLayerManager().gcpmanagement:
             # -> GCP manager
-            if self.parent.toolbars['gcpdisp']:
+            if self.parent.GetToolbar('gcpdisp'):
                 coord = self.Pixel2Cell(self.mouse['end'])
                 if self.parent.MapWindow == self.parent.SrcMapWindow:
                     coordtype = 'source'
@@ -1348,19 +1323,7 @@
                 
                 self.parent.GetLayerManager().gcpmanagement.SetGCPData(coordtype, coord, self, confirm = True)
                 self.UpdateMap(render = False, renderVector = False)
-        
-        elif self.mouse["use"] == "pointer" and \
-                self.parent.GetLayerManager().georectifying:
-            # -> georectifying
-            coord = self.Pixel2Cell(self.mouse['end'])
-            if self.parent.toolbars['georect']:
-                coordtype = 'gcpcoord'
-            else:
-                coordtype = 'mapcoord'
             
-            self.parent.GetLayerManager().georectifying.SetGCPData(coordtype, coord, self)
-            self.UpdateMap(render = False, renderVector = False)
-            
         elif self.mouse["use"] == "pointer" and \
                 hasattr(self, "digit"):
             self._onLeftUp(event)
@@ -1476,7 +1439,7 @@
         """!Mouse entered window and no mouse buttons were pressed
         """
         if self.parent.GetLayerManager().gcpmanagement:
-            if self.parent.toolbars['gcpdisp']:
+            if self.parent.GetToolbar('gcpdisp'):
                 if not self.parent.MapWindow == self:
                     self.parent.MapWindow = self
                     self.parent.Map = self.Map
@@ -1643,8 +1606,8 @@
             self.Map.region['center_northing'] = cn
             self.Map.region['ewres'] = (newreg['e'] - newreg['w']) / self.Map.width
             self.Map.region['nsres'] = (newreg['n'] - newreg['s']) / self.Map.height
-            if 'alignExtent' not in self.parent.statusbarWin or \
-                    self.parent.statusbarWin['alignExtent'].IsChecked():
+            if not self.parent.HasProperty('alignExtent') or \
+                    self.parent.GetProperty('alignExtent'):
                 self.Map.AlignExtentFromDisplay()
             else:
                 for k in ('n', 's', 'e', 'w'):
@@ -1671,13 +1634,7 @@
         
         # disable tool if stack is empty
         if len(self.zoomhistory) < 2: # disable tool
-            if self.parent.GetName() == 'MapWindow':
-                toolbar = self.parent.toolbars['map']
-            elif self.parent.GetName() == 'GRMapWindow':
-                toolbar = self.parent.toolbars['georect']
-            elif self.parent.GetName() == 'GCPMapWindow':
-                toolbar = self.parent.toolbars['gcpdisp']
-            
+            toolbar = self.parent.GetMapToolbar()
             toolbar.Enable('zoomback', enable = False)
         
         # zoom to selected region
@@ -1716,12 +1673,7 @@
         else:
             enable = False
         
-        if self.parent.GetName() == 'MapWindow':
-            toolbar = self.parent.toolbars['map']
-        elif self.parent.GetName() == 'GRMapWindow':
-            toolbar = self.parent.toolbars['georect']
-        elif self.parent.GetName() == 'GCPMapWindow':
-            toolbar = self.parent.toolbars['gcpdisp']
+        toolbar = self.parent.GetMapToolbar()
         
         toolbar.Enable('zoomback', enable)
         
@@ -1805,7 +1757,27 @@
         self.UpdateMap()
         
         self.parent.StatusbarUpdate()
+    
+    
+    def GoTo(self, e, n):
+        region = self.Map.GetCurrentRegion()
+
+        region['center_easting'], region['center_northing'] = e, n
         
+        dn = (region['nsres'] * region['rows']) / 2.
+        region['n'] = region['center_northing'] + dn
+        region['s'] = region['center_northing'] - dn
+        de = (region['ewres'] * region['cols']) / 2.
+        region['e'] = region['center_easting'] + de
+        region['w'] = region['center_easting'] - de
+
+        self.Map.AdjustRegion()
+
+        # add to zoom history
+        self.ZoomHistory(region['n'], region['s'],
+                                   region['e'], region['w'])        
+        self.UpdateMap()
+    
     def DisplayToWind(self):
         """!Set computational region (WIND file) to match display
         extents

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -135,7 +135,7 @@
         os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True)
         
         self.nvizThread = NvizThread(logerr,
-                                     self.parent.statusbarWin['progress'],
+                                     self.parent.GetProgressBar(),
                                      logmsg)
         self.nvizThread.start()
         time.sleep(.1)
@@ -928,7 +928,7 @@
         
         # disable tool if stack is empty
         if len(self.viewhistory) < 2: # disable tool
-            toolbar = self.parent.toolbars['map']
+            toolbar = self.parent.GetMapToolbar()
             toolbar.Enable('zoomback', enable = False)
             
         # set view and update nviz view page
@@ -968,7 +968,7 @@
         else:
             enable = False
         
-        toolbar = self.parent.toolbars['map']
+        toolbar = self.parent.GetMapToolbar()
         toolbar.Enable('zoomback', enable)
         
         return removed     
@@ -1118,12 +1118,12 @@
         self.resize = False
         
         if self.render['quick'] is False:
-            self.parent.statusbarWin['progress'].Show()
-            self.parent.statusbarWin['progress'].SetRange(2)
-            self.parent.statusbarWin['progress'].SetValue(0)
+            self.parent.GetProgressBar().Show()
+            self.parent.GetProgressBar().SetRange(2)
+            self.parent.GetProgressBar().SetValue(0)
         
         if self.render['quick'] is False:
-            self.parent.statusbarWin['progress'].SetValue(1)
+            self.parent.GetProgressBar().SetValue(1)
             self._display.Draw(False, -1)
             if self.saveHistory:
                 self.ViewHistory(view = self.view, iview = self.iview)
@@ -1159,9 +1159,9 @@
         stop = time.clock()
         
         if self.render['quick'] is False:
-            self.parent.statusbarWin['progress'].SetValue(2)
+            self.parent.GetProgressBar().SetValue(2)
             # hide process bar
-            self.parent.statusbarWin['progress'].Hide()
+            self.parent.GetProgressBar().Hide()
         
         Debug.msg(3, "GLWindow.UpdateMap(): quick = %d, -> time = %g" % \
                       (self.render['quick'], (stop-start)))

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -460,12 +460,6 @@
                     'width' : 2,
                     },
                 },
-            'georect' : {
-                'symbol' : {
-                    'color' : (0, 0, 255, 255),
-                    'width' : 2,
-                    },
-                },
             'nviz' : {
                 'view' : {
                     'persp' : {
@@ -710,7 +704,7 @@
         self.internalSettings['appearance']['gSelectPopupHeight']['max'] = 1000
         
         self.internalSettings['display']['driver']['choices'] = ['default']
-        self.internalSettings['display']['statusbarMode']['choices'] = globalvar.MAP_DISPLAY_STATUSBAR_MODE
+        self.internalSettings['display']['statusbarMode']['choices'] = None # set during MapFrame init
 
         self.internalSettings['nviz']['view'] = {}
         self.internalSettings['nviz']['view']['twist'] = {}

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -598,6 +598,8 @@
         
         @return region settings as directory, e.g. {
         'n':'4928010', 's':'4913700', 'w':'589980',...}
+        
+        @see GetCurrentRegion()
         """
         region = {}
         
@@ -680,7 +682,10 @@
         return region
 
     def GetCurrentRegion(self):
-        """!Get current display region settings"""
+        """!Get current display region settings
+        
+        @see GetRegion()
+        """
         return self.region
 
     def SetRegion(self, windres = False):

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -122,7 +122,7 @@
             return
         
         if hasattr(self.parent, 'toolbars'):
-            if self.parent.toolbars['vdigit']:
+            if self.parent.GetToolbar('vdigit'):
                 # update vdigit toolbar (unselect currently selected tool)
                 id = self.parent.toolbars['vdigit'].GetAction(type = 'id')
                 self.parent.toolbars['vdigit'].ToggleTool(id, False)
@@ -362,13 +362,13 @@
             self.parent.AddNviz()
             
         elif tool == self.toolId['vdigit'] and \
-                not self.parent.toolbars['vdigit']:
+                not self.parent.GetToolbar('vdigit'):
             self.ExitToolbars()
             self.parent.AddToolbar("vdigit")
             self.parent.MapWindow.SetFocus()
         
     def ExitToolbars(self):
-        if self.parent.toolbars['vdigit']:
+        if self.parent.GetToolbar('vdigit'):
             self.parent.toolbars['vdigit'].OnExit()
         if self.parent.GetLayerManager().IsPaneShown('toolbarNviz'):
             self.parent.RemoveNviz()
@@ -428,8 +428,8 @@
         # add tool to toggle active map window
         self.togglemapid = wx.NewId()
         self.togglemap = wx.Choice(parent = self, id = self.togglemapid,
-						    choices = [_('source'), _('target')],
-						    style = wx.CB_READONLY)
+                                   choices = [_('source'), _('target')],
+                                   style = wx.CB_READONLY)
 
         self.InsertControl(10, self.togglemap)
 
@@ -1071,9 +1071,9 @@
                 UserSettings.Set(group = 'vdigit', key = 'bgmap',
                                  subkey = 'value', value = '', internal = True)
             
-            self.parent.statusbar.SetStatusText(_("Please wait, "
-                                                  "opening vector map <%s> for editing...") % mapLayer.GetName(),
-                                                0)
+            self.parent.SetStatusText(_("Please wait, "
+                                        "opening vector map <%s> for editing...") % mapLayer.GetName(),
+                                        0)
         
         self.parent.MapWindow.pdcVector = wx.PseudoDC()
         self.digit = self.parent.MapWindow.digit = VDigit(mapwindow = self.parent.MapWindow)
@@ -1133,10 +1133,10 @@
                         self.digit.Undo(0)
                     dlg.Destroy()
             
-            self.parent.statusbar.SetStatusText(_("Please wait, "
-                                                  "closing and rebuilding topology of "
-                                                  "vector map <%s>...") % self.mapLayer.GetName(),
-                                                0)
+            self.parent.SetStatusText(_("Please wait, "
+                                        "closing and rebuilding topology of "
+                                        "vector map <%s>...") % self.mapLayer.GetName(),
+                                      0)
             self.digit.CloseMap()
             
             lmgr = self.parent.GetLayerManager()

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -812,7 +812,7 @@
         self.digit.UpdateSettings()
         
         # redraw map if auto-rendering is enabled
-        if self.parent.statusbarWin['render'].GetValue(): 
+        if self.parent.IsAutoRendered(): 
             self.parent.OnRender(None)
 
 class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py	2011-11-25 21:09:24 UTC (rev 49361)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/workspace.py	2011-11-25 21:32:28 UTC (rev 49362)
@@ -887,23 +887,23 @@
                        'dim="%d,%d,%d,%d" '
                        'extent="%f,%f,%f,%f" '
                        'viewMode="%s" >\n' % (' ' * self.indent,
-                                                    int(mapTree.mapdisplay.statusbarWin['render'].IsChecked()),
-                                                    mapTree.mapdisplay.statusbarWin['toggle'].GetSelection(),
-                                                    int(mapTree.mapdisplay.statusbarWin['region'].IsChecked()),
-                                                    int(mapTree.mapdisplay.statusbarWin['alignExtent'].IsChecked()),
-                                                    int(mapTree.mapdisplay.statusbarWin['resolution'].IsChecked()),
-                                                    displayPos[0],
-                                                    displayPos[1],
-                                                    displaySize[0],
-                                                    displaySize[1],
-                                                    region['w'],
-                                                    region['s'],
-                                                    region['e'],
-                                                    region['n'],
-                                                    viewmode
-                                                    ))
+                                              int(mapTree.mapdisplay.GetProperty('render')),
+                                              mapTree.mapdisplay.statusbarManager.GetMode(),
+                                              int(mapTree.mapdisplay.GetProperty('region')),
+                                              int(mapTree.mapdisplay.GetProperty('alignExtent')),
+                                              int(mapTree.mapdisplay.GetProperty('resolution')),
+                                              displayPos[0],
+                                              displayPos[1],
+                                              displaySize[0],
+                                              displaySize[1],
+                                              region['w'],
+                                              region['s'],
+                                              region['e'],
+                                              region['n'],
+                                              viewmode
+                                              ))
             # projection statusbar info
-            if mapTree.mapdisplay.statusbarWin['projection'].IsChecked() and \
+            if mapTree.mapdisplay.GetProperty('projection') and \
                     UserSettings.Get(group='display', key='projection', subkey='proj4'):
                 self.indent += 4
                 file.write('%s<projection' % (' ' * self.indent))



More information about the grass-commit mailing list