objdictgen/subindextable.py
changeset 485 24b506ea314b
parent 453 c74a73474cce
child 491 2ad3dedf6c6a
--- a/objdictgen/subindextable.py	Mon Jun 23 17:55:11 2008 +0200
+++ b/objdictgen/subindextable.py	Tue Jun 24 19:05:41 2008 +0200
@@ -449,7 +449,23 @@
     def OnSubindexGridCellLeftClick(self, event):
         if not self.ParentWindow.ModeSolo:
             col = event.GetCol()
-            if not self.Editable and col == 0:
+            if self.Editable and col == 0:
+                selected = self.IndexList.GetSelection()
+                if selected != wx.NOT_FOUND:
+                    index = self.ListIndex[selected]
+                    subindex = event.GetRow()
+                    entry_infos = self.Manager.GetEntryInfos(index)
+                    if not entry_infos["struct"] & OD_MultipleSubindexes or subindex != 0:
+                        subentry_infos = self.Manager.GetSubentryInfos(index, subindex)
+                        typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"])
+                        if typeinfos:
+                            bus_id = '.'.join(map(str, self.ParentWindow.GetBusId()))
+                            size = typeinfos["size"]
+                            data = wx.TextDataObject(str(("%s%s.%d.%d"%(SizeConversion[size], bus_id, index, subindex), "location")))
+                            dragSource = wx.DropSource(self.SubindexGrid)
+                            dragSource.SetData(data)
+                            dragSource.DoDragDrop()
+            elif col == 0:
                 selected = self.IndexList.GetSelection()
                 if selected != wx.NOT_FOUND:
                     index = self.ListIndex[selected]