[GRASS-SVN] r48622 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 5 03:37:36 EDT 2011


Author: cmbarton
Date: 2011-10-05 00:37:36 -0700 (Wed, 05 Oct 2011)
New Revision: 48622

Modified:
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/preferences.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/wxplot.py
   grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py
Log:
wxgui: added new bivariate scatter plot tool; code refactoring for profile and histogram plots.

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-10-05 07:13:29 UTC (rev 48621)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-10-05 07:37:36 UTC (rev 48622)
@@ -56,6 +56,7 @@
 from histogram       import HistFrame
 from wxplot          import HistFrame as HistFramePyPlot
 from wxplot          import ProfileFrame
+from wxplot          import ScatterFrame
 from grass.script import core as grass
 
 # for standalone app
@@ -1534,14 +1535,19 @@
         profile = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["profile"].GetLabel())
         profile.SetBitmap(icons["profile"].GetBitmap(self.iconsize))
         toolsmenu.AppendItem(profile)
-        self.Bind(wx.EVT_MENU, self.Profile, profile)
+        self.Bind(wx.EVT_MENU, self.OnProfile, profile)
 
-        histogram2 = wx.MenuItem(toolsmenu, wx.ID_ANY, _("Create histogram with PyPlot"))
+        scatterplot = wx.MenuItem(toolsmenu, wx.ID_ANY, _("Create bivariate scatterplot of raster maps"))
+        scatterplot.SetBitmap(icons["profile"].GetBitmap(self.iconsize))
+        toolsmenu.AppendItem(scatterplot)
+        self.Bind(wx.EVT_MENU, self.OnScatterplot, scatterplot)
+
+        histogram2 = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["histogram"].GetLabel())
         histogram2.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
         toolsmenu.AppendItem(histogram2)
         self.Bind(wx.EVT_MENU, self.OnHistogramPyPlot, histogram2)
 
-        histogram = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["histogram"].GetLabel())
+        histogram = wx.MenuItem(toolsmenu, wx.ID_ANY, _("Create histogram with d.histogram"))
         histogram.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
         toolsmenu.AppendItem(histogram)
         self.Bind(wx.EVT_MENU, self.OnHistogram, histogram)
@@ -1633,7 +1639,7 @@
         
         return dist
 
-    def Profile(self, event):
+    def OnProfile(self, event):
         """!Init profile canvas and tools
         """
         raster = []
@@ -1716,6 +1722,25 @@
         # is selected to be histogrammed
         self.histogramPyPlot.OnSelectRaster(None)
         
+    def OnScatterplot(self, event):
+        """!Init PyPlot scatterplot display canvas and tools
+        """
+        raster = []
+
+        for layer in self.tree.GetSelections():
+            if self.tree.GetPyData(layer)[0]['maplayer'].GetType() != 'raster':
+                continue
+            raster.append(self.tree.GetPyData(layer)[0]['maplayer'].GetName())
+
+        self.scatterplot = ScatterFrame(self, id = wx.ID_ANY, 
+                                                pos = wx.DefaultPosition, size = (700,300),
+                                                style = wx.DEFAULT_FRAME_STYLE, 
+                                                rasterList = raster)
+        self.scatterplot.Show()
+        # Open raster select dialog to make sure that at least 2 rasters (and the desired rasters)
+        # are selected to be plotted
+        self.scatterplot.OnSelectRaster(None)
+
     def OnHistogram(self, event):
         """!Init histogram display canvas and tools
         """

Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2011-10-05 07:13:29 UTC (rev 48621)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2011-10-05 07:37:36 UTC (rev 48622)
@@ -1,2513 +1,1144 @@
 """!
- at package preferences
+ at package wxplot_dialogs.py
 
- at brief User preferences dialog
+Iinteractive plotting using PyPlot (wx.lib.plot.py). Dialogs for
+different plotting routines.
 
-Sets default display font, etc.
-If you want to add some value to settings you have to add default value 
-to defaultSettings and set constraints in internalSettings in Settings class.
-Everything can be used in PreferencesDialog.
-
 Classes:
- - Settings
- - PreferencesBaseDialog
- - PreferencesDialog
- - DefaultFontDialog
- - MapsetAccess
- - NvizPreferencesDialog
+ - ProfileRasterDialog
+ - HistRasterDialog
+ - TextDialog
+ - OptDialog
 
-(C) 2007-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.
+(C) 2011 by the GRASS Development Team
 
- at author Michael Barton (Arizona State University)
- at author Martin Landa <landa.martin gmail.com>
- at author Vaclav Petras <wenzeslaus gmail.com> (menu customization)
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+ at author Michael Barton, Arizona State University
 """
 
 import os
 import sys
-import copy
-import stat
-import types
-try:
-    import pwd
-    havePwd = True
-except ImportError:
-    havePwd = False
+from types import *
 
 import wx
-import wx.lib.filebrowsebutton as filebrowse
-import wx.lib.colourselect as csel
-import wx.lib.mixins.listctrl as listmix
+import wx.lib.colourselect as  csel
 
-from grass.script import core as grass
-
-import gcmd
-import utils
 import globalvar
-from debug import Debug as Debug
+import gcmd
+from gselect     import Select
+from preferences import globalSettings as UserSettings
 
-from wx.lib.newevent import NewEvent
+from grass.script import core   as grass
 
-wxSettingsChanged, EVT_SETTINGS_CHANGED = NewEvent()
+class ProfileRasterDialog(wx.Dialog):
+    def __init__(self, parent, id = wx.ID_ANY, 
+                 title = _("Select raster maps to profile"),
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
+        """!Dialog to select raster maps to profile.
+        """
 
-class Settings:
-    """!Generic class where to store settings"""
-    def __init__(self):
-        # settings file
-        self.filePath = os.path.join(utils.GetSettingsPath(), 'wx')
-        
-        # key/value separator
-        self.sep = ';'
-        
-        try:
-            projFile = utils.PathJoin(os.environ["GRASS_PROJSHARE"], 'epsg')
-        except KeyError:
-            projFile = ''
-        
-        #
-        # default settings
-        #
-        self.defaultSettings = {
-            #
-            # general
-            #
-            'general': {
-                # use default window layout (layer manager, displays, ...)
-                'defWindowPos' : {
-                    'enabled' : True,
-                    'dim' : '0,0,%d,%d,%d,0,%d,%d' % \
-                        (globalvar.GM_WINDOW_SIZE[0],
-                         globalvar.GM_WINDOW_SIZE[1],
-                         globalvar.GM_WINDOW_SIZE[0],
-                         globalvar.MAP_WINDOW_SIZE[0],
-                         globalvar.MAP_WINDOW_SIZE[1])
-                    },
-                # workspace
-                'workspace' : {
-                    'posDisplay' : {
-                        'enabled' : False
-                        },
-                    'posManager' : {
-                        'enabled' : False
-                        },
-                    },
-                },
-            'manager' : {
-                # show opacity level widget
-                'changeOpacityLevel' : {
-                    'enabled' : False
-                    }, 
-                # ask when removing layer from layer tree
-                'askOnRemoveLayer' : {
-                    'enabled' : True
-                    },
-                # ask when quiting wxGUI or closing display
-                'askOnQuit' : {
-                    'enabled' : True
-                    },
-                # hide tabs
-                'hideTabs' : {
-                    'search' : False,
-                    'pyshell' : False,
-                    },
-                'copySelectedTextToClipboard' : {
-                    'enabled' : False
-                    },
-                },
-            #
-            # appearance
-            #
-            'appearance': {
-                'outputfont' : {
-                    'type' : 'Courier New',
-                    'size': '10',
-                    },
-                # expand/collapse element list
-                'elementListExpand' : {
-                    'selection' : 0 
-                    },
-                'menustyle' : {
-                    'selection' : 1
-                    },
-                'gSelectPopupHeight' : {
-                    'value' : 200
-                    },
-                'iconTheme' : {
-                    'type' : 'grass'
-                    },
-                },
-            #
-            # display
-            #
-            'display': {
-                'font' : {
-                    'type' : '',
-                    'encoding': 'ISO-8859-1',
-                    },
-                'driver': {
-                    'type': 'cairo'
-                    },
-                'alignExtent' : {
-                    'enabled' : True
-                    },
-                'compResolution' : {
-                    'enabled' : False
-                    },
-                'autoRendering': {
-                    'enabled' : True
-                    },
-                'autoZooming' : {
-                    'enabled' : False
-                    },
-                'statusbarMode': {
-                    'selection' : 0
-                    },
-                'bgcolor': {
-                    'color' : (255, 255, 255, 255),
-                    },
-                },
-            #
-            # projection
-            #
-            'projection' : {
-                'statusbar' : {
-                    'proj4'    : '',
-                    'epsg'     : '',
-                    'projFile' : projFile,
-                    },
-                'format' : {
-                    'll'  : 'DMS',
-                    'precision' : 2,
-                    },
-                },
-            #
-            # Attribute Table Manager
-            #
-            'atm' : {
-                'highlight' : {
-                    'color' : (255, 255, 0, 255),
-                    'width' : 2
-                    },
-                'leftDbClick' : {
-                    'selection' : 1 # draw selected
-                    },
-                'askOnDeleteRec' : {
-                    'enabled' : True
-                    },
-                'keycolumn' : {
-                    'value' : 'cat'
-                    },
-                'encoding' : {
-                    'value' : '',
-                    }
-                },
-            #
-            # Command
-            #
-            'cmd': {
-                'overwrite' : {
-                    'enabled' : False
-                    },
-                'closeDlg' : {
-                    'enabled' : False
-                    },
-                'verbosity' : {
-                    'selection' : 'grassenv'
-                    },
-                # d.rast
-                'rasterOpaque' : {
-                    'enabled' : False
-                    },
-                'rasterColorTable' : {
-                    'enabled'   : False,
-                    'selection' : 'rainbow',
-                    },
-                # d.vect
-                'showType': {
-                    'point' : {
-                        'enabled' : True
-                        },
-                    'line' : {
-                        'enabled' : True
-                        },
-                    'centroid' : {
-                        'enabled' : True
-                        },
-                    'boundary' : {
-                        'enabled' : True
-                        },
-                    'area' : {
-                        'enabled' : True
-                        },
-                    'face' : {
-                        'enabled' : True
-                        },
-                    },
-                'addNewLayer' : {
-                    'enabled' : True,
-                    },
-                'interactiveInput' : {
-                    'enabled' : True,
-                    },
-                },
-            #
-            # vdigit
-            #
-            'vdigit' : {
-                # symbology
-                'symbol' : {
-                    'highlight' : {
-                        'enabled' : None,
-                        'color' : (255, 255, 0, 255)
-                        }, # yellow
-                    'highlightDupl' : {
-                        'enabled' : None,
-                        'color' : (255, 72, 0, 255)
-                        }, # red
-                    'point' : {
-                        'enabled' : True,
-                        'color' : (0, 0, 0, 255)
-                        }, # black
-                    'line' : {
-                        'enabled' : True,
-                        'color' : (0, 0, 0, 255)
-                        }, # black
-                    'boundaryNo' : {
-                        'enabled' : True,
-                        'color' : (126, 126, 126, 255)
-                        }, # grey
-                    'boundaryOne' : {
-                        'enabled' : True,
-                        'color' : (0, 255, 0, 255)
-                        }, # green
-                    'boundaryTwo' : {
-                        'enabled' : True,
-                        'color' : (255, 135, 0, 255)
-                        }, # orange
-                    'centroidIn' : {
-                        'enabled' : True,
-                        'color' : (0, 0, 255, 255)
-                        }, # blue
-                    'centroidOut' : {
-                        'enabled' : True,
-                        'color' : (165, 42, 42, 255)
-                        }, # brown
-                    'centroidDup' : {
-                        'enabled' : True,
-                        'color' : (156, 62, 206, 255)
-                        }, # violet
-                    'nodeOne' : {
-                        'enabled' : True,
-                        'color' : (255, 0, 0, 255)
-                        }, # red
-                    'nodeTwo' : {
-                        'enabled' : True,
-                        'color' : (0, 86, 45, 255)
-                        }, # dark green
-                    'vertex' : {
-                        'enabled' : False,
-                        'color' : (255, 20, 147, 255)
-                        }, # deep pink
-                    'area' : {
-                        'enabled' : False,
-                        'color' : (217, 255, 217, 255)
-                        }, # green
-                    'direction' : {
-                        'enabled' : False,
-                        'color' : (255, 0, 0, 255)
-                        }, # red
-                    },
-                # display
-                'lineWidth' : {
-                    'value' : 2,
-                    'units' : 'screen pixels'
-                    },
-                # snapping
-                'snapping' : {
-                    'value' : 10,
-                    'units' : 'screen pixels'
-                    },
-                'snapToVertex' : {
-                    'enabled' : False
-                    },
-                # digitize new record
-                'addRecord' : {
-                    'enabled' : True
-                    },
-                'layer' :{
-                    'value' : 1
-                    },
-                'category' : {
-                    'value' : 1
-                    },
-                'categoryMode' : {
-                    'selection' : 0
-                    },
-                # delete existing feature(s)
-                'delRecord' : {
-                    'enabled' : True
-                    },
-                # query tool
-                'query' : {
-                    'selection' : 0,
-                    'box' : True
-                    },
-                'queryLength' : {
-                    'than-selection' : 0,
-                    'thresh' : 0
-                    },
-                'queryDangle' : {
-                    'than-selection' : 0,
-                    'thresh' : 0
-                    },
-                # select feature (point, line, centroid, boundary)
-                'selectType': {
-                    'point' : {
-                        'enabled' : True
-                        },
-                    'line' : {
-                        'enabled' : True
-                        },
-                    'centroid' : {
-                        'enabled' : True
-                        },
-                    'boundary' : {
-                        'enabled' : True
-                        },
-                    },
-                'selectThresh' : {
-                    'value' : 10,
-                    'units' : 'screen pixels'
-                    },
-                'checkForDupl' : {
-                    'enabled' : False
-                    },
-                'selectInside' : {
-                    'enabled' : False
-                    },
-                # exit
-                'saveOnExit' : {
-                    'enabled' : False,
-                    },
-                # break lines on intersection
-                'breakLines' : {
-                    'enabled' : False,
-                    },
-                },
-             # 
-             # plots for profiles, histograms, and scatterplots
-             #
-            'profile': {
-                'raster' : {
-                    'pcolor'        : (0, 0, 255, 255), # line color
-                    'pwidth'        : 1, # line width
-                    'pstyle'        : 'solid', # line pen style
-                    'datatype'      : 'cell', # raster type
-                    },
-                'font' : {
-                    'titleSize' : 12,
-                    'axisSize' : 11,
-                    'legendSize' : 10,
-                    },
-                'marker' : {
-                    'color' : (0, 0, 0, 255),
-                    'fill' : 'transparent',
-                    'size' : 2,
-                    'type' : 'triangle',
-                    'legend' : _('Segment break'),
-                    },
-                'grid' : {
-                    'color' : (200, 200, 200, 255),
-                    'enabled' : True,
-                    },
-                'x-axis' : {
-                    'type' : 'auto', # axis format
-                    'min' : 0, # axis min for custom axis range
-                    'max': 0, # axis max for custom axis range
-                    'log' : False,
-                    },
-                'y-axis' : {
-                    'type' : 'auto', # axis format
-                    'min' : 0, # axis min for custom axis range
-                    'max': 0, # axis max for custom axis range
-                    'log' : False,
-                    },
-                'legend' : {
-                    'enabled' : True
-                    },
-                },
-             'histogram': {
-                'raster' : {
-                    'pcolor'        : (0, 0, 255, 255), # line color
-                    'pwidth'        : 1, # line width
-                    'pstyle'        : 'solid', # line pen style
-                    'datatype'      : 'cell', # raster type
-                    },
-                'font' : {
-                    'titleSize'     : 12,
-                    'axisSize'      : 11,
-                    'legendSize'    : 10,
-                    },
-                'grid' : {
-                    'color'         : (200, 200, 200, 255),
-                    'enabled'       : True,
-                    },
-                'x-axis' : {
-                    'type'          : 'auto', # axis format
-                    'min'           : 0, # axis min for custom axis range
-                    'max'           : 0, # axis max for custom axis range
-                    'log'           : False,
-                    },
-                'y-axis' : {
-                    'type'          : 'auto', # axis format
-                    'min'           : 0, # axis min for custom axis range
-                    'max'           : 0, # axis max for custom axis range
-                    'log'           : False,
-                    },
-                'legend' : {
-                    'enabled'       : True
-                    },
-                },
-             'scatter': {
-                'marker' : {
-                    'color' : (0, 0, 0, 255),
-                    'fill' : 'solid',
-                    'size' : 1,
-                    'type' : 'dot',
-                    'legend' : _('Data point'),
-                    },
-                'font' : {
-                    'titleSize'     : 12,
-                    'axisSize'      : 11,
-                    'legendSize'    : 10,
-                    },
-                'grid' : {
-                    'color'         : (200, 200, 200, 255),
-                    'enabled'       : True,
-                    },
-                'x-axis' : {
-                    'type'          : 'auto', # axis format
-                    'min'           : 0, # axis min for custom axis range
-                    'max'           : 0, # axis max for custom axis range
-                    'log'           : False,
-                    },
-                'y-axis' : {
-                    'type'          : 'auto', # axis format
-                    'min'           : 0, # axis min for custom axis range
-                    'max'           : 0, # axis max for custom axis range
-                    'log'           : False,
-                    },
-                'legend' : {
-                    'enabled'       : True
-                    },
-                },
-            'gcpman' : {
-                'rms' : {
-                    'highestonly' : True,
-                    'sdfactor' : 1,
-                    },
-                'symbol' : {
-                    'color' : (0, 0, 255, 255),
-                    'hcolor' : (255, 0, 0, 255),
-                    'scolor' : (0, 255, 0, 255),
-                    'ucolor' : (255, 165, 0, 255),
-                    'unused' : True,
-                    'size' : 8,
-                    'width' : 2,
-                    },
-                },
-            'georect' : {
-                'symbol' : {
-                    'color' : (0, 0, 255, 255),
-                    'width' : 2,
-                    },
-                },
-            'nviz' : {
-                'view' : {
-                    'persp' : {
-                        'value' : 20,
-                        'step' : 2,
-                        },
-                    'position' : {
-                        'x' : 0.84,
-                        'y' : 0.16,
-                        },
-                    'twist' : {
-                        'value' : 0,
-                        },
-                    'z-exag' : {
-                        'min' : 0,
-                        'max' : 10,
-                        'value': 1,
-                        },
-                    'background' : {
-                        'color' : (255, 255, 255, 255), # white
-                        },
-                    },
-                'surface' : {
-                    'shine': {
-                        'map' : False,
-                        'value' : 60.0,
-                        },
-                    'color' : {
-                        'map' : True,
-                        'value' : (100, 100, 100, 255), # constant: grey
-                        },
-                    'draw' : {
-                        'wire-color' : (136, 136, 136, 255),
-                        'mode' : 1, # fine
-                        'style' : 1, # surface
-                        'shading' : 1, # gouraud
-                        'res-fine' : 6,
-                        'res-coarse' : 9,
-                        },
-                    'position' : {
-                        'x' : 0,
-                        'y' : 0,
-                        'z' : 0,
-                        },
-                    },
-                'constant' : {
-                    'color' : (100, 100, 100, 255),
-                    'value' : 0.0,
-                    'transp' : 0,
-                    'resolution': 6
-                },
-                'vector' : {
-                    'lines' : {
-                        'show' : False,
-                        'width' : 2,
-                        'color' : (0, 0, 255, 255), # blue
-                        'flat' : False,
-                        'height' : 0,
-                        'rgbcolumn': None,
-                        'sizecolumn': None,
-                        },
-                    'points' : {
-                        'show' : False,
-                        'size' : 100,
-                        'width' : 2,
-                        'marker' : 2,
-                        'color' : (0, 0, 255, 255), # blue
-                        'height' : 0,
-                        'rgbcolumn': None,
-                        'sizecolumn': None,
-                        }
-                    },
-                'volume' : {
-                    'color' : {
-                        'map' : True,
-                        'value' : (100, 100, 100, 255), # constant: grey
-                        },
-                    'draw' : {
-                        'mode'       : 0, # isosurfaces
-                        'shading'    : 1, # gouraud
-                        'resolution' : 3, # polygon resolution
-                        },
-                    'shine': {
-                        'map' : False,
-                        'value' : 60,
-                        },
-                    'topo': {
-                        'map' : None,
-                        'value' : 0.0
-                        },
-                    'transp': {
-                        'map' : None,
-                        'value': 0
-                        },
-                    'mask': {
-                        'map' : None,
-                        'value': ''
-                        },
-                    'slice_position': {
-                        'x1' : 0,
-                        'x2' : 1,
-                        'y1' : 0,
-                        'y2' : 1,
-                        'z1' : 0,
-                        'z2' : 1,
-                        'axis' : 0,
-                        }
-                    },
-                'cplane' : {
-                    'shading': 4,
-                    'rotation':{
-                        'rot': 0, 
-                        'tilt': 0
-                        }, 
-                    'position':{
-                        'x' : 0,
-                        'y' : 0,
-                        'z' : 0
-                    }   
-                },
-                'light' : {
-                    'position' : {
-                        'x' : 0.68,
-                        'y' : -0.68,
-                        'z' : 80,
-                        },
-                    'bright'  : 80,
-                    'color'   : (255, 255, 255, 255), # white
-                    'ambient' : 20,
-                    },
-                'fringe' : {
-                    'elev'   : 55,
-                    'color'  : (128, 128, 128, 255), # grey
-                    },
-                'arrow': {
-                    'color': (0, 0, 0),
-                    },
-                'scalebar': {
-                    'color': (0, 0, 0),
-                    }
-                },
-            'modeler' : {
-                'action' : {
-                    'color' : {
-                        'valid'   :  (180, 234, 154, 255), # light green
-                        'invalid' :  (255, 255, 255, 255), # white
-                        'running' :  (255, 0, 0, 255),     # red
-                        'disabled' : (211, 211, 211, 255), # light grey
-                        },
-                    'size' : {
-                        'width'  : 100,
-                        'height' : 50,
-                        },
-                    'width': {
-                        'parameterized' : 2,
-                        'default'       : 1,
-                        },
-                    },
-                'data' : { 
-                    'color': {
-                        'raster'   : (215, 215, 248, 255), # light blue
-                        'raster3d' : (215, 248, 215, 255), # light green
-                        'vector'   : (248, 215, 215, 255), # light red
-                        },
-                    'size' : {
-                        'width' : 175,
-                        'height' : 50,
-                        },
-                    },
-                'loop' : {
-                    'size' : {
-                        'width' : 175,
-                        'height' : 40,
-                        },
-                    },
-                'if-else' : {
-                    'size' : {
-                        'width' : 150,
-                        'height' : 40,
-                        },
-                    },
-                },
-            }
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
 
-        # quick fix, http://trac.osgeo.org/grass/ticket/1233
-        # TODO
-        if sys.platform == 'darwin':
-            self.defaultSettings['general']['defWindowPos']['enabled'] = False
-        
-        #
-        # user settings
-        #
-        self.userSettings = copy.deepcopy(self.defaultSettings)
-        try:
-            self.ReadSettingsFile()
-        except gcmd.GException, e:
-            print >> sys.stderr, e.value
 
-        #
-        # internal settings (based on user settings)
-        #
-        self.internalSettings = {}
-        for group in self.userSettings.keys():
-            self.internalSettings[group] = {}
-            for key in self.userSettings[group].keys():
-                self.internalSettings[group][key] = {}
+        self.parent = parent
+        self.colorList = ["blue", "red", "green", "yellow", "magenta", "cyan", \
+                    "aqua", "black", "grey", "orange", "brown", "purple", "violet", \
+                    "indigo"]
 
-        # self.internalSettings['general']["mapsetPath"]['value'] = self.GetMapsetPath()
-        self.internalSettings['appearance']['elementListExpand']['choices'] = \
-            (_("Collapse all except PERMANENT and current"),
-             _("Collapse all except PERMANENT"),
-             _("Collapse all except current"),
-             _("Collapse all"),
-             _("Expand all"))
-        self.internalSettings['atm']['leftDbClick']['choices'] = (_('Edit selected record'),
-                                                                  _('Display selected'))
+        self.rasterList = self.parent.rasterList
         
-        self.internalSettings['cmd']['verbosity']['choices'] = ('grassenv',
-                                                                'verbose',
-                                                                'quiet')
-                                                                
-        self.internalSettings['appearance']['iconTheme']['choices'] = ('grass',)
-        self.internalSettings['appearance']['menustyle']['choices'] = \
-                   (_("Classic (labels only)"),
-                    _("Combined (labels and module names)"),
-                    _("Professional (module names only)"))
-        self.internalSettings['appearance']['gSelectPopupHeight']['min'] = 50
-        # there is also maxHeight given to TreeCtrlComboPopup.GetAdjustedSize
-        self.internalSettings['appearance']['gSelectPopupHeight']['max'] = 1000
+        self._do_layout()
         
-        self.internalSettings['display']['driver']['choices'] = ['cairo', 'png']
-        self.internalSettings['display']['statusbarMode']['choices'] = globalvar.MAP_DISPLAY_STATUSBAR_MODE
+    def _do_layout(self):
 
-        self.internalSettings['nviz']['view'] = {}
-        self.internalSettings['nviz']['view']['twist'] = {}
-        self.internalSettings['nviz']['view']['twist']['min'] = -180
-        self.internalSettings['nviz']['view']['twist']['max'] = 180
-        self.internalSettings['nviz']['view']['persp'] = {}
-        self.internalSettings['nviz']['view']['persp']['min'] = 1
-        self.internalSettings['nviz']['view']['persp']['max'] = 100
-        self.internalSettings['nviz']['view']['height'] = {}
-        self.internalSettings['nviz']['view']['height']['value'] = -1
-        self.internalSettings['nviz']['view']['z-exag'] = {}
-        self.internalSettings['nviz']['view']['z-exag']['original'] = 1
-        self.internalSettings['nviz']['view']['rotation'] = None
-        self.internalSettings['nviz']['view']['focus'] = {}
-        self.internalSettings['nviz']['view']['focus']['x'] = -1
-        self.internalSettings['nviz']['view']['focus']['y'] = -1
-        self.internalSettings['nviz']['view']['focus']['z'] = -1
-        for decor in ('arrow', 'scalebar'):
-            self.internalSettings['nviz'][decor] = {}
-            self.internalSettings['nviz'][decor]['position'] = {}
-            self.internalSettings['nviz'][decor]['position']['x'] = 0
-            self.internalSettings['nviz'][decor]['position']['y'] = 0
-            self.internalSettings['nviz'][decor]['size'] = 100
-        self.internalSettings['nviz']['vector'] = {}
-        self.internalSettings['nviz']['vector']['points'] = {}
-        self.internalSettings['nviz']['vector']['points']['marker'] = ("x",
-                                                                       _("box"),
-                                                                       _("sphere"),
-                                                                       _("cube"),
-                                                                       _("diamond"),
-                                                                       _("dtree"),
-                                                                       _("ctree"),
-                                                                       _("aster"),
-                                                                       _("gyro"),
-                                                                       _("histogram"))
-        self.internalSettings['vdigit']['bgmap'] = {}
-        self.internalSettings['vdigit']['bgmap']['value'] = ''
-        
-    def ReadSettingsFile(self, settings = None):
-        """!Reads settings file (mapset, location, gisdbase)"""
-        if settings is None:
-            settings = self.userSettings
-        
-        self._readFile(self.filePath, settings)
-        
-        # set environment variables
-        font = self.Get(group = 'display', key = 'font', subkey = 'type')
-        enc  = self.Get(group = 'display', key = 'font', subkey = 'encoding')
-        if font:
-            os.environ["GRASS_FONT"] = font
-        if enc:
-            os.environ["GRASS_ENCODING"] = enc
-        
-    def _readFile(self, filename, settings = None):
-        """!Read settings from file to dict
+        sizer = wx.BoxSizer(wx.VERTICAL)
 
-        @param filename settings file path
-        @param settings dict where to store settings (None for self.userSettings)
-        """
-        if settings is None:
-            settings = self.userSettings
+        box = wx.GridBagSizer (hgap = 3, vgap = 3)
         
-        if not os.path.exists(filename):
-            return
+        rastText = ''
+        for r in self.rasterList:
+            rastText += '%s,' % r
+            
+        rastText = rastText.rstrip(',')
         
-        try:
-            fd = open(filename, "r")
-        except IOError:
-            sys.stderr.write(_("Unable to read settings file <%s>\n") % filename)
-            return
+        txt = _("Select raster map(s) to profile:")
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = txt)
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
         
