Added plcopen.definitions.DefaultType, set to INT.
authorEdouard Tisserant
Fri, 30 May 2014 02:20:19 +0200
changeset 1412 50192dd2f5ff
parent 1411 805d13d216c0
child 1413 dd89016a5028
Added plcopen.definitions.DefaultType, set to INT.
controls/VariablePanel.py
editors/CodeFileEditor.py
editors/DataTypeEditor.py
plcopen/definitions.py
--- a/controls/VariablePanel.py	Wed May 28 18:33:41 2014 +0200
+++ b/controls/VariablePanel.py	Fri May 30 02:20:19 2014 +0200
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
-#based on the plcopen standard. 
+#based on the plcopen standard.
 #
 #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
 #
@@ -30,7 +30,7 @@
 import wx.grid
 import wx.lib.buttons
 
-from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS
+from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS, DefaultType
 from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD, ERROR_HIGHLIGHT
 from dialogs.ArrayTypeDialog import ArrayTypeDialog
 from CustomGrid import CustomGrid
@@ -49,7 +49,7 @@
     else:
         parent.Append(helpString=help, id=id, kind=kind, item=text)
 
-[TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, 
+[TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE,
  POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES
 ] = range(10)
 
@@ -73,8 +73,8 @@
 
 def GetFilterChoiceTransfer():
     _ = lambda x : x
-    return {_("All"): _("All"), _("Interface"): _("Interface"), 
-            _("   Input"): _("Input"), _("   Output"): _("Output"), _("   InOut"): _("InOut"), 
+    return {_("All"): _("All"), _("Interface"): _("Interface"),
+            _("   Input"): _("Input"), _("   Output"): _("Output"), _("   InOut"): _("InOut"),
             _("   External"): _("External"), _("Variables"): _("Variables"), _("   Local"): _("Local"),
             _("   Temp"): _("Temp"), _("Global"): _("Global")}#, _("Access") : _("Access")}
 VARIABLE_CHOICES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().iterkeys()])
@@ -97,7 +97,7 @@
 #-------------------------------------------------------------------------------
 
 class VariableTable(CustomTable):
-    
+
     """
     A custom wx.grid.Grid Table using user supplied data
     """
@@ -105,7 +105,7 @@
         # The base class must be initialized *first*
         CustomTable.__init__(self, parent, data, colnames)
         self.old_value = None
-    
+
     def GetValueByName(self, row, colname):
         if row < self.GetNumberRows():
             return getattr(self.data[row], colname)
@@ -113,7 +113,7 @@
     def SetValueByName(self, row, colname, value):
         if row < self.GetNumberRows():
             setattr(self.data[row], colname, value)
-    
+
     def GetValue(self, row, col):
         if row < self.GetNumberRows():
             if col == 0:
@@ -130,7 +130,7 @@
             if colname in ["Class", "Option"]:
                 return _(value)
             return value
-    
+
     def SetValue(self, row, col, value):
         if col < len(self.colnames):
             colname = self.GetColLabelValue(col, False)
@@ -209,10 +209,10 @@
                                 editor.SetParameters(",".join([_(choice) for choice in self.Parent.ClassList if choice not in excluded]))
                     elif colname != "Documentation":
                         grid.SetReadOnly(row, col, True)
-                
+
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
-                
+
                 if colname == "Location" and LOCATION_MODEL.match(self.GetValueByName(row, colname)) is None:
                     highlight_colours = ERROR_HIGHLIGHT
                 else:
@@ -223,23 +223,23 @@
 
 #-------------------------------------------------------------------------------
 #                         Variable Panel Drop Target
-#-------------------------------------------------------------------------------   
+#-------------------------------------------------------------------------------
 
 class VariableDropTarget(wx.TextDropTarget):
     '''
     This allows dragging a variable location from somewhere to the Location
     column of a variable row.
-    
+
     The drag source should be a TextDataObject containing a Python tuple like:
         ('%ID0.0.0', 'location', 'REAL')
-    
+
     c_ext/CFileEditor.py has an example of this (you can drag a C extension
     variable to the Location column of the variable panel).
     '''
     def __init__(self, parent):
         wx.TextDropTarget.__init__(self)
         self.ParentWindow = parent
-    
+
     def OnDropText(self, x, y, data):
         self.ParentWindow.ParentWindow.Select()
         x, y = self.ParentWindow.VariablesGrid.CalcUnscrolledPosition(x, y)
@@ -248,7 +248,7 @@
         message = None
         element_type = self.ParentWindow.ElementType
         try:
-            values = eval(data)    
+            values = eval(data)
         except:
             message = _("Invalid value \"%s\" for variable grid element")%data
             values = None
@@ -267,12 +267,12 @@
                         location = values[0]
                         variable_type = self.ParentWindow.Table.GetValueByName(row, "Type")
                         base_type = self.ParentWindow.Controler.GetBaseType(variable_type)
-                        
+
                         if values[2] is not None:
                             base_location_type = self.ParentWindow.Controler.GetBaseType(values[2])
                             if values[2] != variable_type and base_type != base_location_type:
                                 message = _("Incompatible data types between \"%s\" and \"%s\"")%(values[2], variable_type)
-                        
+
                         if message is None:
                             if not location.startswith("%"):
                                 if location[0].isdigit() and base_type != "BOOL":
@@ -282,9 +282,9 @@
                                 elif base_type not in LOCATIONDATATYPES[location[0]]:
                                     message = _("Incompatible size of data between \"%s\" and \"%s\"")%(location, variable_type)
                                 else:
-                                    dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow, 
-                                          _("Select a variable class:"), _("Variable class"), 
-                                          ["Input", "Output", "Memory"], 
+                                    dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
+                                          _("Select a variable class:"), _("Variable class"),
+                                          ["Input", "Output", "Memory"],
                                           wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                                     if dialog.ShowModal() == wx.ID_OK:
                                         selected = dialog.GetSelection()
@@ -299,7 +299,7 @@
                                         location = "%Q" + location
                                     else:
                                         location = "%M" + location
-                                        
+
                             if message is None:
                                 self.ParentWindow.Table.SetValue(row, col, location)
                                 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
@@ -311,7 +311,7 @@
                         self.ParentWindow.Table.SetValue(row, col, values[0])
                         self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
                         self.ParentWindow.SaveValues()
