-
-## def ProcessEvent(self, event):
-## stcControl = self.GetControl()
-## if not isinstance(stcControl, wx.stc.StyledTextCtrl):
-## return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
-## id = event.GetId()
-## if id == wx.ID_CUT:
-## stcControl.Cut()
-## return True
-## elif id == wx.ID_COPY:
-## stcControl.Copy()
-## return True
-## elif id == wx.ID_PASTE:
-## stcControl.Paste()
-## return True
-## elif id == wx.ID_CLEAR:
-## stcControl.Clear()
-## return True
-## elif id == wx.ID_SELECTALL:
-## stcControl.SetSelection(0, -1)
-## return True
-##
-##
-## def ProcessUpdateUIEvent(self, event):
-## stcControl = self.GetControl()
-## if not isinstance(stcControl, wx.stc.StyledTextCtrl):
-## return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
-## id = event.GetId()
-## if id == wx.ID_CUT:
-## event.Enable(stcControl.CanCut())
-## return True
-## elif id == wx.ID_COPY:
-## event.Enable(stcControl.CanCopy())
-## return True
-## elif id == wx.ID_PASTE:
-## event.Enable(stcControl.CanPaste())
-## return True
-## elif id == wx.ID_CLEAR:
-## event.Enable(True) # wxBug: should be stcControl.CanCut()) but disabling clear item means del key doesn't work in control as expected
-## return True
-## elif id == wx.ID_SELECTALL:
-## event.Enable(stcControl.GetTextLength() > 0)
-## return True
+ def GetDocument(self):
+ return None
+
+ def OnFocus(self, event):
+ wx.GetApp().GetDocumentManager().ActivateView(self)
+ event.Skip()
+
+ def ProcessEvent(self, event):
+ stcControl = self.GetControl()
+ if not isinstance(stcControl, wx.stc.StyledTextCtrl):
+ return wx.lib.docview.View.ProcessEvent(self, event)
+ id = event.GetId()
+ if id == wx.ID_COPY:
+ stcControl.Copy()
+ return True
+ elif id == wx.ID_CLEAR:
+ stcControl.Clear()
+ return True
+ elif id == wx.ID_SELECTALL:
+ stcControl.SetSelection(0, -1)
+ return True
+
+
+ def ProcessUpdateUIEvent(self, event):
+ stcControl = self.GetControl()
+ if not isinstance(stcControl, wx.stc.StyledTextCtrl):
+ return wx.lib.docview.View.ProcessUpdateUIEvent(self, event)
+ id = event.GetId()
+ if id == wx.ID_CUT or id == wx.ID_PASTE:
+ # I don't think cut or paste makes sense from a message/log window.
+ event.Enable(False)
+ return True
+ elif id == wx.ID_COPY:
+ hasSelection = (stcControl.GetSelectionStart() != stcControl.GetSelectionEnd())
+ event.Enable(hasSelection)
+ return True
+ elif id == wx.ID_CLEAR:
+ event.Enable(True) # wxBug: should be stcControl.CanCut()) but disabling clear item means del key doesn't work in control as expected
+ return True
+ elif id == wx.ID_SELECTALL:
+ event.Enable(stcControl.GetTextLength() > 0)
+ return True