-        try:
-            line = ''
-            for line in fd.readlines():
-                line = line.rstrip('%s' % os.linesep)
-                group, key = line.split(self.sep)[0:2]
-                kv = line.split(self.sep)[2:]
-                subkeyMaster = None
-                if len(kv) % 2 != 0: # multiple (e.g. nviz)
-                    subkeyMaster = kv[0]
-                    del kv[0]
-                idx = 0
-                while idx < len(kv):
-                    if subkeyMaster:
-                        subkey = [subkeyMaster, kv[idx]]
-                    else:
-                        subkey = kv[idx]
-                    value = kv[idx+1]
-                    value = self._parseValue(value, read = True)
-                    self.Append(settings, group, key, subkey, value)
-                    idx += 2
-        except ValueError, e:
-            print >> sys.stderr, _("Error: Reading settings from file <%(file)s> failed.\n"
-                                   "\t\tDetails: %(detail)s\n"
-                                   "\t\tLine: '%(line)s'\n") % { 'file' : filename,
-                                                               'detail' : e,
-                                                               'line' : line }
-            fd.close()
+        selection = Select(self, id = wx.ID_ANY,
+                           size = globalvar.DIALOG_GSELECT_SIZE,
+                           type = 'cell', multiple=True)
+        selection.SetValue(rastText)
+        selection.Bind(wx.EVT_TEXT, self.OnSelection)
         
-        fd.close()
-        
-    def SaveToFile(self, settings = None):
-        """!Save settings to the file"""
-        if settings is None:
-            settings = self.userSettings
-        
-        dirPath = utils.GetSettingsPath()
-        if not os.path.exists(dirPath):
-            try:
-                os.mkdir(dirPath)
-            except:
-                gcmd.GError(_('Unable to create settings directory'))
-                return
-        
-        try:
-            file = open(self.filePath, "w")
-            for group in settings.keys():
-                for key in settings[group].keys():
-                    subkeys = settings[group][key].keys()
-                    file.write('%s%s%s%s' % (group, self.sep, key, self.sep))
-                    for idx in range(len(subkeys)):
-                        value = settings[group][key][subkeys[idx]]
-                        if type(value) == types.DictType:
-                            if idx > 0:
-                                file.write('%s%s%s%s%s' % (os.linesep, group, self.sep, key, self.sep))
-                            file.write('%s%s' % (subkeys[idx], self.sep))
-                            kvalues = settings[group][key][subkeys[idx]].keys()
-                            srange = range(len(kvalues))
-                            for sidx in srange:
-                                svalue = self._parseValue(settings[group][key][subkeys[idx]][kvalues[sidx]])
-                                file.write('%s%s%s' % (kvalues[sidx], self.sep,
-                                                       svalue))
-                                if sidx < len(kvalues) - 1:
-                                    file.write('%s' % self.sep)
-                        else:
-                            if idx > 0 and \
-                                    type(settings[group][key][subkeys[idx - 1]]) == types.DictType:
-                                file.write('%s%s%s%s%s' % (os.linesep, group, self.sep, key, self.sep))
-                            value = self._parseValue(settings[group][key][subkeys[idx]])
-                            file.write('%s%s%s' % (subkeys[idx], self.sep, value))
-                            if idx < len(subkeys) - 1 and \
-                                    type(settings[group][key][subkeys[idx + 1]]) != types.DictType:
-                                file.write('%s' % self.sep)
-                    file.write(os.linesep)
-        except IOError, e:
-            raise gcmd.GException(e)
-        except StandardError, e:
-            raise gcmd.GException(_('Writing settings to file <%(file)s> failed.'
-                                    '\n\nDetails: %(detail)s') % { 'file' : self.filePath,
-                                                                   'detail' : e })
-        
-        file.close()
-        
-    def _parseValue(self, value, read = False):
-        """!Parse value to be store in settings file"""
-        if read: # -> read settings (cast values)
-            if value == 'True':
-                value = True
-            elif value == 'False':
-                value = False
-            elif value == 'None':
-                value = None
-            elif ':' in value: # -> color
-                try:
-                    value = tuple(map(int, value.split(':')))
-                except ValueError: # -> string
-                    pass
-            else:
-                try:
-                    value = int(value)
-                except ValueError:
-                    try:
-                        value = float(value)
-                    except ValueError:
-                        pass
-        else: # -> write settings
-            if type(value) == type(()): # -> color
-                value = str(value[0]) + ':' +\
-                    str(value[1]) + ':' + \
-                    str(value[2])
-                
-        return value
+        box.Add(item = selection, pos = (0, 1))
+            
+        sizer.Add(item = box, proportion = 0,
+                  flag = wx.ALL, border = 10)
 
-    def Get(self, group, key = None, subkey = None, internal = False):
-        """!Get value by key/subkey
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
 
-        Raise KeyError if key is not found
-        
-        @param group settings group
-        @param key (value, None)
-        @param subkey (value, list or None)
-        @param internal use internal settings instead
+        btnsizer = wx.StdDialogButtonSizer()
 
-        @return value
-        """
-        if internal is True:
-            settings = self.internalSettings
-        else:
-            settings = self.userSettings
-            
-        try:
-            if subkey is None:
-                if key is None:
-                    return settings[group]
-                else:
-                    return settings[group][key]
-            else:
-                if type(subkey) == type(tuple()) or \
-                        type(subkey) == type(list()):
-                    return settings[group][key][subkey[0]][subkey[1]]
-                else:
-                    return settings[group][key][subkey]  
+        btn = wx.Button(self, wx.ID_OK)
+        btn.SetDefault()
+        btnsizer.AddButton(btn)
 
-        except KeyError:
-            print >> sys.stderr, "Settings: unable to get value '%s:%s:%s'\n" % \
-                (group, key, subkey)
-        
-    def Set(self, group, value, key = None, subkey = None, internal = False):
-        """!Set value of key/subkey
-        
-        Raise KeyError if group/key is not found
-        
-        @param group settings group
-        @param key key (value, None)
-        @param subkey subkey (value, list or None)
-        @param value value
-        @param internal use internal settings instead
-        """
-        if internal is True:
-            settings = self.internalSettings
-        else:
-            settings = self.userSettings
-        
-        try:
-            if subkey is None:
-                if key is None:
-                    settings[group] = value
-                else:
-                    settings[group][key] = value
-            else:
-                if type(subkey) == type(tuple()) or \
-                        type(subkey) == type(list()):
-                    settings[group][key][subkey[0]][subkey[1]] = value
-                else:
-                    settings[group][key][subkey] = value
-        except KeyError:
-            raise gcmd.GException("%s '%s:%s:%s'" % (_("Unable to set "), group, key, subkey))
-        
-    def Append(self, dict, group, key, subkey, value):
-        """!Set value of key/subkey
+        btn = wx.Button(self, wx.ID_CANCEL)
+        btnsizer.AddButton(btn)
+        btnsizer.Realize()
 
-        Create group/key/subkey if not exists
-        
-        @param dict settings dictionary to use
-        @param group settings group
-        @param key key
-        @param subkey subkey (value or list)
-        @param value value
-        """
-        if group not in dict:
-            dict[group] = {}
+        sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
-        if key not in dict[group]:
-            dict[group][key] = {}
+        self.SetSizer(sizer)
+        sizer.Fit(self)
 
-        if type(subkey) == types.ListType:
-            # TODO: len(subkey) > 2
-            if subkey[0] not in dict[group][key]:
-                dict[group][key][subkey[0]] = {}
-            try:
-                dict[group][key][subkey[0]][subkey[1]] = value
-            except TypeError:
-                print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
-                    ' (' + group + ':' + key + ':' + subkey[0] + ':' + subkey[1] + ')'
-        else:
-            try:
-                dict[group][key][subkey] = value
-            except TypeError:
-                print >> sys.stderr, _("Unable to parse settings '%s'") % value + \
-                    ' (' + group + ':' + key + ':' + subkey + ')'
-        
-    def GetDefaultSettings(self):
-        """!Get default user settings"""
-        return self.defaultSettings
+    def OnSelection(self, event):
+        # for now this is limited to 14 rasters (number of colors in colorList), but it could be increased
+        rstring = event.GetString()
+        rList = rstring.split(',')
+        n = min(len(rList), len(self.colorList))
+        self.rasterList = []
+        for idx in range(0,n):
+            self.rasterList.append(rList[idx])
 