-            elif (element_type not in ["config", "resource", "function"] and values[1] == "Global" and 
+            elif (element_type not in ["config", "resource", "function"] and values[1] == "Global" and
                   self.ParentWindow.Filter in ["All", "Interface", "External"] or
                   element_type != "function" and values[1] == "location"):
                 if values[1] == "location":
@@ -319,11 +319,11 @@
                 else:
                     var_name = values[0]
                 tagname = self.ParentWindow.GetTagName()
-                if var_name.upper() in [name.upper() 
+                if var_name.upper() in [name.upper()
                         for name in self.ParentWindow.Controler.\
                             GetProjectPouNames(self.ParentWindow.Debug)]:
                     message = _("\"%s\" pou already exists!")%var_name
-                elif not var_name.upper() in [name.upper() 
+                elif not var_name.upper() in [name.upper()
                         for name in self.ParentWindow.Controler.\
                             GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
                     var_infos = self.ParentWindow.DefaultValue.copy()
@@ -332,9 +332,9 @@
                     if values[1] == "location":
                         location = values[0]
                         if not location.startswith("%"):
-                            dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow, 
-                                  _("Select a variable class:"), _("Variable class"), 
-                                  ["Input", "Output", "Memory"], 
+                            dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
+                                  _("Select a variable class:"), _("Variable class"),
+                                  ["Input", "Output", "Memory"],
                                   wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
                             if dialog.ShowModal() == wx.ID_OK:
                                 selected = dialog.GetSelection()
@@ -354,7 +354,7 @@
                                                                 self.ParentWindow.Debug)
                             if len(configs) == 0:
                                 return
-                            if not var_name.upper() in [name.upper() 
+                            if not var_name.upper() in [name.upper()
                                 for name in self.ParentWindow.Controler.\
                                     GetConfigurationVariableNames(configs[0])]:
                                 self.ParentWindow.Controler.AddConfigurationGlobalVar(
@@ -372,10 +372,10 @@
                     self.ParentWindow.Values.append(var_infos)
                     self.ParentWindow.SaveValues()
                     self.ParentWindow.RefreshValues()
-        
+
         if message is not None:
             wx.CallAfter(self.ShowMessage, message)
-    
+
     def ShowMessage(self, message):
         message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK|wx.ICON_ERROR)
         message.ShowModal()
@@ -383,85 +383,85 @@
 
 #-------------------------------------------------------------------------------
 #                               Variable Panel
-#-------------------------------------------------------------------------------   
+#-------------------------------------------------------------------------------
 
 class VariablePanel(wx.Panel):
-    
+
     def __init__(self, parent, window, controler, element_type, debug=False):
         wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)
-        
+
         self.MainSizer = wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=0)
         self.MainSizer.AddGrowableCol(0)
         self.MainSizer.AddGrowableRow(1)
-        
+
         controls_sizer = wx.FlexGridSizer(cols=10, hgap=5, rows=1, vgap=5)
         controls_sizer.AddGrowableCol(5)
         controls_sizer.AddGrowableRow(0)
         self.MainSizer.AddSizer(controls_sizer, border=5, flag=wx.GROW|wx.ALL)
-        
+
         self.ReturnTypeLabel = wx.StaticText(self, label=_('Return Type:'))
         controls_sizer.AddWindow(self.ReturnTypeLabel, flag=wx.ALIGN_CENTER_VERTICAL)
-        
+
         self.ReturnType = wx.ComboBox(self,
               size=wx.Size(145, -1), style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnReturnTypeChanged, self.ReturnType)
         controls_sizer.AddWindow(self.ReturnType)
-        
+
         self.DescriptionLabel = wx.StaticText(self, label=_('Description:'))
         controls_sizer.AddWindow(self.DescriptionLabel, flag=wx.ALIGN_CENTER_VERTICAL)
-        
+
         self.Description = wx.TextCtrl(self,
               size=wx.Size(250, -1), style=wx.TE_PROCESS_ENTER)
         self.Bind(wx.EVT_TEXT_ENTER, self.OnDescriptionChanged, self.Description)
         self.Description.Bind(wx.EVT_KILL_FOCUS, self.OnDescriptionChanged)
-        controls_sizer.AddWindow(self.Description) 
-        
+        controls_sizer.AddWindow(self.Description)
+
         class_filter_label = wx.StaticText(self, label=_('Class Filter:'))
         controls_sizer.AddWindow(class_filter_label, flag=wx.ALIGN_CENTER_VERTICAL)
-        
-        self.ClassFilter = wx.ComboBox(self, 
+
+        self.ClassFilter = wx.ComboBox(self,
               size=wx.Size(145, -1), style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnClassFilter, self.ClassFilter)
         controls_sizer.AddWindow(self.ClassFilter)
-        
+
         for name, bitmap, help in [
                 ("AddButton", "add_element", _("Add variable")),
                 ("DeleteButton", "remove_element", _("Remove variable")),
                 ("UpButton", "up", _("Move variable up")),
                 ("DownButton", "down", _("Move variable down"))]:
-            button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap), 
+            button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap),
                   size=wx.Size(28, 28), style=wx.NO_BORDER)
             button.SetToolTipString(help)
             setattr(self, name, button)
             controls_sizer.AddWindow(button)
-        
+
         self.VariablesGrid = CustomGrid(self, style=wx.VSCROLL)
         self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
-        self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, 
+        self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
               self.OnVariablesGridCellChange)
-        self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, 
+        self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
               self.OnVariablesGridCellLeftClick)
-        self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, 
+        self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,
               self.OnVariablesGridEditorShown)
         self.MainSizer.AddWindow(self.VariablesGrid, flag=wx.GROW)
-        
+
         self.SetSizer(self.MainSizer)
-        
+
         self.ParentWindow = window
         self.Controler = controler
         self.ElementType = element_type
         self.Debug = debug
-        
+
         self.RefreshHighlightsTimer = wx.Timer(self, -1)
-        self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, 
+        self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer,
               self.RefreshHighlightsTimer)
-        
+
         self.Filter = "All"
         self.FilterChoices = []
         self.FilterChoiceTransfer = GetFilterChoiceTransfer()
-        
-        self.DefaultValue = _VariableInfos("", "", "", "", "", True, "", "INT", ([], []), 0)
-        
+
+        self.DefaultValue = _VariableInfos("", "", "", "", "", True, "", DefaultType, ([], []), 0)
+
         if element_type in ["config", "resource"]:
             self.DefaultTypes = {"All" : "Global"}
         else:
@@ -481,7 +481,7 @@
 
             # these condense the ColAlignements list
             l = wx.ALIGN_LEFT
-            c = wx.ALIGN_CENTER 
+            c = wx.ALIGN_CENTER
 
             #                      Num  Name    Class   Type    Loc     Init    Option   Doc
             self.ColSizes       = [40,  80,     70,     80,     80,     80,     100,     80]
@@ -502,15 +502,15 @@
 
             # these condense the ColAlignements list
             l = wx.ALIGN_LEFT
-            c = wx.ALIGN_CENTER 
+            c = wx.ALIGN_CENTER
 
             #                      Num  Name    Class   Type    Init    Option   Doc
             self.ColSizes       = [40,  80,     70,     80,     80,     100,     160]
             self.ColAlignements = [c,   l,      l,      l,      l,      l,       l]
-            
+
         self.ElementType = element_type
         self.BodyType = None
-        
+
         for choice in self.FilterChoices:
             self.ClassFilter.Append(_(choice))
 
@@ -526,11 +526,11 @@
                                        "Up": self.UpButton,
                                        "Down": self.DownButton})
         self.VariablesGrid.SetEditable(not self.Debug)
-        
+
         def _AddVariable(new_row):
             if new_row > 0:
                 row_content = self.Values[new_row - 1].copy()
-                
+
                 result = VARIABLE_NAME_SUFFIX_MODEL.search(row_content.Name)
                 if result is not None:
                     name = row_content.Name[:result.start(1)]
@@ -546,8 +546,8 @@
                 row_content = None
                 start_idx = 0
                 name = "LocalVar"
-                
-            if row_content is not None and row_content.Edit: 
+
+            if row_content is not None and row_content.Edit:
                 row_content = self.Values[new_row - 1].copy()
             else:
                 row_content = self.DefaultValue.copy()
@@ -555,10 +555,10 @@
                     row_content.Class = self.DefaultTypes[self.Filter]
                 else:
                     row_content.Class = self.Filter
-            
+
             row_content.Name = self.Controler.GenerateNewName(
                     self.TagName, None, name + "%d", start_idx)
-            
+
             if self.Filter == "All" and len(self.Values) > 0:
                 self.Values.insert(new_row, row_content)
             else:
@@ -568,7 +568,7 @@
             self.RefreshValues()
             return new_row
         setattr(self.VariablesGrid, "_AddRow", _AddVariable)
-        
+
         def _DeleteVariable(row):
             if self.Table.GetValueByName(row, "Edit"):
                 self.Values.remove(self.Table.GetRow(row))
@@ -577,7 +577,7 @@
                     self.ParentWindow.RefreshView(variablepanel = False)
                 self.RefreshValues()
         setattr(self.VariablesGrid, "_DeleteRow", _DeleteVariable)
-            
+
         def _MoveVariable(row, move):
             if self.Filter == "All":
                 new_row = max(0, min(row + move, len(self.Values) - 1))
@@ -588,7 +588,7 @@
                 return new_row
             return row
         setattr(self.VariablesGrid, "_MoveRow", _MoveVariable)
-        
+
         def _RefreshButtons():
             if self:
                 table_length = len(self.Table.data)
@@ -603,7 +603,7 @@
                 self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All"))
                 self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All"))
         setattr(self.VariablesGrid, "RefreshButtons", _RefreshButtons)
-        
+
         self.VariablesGrid.SetRowLabelSize(0)
         for col in range(self.Table.GetNumberCols()):
             attr = wx.grid.GridCellAttr()
@@ -611,29 +611,29 @@
             self.VariablesGrid.SetColAttr(col, attr)
             self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col])
             self.VariablesGrid.AutoSizeColumn(col, False)
-    
+
     def __del__(self):
         self.RefreshHighlightsTimer.Stop()
-    
+
     def SetTagName(self, tagname):
         self.TagName = tagname
         self.BodyType = self.Controler.GetEditedElementBodyType(self.TagName)
-    
+
     def GetTagName(self):
         return self.TagName
-    
+
     def IsFunctionBlockType(self, name):
