equal
deleted
inserted
replaced
205 def __init__(self, parent): |
205 def __init__(self, parent): |
206 wx.TextDropTarget.__init__(self) |
206 wx.TextDropTarget.__init__(self) |
207 self.ParentWindow = parent |
207 self.ParentWindow = parent |
208 |
208 |
209 def OnDropText(self, x, y, data): |
209 def OnDropText(self, x, y, data): |
|
210 self.ParentWindow.Select() |
210 tagname = self.ParentWindow.GetTagName() |
211 tagname = self.ParentWindow.GetTagName() |
211 pou_name, pou_type = self.ParentWindow.Controler.GetEditedElementType(tagname, self.ParentWindow.Debug) |
212 pou_name, pou_type = self.ParentWindow.Controler.GetEditedElementType(tagname, self.ParentWindow.Debug) |
212 x, y = self.ParentWindow.CalcUnscrolledPosition(x, y) |
213 x, y = self.ParentWindow.CalcUnscrolledPosition(x, y) |
213 x = int(x / self.ParentWindow.ViewScale[0]) |
214 x = int(x / self.ParentWindow.ViewScale[0]) |
214 y = int(y / self.ParentWindow.ViewScale[1]) |
215 y = int(y / self.ParentWindow.ViewScale[1]) |
270 self.ParentWindow.Refresh(False) |
271 self.ParentWindow.Refresh(False) |
271 elif values[1] == "location": |
272 elif values[1] == "location": |
272 if pou_type == "program": |
273 if pou_type == "program": |
273 location = values[0] |
274 location = values[0] |
274 if not location.startswith("%"): |
275 if not location.startswith("%"): |
275 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
276 dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow, |
276 _("Select a variable class:"), _("Variable class"), |
277 _("Select a variable class:"), _("Variable class"), |
277 ["Input", "Output", "Memory"], |
278 ["Input", "Output", "Memory"], |
278 wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
279 wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
279 if dialog.ShowModal() == wx.ID_OK: |
280 if dialog.ShowModal() == wx.ID_OK: |
280 selected = dialog.GetSelection() |
281 selected = dialog.GetSelection() |
628 self.Editor.Bind(wx.EVT_SCROLLWIN, self.OnScrollWindow) |
629 self.Editor.Bind(wx.EVT_SCROLLWIN, self.OnScrollWindow) |
629 self.Editor.Bind(wx.EVT_SCROLLWIN_THUMBRELEASE, self.OnScrollStop) |
630 self.Editor.Bind(wx.EVT_SCROLLWIN_THUMBRELEASE, self.OnScrollStop) |
630 self.Editor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheelWindow) |
631 self.Editor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheelWindow) |
631 self.Editor.Bind(wx.EVT_SIZE, self.OnMoveWindow) |
632 self.Editor.Bind(wx.EVT_SIZE, self.OnMoveWindow) |
632 self.Editor.Bind(wx.EVT_MOUSE_EVENTS, self.OnViewerMouseEvent) |
633 self.Editor.Bind(wx.EVT_MOUSE_EVENTS, self.OnViewerMouseEvent) |
633 |
634 |
|
635 # Destructor |
634 def __del__(self): |
636 def __del__(self): |
635 DebugViewer.__del__(self) |
637 DebugViewer.__del__(self) |
|
638 self.Flush() |
|
639 self.ResetView() |
636 self.RefreshHighlightsTimer.Stop() |
640 self.RefreshHighlightsTimer.Stop() |
637 |
641 |
638 def SetCurrentCursor(self, cursor): |
642 def SetCurrentCursor(self, cursor): |
639 if self.Mode != MODE_MOTION: |
643 if self.Mode != MODE_MOTION: |
640 global CURSORS |
644 global CURSORS |
669 |
673 |
670 # Returns a new id |
674 # Returns a new id |
671 def GetNewId(self): |
675 def GetNewId(self): |
672 self.current_id += 1 |
676 self.current_id += 1 |
673 return self.current_id |
677 return self.current_id |
674 |
678 |
675 # Destructor |
|
676 def __del__(self): |
|
677 DebugViewer.__del__(self) |
|
678 self.Flush() |
|
679 self.ResetView() |
|
680 |
|
681 def SetScale(self, scale_number, refresh=True, mouse_event=None): |
679 def SetScale(self, scale_number, refresh=True, mouse_event=None): |
682 new_scale = max(0, min(scale_number, len(ZOOM_FACTORS) - 1)) |
680 new_scale = max(0, min(scale_number, len(ZOOM_FACTORS) - 1)) |
683 if self.CurrentScale != new_scale: |
681 if self.CurrentScale != new_scale: |
684 if refresh: |
682 if refresh: |
685 dc = self.GetLogicalDC() |
683 dc = self.GetLogicalDC() |