Change in layout from AuiMDIParentFrame to AuiNotebook
authorlbessard
Fri, 22 Aug 2008 13:49:22 +0200
changeset 235 7b58a3b5b6ec
parent 234 b9898f557e9b
child 236 9f594b90bb1a
Change in layout from AuiMDIParentFrame to AuiNotebook
Adding support for Instances Tree
DataTypeEditor.py
LDViewer.py
PLCOpenEditor.py
RessourceEditor.py
SFCViewer.py
TextViewer.py
Viewer.py
--- a/DataTypeEditor.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/DataTypeEditor.py	Fri Aug 22 13:49:22 2008 +0200
@@ -31,23 +31,6 @@
 
 DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$")
 
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class MDIDataTypeEditor(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = DataTypeEditor(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
 
 #-------------------------------------------------------------------------------
 #                          Configuration Editor class
--- a/LDViewer.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/LDViewer.py	Fri Aug 22 13:49:22 2008 +0200
@@ -159,23 +159,6 @@
 #                     Ladder Diagram Graphic elements Viewer class
 #-------------------------------------------------------------------------------
 
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class LD_MDIViewer(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = LD_Viewer(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
 
 """
 Class derived from Viewer class that implements a Viewer of Ladder Diagram
--- a/PLCOpenEditor.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/PLCOpenEditor.py	Fri Aug 22 13:49:22 2008 +0200
@@ -49,13 +49,14 @@
 
 CWD = os.path.split(os.path.realpath(__file__))[0]
 
-[ID_PLCOPENEDITOR, ID_PLCOPENEDITORPROJECTTREE, 
+[ID_PLCOPENEDITOR, ID_PLCOPENEDITORTREENOTEBOOK,
+ ID_PLCOPENEDITORTYPESTREE, ID_PLCOPENEDITORINSTANCESTREE, 
  ID_PLCOPENEDITORMAINSPLITTER, ID_PLCOPENEDITORSECONDSPLITTER, 
  ID_PLCOPENEDITOREDITORPANEL, ID_PLCOPENEDITORTABSOPENED, 
  ID_PLCOPENEDITORTOOLBAR, ID_PLCOPENEDITORDEFAULTTOOLBAR, 
  ID_PLCOPENEDITORSFCTOOLBAR, ID_PLCOPENEDITORFBDTOOLBAR, 
  ID_PLCOPENEDITORLDTOOLBAR,
-] = [wx.NewId() for _init_ctrls in range(11)]
+] = [wx.NewId() for _init_ctrls in range(13)]
 
 [ID_PLCOPENEDITORFILEMENUGENERATE, 
 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(1)]
@@ -184,12 +185,7 @@
     else:
         parent.Append(helpString=help, id=id, kind=kind, item=text)
 
-if wx.VERSION >= (2, 8, 0):
-    base_class = wx.aui.AuiMDIParentFrame
-else:
-    base_class = wx.Frame
-
-class PLCOpenEditor(base_class):
+class PLCOpenEditor(wx.Frame):
     
     CopyBuffer = None
     
@@ -341,14 +337,9 @@
         self._init_coll_HelpMenu_Items(self.HelpMenu)
         
     def _init_ctrls(self, prnt):
-        if wx.VERSION >= (2, 8, 0):
-            wx.aui.AuiMDIParentFrame.__init__(self, winid=ID_PLCOPENEDITOR, name=u'PLCOpenEditor', 
-                  parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
-                  style=wx.DEFAULT_FRAME_STYLE|wx.SUNKEN_BORDER|wx.CLIP_CHILDREN, title=u'PLCOpenEditor')
-        else:
-            wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name=u'PLCOpenEditor',
-                  parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
-                  style=wx.DEFAULT_FRAME_STYLE, title=u'PLCOpenEditor')
+        wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name=u'PLCOpenEditor',
+              parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
+              style=wx.DEFAULT_FRAME_STYLE, title=u'PLCOpenEditor')
         self._init_utils()
         self.SetClientSize(wx.Size(1000, 600))
         self.SetMenuBar(self.MenuBar)
@@ -366,38 +357,47 @@
             self.MainSplitter.SetNeedUpdating(True)
             self.MainSplitter.SetMinimumPaneSize(1)
             
-            self.ProjectTree = wx.TreeCtrl(id=ID_PLCOPENEDITORPROJECTTREE,
-                  name='treeCtrl1', parent=self.MainSplitter, pos=wx.Point(0, 0),
-                  size=wx.Size(-1, -1),
+            self.TreeNoteBook = wx.Notebook(id=ID_PLCOPENEDITORTREENOTEBOOK,
+                  name='TreeNoteBook', parent=self.MainSplitter, pos=wx.Point(0,
+                  0), size=wx.Size(0, 0), style=0)
+        else:
+            self.TreeNoteBook = wx.aui.AuiNotebook(self)
+            self.AUIManager.AddPane(self.TreeNoteBook, wx.aui.AuiPaneInfo().Caption("Project").Left().Layer(1).BestSize(wx.Size(200, 500)).CloseButton(False))
+        
+        self.TypesTree = wx.TreeCtrl(id=ID_PLCOPENEDITORTYPESTREE,
+                  name='TypesTree', parent=self.TreeNoteBook, 
+                  pos=wx.Point(0, 0), size=wx.Size(0, 0),
                   style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.SUNKEN_BORDER)
-        else:
-            self.ProjectTree = wx.TreeCtrl(id=ID_PLCOPENEDITORPROJECTTREE,
-                  name='treeCtrl1', parent=self, pos=wx.Point(0, 0),
-                  size=wx.Size(200, -1),
+        self.TreeNoteBook.AddPage(self.TypesTree, "Types")
+        
+        if wx.Platform == '__WXMSW__':
+            self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnTypesTreeRightUp,
+                  id=ID_PLCOPENEDITORTYPESTREE)
+            self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTypesTreeItemSelected,
+                  id=ID_PLCOPENEDITORTYPESTREE)
+        else:
+            if wx.VERSION >= (2, 6, 0):
+                self.TypesTree.Bind(wx.EVT_RIGHT_UP, self.OnTypesTreeRightUp)
+                self.TypesTree.Bind(wx.EVT_LEFT_UP, self.OnTypesTreeLeftUp)
+            else:
+                wx.EVT_RIGHT_UP(self.TypesTree, self.OnTypesTreeRightUp)
+                wx.EVT_LEFT_UP(self.TypesTree, self.OnTypesTreeLeftUp)
+            self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnTypesTreeItemChanging,
+                  id=ID_PLCOPENEDITORTYPESTREE)
+        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnTypesTreeBeginDrag,
+              id=ID_PLCOPENEDITORTYPESTREE)
+        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTypesTreeItemBeginEdit,
+              id=ID_PLCOPENEDITORTYPESTREE)
+        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTypesTreeItemEndEdit,
+              id=ID_PLCOPENEDITORTYPESTREE)
+        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTypesTreeItemActivated,
+              id=ID_PLCOPENEDITORTYPESTREE)
+        
+        self.InstancesTree = wx.TreeCtrl(id=ID_PLCOPENEDITORINSTANCESTREE,
+                  name='InstancesTree', parent=self.TreeNoteBook, 
+                  pos=wx.Point(0, 0), size=wx.Size(0, 0),
                   style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.SUNKEN_BORDER)
-            self.AUIManager.AddPane(self.ProjectTree, wx.aui.AuiPaneInfo().Caption("Project Tree").Left().Layer(1).BestSize(wx.Size(200, 500)).CloseButton(False))
-        if wx.Platform == '__WXMSW__':
-            self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnProjectTreeRightUp,
-                  id=ID_PLCOPENEDITORPROJECTTREE)
-            self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnProjectTreeItemSelected,
-                  id=ID_PLCOPENEDITORPROJECTTREE)
-        else:
-            if wx.VERSION >= (2, 6, 0):
-                self.ProjectTree.Bind(wx.EVT_RIGHT_UP, self.OnProjectTreeRightUp)
-                self.ProjectTree.Bind(wx.EVT_LEFT_UP, self.OnProjectTreeLeftUp)
-            else:
-                wx.EVT_RIGHT_UP(self.ProjectTree, self.OnProjectTreeRightUp)
-                wx.EVT_LEFT_UP(self.ProjectTree, self.OnProjectTreeLeftUp)
-            self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnProjectTreeItemChanging,
-                  id=ID_PLCOPENEDITORPROJECTTREE)
-        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnProjectTreeBeginDrag,
-              id=ID_PLCOPENEDITORPROJECTTREE)
-        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnProjectTreeItemBeginEdit,
-              id=ID_PLCOPENEDITORPROJECTTREE)
-        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnProjectTreeItemEndEdit,
-              id=ID_PLCOPENEDITORPROJECTTREE)
-        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnProjectTreeItemActivated,
-              id=ID_PLCOPENEDITORPROJECTTREE)
+        self.TreeNoteBook.AddPage(self.InstancesTree, "Instances")
         
         if wx.VERSION < (2, 8, 0):
             self.ToolBar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT|wx.NO_BORDER, 
@@ -428,7 +428,7 @@
                   size=wx.Size(0, 0), style=wx.SP_3D)
             self.SecondSplitter.SetMinimumPaneSize(1)
             
-            self.MainSplitter.SplitVertically(self.ProjectTree, self.SecondSplitter, 200)
+            self.MainSplitter.SplitVertically(self.TreeNoteBook, self.SecondSplitter, 200)
             
             self.TabsOpened = wx.Notebook(id=ID_PLCOPENEDITORTABSOPENED,
                   name='TabsOpened', parent=self.SecondSplitter, pos=wx.Point(0,
@@ -439,14 +439,19 @@
             else:
                 wx.EVT_NOTEBOOK_PAGE_CHANGED(self.TabsOpened, ID_PLCOPENEDITORTABSOPENED,
                     self.OnPouSelectedChanged)
-        
+        else:
+            self.TabsOpened = wx.aui.AuiNotebook(self)
+            self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,
+                    self.OnPouSelectedChanged)
+            self.AUIManager.AddPane(self.TabsOpened, wx.aui.AuiPaneInfo().CentrePane())
+            
         if wx.VERSION < (2, 8, 0):
             self.VariablePanelIndexer = VariablePanelIndexer(self.SecondSplitter, self, self.Controler)
             
             self.SecondSplitter.SplitHorizontally(self.TabsOpened, self.VariablePanelIndexer, -200)
         else:
             self.VariablePanelIndexer = VariablePanelIndexer(self, self, self.Controler)
-            self.AUIManager.AddPane(self.VariablePanelIndexer, wx.aui.AuiPaneInfo().Caption("Variable Panel").Bottom().Layer(0).BestSize(wx.Size(800, 200)).CloseButton(False))
+            self.AUIManager.AddPane(self.VariablePanelIndexer, wx.aui.AuiPaneInfo().Caption("Variables").Bottom().Layer(0).BestSize(wx.Size(800, 200)).CloseButton(False))
             
             self.AUIManager.Update()
         
@@ -463,10 +468,13 @@
         
         self.SetIcon(wx.Icon(os.path.join(CWD,"Images","poe.ico"),wx.BITMAP_TYPE_ICO))
         
-        self.TreeImageList = wx.ImageList(16, 16)
-        self.TreeImageDict = {}
+        self.TypesTreeImageList = wx.ImageList(16, 16)
+        self.InstancesTreeImageList = wx.ImageList(16, 16)
+        self.TypesTreeImageDict = {}
+        self.InstancesTreeImageDict = {}
         for language in LANGUAGES:
-            self.TreeImageDict[language]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%language)))
+            self.TypesTreeImageDict[language]=self.TypesTreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%language)))
+            self.InstancesTreeImageDict[language]=self.InstancesTreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%language)))
         
         for imgname, itemtype in [
             #editables
@@ -483,13 +491,22 @@
             ("FUNCTION",       ITEM_FUNCTION),
             ("FUNCTIONBLOCK",  ITEM_FUNCTIONBLOCK),
             ("PROGRAM",        ITEM_PROGRAM),
+            ("VAR_LOCAL",      ITEM_VAR_LOCAL),
+            ("VAR_LOCAL",      ITEM_VAR_GLOBAL),
+            ("VAR_LOCAL",      ITEM_VAR_EXTERNAL),
+            ("VAR_LOCAL",      ITEM_VAR_TEMP),
+            ("VAR_INPUT",      ITEM_VAR_INPUT),
+            ("VAR_OUTPUT",     ITEM_VAR_OUTPUT),
+            ("VAR_INOUT",      ITEM_VAR_INOUT),
             ("TRANSITIONS",    ITEM_TRANSITIONS),
             ("ACTIONS",        ITEM_ACTIONS),
             ("CONFIGURATIONS", ITEM_CONFIGURATIONS),
             ("RESOURCES",      ITEM_RESOURCES),
             ("PROPERTIES",     ITEM_PROPERTIES)]:
-            self.TreeImageDict[itemtype]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%imgname)))
-        self.ProjectTree.AssignImageList(self.TreeImageList)
+            self.TypesTreeImageDict[itemtype]=self.TypesTreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%imgname)))
+            self.InstancesTreeImageDict[itemtype]=self.InstancesTreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%imgname)))
+        self.TypesTree.AssignImageList(self.TypesTreeImageList)
+        self.InstancesTree.AssignImageList(self.InstancesTreeImageList)
         
         self.CurrentToolBar = []
         self.CurrentLanguage = ""
@@ -506,7 +523,8 @@
         self.PageSetupData.SetMarginBottomRight(wx.Point(10, 20))
         
         if not self.ModeSolo or fileOpen is not None:
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
+            self.RefreshInstancesTree()
         
         self.RefreshFileMenu()
         self.RefreshEditMenu()
@@ -517,14 +535,14 @@
         self.SelectedItem = None
 
     def OnPageClose(self, event):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected >= 0:
             tagname = self.GetPage(selected).GetTagName()
             self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-            if self.GetPageCount() > 0:
-                new_index = min(selected, self.GetPageCount() - 1)
+            if self.TabsOpened.GetPageCount() > 0:
+                new_index = min(selected, self.TabsOpened.GetPageCount() - 1)
                 tagname = self.GetPage(new_index).GetTagName()
-                self.SetPageSelection(new_index)
+                self.TabsOpened.SetSelection(new_index)
                 self.VariablePanelIndexer.ChangeVariablePanel(tagname)
             self.RefreshTitle()
             self.RefreshFileMenu()
@@ -560,8 +578,8 @@
                 self.RefreshTitle()
                 self.RefreshFileMenu()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
-                for i in xrange(self.GetPageCount()):
+                self.RefreshTypesTree()
+                for i in xrange(self.TabsOpened.GetPageCount()):
                     editor = self.GetPage(i)
                     editor.RefreshScaling()
         dialog.Destroy()
@@ -591,87 +609,19 @@
 #                            Notebook Unified Functions
 #-------------------------------------------------------------------------------
 
-    def GetPageCount(self):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.GetPageCount()
-            else:
-                return 0
-        else:
-            return self.TabsOpened.GetPageCount()
-    
-    def GetPage(self, idx):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.GetPage(idx).GetViewer()
-            else:
-                return None
-        else:
-            return self.TabsOpened.GetPage(idx)
-
-    def GetPageSelection(self):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.GetSelection()
-            else:
-                return -1
-        else:
-            return self.TabsOpened.GetSelection()
-
-    def SetPageSelection(self, idx):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                notebook.SetSelection(idx)
-        else:
-            self.TabsOpened.SetSelection(idx)
-
-    def DeletePage(self, idx):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                notebook.DeletePage(idx)
-        else:
-            self.TabsOpened.DeletePage(idx)
-
     def DeleteAllPages(self):
         if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                for idx in xrange(notebook.GetPageCount()):
-                    notebook.DeletePage(0)
+            for idx in xrange(self.TabsOpened.GetPageCount()):
+                self.TabsOpened.DeletePage(0)
         else:
             self.TabsOpened.DeleteAllPages()
 
-    def SetPageText(self, idx, text):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.SetPageText(idx, text)
-        else:
-            return self.TabsOpened.SetPageText(idx, text)
-
     def SetPageBitmap(self, idx, bitmap):
         if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.SetPageBitmap(idx, bitmap)
+            return self.TabsOpened.SetPageBitmap(idx, bitmap)
         else:
             return self.TabsOpened.SetPageImage(idx, bitmap)
 
-    def GetPageText(self, idx):
-        if wx.VERSION >= (2, 8, 0):
-            notebook = self.GetNotebook()
-            if notebook is not None:
-                return notebook.GetPageText(idx)
-            else:
-                return ""
-        else:
-            return self.TabsOpened.GetPageText(idx)
-
 
 #-------------------------------------------------------------------------------
 #                            File Menu Functions
@@ -679,12 +629,12 @@
 
     def RefreshFileMenu(self):
         if self.Controler.HasOpenedProject():
-            selected = self.GetPageSelection()
+            selected = self.TabsOpened.GetSelection()
             if selected >= 0:
-                graphic_viewer = isinstance(self.GetPage(selected), Viewer)
+                graphic_viewer = isinstance(self.TabsOpened.GetPage(selected), Viewer)
             else:
                 graphic_viewer = False
-            if self.GetPageCount() > 0:
+            if self.TabsOpened.GetPageCount() > 0:
                 self.FileMenu.Enable(wx.ID_CLOSE, True)
                 if graphic_viewer:
                     self.FileMenu.Enable(wx.ID_PREVIEW, True)
@@ -723,7 +673,8 @@
             self.RefreshTitle()
             self.RefreshFileMenu()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
+            self.RefreshInstancesTree()
         event.Skip()
 
     def OnOpenProjectMenu(self, event):
@@ -747,7 +698,8 @@
                 self.DeleteAllPages()
                 self.VariablePanelIndexer.RemoveAllPanels()
                 self.Controler.OpenXMLFile(filepath)
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
+                self.RefreshInstancesTree()
             self.RefreshTitle()
             self.RefreshFileMenu()
             self.RefreshEditMenu()
@@ -756,15 +708,15 @@
         event.Skip()
 
     def OnCloseTabMenu(self, event):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected >= 0:
-            tagname = self.GetPage(selected).GetTagName()
-            self.DeletePage(selected)
+            tagname = self.TabsOpened.GetPage(selected).GetTagName()
+            self.TabsOpened.DeletePage(selected)
             self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-            if self.GetPageCount() > 0:
-                new_index = min(selected, self.GetPageCount() - 1)
-                tagname = self.GetPage(new_index).GetTagName()
-                self.SetPageSelection(new_index)
+            if self.TabsOpened.GetPageCount() > 0:
+                new_index = min(selected, self.TabsOpened.GetPageCount() - 1)
+                tagname = self.TabsOpened.GetPage(new_index).GetTagName()
+                self.TabsOpened.SetSelection(new_index)
                 self.VariablePanelIndexer.ChangeVariablePanel(tagname)
             self.RefreshTitle()
             self.RefreshFileMenu()
@@ -783,7 +735,8 @@
                 return
         self.DeleteAllPages()
         self.VariablePanelIndexer.RemoveAllPanels()
-        self.ProjectTree.DeleteAllItems()
+        self.TypesTree.DeleteAllItems()
+        self.InstancesTree.DeleteAllItems()
         self.Controler.Reset()
         self.RefreshTitle()
         self.RefreshFileMenu()
@@ -861,14 +814,14 @@
         event.Skip()
 
     def OnPreviewMenu(self, event):
-        selected = self.GetPageSelection()        
+        selected = self.TabsOpened.GetSelection()        
         if selected != -1:
             data = wx.PrintDialogData(self.PrintData)
             properties = self.Controler.GetProjectProperties()
             page_size = map(int, properties["pageSize"])
             margins = (self.PageSetupData.GetMarginTopLeft(), self.PageSetupData.GetMarginBottomRight())
-            printout = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
-            printout2 = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
+            printout = GraphicPrintout(self.TabsOpened.GetPage(selected), page_size, margins, True)
+            printout2 = GraphicPrintout(self.TabsOpened.GetPage(selected), page_size, margins, True)
             preview = wx.PrintPreview(printout, printout2, data)
 
             if preview.Ok():
@@ -880,7 +833,7 @@
         event.Skip()
 
     def OnPrintMenu(self, event):
-        selected = self.GetPageSelection()        
+        selected = self.TabsOpened.GetSelection()        
         if selected != -1:
             dialog_data = wx.PrintDialogData(self.PrintData)
             dialog_data.SetToPage(1)
@@ -888,7 +841,7 @@
             page_size = map(int, properties["pageSize"])
             margins = (self.PageSetupData.GetMarginTopLeft(), self.PageSetupData.GetMarginBottomRight())
             printer = wx.Printer(dialog_data)
-            printout = GraphicPrintout(self.GetPage(selected), page_size, margins)
+            printout = GraphicPrintout(self.TabsOpened.GetPage(selected), page_size, margins)
             
             if not printer.Print(self, printout, True):
                 wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
@@ -917,7 +870,7 @@
             self.EditMenu.Enable(wx.ID_UNDO, False)
             self.EditMenu.Enable(wx.ID_REDO, False)
         if self.Controler.HasOpenedProject():
-            if self.GetPageCount() > 0:
+            if self.TabsOpened.GetPageCount() > 0:
                 self.EditMenu.Enable(wx.ID_REFRESH, True)
             else:
                 self.EditMenu.Enable(wx.ID_REFRESH, False)
@@ -935,9 +888,9 @@
             self.EditMenu.Enable(wx.ID_PASTE, False)
 
     def OnRefreshMenu(self, event):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            window = self.GetPage(selected)
+            window = self.TabsOpened.GetPage(selected)
             window.RefreshView()
             self.VariablePanelIndexer.RefreshVariablePanel(window.GetTagName())
         event.Skip()
@@ -948,40 +901,40 @@
 
     def OnUndoMenu(self, event):
         self.Controler.LoadPrevious()
-        idxs = range(self.GetPageCount())
+        idxs = range(self.TabsOpened.GetPageCount())
         idxs.reverse()
         for idx in idxs:
-            tagname = self.GetPage(idx).GetTagName()
+            tagname = self.TabsOpened.GetPage(idx).GetTagName()
             if self.Controler.GetEditedElement(tagname) is None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
-        selected = self.GetPageSelection()        
+                self.TabsOpened.DeletePage(idx)
+        selected = self.TabsOpened.GetSelection()        
         if selected != -1:
-            window = self.GetPage(selected)
+            window = self.TabsOpened.GetPage(selected)
             window.RefreshView()
             self.VariablePanelIndexer.RefreshVariablePanel(window.GetTagName())
         self.RefreshTitle()
         self.RefreshEditMenu()
-        self.RefreshProjectTree()
+        self.RefreshTypesTree()
         event.Skip()
     
     def OnRedoMenu(self, event):
         self.Controler.LoadNext()
-        idxs = range(self.GetPageCount())
+        idxs = range(self.TabsOpened.GetPageCount())
         idxs.reverse()
         for idx in idxs:
-            tagname = self.GetPage(idx).GetTagName()
+            tagname = self.TabsOpened.GetPage(idx).GetTagName()
             if self.Controler.GetEditedElement(tagname) is None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
-        selected = self.GetPageSelection()
+                self.TabsOpened.DeletePage(idx)
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            window = self.GetPage(selected)
+            window = self.TabsOpened.GetPage(selected)
             window.RefreshView()
             self.VariablePanelIndexer.RefreshVariablePanel(window.GetTagName())
         self.RefreshTitle()
         self.RefreshEditMenu()
-        self.RefreshProjectTree()
+        self.RefreshTypesTree()
         event.Skip()
 
     def OnCutMenu(self, event):
@@ -1010,13 +963,13 @@
     
     def OnDeleteMenu(self, event):
         window = self.FindFocus()
-        if window == self.ProjectTree:
-            selected = self.ProjectTree.GetSelection()
+        if window == self.TypesTree:
+            selected = self.TypesTree.GetSelection()
             if selected.IsOk():
-                type = self.ProjectTree.GetPyData(selected)
+                type = self.TypesTree.GetPyData(selected)
                 tagname = ""
                 if type == ITEM_DATATYPE:
-                    name = self.ProjectTree.GetItemText(selected)
+                    name = self.TypesTree.GetItemText(selected)
                     if not self.Controler.DataTypeIsUsed(name):
                         self.Controler.ProjectRemoveDataType(name)
                         tagname = self.Controler.ComputeDataTypeName(name)
@@ -1025,7 +978,7 @@
                         message.ShowModal()
                         message.Destroy()
                 elif type == ITEM_POU:
-                    name = self.ProjectTree.GetItemText(selected)
+                    name = self.TypesTree.GetItemText(selected)
                     if not self.Controler.DataTypeIsUsed(name):
                         self.Controler.ProjectRemoveDataType(name)
                         tagname = self.Controler.ComputeDataTypeName(name)
@@ -1034,41 +987,41 @@
                         message.ShowModal()
                         message.Destroy()
                 elif type in [ITEM_TRANSITION, ITEM_ACTION]:
-                    item = self.ProjectTree.GetItemParent(selected)
-                    item_type = self.ProjectTree.GetPyData(item)
+                    item = self.TypesTree.GetItemParent(selected)
+                    item_type = self.TypesTree.GetPyData(item)
                     while item_type != ITEM_POU:
-                        item = self.ProjectTree.GetItemParent(item)
-                        item_type = self.ProjectTree.GetPyData(item)
-                    pou_name = self.ProjectTree.GetItemText(item)
+                        item = self.TypesTree.GetItemParent(item)
+                        item_type = self.TypesTree.GetPyData(item)
+                    pou_name = self.TypesTree.GetItemText(item)
                     if type == ITEM_TRANSITION:
-                        transition = self.ProjectTree.GetItemText(selected)
+                        transition = self.TypesTree.GetItemText(selected)
                         self.Controler.ProjectRemovePouTransition(pou_name, transition)
                         tagname = self.Controler.ComputePouTransitionName(pou_name, transition)
                     elif type == ITEM_ACTION:
-                        action = self.ProjectTree.GetItemText(selected)
+                        action = self.TypesTree.GetItemText(selected)
                         self.Controler.ProjectRemovePouAction(pou_name, action)
                         tagname = self.Controler.ComputePouActionName(pou_name, action)
                 elif type == ITEM_CONFIGURATION:
-                    name = self.ProjectTree.GetItemText(selected)
+                    name = self.TypesTree.GetItemText(selected)
                     self.Controler.ProjectRemoveConfiguration(name)
                     tagname = self.Controler.ComputeConfigurationName(name)
                 elif type == ITEM_RESOURCE:
-                    resource = self.ProjectTree.GetItemText(selected)
-                    item = self.ProjectTree.GetItemParent(selected)
-                    item_type = self.ProjectTree.GetPyData(item)
+                    resource = self.TypesTree.GetItemText(selected)
+                    item = self.TypesTree.GetItemParent(selected)
+                    item_type = self.TypesTree.GetPyData(item)
                     while item_type != ITEM_CONFIGURATION:
-                        item = self.ProjectTree.GetItemParent(item)
-                        item_type = self.ProjectTree.GetPyData(item)
-                    config_name = self.ProjectTree.GetItemText(item)
+                        item = self.TypesTree.GetItemParent(item)
+                        item_type = self.TypesTree.GetPyData(item)
+                    config_name = self.TypesTree.GetItemText(item)
                     self.Controler.ProjectRemoveConfigurationResource(config_name, resource)
                     tagname = self.Controler.ComputeConfigurationResourceName(config_name, selected)
                 idx = self.IsOpened(tagname)
                 if idx is not None:
                     self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                    self.DeletePage(idx)
+                    self.TabsOpened.DeletePage(idx)
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
                 self.RefreshToolBar()
         elif isinstance(window, (Viewer, TextViewer)):
             event = wx.KeyEvent(wx.EVT_CHAR._getEvtType())
@@ -1082,31 +1035,24 @@
 #-------------------------------------------------------------------------------
     
     def OnPouSelectedChanged(self, event):
-        if wx.VERSION < (2, 8, 0) or event.GetActive():
-            old_selected = self.GetPageSelection()
-            if old_selected >= 0:
-                self.GetPage(old_selected).ResetBuffer()
-            if wx.VERSION >= (2, 8, 0):
-                window = event.GetEventObject().GetViewer()
-            else:
-                selected = event.GetSelection()
-                if selected >= 0:
-                    window = self.GetPage(selected)
-                else:
-                    window = None
-            if window:
-                self.SelectProjectTreeItem(window.GetTagName())
-                window.RefreshView()
-                self.VariablePanelIndexer.ChangeVariablePanel(window.GetTagName())
-                self.RefreshFileMenu()
-                self.RefreshEditMenu()
-                self.RefreshToolBar()
+        old_selected = self.TabsOpened.GetSelection()
+        if old_selected >= 0:
+            self.TabsOpened.GetPage(old_selected).ResetBuffer()
+        selected = event.GetSelection()
+        if selected >= 0:
+            window = self.TabsOpened.GetPage(selected)
+            self.SelectTypesTreeItem(window.GetTagName())
+            window.RefreshView()
+            self.VariablePanelIndexer.ChangeVariablePanel(window.GetTagName())
+            self.RefreshFileMenu()
+            self.RefreshEditMenu()
+            self.RefreshToolBar()
         event.Skip()
 
     def RefreshEditor(self, variablepanel = True):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            window = self.GetPage(selected)
+            window = self.TabsOpened.GetPage(selected)
             window.RefreshView()
             if variablepanel:
                 self.RefreshVariablePanel(window.GetTagName())
@@ -1115,21 +1061,21 @@
         self.VariablePanelIndexer.RefreshVariablePanel(tagname)
 
     def RefreshEditorNames(self, old_tagname, new_tagname):
-        for i in xrange(self.GetPageCount()):
-            editor = self.GetPage(i)
+        for i in xrange(self.TabsOpened.GetPageCount()):
+            editor = self.TabsOpened.GetPage(i)
             if editor.GetTagName() == old_tagname:
                 editor.SetTagName(new_tagname)
         self.VariablePanelIndexer.UpdateVariablePanelTagName(old_tagname, new_tagname)
 
     def IsOpened(self, tagname):
-        for idx in xrange(self.GetPageCount()):
-            if self.GetPage(idx).IsViewing(tagname):
+        for idx in xrange(self.TabsOpened.GetPageCount()):
+            if self.TabsOpened.GetPage(idx).IsViewing(tagname):
                 return idx
         return None
 
     def RefreshPageTitles(self):
-        for idx in xrange(self.GetPageCount()):
-            window = self.GetPage(idx)
+        for idx in xrange(self.TabsOpened.GetPageCount()):
+            window = self.TabsOpened.GetPage(idx)
             words = window.GetTagName().split("::")
             if words[0] == "P":
                 pou_type = self.Controler.GetEditedElementType(window.GetTagName())[1].upper()
@@ -1147,113 +1093,113 @@
                 self.SetPageBitmap(idx, GenerateBitmap("RESOURCE"))
             elif words[0] == "D":
                 self.SetPageBitmap(idx, GenerateBitmap("DATATYPE"))
-            self.SetPageText(idx, "-".join(words[1:]))
+            self.TabsOpened.SetPageText(idx, "-".join(words[1:]))
 
 
 #-------------------------------------------------------------------------------
 #                         Project Tree Management Functions
 #-------------------------------------------------------------------------------
 
-    def RefreshProjectTree(self):
+    def RefreshTypesTree(self):
         infos = self.Controler.GetProjectInfos()
-        root = self.ProjectTree.GetRootItem()
+        root = self.TypesTree.GetRootItem()
         if not root.IsOk():
-            root = self.ProjectTree.AddRoot(infos["name"])
-        self.GenerateTreeBranch(root, infos)
-        self.ProjectTree.Expand(self.ProjectTree.GetRootItem())
-
-    def GenerateTreeBranch(self, root, infos):
+            root = self.TypesTree.AddRoot(infos["name"])
+        self.GenerateTypesTreeBranch(root, infos)
+        self.TypesTree.Expand(self.TypesTree.GetRootItem())
+
+    def GenerateTypesTreeBranch(self, root, infos, topology=False):
         to_delete = []
-        self.ProjectTree.SetItemText(root, infos["name"])
-        self.ProjectTree.SetPyData(root, infos["type"])
-        if infos["tagname"] in self.Errors:
-            self.ProjectTree.SetItemBackgroundColour(root, wx.Colour(255, 255, 0))
-            self.ProjectTree.SetItemTextColour(root, wx.RED)
-        else:
-            self.ProjectTree.SetItemBackgroundColour(root, wx.WHITE)
-            self.ProjectTree.SetItemTextColour(root, wx.BLACK)
-        if infos["type"] == ITEM_POU :
-            self.ProjectTree.SetItemImage(root,self.TreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
-        else:
-            self.ProjectTree.SetItemImage(root,self.TreeImageDict[infos["type"]])      
+        self.TypesTree.SetItemText(root, infos["name"])
+        self.TypesTree.SetPyData(root, infos["type"])
+        if infos.get("tagname", None) in self.Errors:
+            self.TypesTree.SetItemBackgroundColour(root, wx.Colour(255, 255, 0))
+            self.TypesTree.SetItemTextColour(root, wx.RED)
+        else:
+            self.TypesTree.SetItemBackgroundColour(root, wx.WHITE)
+            self.TypesTree.SetItemTextColour(root, wx.BLACK)
+        if infos["type"] == ITEM_POU:
+            self.TypesTree.SetItemImage(root, self.TypesTreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
+        else:
+            self.TypesTree.SetItemImage(root, self.TypesTreeImageDict[infos["type"]])      
             
         if wx.VERSION >= (2, 6, 0):
-            item, root_cookie = self.ProjectTree.GetFirstChild(root)
-        else:
-            item, root_cookie = self.ProjectTree.GetFirstChild(root, 0)
+            item, root_cookie = self.TypesTree.GetFirstChild(root)
+        else:
+            item, root_cookie = self.TypesTree.GetFirstChild(root, 0)
         for values in infos["values"]:
             if not item.IsOk():
-                item = self.ProjectTree.AppendItem(root, "")
+                item = self.TypesTree.AppendItem(root, "")
                 if wx.Platform != '__WXMSW__':
-                    item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
-            self.GenerateTreeBranch(item, values)
-            item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
+                    item, root_cookie = self.TypesTree.GetNextChild(root, root_cookie)
+            self.GenerateTypesTreeBranch(item, values)
+            item, root_cookie = self.TypesTree.GetNextChild(root, root_cookie)
         while item.IsOk():
             to_delete.append(item)
-            item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
+            item, root_cookie = self.TypesTree.GetNextChild(root, root_cookie)
         for item in to_delete:
-            self.ProjectTree.Delete(item)
-
-    def SelectProjectTreeItem(self, tagname):
-        if self.ProjectTree:
-            root = self.ProjectTree.GetRootItem()
+            self.TypesTree.Delete(item)
+
+    def SelectTypesTreeItem(self, tagname):
+        if self.TypesTree:
+            root = self.TypesTree.GetRootItem()
             words = tagname.split("::")
             if words[0] == "D":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_DATATYPE)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_DATATYPE)])
             elif words[0] == "P":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_POU)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_POU)])
             elif words[0] == "T":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_POU), (words[2], ITEM_TRANSITION)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_POU), (words[2], ITEM_TRANSITION)])
             elif words[0] == "A":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_POU), (words[2], ITEM_ACTION)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_POU), (words[2], ITEM_ACTION)])
             elif words[0] == "C":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_CONFIGURATION)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_CONFIGURATION)])
             elif words[0] == "R":
-                return self.RecursiveProjectTreeItemSelection(root, [(words[1], ITEM_CONFIGURATION), (words[2], ITEM_RESOURCE)])
+                return self.RecursiveTypesTreeItemSelection(root, [(words[1], ITEM_CONFIGURATION), (words[2], ITEM_RESOURCE)])
         return False
 
-    def RecursiveProjectTreeItemSelection(self, root, items):
+    def RecursiveTypesTreeItemSelection(self, root, items):
         found = False
-        if self.ProjectTree:
+        if self.TypesTree:
             if wx.VERSION >= (2, 6, 0):
-                item, root_cookie = self.ProjectTree.GetFirstChild(root)
+                item, root_cookie = self.TypesTree.GetFirstChild(root)
             else:
-                item, root_cookie = self.ProjectTree.GetFirstChild(root, 0)
+                item, root_cookie = self.TypesTree.GetFirstChild(root, 0)
             while item.IsOk() and not found:
-                if (self.ProjectTree.GetItemText(item), self.ProjectTree.GetPyData(item)) == items[0]:
+                if (self.TypesTree.GetItemText(item), self.TypesTree.GetPyData(item)) == items[0]:
                     if len(items) == 1:
                         self.SelectedItem = item
-                        self.ProjectTree.SelectItem(item)
+                        self.TypesTree.SelectItem(item)
                         wx.CallAfter(self.ResetSelectedItem)
                         return True
                     else:
-                        found = self.RecursiveProjectTreeItemSelection(item, items[1:])
+                        found = self.RecursiveTypesTreeItemSelection(item, items[1:])
                 else:
-                    found = self.RecursiveProjectTreeItemSelection(item, items)
-                item, root_cookie = self.ProjectTree.GetNextChild(root, root_cookie)
+                    found = self.RecursiveTypesTreeItemSelection(item, items)
+                item, root_cookie = self.TypesTree.GetNextChild(root, root_cookie)
         return found
 
-    def OnProjectTreeBeginDrag(self, event):
+    def OnTypesTreeBeginDrag(self, event):
         if wx.Platform == '__WXMSW__':
             self.SelectedItem = event.GetItem()
-        if self.SelectedItem is not None and self.ProjectTree.GetPyData(self.SelectedItem) == ITEM_POU:
-            block_name = self.ProjectTree.GetItemText(self.SelectedItem)
+        if self.SelectedItem is not None and self.TypesTree.GetPyData(self.SelectedItem) == ITEM_POU:
+            block_name = self.TypesTree.GetItemText(self.SelectedItem)
             block_type = self.Controler.GetPouType(block_name)
             if block_type != "program":
                 data = wx.TextDataObject(str((block_name, block_type, "")))
-                dragSource = wx.DropSource(self.ProjectTree)
+                dragSource = wx.DropSource(self.TypesTree)
                 dragSource.SetData(data)
                 dragSource.DoDragDrop()
             self.ResetSelectedItem()
 
-    def OnProjectTreeItemBeginEdit(self, event):
+    def OnTypesTreeItemBeginEdit(self, event):
         selected = event.GetItem()
-        if self.ProjectTree.GetPyData(selected) in ITEMS_UNEDITABLE:
+        if self.TypesTree.GetPyData(selected) in ITEMS_UNEDITABLE:
             event.Veto()
         else:
             event.Skip()
 
-    def OnProjectTreeItemEndEdit(self, event):
+    def OnTypesTreeItemEndEdit(self, event):
         message = None
         abort = False
         new_name = event.GetLabel()
@@ -1264,8 +1210,8 @@
                 message = "\"%s\" is a keyword. It can't be used!"%new_name
             else:
                 item = event.GetItem()
-                old_name = self.ProjectTree.GetItemText(item)
-                itemtype = self.ProjectTree.GetPyData(item)
+                old_name = self.TypesTree.GetItemText(item)
+                itemtype = self.TypesTree.GetPyData(item)
                 if itemtype == ITEM_PROJECT:
                     self.Controler.SetProjectProperties(name = new_name)
                 elif itemtype == ITEM_DATATYPE:
@@ -1292,12 +1238,12 @@
                                                 self.Controler.ComputePouName(new_name))
                         self.RefreshPageTitles()
                 elif itemtype == ITEM_TRANSITION:
-                    parent = self.ProjectTree.GetItemParent(item)
-                    parent_type = self.ProjectTree.GetPyData(parent)
+                    parent = self.TypesTree.GetItemParent(item)
+                    parent_type = self.TypesTree.GetPyData(parent)
                     while parent_type != ITEM_POU:
-                        parent = self.ProjectTree.GetItemParent(parent)
-                        parent_type = self.ProjectTree.GetPyData(parent)
-                    pou_name = self.ProjectTree.GetItemText(parent)
+                        parent = self.TypesTree.GetItemParent(parent)
+                        parent_type = self.TypesTree.GetPyData(parent)
+                    pou_name = self.TypesTree.GetItemText(parent)
                     if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = "A pou with \"%s\" as name exists!"%new_name
                     elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariables(pou_name) if name != old_name]:
@@ -1308,12 +1254,12 @@
                                                 self.Controler.ComputePouTransitionName(pou_name, new_name))
                         self.RefreshPageTitles()
                 elif itemtype == ITEM_ACTION:
-                    parent = self.ProjectTree.GetItemParent(item)
-                    parent_type = self.ProjectTree.GetPyData(parent)
+                    parent = self.TypesTree.GetItemParent(item)
+                    parent_type = self.TypesTree.GetPyData(parent)
                     while parent_type != ITEM_POU:
-                        parent = self.ProjectTree.GetItemParent(parent)
-                        parent_type = self.ProjectTree.GetPyData(parent)
-                    pou_name = self.ProjectTree.GetItemText(parent)
+                        parent = self.TypesTree.GetItemParent(parent)
+                        parent_type = self.TypesTree.GetPyData(parent)
+                    pou_name = self.TypesTree.GetItemText(parent)
                     if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = "A pou with \"%s\" as name exists!"%new_name
                     elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariables(pou_name) if name != old_name]:
@@ -1343,12 +1289,12 @@
                                                 self.Controler.ComputeConfigurationName(new_name))
                         self.RefreshPageTitles()
                 elif itemtype == ITEM_RESOURCE:
-                    parent = self.ProjectTree.GetItemParent(item)
-                    parent_type = self.ProjectTree.GetPyData(parent)
+                    parent = self.TypesTree.GetItemParent(item)
+                    parent_type = self.TypesTree.GetPyData(parent)
                     while parent_type != ITEM_CONFIGURATION:
-                        parent = self.ProjectTree.GetItemParent(parent)
-                        parent_type = self.ProjectTree.GetPyData(parent)
-                    config_name = self.ProjectTree.GetItemText(parent)
+                        parent = self.TypesTree.GetItemParent(parent)
+                        parent_type = self.TypesTree.GetPyData(parent)
+                    config_name = self.TypesTree.GetItemText(parent)
                     if new_name.upper() in [name.upper() for name in self.Controler.GetProjectConfigNames()]:
                         message = "\"%s\" config already exists!"%new_name
                         abort = True
@@ -1373,23 +1319,23 @@
                     messageDialog.ShowModal()
                     messageDialog.Destroy()
                 item = event.GetItem()
-                wx.CallAfter(self.ProjectTree.EditLabel, item)
+                wx.CallAfter(self.TypesTree.EditLabel, item)
                 event.Veto()
             else:
-                wx.CallAfter(self.RefreshProjectTree)
-                selected = self.GetPageSelection()
+                wx.CallAfter(self.RefreshTypesTree)
+                selected = self.TabsOpened.GetSelection()
                 if selected != -1:
-                    self.GetPage(selected).RefreshView()
+                    self.TabsOpened.GetPage(selected).RefreshView()
                 event.Skip()
     
-    def OnProjectTreeItemActivated(self, event):
+    def OnTypesTreeItemActivated(self, event):
         selected = event.GetItem()
-        if self.ProjectTree.IsExpanded(selected):
-            self.ProjectTree.Collapse(selected)
-        else:
-            self.ProjectTree.Expand(selected)
-        name = self.ProjectTree.GetItemText(selected)
-        data = self.ProjectTree.GetPyData(selected)
+        if self.TypesTree.IsExpanded(selected):
+            self.TypesTree.Collapse(selected)
+        else:
+            self.TypesTree.Expand(selected)
+        name = self.TypesTree.GetItemText(selected)
+        data = self.TypesTree.GetPyData(selected)
         if name == "Properties":
             self.ShowProperties()
         if data == ITEM_DATATYPE:
@@ -1399,20 +1345,20 @@
         elif data == ITEM_CONFIGURATION:
             self.EditProjectElement(data, self.Controler.ComputeConfigurationName(name))
         elif data == ITEM_RESOURCE:
-            item = self.ProjectTree.GetItemParent(selected)
-            item_type = self.ProjectTree.GetPyData(item)
+            item = self.TypesTree.GetItemParent(selected)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_CONFIGURATION:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            config_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            config_name = self.TypesTree.GetItemText(item)
             self.EditProjectElement(data, self.Controler.ComputeConfigurationResourceName(config_name, name))
         elif data in [ITEM_TRANSITION, ITEM_ACTION]:
-            item = self.ProjectTree.GetItemParent(selected)
-            item_type = self.ProjectTree.GetPyData(item)
+            item = self.TypesTree.GetItemParent(selected)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_POU:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            pou_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            pou_name = self.TypesTree.GetItemText(item)
             if data == ITEM_TRANSITION:
                 tagname = self.Controler.ComputePouTransitionName(pou_name, name)
             elif data == ITEM_ACTION:
@@ -1420,9 +1366,9 @@
             self.EditProjectElement(data, tagname)
         event.Skip()
     
-    def ProjectTreeItemSelect(self, select_item):
-        name = self.ProjectTree.GetItemText(select_item)
-        data = self.ProjectTree.GetPyData(select_item)
+    def TypesTreeItemSelect(self, select_item):
+        name = self.TypesTree.GetItemText(select_item)
+        data = self.TypesTree.GetPyData(select_item)
         if data == ITEM_DATATYPE:
             self.EditProjectElement(data, self.Controler.ComputeDataTypeName(name), True)
         elif data == ITEM_POU:
@@ -1430,39 +1376,39 @@
         elif data == ITEM_CONFIGURATION:
             self.EditProjectElement(data, self.Controler.ComputeConfigurationName(name), True)
         elif data == ITEM_RESOURCE:
-            item = self.ProjectTree.GetItemParent(select_item)
-            item_type = self.ProjectTree.GetPyData(item)
+            item = self.TypesTree.GetItemParent(select_item)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_CONFIGURATION:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            config_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            config_name = self.TypesTree.GetItemText(item)
             self.EditProjectElement(data, self.Controler.ComputeConfigurationResourceName(config_name, name), True)
         elif data in [ITEM_TRANSITION, ITEM_ACTION]:
-            item = self.ProjectTree.GetItemParent(select_item)
-            item_type = self.ProjectTree.GetPyData(item)
+            item = self.TypesTree.GetItemParent(select_item)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_POU:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            pou_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            pou_name = self.TypesTree.GetItemText(item)
             if data == ITEM_TRANSITION:
                 tagname = self.Controler.ComputePouTransitionName(pou_name, name)
             elif data == ITEM_ACTION:
                 tagname = self.Controler.ComputePouActionName(pou_name, name)
             self.EditProjectElement(data, tagname, True)
     
-    def OnProjectTreeLeftUp(self, event):
+    def OnTypesTreeLeftUp(self, event):
         if self.SelectedItem is not None:
-            self.ProjectTree.SelectItem(self.SelectedItem)
-            self.ProjectTreeItemSelect(self.SelectedItem)
+            self.TypesTree.SelectItem(self.SelectedItem)
+            self.TypesTreeItemSelect(self.SelectedItem)
             wx.CallAfter(self.ResetSelectedItem)
         event.Skip()
     
-    def OnProjectTreeItemSelected(self, event):
-        self.ProjectTreeItemSelect(event.GetItem())
-        event.Skip()
-    
-    def OnProjectTreeItemChanging(self, event):
-        if self.ProjectTree.GetPyData(event.GetItem()) not in ITEMS_UNEDITABLE and self.SelectedItem is None:
+    def OnTypesTreeItemSelected(self, event):
+        self.TypesTreeItemSelect(event.GetItem())
+        event.Skip()
+    
+    def OnTypesTreeItemChanging(self, event):
+        if self.TypesTree.GetPyData(event.GetItem()) not in ITEMS_UNEDITABLE and self.SelectedItem is None:
             self.SelectedItem = event.GetItem()
             event.Veto()
         else:
@@ -1471,93 +1417,60 @@
     def EditProjectElement(self, elementtype, tagname, onlyopened = False):
         openedidx = self.IsOpened(tagname)
         if openedidx is not None:
-            old_selected = self.GetPageSelection()
+            old_selected = self.TabsOpened.GetSelection()
             if old_selected != openedidx:
                 if old_selected >= 0:
-                    self.GetPage(old_selected).ResetBuffer()
-                self.SetPageSelection(openedidx)
-            self.GetPage(openedidx).RefreshView()
+                    self.TabsOpened.GetPage(old_selected).ResetBuffer()
+                self.TabsOpened.SetSelection(openedidx)
+            self.TabsOpened.GetPage(openedidx).RefreshView()
             self.VariablePanelIndexer.ChangeVariablePanel(tagname)
             self.RefreshPageTitles()
             self.RefreshFileMenu()
             self.RefreshEditMenu()
             self.RefreshToolBar()
         elif not onlyopened:
-            if wx.VERSION >= (2, 8, 0):
-                if elementtype == ITEM_CONFIGURATION:
-                    new_window = MDIConfigurationEditor(self, tagname, self, self.Controler)
-                elif elementtype == ITEM_RESOURCE:
-                    new_window = MDIResourceEditor(self, tagname, self, self.Controler)
-                elif elementtype in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]:
-                    bodytype = self.Controler.GetEditedElementBodyType(tagname)
-                    if bodytype == "FBD":
-                        new_window = MDIViewer(self, tagname, self, self.Controler)
-                        new_window.GetViewer().RefreshScaling(False)
-                    elif bodytype == "LD":
-                        new_window = LD_MDIViewer(self, tagname, self, self.Controler)
-                        new_window.GetViewer().RefreshScaling(False)
-                    elif bodytype == "SFC":
-                        new_window = SFC_MDIViewer(self, tagname, self, self.Controler)
-                        new_window.GetViewer().RefreshScaling(False)
-                    else:
-                        new_window = TextMDIViewer(self, tagname, self, self.Controler)
-                        viewer = new_window.GetViewer()
-                        viewer.SetTextSyntax(elementtype)
-                        if bodytype == "IL":
-                            viewer.SetKeywords(IL_KEYWORDS)
-                        else:
-                            viewer.SetKeywords(ST_KEYWORDS)
-                elif elementtype == ITEM_DATATYPE:
-                    new_window = MDIDataTypeEditor(self, tagname, self, self.Controler)
-                new_window.Bind(wx.EVT_ACTIVATE, self.OnPouSelectedChanged)
-                new_window.Bind(wx.EVT_CLOSE, self.OnPageClose)
-                new_window.Layout()
-            else:
-                if elementtype == ITEM_CONFIGURATION:
-                    new_window = ConfigurationEditor(self.TabsOpened, tagname, self, self.Controler)
-                    self.TabsOpened.AddPage(new_window, "")
-                elif elementtype == ITEM_RESOURCE:
-                    new_window = ResourceEditor(self.TabsOpened, tagname, self, self.Controler)
-                    self.TabsOpened.AddPage(new_window, "")
-                elif elementtype in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]:
-                    bodytype = self.Controler.GetEditedElementBodyType(tagname)
-                    if bodytype == "FBD":
-                        new_window = Viewer(self.TabsOpened, tagname, self, self.Controler)
-                        new_window.RefreshScaling(False)
-                    elif bodytype == "LD":
-                        new_window = LD_Viewer(self.TabsOpened, tagname, self, self.Controler)
-                        new_window.RefreshScaling(False)
-                    elif bodytype == "SFC":
-                        new_window = SFC_Viewer(self.TabsOpened, tagname, self, self.Controler)
-                        new_window.RefreshScaling(False)
-                    else:
-                        new_window = TextViewer(self.TabsOpened, tagname, self, self.Controler)
-                        new_window.SetTextSyntax(elementtype)
-                        if bodytype == "IL":
-                            new_window.SetKeywords(IL_KEYWORDS)
-                        else:
-                            new_window.SetKeywords(ST_KEYWORDS)
-                    self.TabsOpened.AddPage(new_window, "")
-                elif elementtype == ITEM_DATATYPE:
-                    new_window = DataTypeEditor(self.TabsOpened, tagname, self, self.Controler)
-                    self.TabsOpened.AddPage(new_window, "")
             if elementtype == ITEM_CONFIGURATION:
+                new_window = ConfigurationEditor(self.TabsOpened, tagname, self, self.Controler)
+                self.TabsOpened.AddPage(new_window, "")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, "config")
             elif elementtype == ITEM_RESOURCE:
+                new_window = ResourceEditor(self.TabsOpened, tagname, self, self.Controler)
+                self.TabsOpened.AddPage(new_window, "")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, "resource")
             elif elementtype in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]:
+                bodytype = self.Controler.GetEditedElementBodyType(tagname)
+                if bodytype == "FBD":
+                    new_window = Viewer(self.TabsOpened, tagname, self, self.Controler)
+                    new_window.RefreshScaling(False)
+                elif bodytype == "LD":
+                    new_window = LD_Viewer(self.TabsOpened, tagname, self, self.Controler)
+                    new_window.RefreshScaling(False)
+                elif bodytype == "SFC":
+                    new_window = SFC_Viewer(self.TabsOpened, tagname, self, self.Controler)
+                    new_window.RefreshScaling(False)
+                else:
+                    new_window = TextViewer(self.TabsOpened, tagname, self, self.Controler)
+                    new_window.SetTextSyntax(elementtype)
+                    if bodytype == "IL":
+                        new_window.SetKeywords(IL_KEYWORDS)
+                    else:
+                        new_window.SetKeywords(ST_KEYWORDS)
+                self.TabsOpened.AddPage(new_window, "")
                 words = tagname.split("::")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, self.Controler.GetPouType(words[1]))
+            elif elementtype == ITEM_DATATYPE:
+                new_window = DataTypeEditor(self.TabsOpened, tagname, self, self.Controler)
+                self.TabsOpened.AddPage(new_window, "")
             self.VariablePanelIndexer.ChangeVariablePanel(tagname)
             openedidx = self.IsOpened(tagname)
-            old_selected = self.GetPageSelection()
+            old_selected = self.TabsOpened.GetSelection()
             if old_selected != openedidx:
                 if old_selected >= 0:
-                    self.GetPage(old_selected).ResetBuffer()
-            for i in xrange(self.GetPageCount()):
-                window = self.GetPage(i)
+                    self.TabsOpened.GetPage(old_selected).ResetBuffer()
+            for i in xrange(self.TabsOpened.GetPageCount()):
+                window = self.TabsOpened.GetPage(i)
                 if window.GetTagName() == tagname:
-                    self.SetPageSelection(i)
+                    self.TabsOpened.SetSelection(i)
                     window.RefreshView()
                     window.SetFocus()
                     self.RefreshPageTitles()
@@ -1565,13 +1478,13 @@
                     self.RefreshEditMenu()
                     self.RefreshToolBar()
     
-    def OnProjectTreeRightUp(self, event):
+    def OnTypesTreeRightUp(self, event):
         if wx.Platform == '__WXMSW__':
             item = event.GetItem()
         else:
-            item = self.ProjectTree.GetSelection()
-        name = self.ProjectTree.GetItemText(item)
-        type = self.ProjectTree.GetPyData(item)
+            item = self.TypesTree.GetSelection()
+        name = self.TypesTree.GetItemText(item)
+        type = self.TypesTree.GetPyData(item)
         if type == ITEM_POU:
             menu = wx.Menu(title='')
             if self.Controler.GetPouBodyType(name) == "SFC":
@@ -1631,39 +1544,77 @@
                 menu = wx.Menu(title='')
                 new_id = wx.NewId()
                 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text="Add Transition")
-                parent = self.ProjectTree.GetItemParent(item)
-                parent_type = self.ProjectTree.GetPyData(parent)
+                parent = self.TypesTree.GetItemParent(item)
+                parent_type = self.TypesTree.GetPyData(parent)
                 while parent_type != ITEM_POU:
-                    parent = self.ProjectTree.GetItemParent(parent)
-                    parent_type = self.ProjectTree.GetPyData(parent)
-                self.Bind(wx.EVT_MENU, self.GenerateAddTransitionFunction(self.ProjectTree.GetItemText(parent)), id=new_id)
+                    parent = self.TypesTree.GetItemParent(parent)
+                    parent_type = self.TypesTree.GetPyData(parent)
+                self.Bind(wx.EVT_MENU, self.GenerateAddTransitionFunction(self.TypesTree.GetItemText(parent)), id=new_id)
                 self.PopupMenu(menu)
             elif name == "Actions":
                 menu = wx.Menu(title='')
                 new_id = wx.NewId()
                 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text="Add Action")
-                parent = self.ProjectTree.GetItemParent(item)
-                parent_type = self.ProjectTree.GetPyData(parent)
+                parent = self.TypesTree.GetItemParent(item)
+                parent_type = self.TypesTree.GetPyData(parent)
                 while parent_type != ITEM_POU:
-                    parent = self.ProjectTree.GetItemParent(parent)
-                    parent_type = self.ProjectTree.GetPyData(parent)
-                self.Bind(wx.EVT_MENU, self.GenerateAddActionFunction(self.ProjectTree.GetItemText(parent)), id=new_id)
+                    parent = self.TypesTree.GetItemParent(parent)
+                    parent_type = self.TypesTree.GetPyData(parent)
+                self.Bind(wx.EVT_MENU, self.GenerateAddActionFunction(self.TypesTree.GetItemText(parent)), id=new_id)
                 self.PopupMenu(menu)
             elif name == "Resources":
                 menu = wx.Menu(title='')
                 new_id = wx.NewId()
                 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text="Add Resource")
-                parent = self.ProjectTree.GetItemParent(item)
-                parent_type = self.ProjectTree.GetPyData(parent)
+                parent = self.TypesTree.GetItemParent(item)
+                parent_type = self.TypesTree.GetPyData(parent)
                 while parent_type != ITEM_CONFIGURATION:
-                    parent = self.ProjectTree.GetItemParent(parent)
-                    parent_type = self.ProjectTree.GetPyData(parent)
-                self.Bind(wx.EVT_MENU, self.GenerateAddResourceFunction(self.ProjectTree.GetItemText(parent)), id=new_id)
+                    parent = self.TypesTree.GetItemParent(parent)
+                    parent_type = self.TypesTree.GetPyData(parent)
+                self.Bind(wx.EVT_MENU, self.GenerateAddResourceFunction(self.TypesTree.GetItemText(parent)), id=new_id)
                 self.PopupMenu(menu)
         event.Skip()
 
 
 #-------------------------------------------------------------------------------
+#                         Topology Tree Management Functions
+#-------------------------------------------------------------------------------
+
+    def RefreshInstancesTree(self):
+        infos = self.Controler.GetProjectTopology()
+        root = self.InstancesTree.GetRootItem()
+        if not root.IsOk():
+            root = self.InstancesTree.AddRoot(infos["name"])
+        self.GenerateInstancesTreeBranch(root, infos)
+        self.InstancesTree.Expand(self.InstancesTree.GetRootItem())
+
+    def GenerateInstancesTreeBranch(self, root, infos):
+        to_delete = []
+        if infos.get("elmt_type", None) is not None:
+            self.InstancesTree.SetItemText(root, "%s(%s)"%(infos["name"], infos["elmt_type"]))
+        else:
+            self.InstancesTree.SetItemText(root, infos["name"])
+        self.InstancesTree.SetPyData(root, infos["type"])
+        self.InstancesTree.SetItemImage(root, self.InstancesTreeImageDict[infos["type"]])      
+            
+        if wx.VERSION >= (2, 6, 0):
+            item, root_cookie = self.InstancesTree.GetFirstChild(root)
+        else:
+            item, root_cookie = self.InstancesTree.GetFirstChild(root, 0)
+        for values in infos["values"]:
+            if not item.IsOk():
+                item = self.InstancesTree.AppendItem(root, "")
+                if wx.Platform != '__WXMSW__':
+                    item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
+            self.GenerateInstancesTreeBranch(item, values)
+            item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
+        while item.IsOk():
+            to_delete.append(item)
+            item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
+        for item in to_delete:
+            self.InstancesTree.Delete(item)
+
+#-------------------------------------------------------------------------------
 #                          ToolBar Management Functions
 #-------------------------------------------------------------------------------
 
@@ -1686,9 +1637,9 @@
                     self.AUIManager.Update()
 
     def RefreshToolBar(self):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            language = self.Controler.GetEditedElementBodyType(self.GetPage(selected).GetTagName())
+            language = self.Controler.GetEditedElementBodyType(self.TabsOpened.GetPage(selected).GetTagName())
         else:
             language = None
         if language is not None and language != self.CurrentLanguage:
@@ -1723,9 +1674,9 @@
 #-------------------------------------------------------------------------------
 
     def ResetCurrentMode(self):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            window = self.GetPage(selected)
+            window = self.TabsOpened.GetPage(selected)
             window.SetMode(MODE_SELECTION)
         if wx.VERSION < (2, 8, 0):
             ToolBar = self.ToolBar
@@ -1742,132 +1693,132 @@
         tool.SetToggle(False)
 
     def OnSelectionTool(self, event):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_SELECTION)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_SELECTION)
         event.Skip()
     
     def OnCommentTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCOMMENT)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_COMMENT)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_COMMENT)
         event.Skip()
     
     def OnVariableTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARVARIABLE)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_VARIABLE)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_VARIABLE)
         event.Skip()
     
     def OnBlockTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARBLOCK)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_BLOCK)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_BLOCK)
         event.Skip()
         
     def OnConnectionTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCONNECTION)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_CONNECTION)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_CONNECTION)
         event.Skip()
 
     def OnPowerRailTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARPOWERRAIL)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_POWERRAIL)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_POWERRAIL)
         event.Skip()
 
     def OnRungTool(self, event):
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).AddLadderRung()
+            self.TabsOpened.GetPage(selected).AddLadderRung()
         event.Skip()
     
     def OnCoilTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCOIL)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_COIL)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_COIL)
         event.Skip()
     
     def OnContactTool(self, event):
         if self.DrawingMode == FREEDRAWING_MODE:
             self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARCONTACT)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
             if self.DrawingMode == FREEDRAWING_MODE:
-                self.GetPage(selected).SetMode(MODE_CONTACT)
+                self.TabsOpened.GetPage(selected).SetMode(MODE_CONTACT)
             else:
-                self.GetPage(selected).AddLadderContact()
+                self.TabsOpened.GetPage(selected).AddLadderContact()
         event.Skip()
     
     def OnBranchTool(self, event): 
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).AddLadderBranch()
+            self.TabsOpened.GetPage(selected).AddLadderBranch()
         event.Skip()    
     
     def OnInitialStepTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARINITIALSTEP)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_INITIALSTEP)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_INITIALSTEP)
         event.Skip()
     
     def OnStepTool(self, event):
         if self.GetDrawingMode() == FREEDRAWING_MODE:
             self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARSTEP)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
             if self.GetDrawingMode() == FREEDRAWING_MODE:
-                self.GetPage(selected).SetMode(MODE_STEP)
+                self.TabsOpened.GetPage(selected).SetMode(MODE_STEP)
             else:
-                self.GetPage(selected).AddStep()
+                self.TabsOpened.GetPage(selected).AddStep()
         event.Skip()
 
     def OnActionBlockTool(self, event):
         if self.GetDrawingMode() == FREEDRAWING_MODE:
             self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARACTIONBLOCK)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
             if self.GetDrawingMode() == FREEDRAWING_MODE:
-                self.GetPage(selected).SetMode(MODE_ACTION)
+                self.TabsOpened.GetPage(selected).SetMode(MODE_ACTION)
             else:
-                self.GetPage(selected).AddStepAction()
+                self.TabsOpened.GetPage(selected).AddStepAction()
         event.Skip()
 
     def OnTransitionTool(self, event):
         self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARTRANSITION)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
-            self.GetPage(selected).SetMode(MODE_TRANSITION)
+            self.TabsOpened.GetPage(selected).SetMode(MODE_TRANSITION)
         event.Skip()
 
     def OnDivergenceTool(self, event):
         if self.GetDrawingMode() == FREEDRAWING_MODE:
             self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARDIVERGENCE)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
             if self.GetDrawingMode() == FREEDRAWING_MODE:
-                self.GetPage(selected).SetMode(MODE_DIVERGENCE)
+                self.TabsOpened.GetPage(selected).SetMode(MODE_DIVERGENCE)
             else:
-                self.GetPage(selected).AddDivergence()
+                self.TabsOpened.GetPage(selected).AddDivergence()
         event.Skip()
     
     def OnJumpTool(self, event):
         if self.GetDrawingMode() == FREEDRAWING_MODE:
             self.ResetToolToggle(ID_PLCOPENEDITORTOOLBARJUMP)
-        selected = self.GetPageSelection()
+        selected = self.TabsOpened.GetSelection()
         if selected != -1:
             if self.GetDrawingMode() == FREEDRAWING_MODE:
-                self.GetPage(selected).SetMode(MODE_JUMP)
+                self.TabsOpened.GetPage(selected).SetMode(MODE_JUMP)
             else:
-                self.GetPage(selected).AddJump()
+                self.TabsOpened.GetPage(selected).AddJump()
         event.Skip()
 
 
@@ -1882,7 +1833,7 @@
             self.Controler.ProjectAddDataType(dialog.GetValue())
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         dialog.Destroy()
         event.Skip()
 
@@ -1896,7 +1847,7 @@
                 self.Controler.ProjectAddPou(values["pouName"], values["pouType"], values["language"])
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
             dialog.Destroy()
             event.Skip()
         return OnAddPouMenu
@@ -1911,7 +1862,7 @@
                 self.Controler.ProjectAddPouTransition(pou_name, values["transitionName"], values["language"])
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
             dialog.Destroy()
             event.Skip()
         return OnAddTransitionMenu
@@ -1926,7 +1877,7 @@
                 self.Controler.ProjectAddPouAction(pou_name, values["actionName"], values["language"])
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
             dialog.Destroy()
             event.Skip()
         return OnAddActionMenu
@@ -1940,7 +1891,7 @@
             self.Controler.ProjectAddConfiguration(value)
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         dialog.Destroy()
         event.Skip()
 
@@ -1954,7 +1905,7 @@
                 self.Controler.ProjectAddConfigurationResource(config_name, value)
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
             dialog.Destroy()
             event.Skip()
         return OnAddResourceMenu
@@ -1965,18 +1916,18 @@
 #-------------------------------------------------------------------------------
 
     def OnRemoveDataTypeMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_DATATYPE:
-            name = self.ProjectTree.GetItemText(selected)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_DATATYPE:
+            name = self.TypesTree.GetItemText(selected)
             if not self.Controler.DataTypeIsUsed(name):
                 self.Controler.ProjectRemoveDataType(name)
                 tagname = self.Controler.ComputeDataTypeName(name)
                 idx = self.IsOpened(tagname)
                 if idx is not None:
-                    self.DeletePage(idx)
+                    self.TabsOpened.DeletePage(idx)
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
                 self.RefreshToolBar()
             else:
                 message = wx.MessageDialog(self, "%s is used by one or more POUs. It can't be removed!"%selected, "Error", wx.OK|wx.ICON_ERROR)
@@ -1985,19 +1936,19 @@
         event.Skip()
 
     def OnRemovePouMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_POU: 
-            name = self.ProjectTree.GetItemText(selected)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_POU: 
+            name = self.TypesTree.GetItemText(selected)
             if not self.Controler.PouIsUsed(name):
                 self.Controler.ProjectRemovePou(name)
                 tagname = self.Controler.ComputePouName(name)
                 idx = self.IsOpened(tagname)
                 if idx is not None:
                     self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                    self.DeletePage(idx)
+                    self.TabsOpened.DeletePage(idx)
                 self.RefreshTitle()
                 self.RefreshEditMenu()
-                self.RefreshProjectTree()
+                self.RefreshTypesTree()
                 self.RefreshToolBar()
             else:
                 message = wx.MessageDialog(self, "%s is used by one or more POUs. It can't be removed!"%selected, "Error", wx.OK|wx.ICON_ERROR)
@@ -2006,81 +1957,81 @@
         event.Skip()
 
     def OnRemoveConfigurationMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_CONFIGURATION: 
-            name = self.ProjectTree.GetItemText(selected)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_CONFIGURATION: 
+            name = self.TypesTree.GetItemText(selected)
             self.Controler.ProjectRemoveConfiguration(name)
             tagname = self.Controler.ComputeConfigurationName(name)
             idx = self.IsOpened(tagname)
             if idx is not None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
+                self.TabsOpened.DeletePage(idx)
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         event.Skip()
 
     def OnRemoveTransitionMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_TRANSITION: 
-            transition = self.ProjectTree.GetItemText(selected)
-            item = self.ProjectTree.GetItemParent(selected)
-            item_type = self.ProjectTree.GetPyData(item)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_TRANSITION: 
+            transition = self.TypesTree.GetItemText(selected)
+            item = self.TypesTree.GetItemParent(selected)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_POU:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            pou_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            pou_name = self.TypesTree.GetItemText(item)
             self.Controler.ProjectRemovePouTransition(pou_name, transition)
             tagname = self.Controler.ComputePouTransitionName(pou_name, transition)
             idx = self.IsOpened(tagname)
             if idx is not None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
+                self.TabsOpened.DeletePage(idx)
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         event.Skip()
 
     def OnRemoveActionMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_ACTION: 
-            action = self.ProjectTree.GetItemText(selected)
-            item = self.ProjectTree.GetItemParent(selected)
-            item_type = self.ProjectTree.GetPyData(item)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_ACTION: 
+            action = self.TypesTree.GetItemText(selected)
+            item = self.TypesTree.GetItemParent(selected)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_POU:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            pou_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            pou_name = self.TypesTree.GetItemText(item)
             self.Controler.ProjectRemovePouAction(pou_name, action)
             tagname = self.Controler.ComputePouActionName(pou_name, action)
             idx = self.IsOpened(tagname)
             if idx is not None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
+                self.TabsOpened.DeletePage(idx)
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         event.Skip()
 
     def OnRemoveResourceMenu(self, event):
-        selected = self.ProjectTree.GetSelection()
-        if self.ProjectTree.GetPyData(selected) == ITEM_RESOURCE:
-            resource = self.ProjectTree.GetItemText(selected)
-            item = self.ProjectTree.GetItemParent(selected)
-            item_type = self.ProjectTree.GetPyData(item)
+        selected = self.TypesTree.GetSelection()
+        if self.TypesTree.GetPyData(selected) == ITEM_RESOURCE:
+            resource = self.TypesTree.GetItemText(selected)
+            item = self.TypesTree.GetItemParent(selected)
+            item_type = self.TypesTree.GetPyData(item)
             while item_type != ITEM_CONFIGURATION:
-                item = self.ProjectTree.GetItemParent(item)
-                item_type = self.ProjectTree.GetPyData(item)
-            config_name = self.ProjectTree.GetItemText(item)
+                item = self.TypesTree.GetItemParent(item)
+                item_type = self.TypesTree.GetPyData(item)
+            config_name = self.TypesTree.GetItemText(item)
             self.Controler.ProjectRemoveConfigurationResource(config_name, resource)
             tagname = self.Controler.ComputeConfigurationResourceName(config_name, selected)
             idx = self.IsOpened(tagname)
             if idx is not None:
                 self.VariablePanelIndexer.RemoveVariablePanel(tagname)
-                self.DeletePage(idx)
+                self.TabsOpened.DeletePage(idx)
             self.RefreshTitle()
             self.RefreshEditMenu()
-            self.RefreshProjectTree()
+            self.RefreshTypesTree()
         event.Skip()
     
     def OnPLCOpenEditorMenu(self, event):
@@ -2101,28 +2052,27 @@
 #-------------------------------------------------------------------------------
 
     def ShowError(self, infos, start, end):
-        print infos
         self.EditProjectElement(self.Controler.GetElementType(infos[0]), infos[0])
-        self.SelectProjectTreeItem(infos[0])
+        self.SelectTypesTreeItem(infos[0])
         if infos[1] == "name":
             self.Errors.append(infos[0])
-            self.RefreshProjectTree()
-            self.ProjectTree.Unselect()
+            self.RefreshTypesTree()
+            self.TypesTree.Unselect()
         elif infos[1] == "variable":
             self.VariablePanelIndexer.AddVariableError(infos)
         else:
-            selected = self.GetPageSelection()
+            selected = self.TabsOpened.GetSelection()
             if selected != -1:
-                viewer = self.GetPage(selected)
+                viewer = self.TabsOpened.GetPage(selected)
                 viewer.AddShownError(infos[1:], start, end)
                 viewer.RefreshView()
     
     def ClearErrors(self):
         self.Errors = []
-        self.RefreshProjectTree()
+        self.RefreshTypesTree()
         self.VariablePanelIndexer.ClearErrors()
-        for i in xrange(self.GetPageCount()):
-            viewer = self.GetPage(i)
+        for i in xrange(self.TabsOpened.GetPageCount()):
+            viewer = self.TabsOpened.GetPage(i)
             viewer.ClearErrors()
         
 current_num = 0
--- a/RessourceEditor.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/RessourceEditor.py	Fri Aug 22 13:49:22 2008 +0200
@@ -25,38 +25,6 @@
 import wx
 import wx.grid
 
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class MDIConfigurationEditor(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = ConfigurationEditor(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
-
-    class MDIResourceEditor(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = ResourceEditor(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
 
 #-------------------------------------------------------------------------------
 #                          Configuration Editor class
--- a/SFCViewer.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/SFCViewer.py	Fri Aug 22 13:49:22 2008 +0200
@@ -24,26 +24,8 @@
 
 import wx
 from types import *
-
 from Viewer import *
 
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class SFC_MDIViewer(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = SFC_Viewer(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
 
 class SFC_Viewer(Viewer):
     
--- a/TextViewer.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/TextViewer.py	Fri Aug 22 13:49:22 2008 +0200
@@ -89,23 +89,6 @@
     else:
         return None
 
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class TextMDIViewer(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = TextViewer(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
 
 class TextViewer(wx.stc.StyledTextCtrl):
     
--- a/Viewer.py	Thu Aug 21 15:44:42 2008 +0200
+++ b/Viewer.py	Fri Aug 22 13:49:22 2008 +0200
@@ -168,24 +168,7 @@
             message = wx.MessageDialog(self.ParentWindow, message, "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
-   
-if wx.VERSION >= (2, 8, 0):
-    import wx.aui
-
-    class MDIViewer(wx.aui.AuiMDIChildFrame):
-        def __init__(self, parent, tagname, window, controler):
-            wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, title = "")
-            
-            sizer = wx.BoxSizer(wx.HORIZONTAL)
-            
-            self.Viewer = Viewer(self, tagname, window, controler)
-            
-            sizer.AddWindow(self.Viewer, 1, border=0, flag=wx.GROW)
-            
-            self.SetSizer(sizer)
-        
-        def GetViewer(self):
-            return self.Viewer
+
 
 """
 Class that implements a Viewer based on a wx.ScrolledWindow for drawing and 
@@ -916,13 +899,13 @@
                 self.ContextualMenu.Check(ID_VIEWERCONTEXTUALMENUITEMS0, True)
         self.PopupMenu(self.ContextualMenu)
     
-    def PopupWireMenu(self):
+    def PopupWireMenu(self, delete=True):
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS0, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS1, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS2, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS3, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS5, True)
-        self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS6, True)
+        self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS6, delete)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS8, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS9, False)
         self.ContextualMenu.Enable(ID_VIEWERCONTEXTUALMENUITEMS14, False)