-        if (isinstance(name, TupleType) or 
+        if (isinstance(name, TupleType) or
             self.ElementType != "function" and self.BodyType in ["ST", "IL"]):
             return False
         else:
             return self.Controler.GetBlockType(name, debug=self.Debug) is not None
-    
+
     def RefreshView(self):
         self.PouNames = self.Controler.GetProjectPouNames(self.Debug)
         returnType = None
         description = None
-        
+
         words = self.TagName.split("::")
         if self.ElementType == "config":
             self.Values = self.Controler.GetConfigurationGlobalVars(words[1], self.Debug)
@@ -647,7 +647,7 @@
                 returnType = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, debug=self.Debug)
             description = self.Controler.GetPouDescription(words[1])
             self.Values = self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug)
-        
+
         if returnType is not None:
             self.ReturnType.SetStringSelection(returnType)
             self.ReturnType.Enable(not self.Debug)
@@ -657,7 +657,7 @@
             self.ReturnType.Enable(False)
             self.ReturnTypeLabel.Hide()
             self.ReturnType.Hide()
-        
+
         if description is not None:
             self.Description.SetValue(description)
             self.Description.Enable(not self.Debug)
@@ -667,11 +667,11 @@
             self.Description.Enable(False)
             self.DescriptionLabel.Hide()
             self.Description.Hide()
-        
+
         self.RefreshValues()
         self.VariablesGrid.RefreshButtons()
         self.MainSizer.Layout()
-    
+
     def OnReturnTypeChanged(self, event):
         words = self.TagName.split("::")
         self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
@@ -679,7 +679,7 @@
         self.ParentWindow.RefreshView(variablepanel = False)
         self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
         event.Skip()
-    
+
     def OnDescriptionChanged(self, event):
         words = self.TagName.split("::")
         old_description = self.Controler.GetPouDescription(words[1])
@@ -688,7 +688,7 @@
             self.Controler.SetPouDescription(words[1], new_description)
             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
         event.Skip()
-    
+
     def OnClassFilter(self, event):
         self.Filter = self.FilterChoiceTransfer[VARIABLE_CHOICES_DICT[self.ClassFilter.GetStringSelection()]]
         self.RefreshTypeList()
@@ -711,7 +711,7 @@
         colname = self.Table.GetColLabelValue(col, False)
         value = self.Table.GetValue(row, col)
         message = None
-        
+
         if colname == "Name" and value != "":
             if not TestIdentifier(value):
                 message = _("\"%s\" is not a valid identifier!") % value
@@ -735,7 +735,7 @@
                 wx.CallAfter(self.ParentWindow.RefreshView, False)
             elif colname == "Location":
                 wx.CallAfter(self.ParentWindow.RefreshView)
-            
+
         if message is not None:
             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
             dialog.ShowModal()
@@ -743,9 +743,9 @@
             event.Veto()
         else:
             event.Skip()
-    
+
     def OnVariablesGridEditorShown(self, event):
-        row, col = event.GetRow(), event.GetCol() 
+        row, col = event.GetRow(), event.GetCol()
 
         label_value = self.Table.GetColLabelValue(col, False)
         if label_value == "Type":
@@ -769,9 +769,9 @@
                 self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id)
 
             type_menu.AppendMenu(wx.NewId(), _("User Data Types"), datatype_menu)
-            
+
             for category in self.Controler.GetConfNodeDataTypes():
-               
+
                if len(category["list"]) > 0:
                    # build a submenu containing confnode types
                    confnode_datatype_menu = wx.Menu(title='')
@@ -779,18 +779,18 @@
                        new_id = wx.NewId()
                        AppendMenu(confnode_datatype_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype)
                        self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id)
-                   
+
                    type_menu.AppendMenu(wx.NewId(), category["name"], confnode_datatype_menu)
 
             # build a submenu containing function block types
             bodytype = self.Controler.GetEditedElementBodyType(self.TagName)
             pouname, poutype = self.Controler.GetEditedElementType(self.TagName)
             classtype = self.Table.GetValueByName(row, "Class")
-            
+
             new_id = wx.NewId()
             AppendMenu(type_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Array"))
             self.Bind(wx.EVT_MENU, self.VariableArrayTypeFunction, id=new_id)
-            
+
             if classtype in ["Input", "Output", "InOut", "External", "Global"] or \
             poutype != "function" and bodytype in ["ST", "IL"]:
                 functionblock_menu = wx.Menu(title='')
@@ -812,7 +812,7 @@
             event.Veto()
         else:
             event.Skip()
-    
+
     def GetVariableTypeFunction(self, base_type):
         def VariableTypeFunction(event):
             row = self.VariablesGrid.GetGridCursorRow()
@@ -823,11 +823,11 @@
             self.Controler.BufferProject()
             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
         return VariableTypeFunction
-    
+
     def VariableArrayTypeFunction(self, event):
         row = self.VariablesGrid.GetGridCursorRow()
-        dialog = ArrayTypeDialog(self, 
-                                 self.Controler.GetDataTypes(self.TagName), 
+        dialog = ArrayTypeDialog(self,
+                                 self.Controler.GetDataTypes(self.TagName),
                                  self.Table.GetValueByName(row, "Type"))
         if dialog.ShowModal() == wx.ID_OK:
             self.Table.SetValueByName(row, "Type", dialog.GetValue())
@@ -837,7 +837,7 @@
             self.Controler.BufferProject()
             self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
         dialog.Destroy()
-    
+
     def OnVariablesGridCellLeftClick(self, event):
         row = event.GetRow()
         if not self.Debug and (event.GetCol() == 0 and self.Table.GetValueByName(row, "Edit")):
@@ -849,7 +849,7 @@
             dragSource.SetData(data)
             dragSource.DoDragDrop()
         event.Skip()
-    
+
     def RefreshValues(self):
         data = []
         for num, variable in enumerate(self.Values):
@@ -858,7 +858,7 @@
                 data.append(variable)
         self.Table.SetData(data)
         self.Table.ResetView(self.VariablesGrid)
-            
+
     def SaveValues(self, buffer = True):
         words = self.TagName.split("::")
         if self.ElementType == "config":
@@ -871,7 +871,7 @@
             self.Controler.SetPouInterfaceVars(words[1], self.Values)
         if buffer:
             self.Controler.BufferProject()
-            self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)            
+            self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
 
 #-------------------------------------------------------------------------------
 #                        Highlights showing functions
--- a/editors/CodeFileEditor.py	Wed May 28 18:33:41 2014 +0200
+++ b/editors/CodeFileEditor.py	Fri May 30 02:20:19 2014 +0200
@@ -6,7 +6,7 @@
 import wx.lib.buttons
 
 from plcopen.plcopen import TestTextElement
-from plcopen.structures import TestIdentifier, IEC_KEYWORDS
+from plcopen.structures import TestIdentifier, IEC_KEYWORDS, DefaultType
 from controls import CustomGrid, CustomTable
 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
 from util.BitmapLibrary import GetBitmap
@@ -14,7 +14,7 @@
 from controls.VariablePanel import VARIABLE_NAME_SUFFIX_MODEL
 from graphics.GraphicCommons import ERROR_HIGHLIGHT, SEARCH_RESULT_HIGHLIGHT, REFRESH_HIGHLIGHT_PERIOD
 
-[STC_CODE_ERROR, STC_CODE_SEARCH_RESULT, 
+[STC_CODE_ERROR, STC_CODE_SEARCH_RESULT,
  STC_CODE_SECTION] = range(15, 18)
 
 HIGHLIGHT_TYPES = {
@@ -25,14 +25,14 @@
 EDGE_COLUMN = 80
 
 class CodeEditor(CustomStyledTextCtrl):
-    
+
     KEYWORDS = []
     COMMENT_HEADER = ""
 
     def __init__(self, parent, window, controler):
-        CustomStyledTextCtrl.__init__(self, parent, -1, wx.DefaultPosition, 
+        CustomStyledTextCtrl.__init__(self, parent, -1, wx.DefaultPosition,
                  wx.Size(-1, 300), 0)
-        
+
         self.SetMarginType(1, stc.STC_MARGIN_NUMBER)
         self.SetMarginWidth(1, 25)
 
@@ -41,7 +41,7 @@
         self.SetMargins(0,0)
 
         self.SetViewWhiteSpace(False)
-        
+
         self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
         self.SetEdgeColumn(EDGE_COLUMN)
 
@@ -59,7 +59,7 @@
         self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
         self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
         self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")
-        
+
         self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
         self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
         self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
@@ -78,33 +78,33 @@
         self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % faces)
         self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
         self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")
-        
+
         # Highlighting styles
         self.StyleSetSpec(STC_CODE_ERROR, 'fore:#FF0000,back:#FFFF00,size:%(size)d' % faces)
         self.StyleSetSpec(STC_CODE_SEARCH_RESULT, 'fore:#FFFFFF,back:#FFA500,size:%(size)d' % faces)
-        
+
         # Section style
         self.StyleSetSpec(STC_CODE_SECTION, 'fore:#808080,size:%(size)d')
         self.StyleSetChangeable(STC_CODE_SECTION, False)
-        
+
         # Indentation size
         self.SetTabWidth(4)
         self.SetUseTabs(0)
-        
+
         self.SetCodeLexer()
         self.SetKeyWords(0, " ".join(self.KEYWORDS))
-        
+
         self.Controler = controler
         self.ParentWindow = window
-        
+
         self.DisableEvents = True
         self.CurrentAction = None
-        
+
         self.ResetSearchResults()
-        
+
         self.RefreshHighlightsTimer = wx.Timer(self, -1)
         self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
-        
+
         self.SectionsComments = {}
         for section in self.Controler.SECTIONS_NAMES:
             section_comment = " %s section " % (section)
@@ -112,11 +112,11 @@
             section_comment = self.COMMENT_HEADER * (len_headers / 2) + \
                               section_comment + \
                               self.COMMENT_HEADER * (len_headers - len_headers / 2)
-            
+
             self.SectionsComments[section] = {
                  "comment": section_comment,
             }
-            
+
         for i, section in enumerate(self.Controler.SECTIONS_NAMES):
             section_infos = self.SectionsComments[section]
             if i + 1 < len(self.Controler.SECTIONS_NAMES):
@@ -125,24 +125,24 @@
             else:
                 section_end = "$"
             section_infos["pattern"] = re.compile(
-                section_infos["comment"] + "(.*)" + 
+                section_infos["comment"] + "(.*)" +
                 section_end, re.DOTALL)
-            
+
         self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE)
 
         self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop)
         self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
         self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification)
