Пример #1
0
    def __init__(self, presenter):
        self.presenter = presenter
        self.eventloop = self.presenter.eventloop
        self.app = presenter.app
        self.doc = self.presenter.model
        self.renderer = PDRenderer(self)
        self.dc = self.app.mw.mdi.canvas
        self.timer = self.dc.timer
        Painter.__init__(self)
        self.hit_surface = HitSurface(self)
        self.zoom_stack = []

        self.ctrls = self.init_controllers()
        # ----- Application eventloop bindings
        self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.doc_modified)
        self.eventloop.connect(self.eventloop.PAGE_CHANGED, self.doc_modified)
        self.eventloop.connect(self.eventloop.SELECTION_CHANGED,
                               self.selection_redraw)
Пример #2
0
    def __init__(self, presenter, parent):
        self.presenter = presenter
        self.eventloop = self.presenter.eventloop
        self.app = presenter.app
        self.doc = self.presenter.model
        self.renderer = PDRenderer(self)
        style = wx.FULL_REPAINT_ON_RESIZE | wx.WANTS_CHARS
        wx.Panel.__init__(self, parent, style=style)
        self.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.hit_surface = HitSurface(self)
        self.zoom_stack = []

        self.ctx_menu = ContextMenu(self.app, self)

        self.timer = CanvasTimer(self)
        self.Bind(wx.EVT_TIMER, self._on_timer)

        self.ctrls = self.init_controllers()
        self.Bind(wx.EVT_PAINT, self.on_paint, self)
        self.Bind(wx.EVT_ENTER_WINDOW, self.mouse_enter, self)
        # ----- Mouse binding
        self.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Bind(wx.EVT_LEFT_UP, self.mouse_left_up)
        self.Bind(wx.EVT_LEFT_DCLICK, self.mouse_left_dclick)
        self.Bind(wx.EVT_RIGHT_DOWN, self.mouse_right_down)
        self.Bind(wx.EVT_RIGHT_UP, self.mouse_right_up)
        self.Bind(wx.EVT_MIDDLE_DOWN, self.mouse_middle_down)
        self.Bind(wx.EVT_MIDDLE_UP, self.mouse_middle_up)
        self.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Bind(wx.EVT_MOTION, self.mouse_move)
        self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.capture_lost)
        # ----- Keyboard binding
        self.kbproc = Kbd_Processor(self)
        self.Bind(wx.EVT_KEY_DOWN, self.kbproc.on_key_down)
        self.Bind(wx.EVT_CHAR, self.kbproc.on_char)
        # 		self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
        # ----- Application eventloop bindings
        self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.doc_modified)
        self.eventloop.connect(self.eventloop.PAGE_CHANGED, self.doc_modified)
        self.eventloop.connect(self.eventloop.SELECTION_CHANGED,
                               self.selection_redraw)