-    def Reset(self, key = None):
-        """!Reset to default settings
-
-        @key key in settings dict (None for all keys)
+class ScatterRasterDialog(wx.Dialog):
+    def __init__(self, parent, id = wx.ID_ANY, 
+                 title = _("Select pairs of raster maps for scatterplots"),
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
+        """!Dialog to select raster maps to profile.
         """
-        if not key:
-            self.userSettings = copy.deepcopy(self.defaultSettings)
-        else:
-            self.userSettings[key] = copy.deepcopy(self.defaultSettings[key])
-        
-globalSettings = Settings()
 
-class PreferencesBaseDialog(wx.Dialog):
-    """!Base preferences dialog"""
-    def __init__(self, parent, settings, title = _("User settings"),
-                 size = (500, 375),
-                 style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
-        self.parent = parent # ModelerFrame
-        self.title  = title
-        self.size   = size
-        self.settings = settings
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
+
+        self.parent = parent
+        self.rasterList = self.parent.rasterList
+        self.bins = self.parent.bins
+        self.scattertype = self.parent.scattertype
+        self.maptype = self.parent.maptype
+        self.spinbins = ''        
+        self.colorList = ["blue", "red", "green", "yellow", "magenta", "cyan", \
+                    "aqua", "black", "grey", "orange", "brown", "purple", "violet", \
+                    "indigo"]
         
-        wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
-                           style = style)
+        self._do_layout()
         
-        # notebook
-        self.notebook = wx.Notebook(parent = self, id = wx.ID_ANY, style = wx.BK_DEFAULT)
-        
-        # dict for window ids
-        self.winId = {}
-        
-        # create notebook pages
-        
-        # buttons
-        self.btnDefault = wx.Button(self, wx.ID_ANY, _("Set to default"))
-        self.btnSave = wx.Button(self, wx.ID_SAVE)
-        self.btnApply = wx.Button(self, wx.ID_APPLY)
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
-        self.btnSave.SetDefault()
-        
-        # bindigs
-        self.btnDefault.Bind(wx.EVT_BUTTON, self.OnDefault)
-        self.btnDefault.SetToolTipString(_("Revert settings to default and apply changes"))
-        self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        self.btnApply.SetToolTipString(_("Apply changes for the current session"))
-        self.btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        self.btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
-        self.btnSave.SetDefault()
-        self.btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
-        self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+    def _do_layout(self):
 
-        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+        sizer = wx.BoxSizer(wx.VERTICAL)
 
-        self._layout()
+        box = wx.GridBagSizer (hgap = 3, vgap = 3)
         
-    def _layout(self):
-        """!Layout window"""
-        # sizers
-        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        btnSizer.Add(item = self.btnDefault, proportion = 1,
-                     flag = wx.ALL, border = 5)
-        btnStdSizer = wx.StdDialogButtonSizer()
-        btnStdSizer.AddButton(self.btnCancel)
-        btnStdSizer.AddButton(self.btnSave)
-        btnStdSizer.AddButton(self.btnApply)
-        btnStdSizer.Realize()
+        # parse raster pair tuples 
+        rastText = ''
+        if len(self.rasterList) > 0:
+            for r in self.rasterList:
+                rastText += '%s,%s,' % r
+            rastText = rastText.rstrip(',')
         
-        mainSizer = wx.BoxSizer(wx.VERTICAL)
-        mainSizer.Add(item = self.notebook, proportion = 1, flag = wx.EXPAND | wx.ALL, border = 5)
-        mainSizer.Add(item = btnSizer, proportion = 0,
-                      flag = wx.EXPAND, border = 0)
-        mainSizer.Add(item = btnStdSizer, proportion = 0,
-                      flag = wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border = 5)
+        # select rasters
+        txt = _("Select pairs of raster maps for bivariate scatterplots:")
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = txt)
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
         
-        self.SetSizer(mainSizer)
-        mainSizer.Fit(self)
+        selection = Select(self, id = wx.ID_ANY,
+                           size = globalvar.DIALOG_GSELECT_SIZE,
+                           type = 'cell', multiple=True)
+        selection.SetValue(rastText)
+        selection.Bind(wx.EVT_TEXT, self.OnSelection)
         
-    def OnDefault(self, event):
-        """!Button 'Set to default' pressed"""
-        self.settings.userSettings = copy.deepcopy(self.settings.defaultSettings)
-        
-        # update widgets
-        for gks in self.winId.keys():
-            try:
-                group, key, subkey = gks.split(':')
-                value = self.settings.Get(group, key, subkey)
-            except ValueError:
-                group, key, subkey, subkey1 = gks.split(':')
-                value = self.settings.Get(group, key, [subkey, subkey1])
-            win = self.FindWindowById(self.winId[gks])
-            if win.GetName() in ('GetValue', 'IsChecked'):
-                value = win.SetValue(value)
-            elif win.GetName() == 'GetSelection':
-                value = win.SetSelection(value)
-            elif win.GetName() == 'GetStringSelection':
-                value = win.SetStringSelection(value)
-            else:
-                value = win.SetValue(value)
-        
-    def OnApply(self, event):
-        """!Button 'Apply' pressed
-        Posts event EVT_SETTINGS_CHANGED.
-        """
-        if self._updateSettings():
-            self.parent.goutput.WriteLog(_('Settings applied to current session but not saved'))
-            event = wxSettingsChanged()
-            wx.PostEvent(self, event)
-            self.Close()
+        box.Add(item = selection, pos = (0, 1))
+            
+        # Nsteps for FP maps 
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Number of bins (for FP maps)"))
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.spinbins = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                      size = (100,-1), style = wx.SP_ARROW_KEYS)
+        self.spinbins.SetRange(1,1000)
+        self.spinbins.SetValue(self.bins)
+        box.Add(item = self.spinbins,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 1))
 
-    def OnCloseWindow(self, event):
-        self.Hide()
-        
-    def OnCancel(self, event):
-        """!Button 'Cancel' pressed"""
-        self.Close()
-        
-    def OnSave(self, event):
-        """!Button 'Save' pressed
-        Posts event EVT_SETTINGS_CHANGED.
-        """
-        if self._updateSettings():
-            self.settings.SaveToFile()
-            self.parent.goutput.WriteLog(_('Settings saved to file \'%s\'.') % self.settings.filePath)
-            event = wxSettingsChanged()
-            wx.PostEvent(self, event)
-            self.Close()
+#### TODO possibly make bubble plots with marker size proportional to cell counts
+#        # scatterplot type 
+#        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+#                              label = _("Scatterplot type"))
+#        box.Add(item = label,
+#                flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+#        types = ['normal', 'bubble']
+#        scattertype = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+#                                choices = types, style = wx.CB_DROPDOWN)
+#        scattertype.SetStringSelection(self.scattertype)
+#        box.Add(item = scattertype,
+#                flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 1))
+          
+        sizer.Add(item = box, proportion = 0,
+                  flag = wx.ALL, border = 10)
 
-    def _updateSettings(self):
-        """!Update user settings"""
-        for item in self.winId.keys():
-            try:
-                group, key, subkey = item.split(':')
-                subkey1 = None
-            except ValueError:
-                group, key, subkey, subkey1 = item.split(':')
-            
-            id = self.winId[item]
-            win = self.FindWindowById(id)
-            if win.GetName() == 'GetValue':
-                value = win.GetValue()
-            elif win.GetName() == 'GetSelection':
-                value = win.GetSelection()
-            elif win.GetName() == 'IsChecked':
-                value = win.IsChecked()
-            elif win.GetName() == 'GetStringSelection':
-                value = win.GetStringSelection()
-            elif win.GetName() == 'GetColour':
-                value = tuple(win.GetValue())
-            else:
-                value = win.GetValue()
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
 
-            if key == 'keycolumn' and value == '':
-                wx.MessageBox(parent = self,
-                              message = _("Key column cannot be empty string."),
-                              caption = _("Error"), style = wx.OK | wx.ICON_ERROR)
-                win.SetValue(self.settings.Get(group = 'atm', key = 'keycolumn', subkey = 'value'))
-                return False
+        btnsizer = wx.StdDialogButtonSizer()
 
-            if subkey1:
-                self.settings.Set(group, value, key, [subkey, subkey1])
-            else:
-                self.settings.Set(group, value, key, subkey)
-        
-        #
-        # update default window dimension
-        #
-        if self.settings.Get(group = 'general', key = 'defWindowPos', subkey = 'enabled') is True:
-            dim = ''
-            # layer manager
-            pos = self.parent.GetPosition()
-            size = self.parent.GetSize()
-            dim = '%d,%d,%d,%d' % (pos[0], pos[1], size[0], size[1])
-            # opened displays
-            for page in range(0, self.parent.gm_cb.GetPageCount()):
-                pos = self.parent.gm_cb.GetPage(page).maptree.mapdisplay.GetPosition()
-                size = self.parent.gm_cb.GetPage(page).maptree.mapdisplay.GetSize()
+        btn = wx.Button(self, wx.ID_OK)
+        btn.SetDefault()
+        btnsizer.AddButton(btn)
 
-                dim += ',%d,%d,%d,%d' % (pos[0], pos[1], size[0], size[1])
+        btn = wx.Button(self, wx.ID_CANCEL)
+        btnsizer.AddButton(btn)
+        btnsizer.Realize()
 
-            self.settings.Set(group = 'general', key = 'defWindowPos', subkey = 'dim', value = dim)
-        else:
-            self.settings.Set(group = 'general', key = 'defWindowPos', subkey = 'dim', value = '')
+        sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
-        return True
+        self.spinbins.Bind(wx.EVT_TEXT, self.OnSetBins)
+        self.spinbins.Bind(wx.EVT_SPINCTRL, self.OnSetBins)
+#        scattertype.Bind(wx.EVT_TEXT, self.OnSetScattertypes)
 
-class PreferencesDialog(PreferencesBaseDialog):
-    """!User preferences dialog"""
-    def __init__(self, parent, title = _("GUI Settings"),
-                 settings = globalSettings):
+        self.SetSizer(sizer)
+        sizer.Fit(self)
+
+    def OnSelection(self, event):
+        """!Select raster maps for scatterplot. Must select maps in pairs.
+        """
+        self.rasterList = []
+        self.rasterList = event.GetString().split(',')
+            
+    def OnSetBins(self, event):
+        """!Bins for histogramming FP maps (=nsteps in r.stats)
+        """
+        self.bins = self.spinbins.GetValue()
         
-        PreferencesBaseDialog.__init__(self, parent = parent, title = title,
-                                       settings = settings)
+    def OnSetScattertypes(self, event):
+        self.scattertype = event.GetString()
+
+class HistRasterDialog(wx.Dialog):
+    def __init__(self, parent, id = wx.ID_ANY, 
+                 title = _("Select raster map or imagery group to histogram"),
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
+        """!Dialog to select raster maps to histogram.
+        """
+
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
+
+        self.parent = parent
+        self.rasterList = self.parent.rasterList
+        self.group = self.parent.group
+        self.bins = self.parent.bins
+        self.histtype = self.parent.histtype
+        self.maptype = self.parent.maptype
+        self.spinbins = ''
         
-        # create notebook pages
-        self._createGeneralPage(self.notebook)
-        self._createAppearancePage(self.notebook)
-        self._createDisplayPage(self.notebook)
-        self._createCmdPage(self.notebook)
-        self._createAttributeManagerPage(self.notebook)
-        self._createProjectionPage(self.notebook)
+        self._do_layout()
         
-        self.SetMinSize(self.GetBestSize())
-        self.SetSize(self.size)
+    def _do_layout(self):
+
+        sizer = wx.BoxSizer(wx.VERTICAL)
+
+        box = wx.GridBagSizer (hgap = 3, vgap = 3)
         
-    def _createGeneralPage(self, notebook):
-        """!Create notebook page for general settings"""
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("General"))
-        
-        border = wx.BoxSizer(wx.VERTICAL)
         #
-        # Layer Manager settings
+        # select single raster or image group to histogram radio buttons
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Layer Manager settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
+        self.rasterRadio = wx.RadioButton(self, id = wx.ID_ANY, label = " %s " % _("Histogram single raster"), style = wx.RB_GROUP)
+        self.groupRadio = wx.RadioButton(self, id = wx.ID_ANY, label = " %s " % _("Histogram imagery group"))
+        if self.maptype == 'raster': 
+            self.rasterRadio.SetValue(True)
+        elif self.maptype == 'group': 
+            self.groupRadio.SetValue(True)
+        box.Add(item = self.rasterRadio, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        box.Add(item = self.groupRadio, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 1))
         
         #
-        # ask when removing map layer from layer tree
+        # Select a raster to histogram
         #
-        row = 0
-        askOnRemoveLayer = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                       label = _("Ask when removing map layer from layer tree"),
-                                       name = 'IsChecked')
-        askOnRemoveLayer.SetValue(self.settings.Get(group = 'manager', key = 'askOnRemoveLayer', subkey = 'enabled'))
-        self.winId['manager:askOnRemoveLayer:enabled'] = askOnRemoveLayer.GetId()
-        
-        gridSizer.Add(item = askOnRemoveLayer,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1
-        askOnQuit = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                label = _("Ask when quiting wxGUI or closing display"),
-                                name = 'IsChecked')
-        askOnQuit.SetValue(self.settings.Get(group = 'manager', key = 'askOnQuit', subkey = 'enabled'))
-        self.winId['manager:askOnQuit:enabled'] = askOnQuit.GetId()
-        
-        gridSizer.Add(item = askOnQuit,
-                      pos = (row, 0), span = (1, 2))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Select raster map:"))
+        box.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.rselection = Select(self, id = wx.ID_ANY,
+                                 size = globalvar.DIALOG_GSELECT_SIZE,
+                                 type = 'cell')
+        if self.groupRadio.GetValue() == True: 
+            self.rselection.Disable()
+        else:
+            if len(self.rasterList) > 0: self.rselection.SetValue(self.rasterList[0])
+        box.Add(item = self.rselection, pos = (1, 1))       
 
-        row += 1
-        hideSearch = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                 label = _("Hide '%s' tab (requires GUI restart)") % _("Search module"),
-                                 name = 'IsChecked')
-        hideSearch.SetValue(self.settings.Get(group = 'manager', key = 'hideTabs', subkey = 'search'))
-        self.winId['manager:hideTabs:search'] = hideSearch.GetId()
-        
-        gridSizer.Add(item = hideSearch,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1
-        hidePyShell = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                  label = _("Hide '%s' tab (requires GUI restart)") % _("Python shell"),
-                                  name = 'IsChecked')
-        hidePyShell.SetValue(self.settings.Get(group = 'manager', key = 'hideTabs', subkey = 'pyshell'))
-        self.winId['manager:hideTabs:pyshell'] = hidePyShell.GetId()
-        
-        gridSizer.Add(item = hidePyShell,
-                      pos = (row, 0), span = (1, 2))
-        
         #
-        # Selected text is copied to clipboard
+        # Select an image group to histogram
         #
-        row += 1
-        copySelectedTextToClipboard = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                                  label = _("Automatically copy selected text to clipboard (in Command console)"),
-                                                  name = 'IsChecked')
-        copySelectedTextToClipboard.SetValue(self.settings.Get(group = 'manager', key = 'copySelectedTextToClipboard', subkey = 'enabled'))
-        self.winId['manager:copySelectedTextToClipboard:enabled'] = copySelectedTextToClipboard.GetId()
-        
-        gridSizer.Add(item = copySelectedTextToClipboard,
-                      pos = (row, 0), span = (1, 2))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
-        
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Select image group:"))
+        box.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        self.gselection = Select(self, id = wx.ID_ANY,
+                                 size = globalvar.DIALOG_GSELECT_SIZE,
+                                 type = 'group')
+        if self.rasterRadio.GetValue() == True: 
+            self.gselection.Disable()
+        else:
+            if self.group != None: self.gselection.SetValue(self.group)
+        box.Add(item = self.gselection, pos = (2, 1))
+            
         #
-        # workspace
+        # Nsteps for FP maps and histogram type selection
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Workspace settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
-        
-        row = 0
-        posDisplay = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                 label = _("Suppress positioning Map Display Window(s)"),
-                                 name = 'IsChecked')
-        posDisplay.SetValue(self.settings.Get(group = 'general', key = 'workspace',
-                                              subkey = ['posDisplay', 'enabled']))
-        self.winId['general:workspace:posDisplay:enabled'] = posDisplay.GetId()
-        
-        gridSizer.Add(item = posDisplay,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1 
-        
-        posManager = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                 label = _("Suppress positioning Layer Manager window"),
-                                 name = 'IsChecked')
-        posManager.SetValue(self.settings.Get(group = 'general', key = 'workspace',
-                                              subkey = ['posManager', 'enabled']))
-        self.winId['general:workspace:posManager:enabled'] = posManager.GetId()
-        
-        gridSizer.Add(item = posManager,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1
-        defaultPos = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                 label = _("Save current window layout as default"),
-                                 name = 'IsChecked')
-        defaultPos.SetValue(self.settings.Get(group = 'general', key = 'defWindowPos', subkey = 'enabled'))
-        defaultPos.SetToolTip(wx.ToolTip (_("Save current position and size of Layer Manager window and opened "
-                                            "Map Display window(s) and use as default for next sessions.")))
-        self.winId['general:defWindowPos:enabled'] = defaultPos.GetId()
-        
-        gridSizer.Add(item = defaultPos,
-                      pos = (row, 0), span = (1, 2))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
-        
-        panel.SetSizer(border)
-        
-        return panel
-    
 
-        panel.SetSizer(border)
-        
-        return panel
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Number of bins (for FP maps)"))
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+        self.spinbins = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                      size = (100,-1), style = wx.SP_ARROW_KEYS)
+        self.spinbins.SetRange(1,1000)
+        self.spinbins.SetValue(self.bins)
+        box.Add(item = self.spinbins,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 1))
 
-    def _createAppearancePage(self, notebook):
-        """!Create notebook page for display settings"""
-   
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Appearance"))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Histogram type"))
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+        types = ['count', 'percent', 'area']
+        histtype = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+                                choices = types, style = wx.CB_DROPDOWN)
+        histtype.SetStringSelection(self.histtype)
+        box.Add(item = histtype,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 1))
+          
+        sizer.Add(item = box, proportion = 0,
+                  flag = wx.ALL, border = 10)
 
-        border = wx.BoxSizer(wx.VERTICAL)
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
 
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Font settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        btnsizer = wx.StdDialogButtonSizer()
 
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
+        btn = wx.Button(self, wx.ID_OK)
+        btn.SetDefault()
+        btnsizer.AddButton(btn)
 
-        #
-        # font settings
-        #
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
+        btn = wx.Button(self, wx.ID_CANCEL)
+        btnsizer.AddButton(btn)
+        btnsizer.Realize()
 
-        row = 0
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Font for command output:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        outfontButton = wx.Button(parent = panel, id = wx.ID_ANY,
-                               label = _("Set font"), size = (100, -1))
-        gridSizer.Add(item = outfontButton,
-                      flag = wx.ALIGN_RIGHT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 1))
+        sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
         #
-        # appearence
+        # bindings
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Appearance settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        self.Bind(wx.EVT_RADIOBUTTON, self.OnHistMap, self.rasterRadio)
+        self.Bind(wx.EVT_RADIOBUTTON, self.OnHistMap, self.groupRadio)
+        self.rselection.Bind(wx.EVT_TEXT, self.OnRasterSelection)
+        self.gselection.Bind(wx.EVT_TEXT, self.OnGroupSelection)
+        self.spinbins.Bind(wx.EVT_TEXT, self.OnSetBins)
+        self.spinbins.Bind(wx.EVT_SPINCTRL, self.OnSetBins)
+        histtype.Bind(wx.EVT_TEXT, self.OnSetHisttypes)
 
-        gridSizer  =  wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
+        self.SetSizer(sizer)
+        sizer.Fit(self)
 
-        #
-        # element list
-        #
-        row = 0
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                           label = _("Element list:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        elementList = wx.Choice(parent = panel, id = wx.ID_ANY, size = (325, -1),
-                                choices = self.settings.Get(group = 'appearance', key = 'elementListExpand',
-                                                            subkey = 'choices', internal = True),
-                                name = "GetSelection")
-        elementList.SetSelection(self.settings.Get(group = 'appearance', key = 'elementListExpand',
-                                                   subkey = 'selection'))
-        self.winId['appearance:elementListExpand:selection'] = elementList.GetId()
+    def OnHistMap(self, event):
+        """!Hander for radio buttons to choose between histogramming a
+            single raster and an imagery group
+        """
+        if self.rasterRadio.GetValue() == True:
+            self.maptype = 'raster'
+            self.rselection.Enable()
+            self.gselection.Disable()
+            self.gselection.SetValue('')
+        elif self.groupRadio.GetValue() == True:
+            self.maptype = 'group'
+            self.gselection.Enable()
+            self.rselection.Disable()
+            self.rselection.SetValue('')
+        else:
+            pass
+        
+    def OnRasterSelection(self, event):
+        """!Handler for selecting a single raster map
+        """
+        self.rasterList = []
+        self.rasterList.append(event.GetString())
 
-        gridSizer.Add(item = elementList,
-                      flag = wx.ALIGN_RIGHT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 1))
+    def OnGroupSelection(self, event):
+        """!Handler for selecting imagery group
+        """
+        self.rasterList = []
+        self.group = event.GetString()
+        ret = grass.read_command('i.group', 
+                                  group = '%s' % self.group, 
+                                  quiet = True,
+                                  flags = 'g').strip().split('\n')
+        if ret != None and ret != '':
+            self.rasterList = ret
+                                                                                            
+    def OnSetBins(self, event):
+        """!Bins for histogramming FP maps (=nsteps in r.stats)
+        """
+        self.bins = self.spinbins.GetValue()
         
-        #
-        # menu style
-        #
-        row += 1
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                           label = _("Menu style (requires GUI restart):")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        listOfStyles = self.settings.Get(group = 'appearance', key = 'menustyle',
-                                         subkey = 'choices', internal = True)
+    def OnSetHisttypes(self, event):
+        self.histtype = event.GetString()
         
-        menuItemText = wx.Choice(parent = panel, id = wx.ID_ANY, size = (325, -1),
-                                 choices = listOfStyles,
-                                 name = "GetSelection")
-        menuItemText.SetSelection(self.settings.Get(group = 'appearance', key = 'menustyle', subkey = 'selection'))
-        
-        self.winId['appearance:menustyle:selection'] = menuItemText.GetId()
-        
-        gridSizer.Add(item = menuItemText,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-        
+
+class TextDialog(wx.Dialog):
+    def __init__(self, parent, id, title, plottype = '',
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
+        """!Dialog to set histogram text options: font, title
+        and font size, axis labels and font size
+        """
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
         #
-        # gselect.TreeCtrlComboPopup height
+        # initialize variables
         #
-        row += 1
-        
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Height of map selection popup window (in pixels):")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        min = self.settings.Get(group = 'appearance', key = 'gSelectPopupHeight', subkey = 'min', internal = True)
-        max = self.settings.Get(group = 'appearance', key = 'gSelectPopupHeight', subkey = 'max', internal = True)
-        value = self.settings.Get(group = 'appearance', key = 'gSelectPopupHeight', subkey = 'value')
-        
-        popupHeightSpin = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = (100, -1))
-        popupHeightSpin.SetRange(min,max)
-        popupHeightSpin.SetValue(value)
-        
-        self.winId['appearance:gSelectPopupHeight:value'] = popupHeightSpin.GetId()
-        
-        gridSizer.Add(item = popupHeightSpin,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-        
-        
-        #
-        # icon theme
-        #
-        row += 1
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                           label = _("Icon theme (requires GUI restart):")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        iconTheme = wx.Choice(parent = panel, id = wx.ID_ANY, size = (100, -1),
-                              choices = self.settings.Get(group = 'appearance', key = 'iconTheme',
-                                                        subkey = 'choices', internal = True),
-                              name = "GetStringSelection")
-        iconTheme.SetStringSelection(self.settings.Get(group = 'appearance', key = 'iconTheme', subkey = 'type'))
-        self.winId['appearance:iconTheme:type'] = iconTheme.GetId()
+        # combo box entry lists
+        self.ffamilydict = { 'default' : wx.FONTFAMILY_DEFAULT,
+                             'decorative' : wx.FONTFAMILY_DECORATIVE,
+                             'roman' : wx.FONTFAMILY_ROMAN,
+                             'script' : wx.FONTFAMILY_SCRIPT,
+                             'swiss' : wx.FONTFAMILY_SWISS,
+                             'modern' : wx.FONTFAMILY_MODERN,
+                             'teletype' : wx.FONTFAMILY_TELETYPE }
 
-        gridSizer.Add(item = iconTheme,
-                      flag = wx.ALIGN_RIGHT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 1))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
-        
-        panel.SetSizer(border)
-                
-        # bindings
-        outfontButton.Bind(wx.EVT_BUTTON, self.OnSetOutputFont)
-        
-        return panel
-    
-    def _createDisplayPage(self, notebook):
-        """!Create notebook page for display settings"""
-   
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Map Display"))
+        self.fstyledict = { 'normal' : wx.FONTSTYLE_NORMAL,
+                            'slant' : wx.FONTSTYLE_SLANT,
+                            'italic' : wx.FONTSTYLE_ITALIC }
 
-        border = wx.BoxSizer(wx.VERTICAL)
+        self.fwtdict = { 'normal' : wx.FONTWEIGHT_NORMAL,
+                         'light' : wx.FONTWEIGHT_LIGHT,
+                         'bold' : wx.FONTWEIGHT_BOLD }
 
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Font settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        self.parent = parent
 
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
+        self.ptitle = self.parent.ptitle
+        self.xlabel = self.parent.xlabel
+        self.ylabel = self.parent.ylabel
 
-        #
-        # font settings
-        #
-        row = 0
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Default font for GRASS displays:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        fontButton = wx.Button(parent = panel, id = wx.ID_ANY,
-                               label = _("Set font"), size = (100, -1))
-        gridSizer.Add(item = fontButton,
-                      flag = wx.ALIGN_RIGHT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 1))
+        self.properties = self.parent.properties # read-only
+        
+        # font size
+        self.fontfamily = self.properties['font']['wxfont'].GetFamily()
+        self.fontstyle = self.properties['font']['wxfont'].GetStyle()
+        self.fontweight = self.properties['font']['wxfont'].GetWeight()
 
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
+        self._do_layout()
+                
+    def _do_layout(self):
+        """!Do layout"""
+        # dialog layout
+        sizer = wx.BoxSizer(wx.VERTICAL)
 
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Text settings"))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+
         #
-        # display settings
+        # profile title
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Default display settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Profile title:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        self.ptitleentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
+        # self.ptitleentry.SetFont(self.font)
+        self.ptitleentry.SetValue(self.ptitle)
+        gridSizer.Add(item = self.ptitleentry, pos = (0, 1))
 
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
-
-        
         #
-        # display driver
+        # title font
         #
-        row = 0
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Display driver:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        listOfDrivers = self.settings.Get(group = 'display', key = 'driver', subkey = 'choices', internal = True)
-        driver = wx.Choice(parent = panel, id = wx.ID_ANY, size = (150, -1),
-                           choices = listOfDrivers,
-                           name = "GetStringSelection")
-        driver.SetStringSelection(self.settings.Get(group = 'display', key = 'driver', subkey = 'type'))
-        self.winId['display:driver:type'] = driver.GetId()
-        
-        gridSizer.Add(item = driver,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-        
+        tlabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Title font size (pts):"))
+        gridSizer.Add(item = tlabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.ptitlesize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                      size = (50,-1), style = wx.SP_ARROW_KEYS)
+        self.ptitlesize.SetRange(5,100)
+        self.ptitlesize.SetValue(int(self.properties['font']['prop']['titleSize']))
+        gridSizer.Add(item = self.ptitlesize, pos = (1, 1))
+
         #
-        # Statusbar mode
+        # x-axis label
         #
-        row += 1
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Statusbar mode:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        listOfModes = self.settings.Get(group = 'display', key = 'statusbarMode', subkey = 'choices', internal = True)
-        statusbarMode = wx.Choice(parent = panel, id = wx.ID_ANY, size = (150, -1),
-                                  choices = listOfModes,
-                                  name = "GetSelection")
-        statusbarMode.SetSelection(self.settings.Get(group = 'display', key = 'statusbarMode', subkey = 'selection'))
-        self.winId['display:statusbarMode:selection'] = statusbarMode.GetId()
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("X-axis label:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        self.xlabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
+        # self.xlabelentry.SetFont(self.font)
+        self.xlabelentry.SetValue(self.xlabel)
+        gridSizer.Add(item = self.xlabelentry, pos = (2, 1))
 
-        gridSizer.Add(item = statusbarMode,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-
         #
-        # Background color
+        # y-axis label
         #
-        row += 1
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Background color:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        bgColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
-                                    colour = self.settings.Get(group = 'display', key = 'bgcolor', subkey = 'color'),
-                                    size = globalvar.DIALOG_COLOR_SIZE)
-        bgColor.SetName('GetColour')
-        self.winId['display:bgcolor:color'] = bgColor.GetId()
-        
-        gridSizer.Add(item = bgColor,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-        
-        #
-        # Align extent to display size
-        #
-        row += 1
-        alignExtent = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                  label = _("Align region extent based on display size"),
-                                  name = "IsChecked")
-        alignExtent.SetValue(self.settings.Get(group = 'display', key = 'alignExtent', subkey = 'enabled'))
-        self.winId['display:alignExtent:enabled'] = alignExtent.GetId()
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Y-axis label:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+        self.ylabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
+        # self.ylabelentry.SetFont(self.font)
+        self.ylabelentry.SetValue(self.ylabel)
+        gridSizer.Add(item = self.ylabelentry, pos = (3, 1))
 
-        gridSizer.Add(item = alignExtent,
-                      pos = (row, 0), span = (1, 2))
-        
         #
-        # Use computation resolution
+        # font size
         #
-        row += 1
-        compResolution = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                     label = _("Constrain display resolution to computational settings"),
-                                     name = "IsChecked")
-        compResolution.SetValue(self.settings.Get(group = 'display', key = 'compResolution', subkey = 'enabled'))
-        self.winId['display:compResolution:enabled'] = compResolution.GetId()
+        llabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Label font size (pts):"))
+        gridSizer.Add(item = llabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+        self.axislabelsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                         size = (50, -1), style = wx.SP_ARROW_KEYS)
+        self.axislabelsize.SetRange(5, 100) 
+        self.axislabelsize.SetValue(int(self.properties['font']['prop']['axisSize']))
+        gridSizer.Add(item = self.axislabelsize, pos = (4,1))
 
-        gridSizer.Add(item = compResolution,
-                      pos = (row, 0), span = (1, 2))
+        boxSizer.Add(item = gridSizer)
+        sizer.Add(item = boxSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
-        # auto-rendering
+        # font settings
         #
-        row += 1
-        autoRendering = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                    label = _("Enable auto-rendering"),
-                                    name = "IsChecked")
-        autoRendering.SetValue(self.settings.Get(group = 'display', key = 'autoRendering', subkey = 'enabled'))
-        self.winId['display:autoRendering:enabled'] = autoRendering.GetId()
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Font settings"))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+        gridSizer.AddGrowableCol(1)
 
-        gridSizer.Add(item = autoRendering,
-                      pos = (row, 0), span = (1, 2))
-        
         #
-        # auto-zoom
+        # font family
         #
-        row += 1
-        autoZooming = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                  label = _("Enable auto-zooming to selected map layer"),
-                                  name = "IsChecked")
-        autoZooming.SetValue(self.settings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'))
-        self.winId['display:autoZooming:enabled'] = autoZooming.GetId()
+        label1 = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Font family:"))
+        gridSizer.Add(item = label1, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        self.ffamilycb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+                                choices = self.ffamilydict.keys(), style = wx.CB_DROPDOWN)
+        self.ffamilycb.SetStringSelection('swiss')
+        for item in self.ffamilydict.items():
+            if self.fontfamily == item[1]:
+                self.ffamilycb.SetStringSelection(item[0])
+                break
+        gridSizer.Add(item = self.ffamilycb, pos = (0, 1), flag = wx.ALIGN_RIGHT)
 
-        gridSizer.Add(item = autoZooming,
-                      pos = (row, 0), span = (1, 2))
-
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
-        
-        panel.SetSizer(border)
-                
-        # bindings
-        fontButton.Bind(wx.EVT_BUTTON, self.OnSetFont)
-        
-        return panel
-
-    def _createCmdPage(self, notebook):
-        """!Create notebook page for commad dialog settings"""
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Command"))
-        
-        border = wx.BoxSizer(wx.VERTICAL)
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Command dialog settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
-        
         #
-        # command dialog settings
+        # font style
         #
-        row = 0
-        # overwrite
-        overwrite = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                label = _("Allow output files to overwrite existing files"),
-                                name = "IsChecked")
-        overwrite.SetValue(self.settings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'))
-        self.winId['cmd:overwrite:enabled'] = overwrite.GetId()
-        
-        gridSizer.Add(item = overwrite,
-                      pos = (row, 0), span = (1, 2))
-        row += 1
-        # close
-        close = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                            label = _("Close dialog when command is successfully finished"),
-                            name = "IsChecked")
-        close.SetValue(self.settings.Get(group = 'cmd', key = 'closeDlg', subkey = 'enabled'))
-        self.winId['cmd:closeDlg:enabled'] = close.GetId()
-        
-        gridSizer.Add(item = close,
-                      pos = (row, 0), span = (1, 2))
-        row += 1
-        # add layer
-        add = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                          label = _("Add created map into layer tree"),
-                          name = "IsChecked")
-        add.SetValue(self.settings.Get(group = 'cmd', key = 'addNewLayer', subkey = 'enabled'))
-        self.winId['cmd:addNewLayer:enabled'] = add.GetId()
-    
-        gridSizer.Add(item = add,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1
-        # interactive input
-        interactive = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                  label = _("Allow interactive input"),
-                                  name = "IsChecked")
-        interactive.SetValue(self.settings.Get(group = 'cmd', key = 'interactiveInput', subkey = 'enabled'))
-        self.winId['cmd:interactiveInput:enabled'] = interactive.GetId()
-        gridSizer.Add(item = interactive,
-                      pos = (row, 0), span = (1, 2))
-        
-        row += 1
-        # verbosity
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Verbosity level:")),
-                      flag = wx.ALIGN_LEFT |
-                      wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 0))
-        verbosity = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
-                              choices = self.settings.Get(group = 'cmd', key = 'verbosity', subkey = 'choices', internal = True),
-                              name = "GetStringSelection")
-        verbosity.SetStringSelection(self.settings.Get(group = 'cmd', key = 'verbosity', subkey = 'selection'))
-        self.winId['cmd:verbosity:selection'] = verbosity.GetId()
-        
-        gridSizer.Add(item = verbosity,
-                      pos = (row, 1))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
-        
-        #
-        # raster settings
-        #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Raster settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(0)
-        
-        #
-        # raster overlay
-        #
-        row = 0
-        rasterOpaque = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                    label = _("Make null cells opaque"),
-                                    name = 'IsChecked')
-        rasterOpaque.SetValue(self.settings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'))
-        self.winId['cmd:rasterOpaque:enabled'] = rasterOpaque.GetId()
-        
-        gridSizer.Add(item = rasterOpaque,
-                      pos = (row, 0), span = (1, 2))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.fstylecb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+                                    choices = self.fstyledict.keys(), style = wx.CB_DROPDOWN)
+        self.fstylecb.SetStringSelection('normal')
+        for item in self.fstyledict.items():
+            if self.fontstyle == item[1]:
+                self.fstylecb.SetStringSelection(item[0])
+                break
+        gridSizer.Add(item = self.fstylecb, pos = (1, 1), flag = wx.ALIGN_RIGHT)
 
-        # default color table
-        row += 1
-        rasterCTCheck = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                    label = _("Default color table"),
-                                    name = 'IsChecked')
-        rasterCTCheck.SetValue(self.settings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'enabled'))
-        self.winId['cmd:rasterColorTable:enabled'] = rasterCTCheck.GetId()
-        rasterCTCheck.Bind(wx.EVT_CHECKBOX, self.OnCheckColorTable)
-        
-        gridSizer.Add(item = rasterCTCheck,
-                      pos = (row, 0))
-        
-        rasterCTName = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
-                               choices = utils.GetColorTables(),
-                               name = "GetStringSelection")
-        rasterCTName.SetStringSelection(self.settings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'selection'))
-        self.winId['cmd:rasterColorTable:selection'] = rasterCTName.GetId()
-        if not rasterCTCheck.IsChecked():
-            rasterCTName.Enable(False)
-        
-        gridSizer.Add(item = rasterCTName,
-                      pos = (row, 1))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
-        
         #
-        # vector settings
+        # font weight
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Vector settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        
-        gridSizer = wx.FlexGridSizer (cols = 7, hgap = 3, vgap = 3)
-        
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Display:")),
-                      flag = wx.ALIGN_CENTER_VERTICAL)
-        
-        for type in ('point', 'line', 'centroid', 'boundary',
-                     'area', 'face'):
-            chkbox = wx.CheckBox(parent = panel, label = type)
-            checked = self.settings.Get(group = 'cmd', key = 'showType',
-                                        subkey = [type, 'enabled'])
-            chkbox.SetValue(checked)
-            self.winId['cmd:showType:%s:enabled' % type] = chkbox.GetId()
-            gridSizer.Add(item = chkbox)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Weight:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        self.fwtcb = wx.ComboBox(parent = self, size = (250, -1),
+                                 choices = self.fwtdict.keys(), style = wx.CB_DROPDOWN)
+        self.fwtcb.SetStringSelection('normal')
+        for item in self.fwtdict.items():
+            if self.fontweight == item[1]:
+                self.fwtcb.SetStringSelection(item[0])
+                break
 
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
-        
-        panel.SetSizer(border)
-        
-        return panel
+        gridSizer.Add(item = self.fwtcb, pos = (2, 1), flag = wx.ALIGN_RIGHT)
+                      
+        boxSizer.Add(item = gridSizer, flag = wx.EXPAND)
+        sizer.Add(item = boxSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
 
-    def _createAttributeManagerPage(self, notebook):
-        """!Create notebook page for 'Attribute Table Manager' settings"""
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Attributes"))
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
 
-        pageSizer = wx.BoxSizer(wx.VERTICAL)
-
         #
-        # highlighting
+        # buttons
         #
-        highlightBox = wx.StaticBox(parent = panel, id = wx.ID_ANY,
-                                    label = " %s " % _("Highlighting"))
-        highlightSizer = wx.StaticBoxSizer(highlightBox, wx.VERTICAL)
+        btnSave = wx.Button(self, wx.ID_SAVE)
+        btnApply = wx.Button(self, wx.ID_APPLY)
+        btnOk = wx.Button(self, wx.ID_OK)
+        btnCancel = wx.Button(self, wx.ID_CANCEL)
+        btnOk.SetDefault()
 
-        flexSizer = wx.FlexGridSizer (cols = 2, hgap = 5, vgap = 5)
-        flexSizer.AddGrowableCol(0)
+        # bindings
+        btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
+        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
+        btnOk.SetToolTipString(_("Apply changes for the current session and close dialog"))
+        btnOk.SetDefault()
+        btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
+        btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
+        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+
+        # sizers
+        btnStdSizer = wx.StdDialogButtonSizer()
+        btnStdSizer.AddButton(btnOk)
+        btnStdSizer.AddButton(btnApply)
+        btnStdSizer.AddButton(btnCancel)
+        btnStdSizer.Realize()
         
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY, label = _("Color:"))
-        hlColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
-                                    colour = self.settings.Get(group = 'atm', key = 'highlight', subkey = 'color'),
-                                    size = globalvar.DIALOG_COLOR_SIZE)
-        hlColor.SetName('GetColour')
-        self.winId['atm:highlight:color'] = hlColor.GetId()
+        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+        btnSizer.Add(item = btnSave, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
+        btnSizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+        sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
-        flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
-        flexSizer.Add(hlColor, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
-
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY, label = _("Line width (in pixels):"))
-        hlWidth = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = (50, -1),
-                              initial = self.settings.Get(group = 'atm', key = 'highlight',subkey = 'width'),
-                              min = 1, max = 1e6)
-        self.winId['atm:highlight:width'] = hlWidth.GetId()
-
-        flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
-        flexSizer.Add(hlWidth, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
-
-        highlightSizer.Add(item = flexSizer,
-                           proportion = 0,
-                           flag = wx.ALL | wx.EXPAND,
-                           border = 5)
-
-        pageSizer.Add(item = highlightSizer,
-                      proportion = 0,
-                      flag = wx.ALL | wx.EXPAND,
-                      border = 5)
-
         #
-        # data browser related settings
+        # bindings
         #
-        dataBrowserBox = wx.StaticBox(parent = panel, id = wx.ID_ANY,
-                                    label = " %s " % _("Data browser"))
-        dataBrowserSizer = wx.StaticBoxSizer(dataBrowserBox, wx.VERTICAL)
+        self.ptitleentry.Bind(wx.EVT_TEXT, self.OnTitle)
+        self.xlabelentry.Bind(wx.EVT_TEXT, self.OnXLabel)
+        self.ylabelentry.Bind(wx.EVT_TEXT, self.OnYLabel)
 
-        flexSizer = wx.FlexGridSizer (cols = 2, hgap = 5, vgap = 5)
-        flexSizer.AddGrowableCol(0)
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY, label = _("Left mouse double click:"))
-        leftDbClick = wx.Choice(parent = panel, id = wx.ID_ANY,
-                                choices = self.settings.Get(group = 'atm', key = 'leftDbClick', subkey = 'choices', internal = True),
-                                name = "GetSelection")
-        leftDbClick.SetSelection(self.settings.Get(group = 'atm', key = 'leftDbClick', subkey = 'selection'))
-        self.winId['atm:leftDbClick:selection'] = leftDbClick.GetId()
+        self.SetSizer(sizer)
+        sizer.Fit(self)
 
-        flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
-        flexSizer.Add(leftDbClick, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
+    def OnTitle(self, event):
+        self.ptitle = event.GetString()
 
-        # encoding
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("Encoding (e.g. utf-8, ascii, iso8859-1, koi8-r):"))
-        encoding = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
-                               value = self.settings.Get(group = 'atm', key = 'encoding', subkey = 'value'),
-                               name = "GetValue", size = (200, -1))
-        self.winId['atm:encoding:value'] = encoding.GetId()
+    def OnXLabel(self, event):
+        self.xlabel = event.GetString()
 
-        flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
-        flexSizer.Add(encoding, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
+    def OnYLabel(self, event):
+        self.ylabel = event.GetString()
 
-        # ask on delete record
-        askOnDeleteRec = wx.CheckBox(parent = panel, id = wx.ID_ANY,
-                                     label = _("Ask when deleting data record(s) from table"),
-                                     name = 'IsChecked')
-        askOnDeleteRec.SetValue(self.settings.Get(group = 'atm', key = 'askOnDeleteRec', subkey = 'enabled'))
-        self.winId['atm:askOnDeleteRec:enabled'] = askOnDeleteRec.GetId()
+    def UpdateSettings(self):
+        self.properties['font']['prop']['titleSize'] = self.ptitlesize.GetValue()
+        self.properties['font']['prop']['axisSize'] = self.axislabelsize.GetValue()
 
-        flexSizer.Add(askOnDeleteRec, proportion = 0)
+        family = self.ffamilydict[self.ffamilycb.GetStringSelection()]
+        self.properties['font']['wxfont'].SetFamily(family)
+        style = self.fstyledict[self.fstylecb.GetStringSelection()]
+        self.properties['font']['wxfont'].SetStyle(style)
+        weight = self.fwtdict[self.fwtcb.GetStringSelection()]
+        self.properties['font']['wxfont'].SetWeight(weight)
 
-        dataBrowserSizer.Add(item = flexSizer,
-                           proportion = 0,
-                           flag = wx.ALL | wx.EXPAND,
-                           border = 5)
+    def OnSave(self, event):
+        """!Button 'Save' pressed"""
+        self.UpdateSettings()
+        fileSettings = {}
+        UserSettings.ReadSettingsFile(settings=fileSettings)
+        fileSettings['plot'] = UserSettings.Get(group = 'plot')
+        file = UserSettings.SaveToFile(fileSettings)
+        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot text settings saved to file \'%s\'.') % file)
+        self.EndModal(wx.ID_OK)
 
-        pageSizer.Add(item = dataBrowserSizer,
-                      proportion = 0,
-                      flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
-                      border = 3)
-
-        #
-        # create table
-        #
-        createTableBox = wx.StaticBox(parent = panel, id = wx.ID_ANY,
-                                    label = " %s " % _("Create table"))
-        createTableSizer = wx.StaticBoxSizer(createTableBox, wx.VERTICAL)
-
-        flexSizer = wx.FlexGridSizer (cols = 2, hgap = 5, vgap = 5)
-        flexSizer.AddGrowableCol(0)
-
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("Key column:"))
-        keyColumn = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
-                                size = (250, -1))
-        keyColumn.SetValue(self.settings.Get(group = 'atm', key = 'keycolumn', subkey = 'value'))
-        self.winId['atm:keycolumn:value'] = keyColumn.GetId()
+    def OnApply(self, event):
+        """!Button 'Apply' pressed"""
+        self.UpdateSettings()
+        self.parent.OnPlotText(self)
         
-        flexSizer.Add(label, proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL)
-        flexSizer.Add(keyColumn, proportion = 0, flag = wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
+    def OnOk(self, event):
+        """!Button 'OK' pressed"""
+        self.UpdateSettings()
+        self.EndModal(wx.ID_OK)
 
-        createTableSizer.Add(item = flexSizer,
-                             proportion = 0,
-                             flag = wx.ALL | wx.EXPAND,
-                             border = 5)
-
-        pageSizer.Add(item = createTableSizer,
-                      proportion = 0,
-                      flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
-                      border = 3)
+    def OnCancel(self, event):
+        """!Button 'Cancel' pressed"""
+        self.EndModal(wx.ID_CANCEL)
         
-        panel.SetSizer(pageSizer)
-
-        return panel
-
-    def _createProjectionPage(self, notebook):
-        """!Create notebook page for workspace settings"""
-        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Projection"))
+class OptDialog(wx.Dialog):
+    def __init__(self, parent, id, title, plottype = '',
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs): 
+        """!Dialog to set various options for data plotted, including: line
+        width, color, style; marker size, color, fill, and style; grid
+        and legend options.
+        """
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
+        # init variables
+        self.parent = parent
+        self.linestyledict = parent.linestyledict
+        self.ptfilldict = parent.ptfilldict
+        self.plottype = plottype
         
-        border = wx.BoxSizer(wx.VERTICAL)
+        self.pttypelist = ['circle',
+                           'dot',
+                           'square',
+                           'triangle',
+                           'triangle_down',
+                           'cross',
+                           'plus']
         
-        #
-        # projections statusbar settings
-        #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Projection statusbar settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        self.axislist = ['min',
+                         'auto',
+                         'custom']
 
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(1)
-
-        # epsg
-        row = 0
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("EPSG code:"))
-        epsgCode = wx.ComboBox(parent = panel, id = wx.ID_ANY,
-                               name = "GetValue",
-                               size = (150, -1))
-        self.epsgCodeDict = dict()
-        epsgCode.SetValue(str(self.settings.Get(group = 'projection', key = 'statusbar', subkey = 'epsg')))
-        self.winId['projection:statusbar:epsg'] = epsgCode.GetId()
+        # widgets ids
+        self.wxId = {}
         
-        gridSizer.Add(item = label,
-                      pos = (row, 0),
-                      flag = wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(item = epsgCode,
-                      pos = (row, 1), span = (1, 2))
-        
-        # proj
-        row += 1
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("Proj.4 string (required):"))
-        projString = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
-                                 value = self.settings.Get(group = 'projection', key = 'statusbar', subkey = 'proj4'),
-                                 name = "GetValue", size = (400, -1))
-        self.winId['projection:statusbar:proj4'] = projString.GetId()
+        self.parent = parent
 
-        gridSizer.Add(item = label,
-                      pos = (row, 0),
-                      flag  =  wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(item = projString,
-                      pos = (row, 1), span = (1, 2),
-                      flag = wx.ALIGN_CENTER_VERTICAL)
+        # read-only
+        self.raster = self.parent.raster
+        self.rasterList = self.parent.rasterList
+        self.properties = self.parent.properties
+        self.map = ''
         
-        # epsg file
-        row += 1
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("EPSG file:"))
-        projFile = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
-                               value  =  self.settings.Get(group = 'projection', key = 'statusbar', subkey = 'projFile'),
-                               name = "GetValue", size = (400, -1))
-        self.winId['projection:statusbar:projFile'] = projFile.GetId()
-        gridSizer.Add(item = label,
-                      pos = (row, 0),
-                      flag  =  wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(item = projFile,
-                      pos = (row, 1),
-                      flag  =  wx.ALIGN_CENTER_VERTICAL)
+        if len(self.rasterList) == 0:
+            wx.MessageBox(parent = self,
+                              message = _("No map or image group selected to plot."),
+                              caption = _("Warning"), style = wx.OK | wx.ICON_ERROR)
+            
+        self._do_layout()
         
-        # note + button
-        row += 1
-        note = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                             label = _("Load EPSG codes (be patient), enter EPSG code or "
-                                       "insert Proj.4 string directly."))
-        gridSizer.Add(item = note,
-                      span = (1, 2),
-                      pos = (row, 0))
+    def ConvertTuples(self, tlist):
+        """!Converts tuples to strings when rasterList contains raster pairs
+            for scatterplot
+        """
+        list = []
+        for i in tlist:
+            i = str(i).strip('()')
+            list.append(i)
+            
+        return list
 
-        row += 1
-        epsgLoad = wx.Button(parent = panel, id = wx.ID_ANY,
-                             label = _("&Load EPSG codes"))
-        gridSizer.Add(item = epsgLoad,
-                      flag = wx.ALIGN_RIGHT,
-                      pos = (row, 1))
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
+    def _do_layout(self):
+        """!Do layout"""
+        # dialog layout
+        sizer = wx.BoxSizer(wx.VERTICAL)
 
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Plot settings")) 
+        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
+
+        self.wxId['pcolor']  = 0
+        self.wxId['pwidth']  = 0
+        self.wxId['pstyle']  = 0
+        self.wxId['psize'] = 0
+        self.wxId['ptype'] = 0
+        self.wxId['pfill'] = 0
+        self.wxId['plegend'] = 0
+        self.wxId['marker'] = {}
+        self.wxId['x-axis'] = {}
+        self.wxId['y-axis'] = {}
+        
         #
-        # format
+        # plot line settings and point settings
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Coordinates format"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        if len(self.rasterList) == 0: return
         
-        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
-        gridSizer.AddGrowableCol(2)
-
-        row = 0
-        # ll format
-        ll = wx.RadioBox(parent = panel, id = wx.ID_ANY,
-                         label = " %s " % _("LL projections"),
-                         choices = ["DMS", "DEG"],
-                         name = "GetStringSelection")
-        self.winId['projection:format:ll'] = ll.GetId()
-        if self.settings.Get(group = 'projection', key = 'format', subkey = 'll') == 'DMS':
-            ll.SetSelection(0)
-        else:
-            ll.SetSelection(1)
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = _("Map/image plotted"))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         
-        # precision
-        precision =  wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
-                                 min = 0, max = 12,
-                                 name = "GetValue")
-        precision.SetValue(int(self.settings.Get(group = 'projection', key = 'format', subkey = 'precision')))
-        self.winId['projection:format:precision'] = precision.GetId()
-                
-        gridSizer.Add(item = ll,
-                      pos = (row, 0))
-        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                         label = _("Precision:")),
-                      flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT,
-                      border = 20,
-                      pos = (row, 1))
-        gridSizer.Add(item = precision,
-                      flag = wx.ALIGN_CENTER_VERTICAL,
-                      pos = (row, 2))
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
         
-        
-        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
-        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
-        
-        panel.SetSizer(border)
+        row = 0
+        choicelist = []
+        for i in self.rasterList:
+            choicelist.append(str(i))
 
-        # bindings
-        epsgLoad.Bind(wx.EVT_BUTTON, self.OnLoadEpsgCodes)
-        epsgCode.Bind(wx.EVT_COMBOBOX, self.OnSetEpsgCode)
-        epsgCode.Bind(wx.EVT_TEXT_ENTER, self.OnSetEpsgCode)
-        
-        return panel
-
-    def OnCheckColorTable(self, event):
-        """!Set/unset default color table"""
-        win = self.FindWindowById(self.winId['cmd:rasterColorTable:selection'])
-        if event.IsChecked():
-            win.Enable()
+        self.mapchoice = wx.Choice(parent = self, id = wx.ID_ANY, size = (300, -1),
+                                   choices = choicelist)
+        if not self.map:
+            self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
         else:
-            win.Enable(False)
+            self.mapchoice.SetStringSelection(str(self.map))
+            
+                
+        gridSizer.Add(item = self.mapchoice, flag = wx.ALIGN_CENTER_VERTICAL, 
+                      pos = (row, 0), span = (1, 2))
         
-    def OnLoadEpsgCodes(self, event):
-        """!Load EPSG codes from the file"""
-        win = self.FindWindowById(self.winId['projection:statusbar:projFile'])
-        path = win.GetValue()
+        #
+        # options for line plots (profiles and histograms)
+        #
+        if self.plottype != 'scatter':
+            row +=1            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line color"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            color = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.raster[self.map]['pcolor'])
+            self.wxId['pcolor'] = color.GetId()
+            gridSizer.Add(item = color, pos = (row, 1))
 
-        self.epsgCodeDict = utils.ReadEpsgCodes(path)
-        list = self.FindWindowById(self.winId['projection:statusbar:epsg'])
-        if type(self.epsgCodeDict) == type(''):
-            wx.MessageBox(parent = self,
-                          message = _("Unable to read EPSG codes: %s") % self.epsgCodeDict,
-                          caption = _("Error"),  style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            self.epsgCodeDict = dict()
-            list.SetItems([])
-            list.SetValue('')
-            self.FindWindowById(self.winId['projection:statusbar:proj4']).SetValue('')
-            return
-        
-        choices = map(str, self.epsgCodeDict.keys())
+            row += 1
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line width"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            width = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                                 size = (50,-1), style = wx.SP_ARROW_KEYS)
+            width.SetRange(1, 10)
+            width.SetValue(self.raster[self.map]['pwidth'])
+            self.wxId['pwidth'] = width.GetId()
+            gridSizer.Add(item = width, pos = (row, 1))
 
-        list.SetItems(choices)
-        try:
-            code = int(list.GetValue())
-        except ValueError:
-            code = -1
-        win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
-        if code in self.epsgCodeDict:
-            win.SetValue(self.epsgCodeDict[code][1])
-        else:
-            list.SetSelection(0)
-            code = int(list.GetStringSelection())
-            win.SetValue(self.epsgCodeDict[code][1])
-    
-    def OnSetEpsgCode(self, event):
-        """!EPSG code selected"""
-        winCode = self.FindWindowById(event.GetId())
-        win = self.FindWindowById(self.winId['projection:statusbar:proj4'])
-        if not self.epsgCodeDict:
-            wx.MessageBox(parent = self,
-                          message = _("EPSG code %s not found") % event.GetString(),
-                          caption = _("Error"),  style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            winCode.SetValue('')
-            win.SetValue('')
-        
-        try:
-            code = int(event.GetString())
-        except ValueError:
-            wx.MessageBox(parent = self,
-                          message = _("EPSG code %s not found") % str(code),
-                          caption = _("Error"),  style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            winCode.SetValue('')
-            win.SetValue('')
-        
-        
-        try:
-            win.SetValue(self.epsgCodeDict[code][1].replace('<>', '').strip())
-        except KeyError:
-            wx.MessageBox(parent = self,
-                          message = _("EPSG code %s not found") % str(code),
-                          caption = _("Error"),  style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            winCode.SetValue('')
-            win.SetValue('')
-        
-    def OnSetFont(self, event):
-        """'Set font' button pressed"""
-        dlg = DefaultFontDialog(parent = self,
-                                title = _('Select default display font'),
-                                style = wx.DEFAULT_DIALOG_STYLE,
-                                type = 'font')
-        
-        if dlg.ShowModal() == wx.ID_OK:
-            # set default font and encoding environmental variables
-            if dlg.font:
-                os.environ["GRASS_FONT"] = dlg.font
-                self.settings.Set(group = 'display', value = dlg.font,
-                                  key = 'font', subkey = 'type')
+            row +=1
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            style = wx.Choice(parent = self, id = wx.ID_ANY, 
+                                 size = (120, -1), choices = self.linestyledict.keys(), style = wx.CB_DROPDOWN)
+            style.SetStringSelection(self.raster[self.map]['pstyle'])
+            self.wxId['pstyle'] = style.GetId()
+            gridSizer.Add(item = style, pos = (row, 1))
 
-            if dlg.encoding and \
-                    dlg.encoding != "ISO-8859-1":
-                os.environ["GRASS_ENCODING"] = dlg.encoding
-                self.settings.Set(group = 'display', value = dlg.encoding,
-                                  key = 'font', subkey = 'encoding')
-                
-        dlg.Destroy()
+        row += 1
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        legend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
+        legend.SetValue(self.raster[self.map]['plegend'])
+        gridSizer.Add(item = legend, pos = (row, 1))
+        self.wxId['plegend'] = legend.GetId()
         
-        event.Skip()
+        boxSizer.Add(item = gridSizer)
+        boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
 
-    def OnSetOutputFont(self, event):
-        """'Set output font' button pressed
-        """
+        #
+        # segment marker settings for profiles only
+        #       
+        if self.plottype == 'profile':
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s " % _("Transect segment marker settings"))
+            
+            boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+            
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Color"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+            ptcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.properties['marker']['color'])
+            self.wxId['marker']['color'] = ptcolor.GetId()
+            gridSizer.Add(item = ptcolor, pos = (0, 1))
 
-        type = self.settings.Get(group = 'appearance', key = 'outputfont', subkey = 'type')   
-                           
-        size = self.settings.Get(group = 'appearance', key = 'outputfont', subkey = 'size')
-        if size == None or size == 0: size = 11
-        size = float(size)
-        if type == None or type == '': type = 'Courier'
-        
-        outfont = wx.Font(size, wx.FONTFAMILY_MODERN, wx.NORMAL, 0, faceName = type)
-        
-        fontdata = wx.FontData()
-        fontdata.EnableEffects(True)
-        fontdata.SetColour('black')
-        fontdata.SetInitialFont(outfont)
-        
-        dlg = wx.FontDialog(self, fontdata)
-        
-        'FIXME: native font dialog does not initialize with current font'
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Size"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+            ptsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                                 size = (50, -1), style = wx.SP_ARROW_KEYS)
+            ptsize.SetRange(1, 10)
+            ptsize.SetValue(self.properties['marker']['size'])
+            self.wxId['marker']['size'] = ptsize.GetId()
+            gridSizer.Add(item = ptsize, pos = (1, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+            ptfill = wx.ComboBox(parent = self, id = wx.ID_ANY,
+                                 size = (120, -1), choices = self.ptfilldict.keys(), style = wx.CB_DROPDOWN)
+            ptfill.SetStringSelection(self.properties['marker']['fill'])
+            self.wxId['marker']['fill'] = ptfill.GetId()
+            gridSizer.Add(item = ptfill, pos = (2, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+            ptlegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
+            ptlegend.SetValue(self.properties['marker']['legend'])
+            self.wxId['marker']['legend'] = ptlegend.GetId()
+            gridSizer.Add(item = ptlegend, pos = (3, 1))
+                    
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Type"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+            pttype = wx.ComboBox(parent = self, 
+                                 size = (200, -1), choices = self.pttypelist, style = wx.CB_DROPDOWN)
+            pttype.SetStringSelection(self.properties['marker']['type'])
+            self.wxId['marker']['type'] = pttype.GetId()
+            gridSizer.Add(item = pttype, pos = (4, 1))
 
-        if dlg.ShowModal() == wx.ID_OK:
-            outdata = dlg.GetFontData()
-            font = outdata.GetChosenFont()
+            boxSizer.Add(item = gridSizer)
+            boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
+            
+        #
+        # point options for scatterplots
+        #
+        elif self.plottype == 'scatter':
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s " % _("Scatterplot points"))
+            
+            boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+            
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Color"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+            ptcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.raster[self.map]['pcolor'])
+            self.wxId['pcolor'] = ptcolor.GetId()
+            gridSizer.Add(item = ptcolor, pos = (0, 1))
 
-            self.settings.Set(group = 'appearance', value = font.GetFaceName(),
-                                  key = 'outputfont', subkey = 'type')
-            self.settings.Set(group = 'appearance', value = font.GetPointSize(),
-                                  key = 'outputfont', subkey = 'size')
-        dlg.Destroy()
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Size"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+            ptsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                                 size = (50, -1), style = wx.SP_ARROW_KEYS)
+            ptsize.SetRange(1, 10)
+            ptsize.SetValue(self.raster[self.map]['psize'])
+            self.wxId['psize'] = ptsize.GetId()
+            gridSizer.Add(item = ptsize, pos = (1, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+            ptfill = wx.ComboBox(parent = self, id = wx.ID_ANY,
+                                 size = (120, -1), choices = self.ptfilldict.keys(), style = wx.CB_DROPDOWN)
+            ptfill.SetStringSelection(self.raster[self.map]['pfill'])
+            self.wxId['pfill'] = ptfill.GetId()
+            gridSizer.Add(item = ptfill, pos = (2, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+            ptlegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
+            ptlegend.SetValue(self.raster[self.map]['plegend'])
+            self.wxId['plegend'] = ptlegend.GetId()
+            gridSizer.Add(item = ptlegend, pos = (3, 1))
+                    
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Type"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+            pttype = wx.ComboBox(parent = self, 
+                                 size = (200, -1), choices = self.pttypelist, style = wx.CB_DROPDOWN)
+            pttype.SetStringSelection(self.raster[self.map]['ptype'])
+            self.wxId['ptype'] = pttype.GetId()
+            gridSizer.Add(item = pttype, pos = (4, 1))
 
-        event.Skip()
+            boxSizer.Add(item = gridSizer)
+            boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
+            
+        sizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
-class DefaultFontDialog(wx.Dialog):
-    """
-    Opens a file selection dialog to select default font
-    to use in all GRASS displays
-    """
-    def __init__(self, parent, title, id = wx.ID_ANY,
-                 style = wx.DEFAULT_DIALOG_STYLE |
-                 wx.RESIZE_BORDER,
-                 settings = globalSettings,
-                 type = 'font'):
-        
-        self.settings = settings
-        self.type = type
-        
-        wx.Dialog.__init__(self, parent, id, title, style = style)
+        #
+        # axis options for all plots
+        #
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Axis settings"))
+        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
-        panel = wx.Panel(parent = self, id = wx.ID_ANY)
-        
-        self.fontlist = self.GetFonts()
-        
-        border = wx.BoxSizer(wx.VERTICAL)
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Font settings"))
-        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        middleSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-        gridSizer = wx.GridBagSizer (hgap = 5, vgap = 5)
-        gridSizer.AddGrowableCol(0)
+        idx = 0
+        for axis, atype in [(_("X-Axis"), 'x-axis'),
+                     (_("Y-Axis"), 'y-axis')]:
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s " % axis)
+            boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
 
-        label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("Select font:"))
-        gridSizer.Add(item = label,
-                      flag = wx.ALIGN_TOP,
-                      pos = (0,0))
-        
-        self.fontlb = wx.ListBox(parent = panel, id = wx.ID_ANY, pos = wx.DefaultPosition,
-                                 choices = self.fontlist,
-                                 style = wx.LB_SINGLE|wx.LB_SORT)
-        self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.fontlb)
-        self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.fontlb)
+            prop = self.properties[atype]['prop']
+            
+            row = 0
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            type = wx.Choice(parent = self, id = wx.ID_ANY,
+                               size = (100, -1), choices = self.axislist, style = wx.CB_DROPDOWN)
+            type.SetStringSelection(prop['type']) 
+            self.wxId[atype]['type'] = type.GetId()
+            gridSizer.Add(item = type, pos = (row, 1))
+                        
+            row += 1
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Custom min"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            min = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (70, -1))
+            min.SetValue(str(prop['min']))
+            self.wxId[atype]['min'] = min.GetId()
+            gridSizer.Add(item = min, pos = (row, 1))
 
-        gridSizer.Add(item = self.fontlb,
-                flag = wx.EXPAND, pos = (1, 0))
+            row += 1
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Custom max"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            max = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (70, -1))
+            max.SetValue(str(prop['max']))
+            self.wxId[atype]['max'] = max.GetId()
+            gridSizer.Add(item = max, pos = (row, 1))
+            
+            row += 1
+            log = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Log scale"))
+            log.SetValue(prop['log'])
+            self.wxId[atype]['log'] = log.GetId()
+            gridSizer.Add(item = log, pos = (row, 0), span = (1, 2))
 
-        if self.type == 'font':
-            if "GRASS_FONT" in os.environ:
-                self.font = os.environ["GRASS_FONT"]
+            if idx == 0:
+                flag = wx.ALL | wx.EXPAND
             else:
-                self.font = self.settings.Get(group = 'display',
-                                              key = 'font', subkey = 'type')
-            self.encoding = self.settings.Get(group = 'display',
-                                          key = 'font', subkey = 'encoding')
+                flag = wx.TOP | wx.BOTTOM | wx.RIGHT | wx.EXPAND
 
-            label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                                  label = _("Character encoding:"))
-            gridSizer.Add(item = label,
-                          flag = wx.ALIGN_CENTER_VERTICAL,
-                          pos = (2, 0))
+            boxSizer.Add(item = gridSizer, flag = wx.ALL, border = 3)
+            boxMainSizer.Add(item = boxSizer, flag = flag, border = 3)
 
-            self.textentry = wx.TextCtrl(parent = panel, id = wx.ID_ANY,
-                                         value = self.encoding)
-            gridSizer.Add(item = self.textentry,
-                    flag = wx.EXPAND, pos = (3, 0))
+            idx += 1
+            
+        middleSizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
-            self.textentry.Bind(wx.EVT_TEXT, self.OnEncoding)
+        #
+        # grid & legend options for all plots
+        #
+        self.wxId['grid'] = {}
+        self.wxId['legend'] = {}
+        self.wxId['font'] = {}
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Grid and Legend settings"))
+        boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
 
-        elif self.type == 'outputfont':
-            self.font = self.settings.Get(group = 'appearance',
-                                              key = 'outputfont', subkey = 'type')
-            self.fontsize = self.settings.Get(group = 'appearance',
-                                          key = 'outputfont', subkey = 'size')
-            label = wx.StaticText(parent = panel, id = wx.ID_ANY,
-                              label = _("Font size:"))
-            gridSizer.Add(item = label,
-                      flag = wx.ALIGN_CENTER_VERTICAL,
-                      pos = (2, 0))
-                      
-            self.spin = wx.SpinCtrl(parent = panel, id = wx.ID_ANY)
-            if self.fontsize:
-                self.spin.SetValue(self.fontsize)
-            self.spin.Bind(wx.EVT_SPINCTRL, self.OnSizeSpin)
-            self.spin.Bind(wx.EVT_TEXT, self.OnSizeSpin)
-            gridSizer.Add(item = self.spin,
-                      flag = wx.ALIGN_CENTER_VERTICAL,
-                      pos = (3, 0))
+        row = 0
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Grid color"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        gridcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.properties['grid']['color'])
+        self.wxId['grid']['color'] = gridcolor.GetId()
+        gridSizer.Add(item = gridcolor, pos = (row, 1))
 
-        else: 
-            return
+        row +=1
+        gridshow = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Show grid"))
+        gridshow.SetValue(self.properties['grid']['enabled'])
+        self.wxId['grid']['enabled'] = gridshow.GetId()
+        gridSizer.Add(item = gridshow, pos = (row, 0), span = (1, 2))
 
-        if self.font:
-            self.fontlb.SetStringSelection(self.font, True)
+        row +=1
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend font size"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        legendfontsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", 
+                                     size = (50, -1), style = wx.SP_ARROW_KEYS)
+        legendfontsize.SetRange(5,100)
+        legendfontsize.SetValue(int(self.properties['font']['prop']['legendSize']))
+        self.wxId['font']['legendSize'] = legendfontsize.GetId()
+        gridSizer.Add(item = legendfontsize, pos = (row, 1))
 
-        sizer.Add(item = gridSizer, proportion = 1,
-                  flag = wx.EXPAND | wx.ALL,
-                  border = 5)
+        row += 1
+        legendshow = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Show legend"))
+        legendshow.SetValue(self.properties['legend']['enabled'])
+        self.wxId['legend']['enabled'] = legendshow.GetId()
+        gridSizer.Add(item = legendshow, pos = (row, 0), span = (1, 2))
 
-        border.Add(item = sizer, proportion = 1,
-                   flag = wx.ALL | wx.EXPAND, border = 3)
-        
-        btnsizer = wx.StdDialogButtonSizer()
+        boxMainSizer.Add(item = gridSizer, flag = flag, border = 3)
 
-        btn = wx.Button(parent = panel, id = wx.ID_OK)
-        btn.SetDefault()
-        btnsizer.AddButton(btn)
+        middleSizer.Add(item = boxMainSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
 
-        btn = wx.Button(parent = panel, id = wx.ID_CANCEL)
-        btnsizer.AddButton(btn)
-        btnsizer.Realize()
-
-        border.Add(item = btnsizer, proportion = 0,
-                   flag = wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, border = 5)
+        sizer.Add(item = middleSizer, flag = wx.ALL, border = 0)
         
-        panel.SetAutoLayout(True)
-        panel.SetSizer(border)
-        border.Fit(self)
-        
-        self.Layout()
-        
-    def EvtRadioBox(self, event):
-        if event.GetInt() == 0:
-            self.fonttype = 'grassfont'
-        elif event.GetInt() == 1:
-            self.fonttype = 'truetype'
+        #
+        # line & buttons
+        #
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
 
-        self.fontlist = self.GetFonts(self.fonttype)
-        self.fontlb.SetItems(self.fontlist)
+        #
+        # buttons
+        #
+        btnSave = wx.Button(self, wx.ID_SAVE)
+        btnApply = wx.Button(self, wx.ID_APPLY)
+        btnCancel = wx.Button(self, wx.ID_CANCEL)
+        btnSave.SetDefault()
 
-    def OnEncoding(self, event):
-        self.encoding = event.GetString()
+        # tooltips for buttons
+        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
+        btnSave.SetDefault()
+        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
 
-    def EvtListBox(self, event):
-        self.font = event.GetString()
-        event.Skip()
+        # sizers
+        btnStdSizer = wx.StdDialogButtonSizer()
+        btnStdSizer.AddButton(btnCancel)
+        btnStdSizer.AddButton(btnSave)
+        btnStdSizer.AddButton(btnApply)
+        btnStdSizer.Realize()
+        
+        sizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
-    def EvtListBoxDClick(self, event):
-        self.font = event.GetString()
-        event.Skip()
+        #
+        # bindings for buttons and map plot settings controls
+        #
+        self.mapchoice.Bind(wx.EVT_CHOICE, self.OnSetMap)
         
-    def OnSizeSpin(self, event):
-        self.fontsize = self.spin.GetValue()
-        event.Skip()
-    
-    def GetFonts(self):
-        """
-        parses fonts directory or fretypecap file to get a list of fonts for the listbox
-        """
-        fontlist = []
+        if self.plottype != 'scatter':
+            color.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+            width.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+            style.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            legend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+            
+        if self.plottype != 'histogram':
+            ptcolor.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+            ptsize.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+            ptfill.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            ptlegend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+            pttype.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            
+        btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
+        btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
+        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
 
-        cmd = ["d.font", "-l"]
+        self.SetSizer(sizer)
+        sizer.Fit(self)
 
-        ret = gcmd.RunCommand('d.font',
-                              read = True,
-                              flags = 'l')
+    def OnSetMap(self, event):
+        """!Handler for changing map selection"""
+        idx = event.GetSelection()
+        self.map = self.rasterList[idx]
+        
+        # update settings controls for all plots
+        self.FindWindowById(self.wxId['pcolor']).SetColour(self.raster[self.map]['pcolor'])
+        self.FindWindowById(self.wxId['plegend']).SetValue(self.raster[self.map]['plegend'])
 
-        if not ret:
-            return fontlist
+        # update settings controls for histograms and profiles
+        if self.plottype != 'scatter':
+            self.FindWindowById(self.wxId['pwidth']).SetValue(self.raster[self.map]['pwidth'])
+            self.FindWindowById(self.wxId['pstyle']).SetStringSelection(self.raster[self.map]['pstyle'])
 
-        dfonts = ret.splitlines()
-        dfonts.sort(lambda x,y: cmp(x.lower(), y.lower()))
-        for item in range(len(dfonts)):
-           # ignore duplicate fonts and those starting with #
-           if not dfonts[item].startswith('#') and \
-                  dfonts[item] != dfonts[item-1]:
-              fontlist.append(dfonts[item])
-
-        return fontlist
-
-class MapsetAccess(wx.Dialog):
-    """!Controls setting options and displaying/hiding map overlay
-    decorations
-    """
-    def __init__(self, parent, id = wx.ID_ANY,
-                 title = _('Manage access to mapsets'),
-                 size  =  (350, 400),
-                 style  =  wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, **kwargs):
-        wx.Dialog.__init__(self, parent, id, title, size = size, style = style)
-
-        self.all_mapsets_ordered = utils.ListOfMapsets(get = 'ordered')
-        self.accessible_mapsets  = utils.ListOfMapsets(get = 'accessible')
-        self.curr_mapset = grass.gisenv()['MAPSET']
-
-        # make a checklistbox from available mapsets and check those that are active
-        sizer = wx.BoxSizer(wx.VERTICAL)
-
-        label = wx.StaticText(parent = self, id = wx.ID_ANY,
-                              label = _("Check a mapset to make it accessible, uncheck it to hide it.\n"
-                                        "  Notes:\n"
-                                        "    - The current mapset is always accessible.\n"
-                                        "    - You may only write to the current mapset.\n"
-                                        "    - You may only write to mapsets which you own."))
+        # update settings controls for scatterplots
+        elif self.plottype == 'scatter':
+            self.FindWindowById(self.wxId['psize']).SetValue(self.raster[self.map]['psize'])
+            self.FindWindowById(self.wxId['ptype']).SetStringSelection(self.raster[self.map]['ptype'])
+            self.FindWindowById(self.wxId['pfill']).SetStringSelection(self.raster[self.map]['pfill'])
+            
+        self.Refresh()
         
-        sizer.Add(item = label, proportion = 0,
-                  flag = wx.ALL, border = 5)
+    def OnSetOpt(self, event):
+        """!Handler for changing any other option"""
+        self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
+        self.UpdateSettings()
+        self.parent.SetGraphStyle()
+        if self.parent.plot:
+            p = self.parent.CreatePlotList()
+            self.parent.DrawPlot(p)
 
-        self.mapsetlb = CheckListMapset(parent = self)
-        self.mapsetlb.LoadData()
+    def UpdateSettings(self):
+        """!Apply settings to each map and to entire plot"""
         
-        sizer.Add(item = self.mapsetlb, proportion = 1,
-                  flag = wx.ALL | wx.EXPAND, border = 5)
+        # update plot settings for selected map
+        self.raster[self.map]['pcolor'] = self.FindWindowById(self.wxId['pcolor']).GetColour()
+        self.raster[self.map]['plegend'] = self.FindWindowById(self.wxId['plegend']).GetValue()
+        
+        if self.plottype != 'scatter':
+            self.raster[self.map]['pwidth'] = int(self.FindWindowById(self.wxId['pwidth']).GetValue())
+            self.raster[self.map]['pstyle'] = self.FindWindowById(self.wxId['pstyle']).GetStringSelection()
+            
+        elif self.plottype == 'scatter':
+            self.raster[self.map]['psize'] = self.FindWindowById(self.wxId['psize']).GetValue()
+            self.raster[self.map]['ptype'] = self.FindWindowById(self.wxId['ptype']).GetValue()
+            self.raster[self.map]['pfill'] = self.FindWindowById(self.wxId['pfill']).GetValue()
 
-        # check all accessible mapsets
-        for mset in self.accessible_mapsets:
-            self.mapsetlb.CheckItem(self.all_mapsets_ordered.index(mset), True)
+        # update settings for entire plot
+        for axis in ('x-axis', 'y-axis'):
+            self.properties[axis]['prop']['type'] = self.FindWindowById(self.wxId[axis]['type']).GetStringSelection()
+            self.properties[axis]['prop']['min'] = float(self.FindWindowById(self.wxId[axis]['min']).GetValue())
+            self.properties[axis]['prop']['max'] = float(self.FindWindowById(self.wxId[axis]['max']).GetValue())
+            self.properties[axis]['prop']['log'] = self.FindWindowById(self.wxId[axis]['log']).IsChecked()
 
-        # FIXME (howto?): grey-out current mapset
-        #self.mapsetlb.Enable(0, False)
+        if self.plottype == 'profile':
+            self.properties['marker']['color'] = self.FindWindowById(self.wxId['marker']['color']).GetColour()
+            self.properties['marker']['fill'] = self.FindWindowById(self.wxId['marker']['fill']).GetStringSelection()
+            self.properties['marker']['size'] = self.FindWindowById(self.wxId['marker']['size']).GetValue()
+            self.properties['marker']['type'] = self.FindWindowById(self.wxId['marker']['type']).GetValue()
+            self.properties['marker']['legend'] = self.FindWindowById(self.wxId['marker']['legend']).GetValue()
 
-        # dialog buttons
-        line = wx.StaticLine(parent = self, id = wx.ID_ANY,
-                             style = wx.LI_HORIZONTAL)
-        sizer.Add(item = line, proportion = 0,
-                  flag = wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border = 5)
+        self.properties['grid']['color'] = self.FindWindowById(self.wxId['grid']['color']).GetColour()
+        self.properties['grid']['enabled'] = self.FindWindowById(self.wxId['grid']['enabled']).IsChecked()
 
-        btnsizer = wx.StdDialogButtonSizer()
-        okbtn = wx.Button(self, wx.ID_OK)
-        okbtn.SetDefault()
-        btnsizer.AddButton(okbtn)
+        self.properties['font']['prop']['legendSize'] = self.FindWindowById(self.wxId['font']['legendSize']).GetValue()
+        self.properties['legend']['enabled'] = self.FindWindowById(self.wxId['legend']['enabled']).IsChecked()
 
-        cancelbtn = wx.Button(self, wx.ID_CANCEL)
-        btnsizer.AddButton(cancelbtn)
-        btnsizer.Realize()
+    def OnSave(self, event):
+        """!Button 'Save' pressed"""
+        self.OnApply(None)
+        fileSettings = {}
+        UserSettings.ReadSettingsFile(settings = fileSettings)
+        fileSettings[self.plottype] = UserSettings.Get(group = self.plottype)
+        file = UserSettings.SaveToFile(fileSettings)
+        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot settings saved to file \'%s\'.') % file)
+        self.Close()
 
-        sizer.Add(item = btnsizer, proportion = 0,
-                  flag = wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, border = 5)
-
-        # do layout
-        self.Layout()
-        self.SetSizer(sizer)
-        sizer.Fit(self)
-
-        self.SetMinSize(size)
+    def OnApply(self, event):
+        """!Button 'Apply' pressed. Does not close dialog"""
+        self.UpdateSettings()
+        self.parent.SetGraphStyle()
+        if self.parent.plot:
+            p = self.parent.CreatePlotList()
+            self.parent.DrawPlot(p)
         
-    def GetMapsets(self):
-        """!Get list of checked mapsets"""
-        ms = []
-        i = 0
-        for mset in self.all_mapsets_ordered:
-            if self.mapsetlb.IsChecked(i):
-                ms.append(mset)
-            i += 1
+    def OnCancel(self, event):
+        """!Button 'Cancel' pressed"""
+        self.Close()
 
-        return ms
-
-class CheckListMapset(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
-    """!List of mapset/owner/group"""
-    def __init__(self, parent, pos = wx.DefaultPosition,
-                 log = None):
-        self.parent = parent
-        
-        wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
-                             style = wx.LC_REPORT)
-        listmix.CheckListCtrlMixin.__init__(self)
-        self.log = log
-
-        # setup mixins
-        listmix.ListCtrlAutoWidthMixin.__init__(self)
-
-    def LoadData(self):
-        """!Load data into list"""
-        self.InsertColumn(0, _('Mapset'))
-        self.InsertColumn(1, _('Owner'))
-        ### self.InsertColumn(2, _('Group'))
-        gisenv = grass.gisenv()
-        locationPath = os.path.join(gisenv['GISDBASE'], gisenv['LOCATION_NAME'])
-
-        for mapset in self.parent.all_mapsets_ordered:
-            index = self.InsertStringItem(sys.maxint, mapset)
-            mapsetPath = os.path.join(locationPath,
-                                      mapset)
-            stat_info = os.stat(mapsetPath)
-            if havePwd:
-                self.SetStringItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
-                # FIXME: get group name
-                ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid) 
-            else:
-                # FIXME: no pwd under MS Windows (owner: 0, group: 0)
-                self.SetStringItem(index, 1, "%-8s" % stat_info.st_uid)
-                ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
-                
-        self.SetColumnWidth(col = 0, width = wx.LIST_AUTOSIZE)
-        ### self.SetColumnWidth(col = 1, width = wx.LIST_AUTOSIZE)
-        
-    def OnCheckItem(self, index, flag):
-        """!Mapset checked/unchecked"""
-        mapset = self.parent.all_mapsets_ordered[index]
-        if mapset == self.parent.curr_mapset:
-            self.CheckItem(index, True)
+#### merge with generic options dialog        

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-10-05 07:13:29 UTC (rev 48621)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-10-05 07:37:36 UTC (rev 48622)
@@ -14,6 +14,7 @@
  - ModelToolbar
  - HistogramToolbar
  - Histogram2Toolbar
+ - ScatterplotToolbar
  - LMWorkspaceToolbar
  - LMDataToolbar
  - LMToolsToolbar
@@ -1456,6 +1457,45 @@
                                       self.parent.OnQuit),
                                      ))
 
+class ScatterplotToolbar(AbstractToolbar):
+    """!Toolbar for bivariate scatterplots of raster map pairs
+    """ 
+    def __init__(self, parent):
+        AbstractToolbar.__init__(self, parent)
+        
+        self.InitToolbar(self._toolbarData())
+        
+        # realize the toolbar
+        self.Realize()
+        
+    def _toolbarData(self):
+        """!Toolbar data"""
+        icons = Icons['profile']
+        return self._getToolbarData((('addraster', Icons['layerManager']["addRast"],
+                                      self.parent.OnSelectRaster),
+                                     (None, ),
+                                     ('draw', icons["draw"],
+                                      self.parent.OnCreateScatter),
+                                     ('erase', Icons['displayWindow']["erase"],
+                                      self.parent.OnErase),
+                                     ('drag', Icons['displayWindow']['pan'],
+                                      self.parent.OnDrag),
+                                     ('zoom', Icons['displayWindow']['zoomIn'],
+                                      self.parent.OnZoom),
+                                     ('unzoom', Icons['displayWindow']['zoomBack'],
+                                      self.parent.OnRedraw),
+                                     (None, ),
+                                     ('image', Icons['displayWindow']["saveFile"],
+                                      self.parent.SaveToFile),
+                                     ('print', Icons['displayWindow']["print"],
+                                      self.parent.PrintMenu),
+                                     (None, ),
+                                     ('settings', icons["options"],
+                                      self.parent.PlotOptionsMenu),
+                                     ('quit', icons["quit"],
+                                      self.parent.OnQuit),
+                                     ))
+
 class LMWorkspaceToolbar(AbstractToolbar):
     """!Layer Manager `workspace` toolbar
     """

Modified: grass/trunk/gui/wxpython/gui_modules/wxplot.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxplot.py	2011-10-05 07:13:29 UTC (rev 48621)
+++ grass/trunk/gui/wxpython/gui_modules/wxplot.py	2011-10-05 07:37:36 UTC (rev 48622)
@@ -28,6 +28,7 @@
 from render      import Map
 from toolbars    import Histogram2Toolbar
 from toolbars    import ProfileToolbar
+from toolbars    import ScatterplotToolbar
 from preferences import globalSettings as UserSettings
 
 import wxplot_dialogs as dialogs
@@ -48,10 +49,10 @@
 
 class AbstractPlotFrame(wx.Frame):
     """!Abstract PyPlot display frame class"""
-    def __init__(self, parent, id = wx.ID_ANY, title = '', size = (700, 400),
+    def __init__(self, parent = None, id = wx.ID_ANY, size = (700, 300),
                  style = wx.DEFAULT_FRAME_STYLE, rasterList = [],  **kwargs):
 
-        wx.Frame.__init__(self, parent, id, title, size = size, style = style, **kwargs)
+        wx.Frame.__init__(self, parent, id, size = size, style = style, **kwargs)
         
         self.parent = parent            # MapFrame
         self.mapwin = self.parent.MapWindow
@@ -60,7 +61,7 @@
         self.raster = {}    # dictionary of raster maps and their plotting parameters
         self.plottype = ''
         
-        self.pstyledict = { 'solid' : wx.SOLID,
+        self.linestyledict = { 'solid' : wx.SOLID,
                             'dot' : wx.DOT,
                             'long-dash' : wx.LONG_DASH,
                             'short-dash' : wx.SHORT_DASH,
@@ -136,7 +137,7 @@
                                                     wx.FONTSTYLE_NORMAL,
                                                     wx.FONTWEIGHT_NORMAL)
         
-        if self.plottype != 'histogram':
+        if self.plottype == 'profile':
             self.properties['marker'] = UserSettings.Get(group = self.plottype, key = 'marker')
             # changing color string to tuple for markers/points
             colstr = str(self.properties['marker']['color'])
@@ -172,7 +173,7 @@
         else:
             self.client.SetYSpec('auto')
         
-    def InitRasterOpts(self, rasterList):
+    def InitRasterOpts(self, rasterList, plottype):
         """!Initialize or update raster dictionary for plotting
         """
 
@@ -186,8 +187,8 @@
             except:
                 continue
                 # if r.info cannot parse map, skip it
-
-#            self.raster[r] = UserSettings.Get(group = 'plot', key = 'raster') # some default settings
+                
+            self.raster[r] = UserSettings.Get(group = plottype, key = 'raster') # some default settings
             rdict[r] = {} # initialize sub-dictionaries for each raster in the list
 
             if ret['units'] == '(none)' or ret['units'] == '' or ret['units'] == None:
@@ -213,6 +214,58 @@
             
         return rdict
             
+    def InitRasterPairs(self, rasterList, plottype):
+        """!Initialize or update raster dictionary with raster pairs for
+            bivariate scatterplots
+        """
+        
+        if len(rasterList) == 0: return
+
+        rdict = {} # initialize a dictionary
+        for rpair in rasterList:
+            idx = rasterList.index(rpair)
+            
+            try:
+                ret0 = raster.raster_info(rpair[0])
+                ret1 = raster.raster_info(rpair[1])
+
+            except:
+                continue
+                # if r.info cannot parse map, skip it
+
+            self.raster[rpair] = UserSettings.Get(group = plottype, key = 'rasters') # some default settings
+            rdict[rpair] = {} # initialize sub-dictionaries for each raster in the list
+            rdict[rpair][0] = {}
+            rdict[rpair][1] = {}
+
+            if ret0['units'] == '(none)' or ret['units'] == '' or ret['units'] == None:
+                rdict[rpair][0]['units'] = ''
+            else:
+                self.raster[rpair][0]['units'] = ret0['units']
+
+            if ret1['units'] == '(none)' or ret['units'] == '' or ret['units'] == None:
+                rdict[rpair][1]['units'] = ''
+            else:
+                self.raster[rpair][1]['units'] = ret1['units']
+
+            rdict[rpair]['plegend'] = rpair[0].split('@')[0] + ' vs ' + rpair[1].split('@')[0]
+            rdict[rpair]['datalist'] = [] # list of cell value,frequency pairs for plotting histogram
+            rdict[rpair]['ptype'] = 'dot'
+            rdict[rpair][0]['datatype'] = ret0['datatype']
+            rdict[rpair][1]['datatype'] = ret1['datatype']
+            rdict[rpair]['psize'] = 1
+            rdict[rpair]['pfill'] = 'solid'
+            
+            if idx <= len(self.colorList):
+                rdict[rpair]['pcolor'] = self.colorDict[self.colorList[idx]]
+            else:
+                r = randint(0, 255)
+                b = randint(0, 255)
+                g = randint(0, 255)
+                rdict[rpair]['pcolor'] = ((r,g,b,255))
+            
+        return rdict
+
     def SetGraphStyle(self):
         """!Set plot and text options
         """
@@ -234,7 +287,7 @@
         if self.properties['y-axis']['prop']['type'] == 'custom':
             self.client.SetYSpec('min')
         else:
-            self.client.SetYSpec(self.properties['y-axis']['prop']['type'])
+            self.client.SetYSpec(self.properties['y-axis']['prop'])
 
         if self.properties['x-axis']['prop']['type'] == 'custom' and \
                self.properties['x-axis']['prop']['min'] < self.properties['x-axis']['prop']['max']:
@@ -273,7 +326,6 @@
     def DrawPlot(self, plotlist):
         """!Draw line and point plot from list plot elements.
         """
-
         self.plot = plot.PlotGraphics(plotlist,
                                          self.ptitle,
                                          self.xlabel,
@@ -497,15 +549,14 @@
         self.Destroy()
         
 class HistFrame(AbstractPlotFrame):
-    def __init__(self, parent, title = _("GRASS Histogramming Tool"),
-                 rasterList = [], **kwargs):
+    def __init__(self, parent, id, pos, style, size, rasterList = []):
         """!Mainframe for displaying histogram of raster map. Uses wx.lib.plot.
         """
-        AbstractPlotFrame.__init__(self, parent, title = title,
-                                   rasterList = rasterList, **kwargs)
+        AbstractPlotFrame.__init__(self, parent, rasterList = rasterList, **kwargs)
         
         self.toolbar = Histogram2Toolbar(parent = self)
         self.SetToolBar(self.toolbar)
+        self.SetLabel(_("GRASS Histogramming Tool"))
 
         #
         # Init variables
@@ -524,7 +575,7 @@
                     "indigo"]
         
         if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
-            self.InitRasterOpts(self.rasterList)
+            self.InitRasterOpts(self.rasterList, self.plottype)
 
         self._initOpts()
 
@@ -555,14 +606,11 @@
             self.bins = dlg.bins
             self.histtype = dlg.histtype
             self.maptype = dlg.maptype
-            self.raster = self.InitRasterOpts(self.rasterList)
+            self.raster = self.InitRasterOpts(self.rasterList, self.plottype)
 
             # plot histogram
             if len(self.rasterList) > 0:
                 self.OnCreateHist(event = None)
-                self.SetupHistogram()
-                p = self.CreatePlotList()
-                self.DrawPlot(p)
 
         dlg.Destroy()
 
@@ -658,7 +706,7 @@
                 self.raster[r]['pline'] = plot.PolyLine(self.raster[r]['datalist'],
                                                         colour = col,
                                                         width = self.raster[r]['pwidth'],
-                                                        style = self.pstyledict[self.raster[r]['pstyle']],
+                                                        style = self.linestyledict[self.raster[r]['pstyle']],
                                                         legend = self.raster[r]['plegend'])
 
                 self.plotlist.append(self.raster[r]['pline'])
@@ -679,14 +727,13 @@
 class ProfileFrame(AbstractPlotFrame):
     """!Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot.
     """
-    def __init__(self, parent, title = _("GRASS Profile Analysis Tool"),
-                 rasterList = [], **kwargs):
+    def __init__(self, parent, id, pos, style, size, rasterList = []):
 
-        AbstractPlotFrame.__init__(self, parent, title = title,
-                                   rasterList = rasterList, **kwargs)
+        AbstractPlotFrame.__init__(self, parent, rasterList = rasterList, **kwargs)
 
         self.toolbar = ProfileToolbar(parent = self)
         self.SetToolBar(self.toolbar)
+        self.SetLabel(_("GRASS Profile Analysis Tool"))
 
         #
         # Init variables
@@ -705,7 +752,7 @@
                     "indigo"]
 
         if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
-            self.InitRasterOpts(self.rasterList)
+            self.InitRasterOpts(self.rasterList, self.plottype)
             
         
         self._initOpts()
@@ -746,7 +793,7 @@
 
         if dlg.ShowModal() == wx.ID_OK:
             self.rasterList = dlg.rasterList
-            self.raster = self.InitRasterOpts(self.rasterList)
+            self.raster = self.InitRasterOpts(self.rasterList, self.plottype)
             
             # plot profile
             if len(self.mapwin.polycoords) > 0 and len(self.rasterList) > 0:
@@ -934,7 +981,7 @@
             self.raster[r]['pline'] = plot.PolyLine(self.raster[r]['datalist'],
                                                     colour = col,
                                                     width = self.raster[r]['pwidth'],
-                                                    style = self.pstyledict[self.raster[r]['pstyle']],
+                                                    style = self.linestyledict[self.raster[r]['pstyle']],
                                                     legend = self.raster[r]['plegend'])
 
             self.plotlist.append(self.raster[r]['pline'])
@@ -978,3 +1025,203 @@
                 file.close()
 
         dlg.Destroy()
+        
+class ScatterFrame(AbstractPlotFrame):
+    """!Mainframe for displaying bivariate scatter plot of two raster maps. Uses wx.lib.plot.
+    """
+    def __init__(self, parent, id, pos, style, size, rasterList = []):
+
+        AbstractPlotFrame.__init__(self, parent)
+        
+        self.toolbar = ScatterplotToolbar(parent = self)
+        self.SetToolBar(self.toolbar)
+        self.SetLabel(_("GRASS Bivariate Scatterplot Tool"))
+
+        #
+        # Init variables
+        #
+        self.rasterList = rasterList
+        self.plottype = 'scatter'
+        self.ptitle = _('Bivariate Scatterplot')     # title of window
+        self.xlabel = _("Raster cell values")           # default X-axis label
+        self.ylabel = _("Raster cell values")           # default Y-axis label
+        self.maptype = 'raster'                         # default type of scatterplot
+        self.scattertype = 'normal' 
+        self.bins = 255
+        self.colorList = ["blue", "red", "black", "green", "yellow", "magenta", "cyan", \
+                    "aqua", "grey", "orange", "brown", "purple", "violet", \
+                    "indigo"]
+        
+        if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
+            self.InitRasterOpts(self.rasterList, 'scatter')
+
+        self._initOpts()
+
+    def _initOpts(self):
+        """!Initialize plot options
+        """
+        self.InitPlotOpts('scatter')            
+
+    def OnCreateScatter(self, event):
+        """!Main routine for creating a scatterplot. Uses r.stats to
+        create a list of cell value pairs. This is passed to
+        plot to create a scatterplot.
+        """
+        self.SetCursor(self.parent.cursors["default"])
+        self.SetGraphStyle()
+        self.SetupScatterplot()
+        p = self.CreatePlotList()
+        self.DrawPlot(p)
+
+    def OnSelectRaster(self, event):
+        """!Select raster map(s) to profile
+        """
+        dlg = dialogs.ScatterRasterDialog(parent = self)
+
+        if dlg.ShowModal() == wx.ID_OK:
+            rlist = dlg.rasterList
+            if rlist < 2: return                        # need at least 2 rasters for scatterplot
+            self.bins = dlg.bins                        # bins for r.stats with float and dcell maps
+            self.scattertype = dlg.scattertype          # scatterplot or bubbleplot
+            self.rasterList = self.CreatePairs(rlist)   # list of raster pairs (tuples)
+            self.raster = self.InitRasterPairs(self.rasterList, 'scatter') # dictionary of raster pairs
+
+            # plot histogram
+            if len(self.rasterList) > 0:
+                self.OnCreateScatter(event = None)
+
+        dlg.Destroy()
+        
+    def CreatePairs(self, rlist):
+        """!Transforms list of rasters into tuples of raster pairs
+        """
+        rasterList = []
+        next = 'first'
+        for r in rlist:
+            if next == 'first':
+                first = r
+                next = 'second'
+            else:
+                second = r
+                t = (first, second)
+                rasterList.append(t)
+                next = 'first'
+                first = second = ''
+                
+        return rasterList
+
+    def SetupScatterplot(self):
+        """!Build data list for ploting each raster
+        """
+
+        #
+        # initialize title string
+        #
+        self.ptitle = _('Bivariate Scatterplot of ')        
+
+        #
+        # create a datalist for plotting for each raster pair
+        #
+        if len(self.rasterList) == 0: return  # at least 1 pair of maps needed to plot        
+        
+        for rpair in self.rasterList:
+            self.raster[rpair]['datalist'] = self.CreateDatalist(rpair)
+            
+            # update title
+            self.ptitle += '%s vs %s, ' % (rpair[0].split('@')[0], rpair[1].split('@')[0])
+
+        self.ptitle = self.ptitle.strip(', ')
+        
+        #
+        # set xlabel & ylabel based on raster maps of first pair to be plotted
+        #
+        units = self.raster[self.rasterList[0]][0]['units']
+        if units != '' and units != '(none)' and units != None:
+            self.xlabel = _('Raster cell values %s') % units
+        else:
+            self.xlabel = _('Raster cell values') 
+
+        units = self.raster[self.rasterList[0]][1]['units']
+        if units != '' and units != '(none)' and units != None:
+            self.ylabel = _('Raster cell values %s') % units
+        else:
+            self.ylabel = _('Raster cell values') 
+
+    def CreateDatalist(self, rpair):
+        """!Build a list of cell value, frequency pairs for histogram
+            frequency can be in cell counts, percents, or area
+        """
+        datalist = []
+        
+        if self.scattertype == 'bubble': 
+            freqflag = 'cn'
+        else:
+            freqflag = 'n'
+                
+        try:
+            ret = gcmd.RunCommand("r.stats",
+                                  parent = self,
+                                  input = '%s,%s' % rpair,
+                                  flags = freqflag,
+                                  nsteps = self.bins,
+                                  fs = ',',
+                                  quiet = True,
+                                  read = True)
+            
+            
+            if not ret:
+                return datalist
+            
+            for line in ret.splitlines():
+                rast1, rast2 = line.strip().split(',')
+                rast1 = rast1.strip()
+                if '-' in rast1: rast1 = rast1.split('-')[0]
+                rast2 = rast2.strip()
+                if '-' in rast2: rast2 = rast2.split('-')[0]
+                
+                rast1 = rast1.encode('ascii', 'ignore')
+                rast2 = rast2.encode('ascii', 'ignore')
+                    
+                datalist.append((rast1,rast2))
+
+            return datalist
+        except gcmd.GException, e:
+            gcmd.GError(parent = self,
+                        message = e.value)
+            return None
+        
+    def CreatePlotList(self):
+        """!Make list of elements to plot
+        """
+        # graph the cell value, frequency pairs for the histogram
+        self.plotlist = []
+
+        for rpair in self.rasterList:
+            if 'datalist' not in self.raster[rpair] or \
+                self.raster[rpair]['datalist'] == None: return
+            
+            if len(self.raster[rpair]['datalist']) > 0:
+                col = wx.Color(self.raster[rpair]['pcolor'][0],
+                               self.raster[rpair]['pcolor'][1],
+                               self.raster[rpair]['pcolor'][2],
+                               255)
+                scatterpoints = plot.PolyMarker(self.raster[rpair]['datalist'],
+                                                legend = ' ' + self.raster[rpair]['plegend'],
+                                                colour = col,size = self.raster[rpair]['psize'],
+                                                fillstyle = self.ptfilldict[self.raster[rpair]['pfill']],
+                                                marker = self.raster[rpair]['ptype'])
+
+                self.plotlist.append(scatterpoints)
+          
+        if len(self.plotlist) > 0:        
+            return self.plotlist
+        else:
+            return None
+
+    def Update(self):
+        """!Update histogram after changing options
+        """
+        self.SetGraphStyle()
+        p = self.CreatePlotList()
+        self.DrawPlot(p)
+        

Modified: grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py	2011-10-05 07:13:29 UTC (rev 48621)
+++ grass/trunk/gui/wxpython/gui_modules/wxplot_dialogs.py	2011-10-05 07:37:36 UTC (rev 48622)
@@ -20,6 +20,7 @@
 
 import os
 import sys
+from types import *
 
 import wx
 import wx.lib.colourselect as  csel
@@ -33,7 +34,7 @@
 
 class ProfileRasterDialog(wx.Dialog):
     def __init__(self, parent, id = wx.ID_ANY, 
-                 title = _("Select raster map or imagery group to histogram"),
+                 title = _("Select raster maps to profile"),
                  style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
         """!Dialog to select raster maps to profile.
         """
@@ -106,6 +107,119 @@
         for idx in range(0,n):
             self.rasterList.append(rList[idx])
 
+class ScatterRasterDialog(wx.Dialog):
+    def __init__(self, parent, id = wx.ID_ANY, 
+                 title = _("Select pairs of raster maps for scatterplots"),
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
+        """!Dialog to select raster maps to profile.
+        """
+
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
+
+        self.parent = parent
+        self.rasterList = self.parent.rasterList
+        self.bins = self.parent.bins
+        self.scattertype = self.parent.scattertype
+        self.maptype = self.parent.maptype
+        self.spinbins = ''        
+        self.colorList = ["blue", "red", "green", "yellow", "magenta", "cyan", \
+                    "aqua", "black", "grey", "orange", "brown", "purple", "violet", \
+                    "indigo"]
+        
+        self._do_layout()
+        
+    def _do_layout(self):
+
+        sizer = wx.BoxSizer(wx.VERTICAL)
+
+        box = wx.GridBagSizer (hgap = 3, vgap = 3)
+        
+        # parse raster pair tuples 
+        rastText = ''
+        if len(self.rasterList) > 0:
+            for r in self.rasterList:
+                rastText += '%s,%s,' % r
+            rastText = rastText.rstrip(',')
+        
+        # select rasters
+        txt = _("Select pairs of raster maps for bivariate scatterplots:")
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = txt)
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        
+        selection = Select(self, id = wx.ID_ANY,
+                           size = globalvar.DIALOG_GSELECT_SIZE,
+                           type = 'cell', multiple=True)
+        selection.SetValue(rastText)
+        selection.Bind(wx.EVT_TEXT, self.OnSelection)
+        
+        box.Add(item = selection, pos = (0, 1))
+            
+        # Nsteps for FP maps 
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+                              label = _("Number of bins (for FP maps)"))
+        box.Add(item = label,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.spinbins = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                      size = (100,-1), style = wx.SP_ARROW_KEYS)
+        self.spinbins.SetRange(1,1000)
+        self.spinbins.SetValue(self.bins)
+        box.Add(item = self.spinbins,
+                flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 1))
+
+#### TODO possibly make bubble plots with marker size proportional to cell counts
+#        # scatterplot type 
+#        label = wx.StaticText(parent = self, id = wx.ID_ANY, 
+#                              label = _("Scatterplot type"))
+#        box.Add(item = label,
+#                flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+#        types = ['normal', 'bubble']
+#        scattertype = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+#                                choices = types, style = wx.CB_DROPDOWN)
+#        scattertype.SetStringSelection(self.scattertype)
+#        box.Add(item = scattertype,
+#                flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 1))
+          
+        sizer.Add(item = box, proportion = 0,
+                  flag = wx.ALL, border = 10)
+
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
+
+        btnsizer = wx.StdDialogButtonSizer()
+
+        btn = wx.Button(self, wx.ID_OK)
+        btn.SetDefault()
+        btnsizer.AddButton(btn)
+
+        btn = wx.Button(self, wx.ID_CANCEL)
+        btnsizer.AddButton(btn)
+        btnsizer.Realize()
+
+        sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+
+        self.spinbins.Bind(wx.EVT_TEXT, self.OnSetBins)
+        self.spinbins.Bind(wx.EVT_SPINCTRL, self.OnSetBins)
+#        scattertype.Bind(wx.EVT_TEXT, self.OnSetScattertypes)
+
+        self.SetSizer(sizer)
+        sizer.Fit(self)
+
+    def OnSelection(self, event):
+        """!Select raster maps for scatterplot. Must select maps in pairs.
+        """
+        self.rasterList = []
+        self.rasterList = event.GetString().split(',')
+            
+    def OnSetBins(self, event):
+        """!Bins for histogramming FP maps (=nsteps in r.stats)
+        """
+        self.bins = self.spinbins.GetValue()
+        
+    def OnSetScattertypes(self, event):
+        self.scattertype = event.GetString()
+
 class HistRasterDialog(wx.Dialog):
     def __init__(self, parent, id = wx.ID_ANY, 
                  title = _("Select raster map or imagery group to histogram"),
@@ -538,7 +652,7 @@
         wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
         # init variables
         self.parent = parent
-        self.pstyledict = parent.pstyledict
+        self.linestyledict = parent.linestyledict
         self.ptfilldict = parent.ptfilldict
         self.plottype = plottype
         
@@ -571,6 +685,17 @@
                               caption = _("Warning"), style = wx.OK | wx.ICON_ERROR)
             
         self._do_layout()
+        
+    def ConvertTuples(self, tlist):
+        """!Converts tuples to strings when rasterList contains raster pairs
+            for scatterplot
+        """
+        list = []
+        for i in tlist:
+            i = str(i).strip('()')
+            list.append(i)
+            
+        return list
 
     def _do_layout(self):
         """!Do layout"""
@@ -584,73 +709,86 @@
         self.wxId['pcolor']  = 0
         self.wxId['pwidth']  = 0
         self.wxId['pstyle']  = 0
+        self.wxId['psize'] = 0
+        self.wxId['ptype'] = 0
+        self.wxId['pfill'] = 0
         self.wxId['plegend'] = 0
         self.wxId['marker'] = {}
         self.wxId['x-axis'] = {}
         self.wxId['y-axis'] = {}
+        
+        #
+        # plot line settings and point settings
+        #
+        if len(self.rasterList) == 0: return
+        
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = _("Map/image plotted"))
+        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+        
+        row = 0
+        choicelist = []
+        for i in self.rasterList:
+            choicelist.append(str(i))
 
+        self.mapchoice = wx.Choice(parent = self, id = wx.ID_ANY, size = (300, -1),
+                                   choices = choicelist)
+        if not self.map:
+            self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
+        else:
+            self.mapchoice.SetStringSelection(str(self.map))
+            
+                
+        gridSizer.Add(item = self.mapchoice, flag = wx.ALIGN_CENTER_VERTICAL, 
+                      pos = (row, 0), span = (1, 2))
+        
         #
-        # plot line settings
+        # options for line plots (profiles and histograms)
         #
-        if len(self.rasterList) > 0:
-            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
-                               label = _("Map/image plotted"))
-            boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-            
-            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
-            
-            row = 0
-            self.mapchoice = wx.Choice(parent = self, id = wx.ID_ANY, size = (300, -1),
-                                       choices = self.rasterList)
-            if not self.map:
-                self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
-            else:
-                self.mapchoice.SetStringSelection(self.map)
-            gridSizer.Add(item = self.mapchoice, flag = wx.ALIGN_CENTER_VERTICAL, 
-                          pos = (row, 0), span = (1, 2))
-            
+        if self.plottype != 'scatter':
             row +=1            
             label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line color"))
             gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
-            pcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.raster[self.map]['pcolor'])
-            self.wxId['pcolor'] = pcolor.GetId()
-            gridSizer.Add(item = pcolor, pos = (row, 1))
+            color = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.raster[self.map]['pcolor'])
+            self.wxId['pcolor'] = color.GetId()
+            gridSizer.Add(item = color, pos = (row, 1))
 
             row += 1
             label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line width"))
             gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
-            pwidth = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+            width = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
                                  size = (50,-1), style = wx.SP_ARROW_KEYS)
-            pwidth.SetRange(1, 10)
-            pwidth.SetValue(self.raster[self.map]['pwidth'])
-            self.wxId['pwidth'] = pwidth.GetId()
-            gridSizer.Add(item = pwidth, pos = (row, 1))
+            width.SetRange(1, 10)
+            width.SetValue(self.raster[self.map]['pwidth'])
+            self.wxId['pwidth'] = width.GetId()
+            gridSizer.Add(item = width, pos = (row, 1))
 
             row +=1
             label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line style"))
             gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
-            pstyle = wx.Choice(parent = self, id = wx.ID_ANY, 
-                                 size = (120, -1), choices = self.pstyledict.keys(), style = wx.CB_DROPDOWN)
-            pstyle.SetStringSelection(self.raster[self.map]['pstyle'])
-            self.wxId['pstyle'] = pstyle.GetId()
-            gridSizer.Add(item = pstyle, pos = (row, 1))
+            style = wx.Choice(parent = self, id = wx.ID_ANY, 
+                                 size = (120, -1), choices = self.linestyledict.keys(), style = wx.CB_DROPDOWN)
+            style.SetStringSelection(self.raster[self.map]['pstyle'])
+            self.wxId['pstyle'] = style.GetId()
+            gridSizer.Add(item = style, pos = (row, 1))
 
-            row += 1
-            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
-            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
-            plegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
-            plegend.SetValue(self.raster[self.map]['plegend'])
-            gridSizer.Add(item = plegend, pos = (row, 1))
-            self.wxId['plegend'] = plegend.GetId()
-            
-            boxSizer.Add(item = gridSizer)
-            boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
+        row += 1
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        legend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
+        legend.SetValue(self.raster[self.map]['plegend'])
+        gridSizer.Add(item = legend, pos = (row, 1))
+        self.wxId['plegend'] = legend.GetId()
+        
+        boxSizer.Add(item = gridSizer)
+        boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
 
-
         #
-        # segment marker settings
+        # segment marker settings for profiles only
         #       
-        if self.plottype != 'histogram':
+        if self.plottype == 'profile':
             box = wx.StaticBox(parent = self, id = wx.ID_ANY,
                                label = " %s " % _("Transect segment marker settings"))
             
@@ -698,10 +836,61 @@
             boxSizer.Add(item = gridSizer)
             boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
             
+        #
+        # point options for scatterplots
+        #
+        elif self.plottype == 'scatter':
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s " % _("Scatterplot points"))
+            
+            boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+            
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Color"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+            ptcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.raster[self.map]['pcolor'])
+            self.wxId['pcolor'] = ptcolor.GetId()
+            gridSizer.Add(item = ptcolor, pos = (0, 1))
+
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Size"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+            ptsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                                 size = (50, -1), style = wx.SP_ARROW_KEYS)
+            ptsize.SetRange(1, 10)
+            ptsize.SetValue(self.raster[self.map]['psize'])
+            self.wxId['psize'] = ptsize.GetId()
+            gridSizer.Add(item = ptsize, pos = (1, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+            ptfill = wx.ComboBox(parent = self, id = wx.ID_ANY,
+                                 size = (120, -1), choices = self.ptfilldict.keys(), style = wx.CB_DROPDOWN)
+            ptfill.SetStringSelection(self.raster[self.map]['pfill'])
+            self.wxId['pfill'] = ptfill.GetId()
+            gridSizer.Add(item = ptfill, pos = (2, 1))
+            
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+            ptlegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
+            ptlegend.SetValue(self.raster[self.map]['plegend'])
+            self.wxId['plegend'] = ptlegend.GetId()
+            gridSizer.Add(item = ptlegend, pos = (3, 1))
+                    
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Type"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+            pttype = wx.ComboBox(parent = self, 
+                                 size = (200, -1), choices = self.pttypelist, style = wx.CB_DROPDOWN)
+            pttype.SetStringSelection(self.raster[self.map]['ptype'])
+            self.wxId['ptype'] = pttype.GetId()
+            gridSizer.Add(item = pttype, pos = (4, 1))
+
+            boxSizer.Add(item = gridSizer)
+            boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
+            
         sizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
-        # axis options
+        # axis options for all plots
         #
         box = wx.StaticBox(parent = self, id = wx.ID_ANY,
                            label = " %s " % _("Axis settings"))
@@ -763,7 +952,7 @@
         middleSizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
-        # grid & legend options
+        # grid & legend options for all plots
         #
         self.wxId['grid'] = {}
         self.wxId['legend'] = {}
@@ -842,10 +1031,20 @@
         # bindings for buttons and map plot settings controls
         #
         self.mapchoice.Bind(wx.EVT_CHOICE, self.OnSetMap)
-        pcolor.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
-        pwidth.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
-        pstyle.Bind(wx.EVT_CHOICE, self.OnSetOpt)
-        plegend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+        
+        if self.plottype != 'scatter':
+            color.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+            width.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+            style.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            legend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+            
+        if self.plottype != 'histogram':
+            ptcolor.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+            ptsize.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+            ptfill.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            ptlegend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+            pttype.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+            
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
@@ -855,13 +1054,24 @@
 
     def OnSetMap(self, event):
         """!Handler for changing map selection"""
-        self.map = event.GetString()
+        idx = event.GetSelection()
+        self.map = self.rasterList[idx]
         
-        # update plot settings controls for selected map
+        # update settings controls for all plots
         self.FindWindowById(self.wxId['pcolor']).SetColour(self.raster[self.map]['pcolor'])
-        self.FindWindowById(self.wxId['pwidth']).SetValue(self.raster[self.map]['pwidth'])
-        self.FindWindowById(self.wxId['pstyle']).SetStringSelection(self.raster[self.map]['pstyle'])
         self.FindWindowById(self.wxId['plegend']).SetValue(self.raster[self.map]['plegend'])
+
+        # update settings controls for histograms and profiles
+        if self.plottype != 'scatter':
+            self.FindWindowById(self.wxId['pwidth']).SetValue(self.raster[self.map]['pwidth'])
+            self.FindWindowById(self.wxId['pstyle']).SetStringSelection(self.raster[self.map]['pstyle'])
+
+        # update settings controls for scatterplots
+        elif self.plottype == 'scatter':
+            self.FindWindowById(self.wxId['psize']).SetValue(self.raster[self.map]['psize'])
+            self.FindWindowById(self.wxId['ptype']).SetStringSelection(self.raster[self.map]['ptype'])
+            self.FindWindowById(self.wxId['pfill']).SetStringSelection(self.raster[self.map]['pfill'])
+            
         self.Refresh()
         
     def OnSetOpt(self, event):
@@ -870,7 +1080,7 @@
         self.UpdateSettings()
         self.parent.SetGraphStyle()
         if self.parent.plot:
-            p = self.parent.CreatPlotList()
+            p = self.parent.CreatePlotList()
             self.parent.DrawPlot(p)
 
     def UpdateSettings(self):
@@ -878,9 +1088,16 @@
         
         # update plot settings for selected map
         self.raster[self.map]['pcolor'] = self.FindWindowById(self.wxId['pcolor']).GetColour()
-        self.raster[self.map]['pwidth'] = int(self.FindWindowById(self.wxId['pwidth']).GetValue())
-        self.raster[self.map]['pstyle'] = self.FindWindowById(self.wxId['pstyle']).GetStringSelection()
         self.raster[self.map]['plegend'] = self.FindWindowById(self.wxId['plegend']).GetValue()
+        
+        if self.plottype != 'scatter':
+            self.raster[self.map]['pwidth'] = int(self.FindWindowById(self.wxId['pwidth']).GetValue())
+            self.raster[self.map]['pstyle'] = self.FindWindowById(self.wxId['pstyle']).GetStringSelection()
+            
+        elif self.plottype == 'scatter':
+            self.raster[self.map]['psize'] = self.FindWindowById(self.wxId['psize']).GetValue()
+            self.raster[self.map]['ptype'] = self.FindWindowById(self.wxId['ptype']).GetValue()
+            self.raster[self.map]['pfill'] = self.FindWindowById(self.wxId['pfill']).GetValue()
 
         # update settings for entire plot
         for axis in ('x-axis', 'y-axis'):
@@ -889,7 +1106,7 @@
             self.properties[axis]['prop']['max'] = float(self.FindWindowById(self.wxId[axis]['max']).GetValue())
             self.properties[axis]['prop']['log'] = self.FindWindowById(self.wxId[axis]['log']).IsChecked()
 
-        if self.plottype != 'histogram':
+        if self.plottype == 'profile':
             self.properties['marker']['color'] = self.FindWindowById(self.wxId['marker']['color']).GetColour()
             self.properties['marker']['fill'] = self.FindWindowById(self.wxId['marker']['fill']).GetStringSelection()
             self.properties['marker']['size'] = self.FindWindowById(self.wxId['marker']['size']).GetValue()



More information about the grass-commit mailing list