-    
+
     def SetCodeLexer(self):
         pass
-    
+
     def ResetSearchResults(self):
         self.Highlights = []
         self.SearchParams = None
         self.SearchResults = None
         self.CurrentFindHighlight = None
-    
+
     def OnModification(self, event):
         if not self.DisableEvents:
             mod_type = event.GetModificationType()
@@ -165,7 +165,7 @@
                     wx.CallAfter(self.RefreshModel)
         wx.CallAfter(self.RefreshSectionStyling)
         event.Skip()
-    
+
     def OnDoDrop(self, event):
         try:
             values = eval(event.GetDragText())
@@ -192,7 +192,7 @@
             self.ParentWindow.RefreshFileMenu()
             self.ParentWindow.RefreshEditMenu()
             self.ParentWindow.RefreshPageTitles()
-    
+
     def StartBuffering(self):
         self.Controler.StartBuffering()
         if self.ParentWindow is not None:
@@ -200,7 +200,7 @@
             self.ParentWindow.RefreshFileMenu()
             self.ParentWindow.RefreshEditMenu()
             self.ParentWindow.RefreshPageTitles()
-    
+
     def ResetBuffer(self):
         if self.CurrentAction != None:
             self.Controler.EndBuffering()
@@ -240,18 +240,18 @@
                 self.GotoPos(old_cursor_pos)
             self.EmptyUndoBuffer()
         self.DisableEvents = False
-        
+
         self.RefreshSectionStyling()
-        
+
         self.ShowHighlights()
-        
+
     def RefreshSectionStyling(self):
         self.Colourise(0, -1)
-        
+
         text = self.GetText()
         for line in xrange(self.GetLineCount()):
             self.SetLineState(line, 0)
-        
+
         for section in self.Controler.SECTIONS_NAMES:
             section_comments = self.SectionsComments[section]
             start_pos = text.find(section_comments["comment"])
@@ -259,7 +259,7 @@
             self.StartStyling(start_pos, 0xff)
             self.SetStyling(end_pos - start_pos, STC_CODE_SECTION)
             self.SetLineState(self.LineFromPosition(start_pos), 1)
-            
+
         self.StartStyling(end_pos, 0x00)
         self.SetStyling(len(self.GetText()) - end_pos, stc.STC_STYLE_DEFAULT)
 
@@ -278,7 +278,7 @@
                 parts[section] = ""
         self.Controler.SetTextParts(parts)
         self.ResetSearchResults()
-    
+
     def OnKeyPressed(self, event):
         if self.CallTipActive():
             self.CallTipCancel()
@@ -286,14 +286,14 @@
         current_pos = self.GetCurrentPos()
         selected = self.GetSelection()
         text_selected = selected[0] != selected[1]
-        
+
         # Test if caret is before Windows like new line
         text = self.GetText()
         if current_pos < len(text) and ord(text[current_pos]) == 13:
             newline_size = 2
         else:
             newline_size = 1
-        
+
         # Disable to type any character in section header lines
         if (self.GetLineState(self.LineFromPosition(current_pos)) and
             not text_selected and
@@ -301,7 +301,7 @@
                 wx.WXK_RETURN,
                 wx.WXK_NUMPAD_ENTER]):
             return
-        
+
         # Disable to delete line between code and header lines
         elif (self.GetCurLine()[0].strip() != "" and not text_selected and
               (key == wx.WXK_BACK and
@@ -309,7 +309,7 @@
                key in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE] and
                self.GetLineState(self.LineFromPosition(min(len(text), current_pos + newline_size))))):
             return
-        
+
         elif key == 32 and event.ControlDown():
             pos = self.GetCurrentPos()
 
@@ -319,7 +319,7 @@
             # Code completion
             else:
                 self.AutoCompSetIgnoreCase(False)  # so this needs to match
-                
+
                 keywords = self.KEYWORDS + [var["Name"]
                                             for var in self.Controler.GetVariables()]
                 keywords.sort()
@@ -361,11 +361,11 @@
             self.BraceBadLight(braceAtCaret)
         else:
             self.BraceHighlight(braceAtCaret, braceOpposite)
-        
+
         selected_text = self.GetSelectedText()
         if selected_text:
             self.ParentWindow.SetCopyBuffer(selected_text, True)
-    
+
     def OnMarginClick(self, event):
         # fold and unfold as needed
         if evt.GetMargin() == 2:
@@ -464,11 +464,11 @@
         self.DisableEvents = False
         self.RefreshModel()
         self.RefreshBuffer()
-    
+
     def Copy(self):
         self.CmdKeyExecute(wx.stc.STC_CMD_COPY)
         self.ParentWindow.RefreshEditMenu()
-    
+
     def Paste(self):
         self.ResetBuffer()
         self.DisableEvents = True
@@ -480,21 +480,21 @@
     def Find(self, direction, search_params):
         if self.SearchParams != search_params:
             self.ClearHighlights(SEARCH_RESULT_HIGHLIGHT)
-            
+
             self.SearchParams = search_params
             criteria = {
-                "raw_pattern": search_params["find_pattern"], 
+                "raw_pattern": search_params["find_pattern"],
                 "pattern": re.compile(search_params["find_pattern"]),
                 "case_sensitive": search_params["case_sensitive"],
                 "regular_expression": search_params["regular_expression"],
                 "filter": "all"}
-            
+
             self.SearchResults = [
                 (start, end, SEARCH_RESULT_HIGHLIGHT)
-                for start, end, text in 
+                for start, end, text in
                 TestTextElement(self.GetText(), criteria)]
             self.CurrentFindHighlight = None
-        
+
         if len(self.SearchResults) > 0:
             if self.CurrentFindHighlight is not None:
                 old_idx = self.SearchResults.index(self.CurrentFindHighlight)
@@ -522,9 +522,9 @@
                         break
                 if self.CurrentFindHighlight is not None:
                     self.AddHighlight(*self.CurrentFindHighlight)
-            
+
             self.ScrollToLine(self.CurrentFindHighlight[0][0])
-            
+
         else:
             if self.CurrentFindHighlight is not None:
                 self.RemoveHighlight(*self.CurrentFindHighlight)
@@ -557,11 +557,11 @@
 
     def RemoveHighlight(self, start, end, highlight_type):
         highlight_type = HIGHLIGHT_TYPES.get(highlight_type, None)
-        if (highlight_type is not None and 
+        if (highlight_type is not None and
             (start, end, highlight_type) in self.Highlights):
             self.Highlights.remove((start, end, highlight_type))
             self.RefreshHighlightsTimer.Start(int(REFRESH_HIGHLIGHT_PERIOD * 1000), oneShot=True)
-    
+
     def ShowHighlights(self):
         for start, end, highlight_type in self.Highlights:
             if start[0] == 0:
@@ -583,14 +583,14 @@
 #-------------------------------------------------------------------------------
 
 class VariablesTable(CustomTable):
-    
+
     def GetValue(self, row, col):
         if row < self.GetNumberRows():
             if col == 0:
                 return row + 1
             else:
                 return str(self.data[row].get(self.GetColLabelValue(col, False), ""))
-    
+
     def _updateColAttrs(self, grid):
         """
         wxGrid -> update the column attributes to add the
@@ -598,7 +598,7 @@
 
         Otherwise default to the default renderer.
         """
-        
+
         typelist = None
         accesslist = None
         for row in range(self.GetNumberRows()):
@@ -606,7 +606,7 @@
                 editor = None
                 renderer = None
                 colname = self.GetColLabelValue(col, False)
-                
+
                 if colname in ["Name", "Initial"]:
                     editor = wx.grid.GridCellTextEditor()
                 elif colname == "Class":
@@ -616,49 +616,49 @@
                     pass
                 else:
                     grid.SetReadOnly(row, col, True)
-                
+
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
-                
+
                 grid.SetCellBackgroundColour(row, col, wx.WHITE)
             self.ResizeRow(grid, row)
 
 
 class VariablesEditor(wx.Panel):
-    
+
     def __init__(self, parent, window, controler):
         wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)
-        
+
         main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=4)
         main_sizer.AddGrowableCol(1)
         main_sizer.AddGrowableRow(0)
-        
+
         controls_sizer = wx.BoxSizer(wx.VERTICAL)
         main_sizer.AddSizer(controls_sizer, border=5, flag=wx.ALL)
-        
+
         for name, bitmap, help in [
                 ("AddVariableButton", "add_element", _("Add variable")),
                 ("DeleteVariableButton", "remove_element", _("Remove variable")),
                 ("UpVariableButton", "up", _("Move variable up")),
                 ("DownVariableButton", "down", _("Move variable down"))]:
-            button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap), 
+            button = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap(bitmap),
                   size=wx.Size(28, 28), style=wx.NO_BORDER)
             button.SetToolTipString(help)
             setattr(self, name, button)
             controls_sizer.AddWindow(button, border=5, flag=wx.BOTTOM)
-        
+
         self.VariablesGrid = CustomGrid(self, style=wx.VSCROLL)
         self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnVariablesGridCellChange)
         self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnVariablesGridCellLeftClick)
         self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.OnVariablesGridEditorShown)
         main_sizer.AddWindow(self.VariablesGrid, flag=wx.GROW)
-        
+
         self.SetSizer(main_sizer)
-                
+
         self.ParentWindow = window
         self.Controler = controler
-        
-        self.VariablesDefaultValue = {"Name" : "", "Type" : "INT", "Initial": ""}
+
+        self.VariablesDefaultValue = {"Name" : "", "Type" : DefaultType, "Initial": ""}
         self.Table = VariablesTable(self, [], ["#", "Name", "Type", "Initial"])
         self.ColAlignements = [wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
         self.ColSizes = [40, 200, 150, 150]
@@ -667,7 +667,7 @@
                                        "Delete": self.DeleteVariableButton,
                                        "Up": self.UpVariableButton,
                                        "Down": self.DownVariableButton})
-        
+
         def _AddVariable(new_row):
             if new_row > 0:
                 row_content = self.Table.data[new_row - 1].copy()
@@ -691,13 +691,13 @@
             self.RefreshView()
             return new_row
         setattr(self.VariablesGrid, "_AddRow", _AddVariable)
-        
+
         def _DeleteVariable(row):
             self.Table.RemoveRow(row)
             self.RefreshModel()
             self.RefreshView()
         setattr(self.VariablesGrid, "_DeleteRow", _DeleteVariable)
-        
+
         def _MoveVariable(row, move):
             new_row = self.Table.MoveRow(row, move)
             if new_row != row:
@@ -705,7 +705,7 @@
                 self.RefreshView()
             return new_row
         setattr(self.VariablesGrid, "_MoveRow", _MoveVariable)
-        
+
         self.VariablesGrid.SetRowLabelSize(0)
         for col in range(self.Table.GetNumberCols()):
             attr = wx.grid.GridCellAttr()
@@ -717,7 +717,7 @@
     def RefreshModel(self):
         self.Controler.SetVariables(self.Table.GetData())
         self.RefreshBuffer()
-        
+
     # Buffer the last model state
     def RefreshBuffer(self):
         self.Controler.BufferCodeFile()
@@ -730,23 +730,23 @@
         self.Table.SetData(self.Controler.GetVariables())
         self.Table.ResetView(self.VariablesGrid)
         self.VariablesGrid.RefreshButtons()
-    
+
     def DoGetBestSize(self):
         return self.ParentWindow.GetPanelBestSize()
-    
+
     def OnVariablesGridCellChange(self, event):
         row, col = event.GetRow(), event.GetCol()
         colname = self.Table.GetColLabelValue(col, False)
         value = self.Table.GetValue(row, col)
         message = None
-        
+
         if colname == "Name" and value != "":
             if not TestIdentifier(value):
                 message = _("\"%s\" is not a valid identifier!") % value
             elif value.upper() in IEC_KEYWORDS:
                 message = _("\"%s\" is a keyword. It can't be used!") % value
-            elif value.upper() in [var["Name"].upper() 
-                                   for var_row, var in enumerate(self.Table.data) 
+            elif value.upper() in [var["Name"].upper()
+                                   for var_row, var in enumerate(self.Table.data)
                                    if var_row != row]:
                 message = _("A variable with \"%s\" as name already exists!") % value
             else:
@@ -755,7 +755,7 @@
         else:
             self.RefreshModel()
             wx.CallAfter(self.RefreshView)
-        
+
         if message is not None:
             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
             dialog.ShowModal()
@@ -765,7 +765,7 @@
             event.Skip()
 
     def OnVariablesGridEditorShown(self, event):
-        row, col = event.GetRow(), event.GetCol() 
+        row, col = event.GetRow(), event.GetCol()
         if self.Table.GetColLabelValue(col, False) == "Type":
             type_menu = wx.Menu(title='')
             base_menu = wx.Menu(title='')
@@ -781,7 +781,7 @@
                 self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id)
             type_menu.AppendMenu(wx.NewId(), "User Data Types", datatype_menu)
             rect = self.VariablesGrid.BlockToDeviceRect((row, col), (row, col))
-            
+
             self.VariablesGrid.PopupMenuXY(type_menu, rect.x + rect.width, rect.y + self.VariablesGrid.GetColLabelSize())
             type_menu.Destroy()
             event.Veto()
@@ -803,64 +803,64 @@
             row = event.GetRow()
             data_type = self.Table.GetValueByName(row, "Type")
             var_name = self.Table.GetValueByName(row, "Name")
-            data = wx.TextDataObject(str((var_name, "Global", data_type, 
+            data = wx.TextDataObject(str((var_name, "Global", data_type,
                     self.Controler.GetCurrentLocation())))
             dragSource = wx.DropSource(self.VariablesGrid)
             dragSource.SetData(data)
             dragSource.DoDragDrop()
             return
         event.Skip()
-    
+
 
 #-------------------------------------------------------------------------------
 #                          CodeFileEditor Main Frame Class
 #-------------------------------------------------------------------------------
 
 class CodeFileEditor(ConfTreeNodeEditor):
-    
+
     CONFNODEEDITOR_TABS = []
     CODE_EDITOR = None
-    
+
     def _create_CodePanel(self, prnt):
         self.CodeEditorPanel = wx.SplitterWindow(prnt)
         self.CodeEditorPanel.SetMinimumPaneSize(1)
-        
-        self.VariablesPanel = VariablesEditor(self.CodeEditorPanel, 
+
+        self.VariablesPanel = VariablesEditor(self.CodeEditorPanel,
                 self.ParentWindow, self.Controler)
-        
+
         if self.CODE_EDITOR is not None:
-            self.CodeEditor = self.CODE_EDITOR(self.CodeEditorPanel, 
+            self.CodeEditor = self.CODE_EDITOR(self.CodeEditorPanel,
                         self.ParentWindow, self.Controler)
-            
-            self.CodeEditorPanel.SplitHorizontally(self.VariablesPanel, 
+
+            self.CodeEditorPanel.SplitHorizontally(self.VariablesPanel,
                     self.CodeEditor, 150)
         else:
             self.CodeEditorPanel.Initialize(self.VariablesPanel)
-        
+
         return self.CodeEditorPanel
-    
+
     def __init__(self, parent, controler, window):
         ConfTreeNodeEditor.__init__(self, parent, controler, window)
-        
+
         wx.CallAfter(self.CodeEditorPanel.SetSashPosition, 150)
-    
+
     def GetBufferState(self):
         return self.Controler.GetBufferState()
-        
+
     def Undo(self):
         self.Controler.LoadPrevious()
         self.RefreshView()
-            
+
     def Redo(self):
         self.Controler.LoadNext()
         self.RefreshView()
-    
+
     def RefreshView(self):
         ConfTreeNodeEditor.RefreshView(self)
-        
+
         self.VariablesPanel.RefreshView()
         self.CodeEditor.RefreshView()
-    
+
     def Find(self, direction, search_params):
         self.CodeEditor.Find(direction, search_params)
-        
\ No newline at end of file
+
--- a/editors/DataTypeEditor.py	Wed May 28 18:33:41 2014 +0200
+++ b/editors/DataTypeEditor.py	Fri May 30 02:20:19 2014 +0200
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
-#based on the plcopen standard. 
+#based on the plcopen standard.
 #
 #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
 #
@@ -29,7 +29,7 @@
 import wx.grid
 import wx.lib.buttons
 
-from plcopen.structures import IEC_KEYWORDS, TestIdentifier
+from plcopen.structures import IEC_KEYWORDS, TestIdentifier, DefaultType
 from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD
 from controls import CustomEditableListBox, CustomGrid, CustomTable
 from dialogs import ArrayTypeDialog
@@ -59,7 +59,7 @@
 #-------------------------------------------------------------------------------
 
 class ElementsTable(CustomTable):
-    
+
     """
     A custom wx.grid.Grid Table using user supplied data
     """
@@ -67,7 +67,7 @@
         # The base class must be initialized *first*
         CustomTable.__init__(self, parent, data, colnames)
         self.old_value = None
-        
+
     def GetValue(self, row, col):
         if row < self.GetNumberRows():
             if col == 0:
@@ -78,17 +78,17 @@
                 if value[0] == "array":
                     return "ARRAY [%s] OF %s" % (",".join(map(lambda x : "..".join(x), value[2])), value[1])
             return str(value)
-    
+
     def SetValue(self, row, col, value):
         if col < len(self.colnames):
             colname = self.GetColLabelValue(col, False)
             if colname == "Name":
                 self.old_value = self.data[row][colname]
             self.data[row][colname] = value
-    
+
     def GetOldValue(self):
         return self.old_value
-    
+
     def _updateColAttrs(self, grid):
         """
         wx.grid.Grid -> update the column attributes to add the
@@ -96,7 +96,7 @@
 
         Otherwise default to the default renderer.
         """
-        
+
         for row in range(self.GetNumberRows()):
             row_highlights = self.Highlights.get(row, {})
             for col in range(self.GetNumberCols()):
@@ -115,15 +115,15 @@
                         editor = wx.grid.GridCellTextEditor()
                 else:
                     grid.SetReadOnly(row, col, True)
-                
+
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
-                
+
                 highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
                 grid.SetCellTextColour(row, col, highlight_colours[1])
             self.ResizeRow(grid, row)
-    
+
     def AddHighlight(self, infos, highlight_type):
         row_highlights = self.Highlights.setdefault(infos[0], {})
         if infos[1] == "initial":
@@ -137,216 +137,216 @@
 #-------------------------------------------------------------------------------
 
 class DataTypeEditor(EditorPanel):
-    
+
     def _init_Editor(self, parent):
         self.Editor = wx.Panel(parent, style=wx.SUNKEN_BORDER)
-        
+
         self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
         self.MainSizer.AddGrowableCol(0)
         self.MainSizer.AddGrowableRow(1)
-        
+
         top_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.MainSizer.AddSizer(top_sizer, border=5, 
+        self.MainSizer.AddSizer(top_sizer, border=5,
               flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
-        
+
         derivation_type_label = wx.StaticText(self.Editor, label=_('Derivation Type:'))
-        top_sizer.AddWindow(derivation_type_label, border=5, 
+        top_sizer.AddWindow(derivation_type_label, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT)
-        
+
         self.DerivationType = wx.ComboBox(self.Editor,
               size=wx.Size(200, -1), style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnDerivationTypeChanged, self.DerivationType)
         top_sizer.AddWindow(self.DerivationType, border=5, flag=wx.GROW|wx.RIGHT)
-        
+
         typeinfos_staticbox = wx.StaticBox(self.Editor, label=_('Type infos:'))
         typeinfos_sizer = wx.StaticBoxSizer(typeinfos_staticbox, wx.HORIZONTAL)
-        self.MainSizer.AddSizer(typeinfos_sizer, border=5, 
+        self.MainSizer.AddSizer(typeinfos_sizer, border=5,
               flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT)
-        
+
         # Panel for Directly derived data types
 
         self.DirectlyPanel = wx.Panel(self.Editor, style=wx.TAB_TRAVERSAL)
         typeinfos_sizer.AddWindow(self.DirectlyPanel, 1)
-        
+
         directly_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        
-        directly_basetype_label = wx.StaticText(self.DirectlyPanel, 
+
+        directly_basetype_label = wx.StaticText(self.DirectlyPanel,
               label=_('Base Type:'))
-        directly_panel_sizer.AddWindow(directly_basetype_label, 1, border=5, 
+        directly_panel_sizer.AddWindow(directly_basetype_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.DirectlyBaseType = wx.ComboBox(self.DirectlyPanel, style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.DirectlyBaseType)
-        directly_panel_sizer.AddWindow(self.DirectlyBaseType, 1, border=5, 
+        directly_panel_sizer.AddWindow(self.DirectlyBaseType, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         directly_initialvalue_label = wx.StaticText(self.DirectlyPanel,
               label=_('Initial Value:'))
-        directly_panel_sizer.AddWindow(directly_initialvalue_label, 1, border=5, 
+        directly_panel_sizer.AddWindow(directly_initialvalue_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
-        self.DirectlyInitialValue = wx.TextCtrl(self.DirectlyPanel, 
+
+        self.DirectlyInitialValue = wx.TextCtrl(self.DirectlyPanel,
               style=wx.TE_PROCESS_ENTER|wx.TE_RICH)
         self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, self.DirectlyInitialValue)
-        directly_panel_sizer.AddWindow(self.DirectlyInitialValue, 1, border=5, 
+        directly_panel_sizer.AddWindow(self.DirectlyInitialValue, 1, border=5,
               flag=wx.ALL)
-        
+
         self.DirectlyPanel.SetSizer(directly_panel_sizer)
-        
+
         # Panel for Subrange data types
 
         self.SubrangePanel = wx.Panel(self.Editor, style=wx.TAB_TRAVERSAL)
         typeinfos_sizer.AddWindow(self.SubrangePanel, 1)
-        
+
         subrange_panel_sizer = wx.GridSizer(cols=4, hgap=5, rows=3, vgap=0)
-        
+
         subrange_basetype_label = wx.StaticText(self.SubrangePanel,
               label=_('Base Type:'))
-        subrange_panel_sizer.AddWindow(subrange_basetype_label, 1, border=5, 
+        subrange_panel_sizer.AddWindow(subrange_basetype_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.SubrangeBaseType = wx.ComboBox(self.SubrangePanel, style=wx.CB_READONLY)
-        self.Bind(wx.EVT_COMBOBOX, self.OnSubrangeBaseTypeChanged, 
+        self.Bind(wx.EVT_COMBOBOX, self.OnSubrangeBaseTypeChanged,
               self.SubrangeBaseType)
-        subrange_panel_sizer.AddWindow(self.SubrangeBaseType, 1, border=5, 
+        subrange_panel_sizer.AddWindow(self.SubrangeBaseType, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         subrange_initialvalue_label = wx.StaticText(self.SubrangePanel,
               label=_('Initial Value:'))
-        subrange_panel_sizer.AddWindow(subrange_initialvalue_label, 1, border=5, 
+        subrange_panel_sizer.AddWindow(subrange_initialvalue_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
-        self.SubrangeInitialValue = wx.SpinCtrl(self.SubrangePanel, 
+
+        self.SubrangeInitialValue = wx.SpinCtrl(self.SubrangePanel,
               style=wx.TAB_TRAVERSAL)
         self.Bind(wx.EVT_SPINCTRL, self.OnInfosChanged, self.SubrangeInitialValue)
-        subrange_panel_sizer.AddWindow(self.SubrangeInitialValue, 1, border=5, 
+        subrange_panel_sizer.AddWindow(self.SubrangeInitialValue, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         subrange_minimum_label = wx.StaticText(self.SubrangePanel, label=_('Minimum:'))
-        subrange_panel_sizer.AddWindow(subrange_minimum_label, 1, border=5, 
+        subrange_panel_sizer.AddWindow(subrange_minimum_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.SubrangeMinimum = wx.SpinCtrl(self.SubrangePanel, style=wx.TAB_TRAVERSAL)
         self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMinimumChanged, self.SubrangeMinimum)
-        subrange_panel_sizer.AddWindow(self.SubrangeMinimum, 1, border=5, 
+        subrange_panel_sizer.AddWindow(self.SubrangeMinimum, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         for i in xrange(2):
             subrange_panel_sizer.AddWindow(wx.Size(0, 0), 1)
-        
+
         subrange_maximum_label = wx.StaticText(self.SubrangePanel,
               label=_('Maximum:'))
-        subrange_panel_sizer.AddWindow(subrange_maximum_label, 1, border=5, 
+        subrange_panel_sizer.AddWindow(subrange_maximum_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.SubrangeMaximum = wx.SpinCtrl(self.SubrangePanel, style=wx.TAB_TRAVERSAL)
         self.Bind(wx.EVT_SPINCTRL, self.OnSubrangeMaximumChanged, self.SubrangeMaximum)
-        
-        subrange_panel_sizer.AddWindow(self.SubrangeMaximum, 1, border=5, 
+
+        subrange_panel_sizer.AddWindow(self.SubrangeMaximum, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         self.SubrangePanel.SetSizer(subrange_panel_sizer)
-        
+
         # Panel for Enumerated data types
-        
+
         self.EnumeratedPanel = wx.Panel(self.Editor, style=wx.TAB_TRAVERSAL)
         typeinfos_sizer.AddWindow(self.EnumeratedPanel, 1)
-        
+
         enumerated_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        
-        self.EnumeratedValues = CustomEditableListBox(self.EnumeratedPanel, 
-              label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW| 
-                                        wx.gizmos.EL_ALLOW_EDIT| 
+
+        self.EnumeratedValues = CustomEditableListBox(self.EnumeratedPanel,
+              label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW|
+                                        wx.gizmos.EL_ALLOW_EDIT|
                                         wx.gizmos.EL_ALLOW_DELETE)
         setattr(self.EnumeratedValues, "_OnLabelEndEdit", self.OnEnumeratedValueEndEdit)
         for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
             setattr(self.EnumeratedValues, func, self.OnEnumeratedValuesChanged)
-        enumerated_panel_sizer.AddWindow(self.EnumeratedValues, 1, border=5, 
+        enumerated_panel_sizer.AddWindow(self.EnumeratedValues, 1, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         enumerated_panel_rightsizer = wx.BoxSizer(wx.HORIZONTAL)
         enumerated_panel_sizer.AddSizer(enumerated_panel_rightsizer, 1)
-        
+
         enumerated_initialvalue_label = wx.StaticText(self.EnumeratedPanel,
               label=_('Initial Value:'))
-        enumerated_panel_rightsizer.AddWindow(enumerated_initialvalue_label, 1, 
+        enumerated_panel_rightsizer.AddWindow(enumerated_initialvalue_label, 1,
               border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
-        self.EnumeratedInitialValue = wx.ComboBox(self.EnumeratedPanel, 
+
+        self.EnumeratedInitialValue = wx.ComboBox(self.EnumeratedPanel,
               style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.EnumeratedInitialValue)
-        enumerated_panel_rightsizer.AddWindow(self.EnumeratedInitialValue, 1, 
+        enumerated_panel_rightsizer.AddWindow(self.EnumeratedInitialValue, 1,
               border=5, flag=wx.ALL)
-        
+
         self.EnumeratedPanel.SetSizer(enumerated_panel_sizer)
-        
+
         # Panel for Array data types
 
         self.ArrayPanel = wx.Panel(self.Editor, style=wx.TAB_TRAVERSAL)
         typeinfos_sizer.AddWindow(self.ArrayPanel, 1)
-        
+
         array_panel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=0)
         array_panel_sizer.AddGrowableCol(0)
         array_panel_sizer.AddGrowableCol(1)
         array_panel_sizer.AddGrowableRow(1)
-        
+
         array_panel_leftSizer = wx.BoxSizer(wx.HORIZONTAL)
         array_panel_sizer.AddSizer(array_panel_leftSizer, flag=wx.GROW)
-        
+
         array_basetype_label = wx.StaticText(self.ArrayPanel, label=_('Base Type:'))
-        array_panel_leftSizer.AddWindow(array_basetype_label, 1, border=5, 
+        array_panel_leftSizer.AddWindow(array_basetype_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.ArrayBaseType = wx.ComboBox(self.ArrayPanel, style=wx.CB_READONLY)
         self.Bind(wx.EVT_COMBOBOX, self.OnInfosChanged, self.ArrayBaseType)
-        array_panel_leftSizer.AddWindow(self.ArrayBaseType, 1, border=5, 
+        array_panel_leftSizer.AddWindow(self.ArrayBaseType, 1, border=5,
               flag=wx.GROW|wx.ALL)
-    
+
         array_panel_rightsizer = wx.BoxSizer(wx.HORIZONTAL)
         array_panel_sizer.AddSizer(array_panel_rightsizer, flag=wx.GROW)
-        
+
         array_initialvalue_label = wx.StaticText(self.ArrayPanel,
               label=_('Initial Value:'))
-        array_panel_rightsizer.AddWindow(array_initialvalue_label, 1, border=5, 
+        array_panel_rightsizer.AddWindow(array_initialvalue_label, 1, border=5,
               flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL)
-        
+
         self.ArrayInitialValue = wx.TextCtrl(self.ArrayPanel,
               style=wx.TE_PROCESS_ENTER|wx.TE_RICH)
         self.Bind(wx.EVT_TEXT_ENTER, self.OnReturnKeyPressed, self.ArrayInitialValue)
-        array_panel_rightsizer.AddWindow(self.ArrayInitialValue, 1, border=5, 
-              flag=wx.ALL)        
-        
-        self.ArrayDimensions = CustomEditableListBox(self.ArrayPanel, 
+        array_panel_rightsizer.AddWindow(self.ArrayInitialValue, 1, border=5,
+              flag=wx.ALL)
+
+        self.ArrayDimensions = CustomEditableListBox(self.ArrayPanel,
               label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW|
                                             wx.gizmos.EL_ALLOW_EDIT|
                                             wx.gizmos.EL_ALLOW_DELETE)
-        for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton", 
+        for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton",
                      "_OnUpButton", "_OnDownButton"]:
             setattr(self.ArrayDimensions, func, self.OnDimensionsChanged)
-        array_panel_sizer.AddWindow(self.ArrayDimensions, 0, border=5, 
+        array_panel_sizer.AddWindow(self.ArrayDimensions, 0, border=5,
               flag=wx.GROW|wx.ALL)
-        
+
         self.ArrayPanel.SetSizer(array_panel_sizer)
-        
+
         # Panel for Structure data types
-        
+
         self.StructurePanel = wx.Panel(self.Editor, style=wx.TAB_TRAVERSAL)
         typeinfos_sizer.AddWindow(self.StructurePanel, 1)
-        
+
         structure_panel_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
         structure_panel_sizer.AddGrowableCol(0)
         structure_panel_sizer.AddGrowableRow(1)
-        
+
         structure_button_sizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0)
         structure_button_sizer.AddGrowableCol(0)
         structure_button_sizer.AddGrowableRow(0)
-        structure_panel_sizer.AddSizer(structure_button_sizer, 0, border=5, 
+        structure_panel_sizer.AddSizer(structure_button_sizer, 0, border=5,
               flag=wx.ALL|wx.GROW)
-        
+
         structure_elements_label = wx.StaticText(self.StructurePanel,
               label=_('Elements :'))
         structure_button_sizer.AddWindow(structure_elements_label, flag=wx.ALIGN_BOTTOM)
-        
+
         for name, bitmap, help in [
                 ("StructureAddButton", "add_element", _("Add element")),
                 ("StructureDeleteButton", "remove_element", _("Remove element")),
@@ -357,46 +357,46 @@
             button.SetToolTipString(help)
             setattr(self, name, button)
             structure_button_sizer.AddWindow(button)
-        
-        self.StructureElementsGrid = CustomGrid(self.StructurePanel, 
+
+        self.StructureElementsGrid = CustomGrid(self.StructurePanel,
               size=wx.Size(0, 150), style=wx.VSCROLL)
-        self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, 
+        self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
               self.OnStructureElementsGridCellChange)
-        self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, 
+        self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,
               self.OnStructureElementsGridEditorShown)
         structure_panel_sizer.AddWindow(self.StructureElementsGrid, flag=wx.GROW)
-        
+
         self.StructurePanel.SetSizer(structure_panel_sizer)
-        
+
         self.Editor.SetSizer(self.MainSizer)
-        
+
     def __init__(self, parent, tagname, window, controler):
         EditorPanel.__init__(self, parent, tagname, window, controler)
-        
-        self.StructureElementDefaultValue = {"Name" : "", "Type" : "INT", "Initial Value" : ""}
+
+        self.StructureElementDefaultValue = {"Name" : "", "Type" : DefaultType, "Initial Value" : ""}
         self.StructureElementsTable = ElementsTable(self, [], GetElementsTableColnames())
         self.StructureColSizes = [40, 150, 100, 250]
         self.StructureColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
-        
+
         self.StructureElementsGrid.SetTable(self.StructureElementsTable)
         self.StructureElementsGrid.SetButtons({"Add": self.StructureAddButton,
                                                "Delete": self.StructureDeleteButton,
                                                "Up": self.StructureUpButton,
                                                "Down": self.StructureDownButton})
-        
+
         def _AddStructureElement(new_row):
             self.StructureElementsTable.InsertRow(new_row, self.StructureElementDefaultValue.copy())
             self.RefreshTypeInfos()
             self.StructureElementsTable.ResetView(self.StructureElementsGrid)
             return new_row
         setattr(self.StructureElementsGrid, "_AddRow", _AddStructureElement)
-        
+
         def _DeleteStructureElement(row):
             self.StructureElementsTable.RemoveRow(row)
             self.RefreshTypeInfos()
             self.StructureElementsTable.ResetView(self.StructureElementsGrid)
         setattr(self.StructureElementsGrid, "_DeleteRow", _DeleteStructureElement)
-            
+
         def _MoveStructureElement(row, move):
             new_row = self.StructureElementsTable.MoveRow(row, move)
             if new_row != row:
@@ -404,7 +404,7 @@
                 self.StructureElementsTable.ResetView(self.StructureElementsGrid)
             return new_row
         setattr(self.StructureElementsGrid, "_MoveRow", _MoveStructureElement)
-        
+
         self.StructureElementsGrid.SetRowLabelSize(0)
         for col in range(self.StructureElementsTable.GetNumberCols()):
             attr = wx.grid.GridCellAttr()
@@ -413,7 +413,7 @@
             self.StructureElementsGrid.SetColMinimalWidth(col, self.StructureColSizes[col])
             self.StructureElementsGrid.AutoSizeColumn(col, False)
         self.StructureElementsGrid.RefreshButtons()
-        
+
         for datatype in GetDatatypeTypes():
             self.DerivationType.Append(_(datatype))
         self.SubrangePanel.Hide()
@@ -423,7 +423,7 @@
         self.CurrentPanel = "Directly"
         self.Highlights = []
         self.Initializing = False
-        
+
         self.HighlightControls = {
             ("Directly", "base"): self.DirectlyBaseType,
             ("Directly", "initial"): self.DirectlyInitialValue,
@@ -437,27 +437,27 @@
             ("Array", "base"): self.ArrayBaseType,
             ("Array", "range"): self.ArrayDimensions,
         }
-        
+
         self.RefreshHighlightsTimer = wx.Timer(self, -1)
         self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
-        
+
     def __del__(self):
         self.RefreshHighlightsTimer.Stop()
-    
+
     def GetBufferState(self):
         return self.Controler.GetBufferState()
-        
+
     def Undo(self):
         self.Controler.LoadPrevious()
         self.ParentWindow.CloseTabsWithoutModel()
-            
+
     def Redo(self):
         self.Controler.LoadNext()
         self.ParentWindow.CloseTabsWithoutModel()
-    
+
     def HasNoModel(self):
         return self.Controler.GetEditedElement(self.TagName) is None
-        
+
     def RefreshView(self):
         self.Initializing = True
         self.DirectlyBaseType.Clear()
@@ -504,7 +504,7 @@
         self.StructureElementsTable.ResetView(self.StructureElementsGrid)
         self.StructureElementsGrid.RefreshButtons()
         self.Initializing = False
-    
+
     def OnDerivationTypeChanged(self, event):
         wx.CallAfter(self.RefreshDisplayedInfos)
         wx.CallAfter(self.RefreshTypeInfos)
@@ -512,7 +512,7 @@
 
     def OnReturnKeyPressed(self, event):
         self.RefreshTypeInfos()
-        
+
     def OnInfosChanged(self, event):
         self.RefreshTypeInfos()
         event.Skip()
@@ -563,12 +563,12 @@
                 event.Skip()
         else:
             event.Skip()
-    
+
     def OnEnumeratedValuesChanged(self, event):
         wx.CallAfter(self.RefreshEnumeratedValues)
         wx.CallAfter(self.RefreshTypeInfos)
         event.Skip()
-    
+
     def OnStructureElementsGridCellChange(self, event):
         row, col = event.GetRow(), event.GetCol()
         colname = self.StructureElementsTable.GetColLabelValue(col, False)
@@ -606,34 +606,34 @@
             self.RefreshTypeInfos()
             wx.CallAfter(self.StructureElementsTable.ResetView, self.StructureElementsGrid)
             event.Skip()
-    
+
     def OnStructureElementsGridSelectCell(self, event):
         wx.CallAfter(self.RefreshStructureButtons)
         event.Skip()
-    
+
     def OnStructureElementsGridEditorShown(self, event):
-        row, col = event.GetRow(), event.GetCol() 
+        row, col = event.GetRow(), event.GetCol()
         if self.StructureElementsTable.GetColLabelValue(col, False) == "Type":
             type_menu = wx.Menu(title='')
-            
+
             base_menu = wx.Menu(title='')
             for base_type in self.Controler.GetBaseTypes():
                 new_id = wx.NewId()
                 AppendMenu(base_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=base_type)
                 self.Bind(wx.EVT_MENU, self.GetElementTypeFunction(base_type), id=new_id)
             type_menu.AppendMenu(wx.NewId(), _("Base Types"), base_menu)
-            
+
             datatype_menu = wx.Menu(title='')
             for datatype in self.Controler.GetDataTypes(self.TagName, False):
                 new_id = wx.NewId()
                 AppendMenu(datatype_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype)
                 self.Bind(wx.EVT_MENU, self.GetElementTypeFunction(datatype), id=new_id)
             type_menu.AppendMenu(wx.NewId(), _("User Data Types"), datatype_menu)
-            
+
             new_id = wx.NewId()
             AppendMenu(type_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Array"))
             self.Bind(wx.EVT_MENU, self.ElementArrayTypeFunction, id=new_id)
-            
+
 ##            functionblock_menu = wx.Menu(title='')
 ##            bodytype = self.Controler.GetEditedElementBodyType(self.TagName)
 ##            pouname, poutype = self.Controler.GetEditedElementType(self.TagName)
@@ -661,8 +661,8 @@
 
     def ElementArrayTypeFunction(self, event):
         row = self.StructureElementsGrid.GetGridCursorRow()
-        dialog = ArrayTypeDialog(self, 
-                                 self.Controler.GetDataTypes(self.TagName), 
+        dialog = ArrayTypeDialog(self,
+                                 self.Controler.GetDataTypes(self.TagName),
                                  self.StructureElementsTable.GetValueByName(row, "Type"))
         if dialog.ShowModal() == wx.ID_OK:
             self.StructureElementsTable.SetValueByName(row, "Type", dialog.GetValue())
--- a/plcopen/definitions.py	Wed May 28 18:33:41 2014 +0200
+++ b/plcopen/definitions.py	Fri May 30 02:20:19 2014 +0200
@@ -105,6 +105,8 @@
     #("WSTRING", "ANY_STRING") # TODO
 ]
 
+DefaultType = "DINT"
+
 DataTypeRange_list = [
     ("SINT", (-2**7, 2**7 - 1)),
     ("INT", (-2**15, 2**15 - 1)),