mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
Merge pull request #2175 from DietmarSchwertberger/gridmovers_scrolled
gridmovers: don't cache value from GetScrollPixelsPerUnit
This commit is contained in:
@@ -111,7 +111,6 @@ class ColDragWindow(wx.Window):
|
|||||||
wx.Window.__init__(self,parent,-1, style=wx.SIMPLE_BORDER)
|
wx.Window.__init__(self,parent,-1, style=wx.SIMPLE_BORDER)
|
||||||
self.image = image
|
self.image = image
|
||||||
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
|
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
|
||||||
self.ux = parent.GetScrollPixelsPerUnit()[0]
|
|
||||||
self.moveColumn = dragCol
|
self.moveColumn = dragCol
|
||||||
|
|
||||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||||
@@ -128,7 +127,8 @@ class ColDragWindow(wx.Window):
|
|||||||
|
|
||||||
def _GetInsertionInfo(self):
|
def _GetInsertionInfo(self):
|
||||||
parent = self.GetParent()
|
parent = self.GetParent()
|
||||||
sx = parent.GetViewStart()[0] * self.ux
|
ux = parent.GetScrollPixelsPerUnit()[0]
|
||||||
|
sx = parent.GetViewStart()[0] * ux
|
||||||
sx -= parent.GetRowLabelSize()
|
sx -= parent.GetRowLabelSize()
|
||||||
x = self.GetPosition()[0]
|
x = self.GetPosition()[0]
|
||||||
w = self.GetSize()[0]
|
w = self.GetSize()[0]
|
||||||
@@ -174,7 +174,6 @@ class RowDragWindow(wx.Window):
|
|||||||
wx.Window.__init__(self,parent,-1, style=wx.SIMPLE_BORDER)
|
wx.Window.__init__(self,parent,-1, style=wx.SIMPLE_BORDER)
|
||||||
self.image = image
|
self.image = image
|
||||||
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
|
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
|
||||||
self.uy = parent.GetScrollPixelsPerUnit()[1]
|
|
||||||
self.moveRow = dragRow
|
self.moveRow = dragRow
|
||||||
|
|
||||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||||
@@ -191,7 +190,8 @@ class RowDragWindow(wx.Window):
|
|||||||
|
|
||||||
def _GetInsertionInfo(self):
|
def _GetInsertionInfo(self):
|
||||||
parent = self.GetParent()
|
parent = self.GetParent()
|
||||||
sy = parent.GetViewStart()[1] * self.uy
|
uy = parent.GetScrollPixelsPerUnit()[1]
|
||||||
|
sy = parent.GetViewStart()[1] * uy
|
||||||
sy -= parent.GetColLabelSize()
|
sy -= parent.GetColLabelSize()
|
||||||
y = self.GetPosition()[1]
|
y = self.GetPosition()[1]
|
||||||
h = self.GetSize()[1]
|
h = self.GetSize()[1]
|
||||||
@@ -239,7 +239,6 @@ class GridColMover(wx.EvtHandler):
|
|||||||
self.lwin = grid.GetGridColLabelWindow()
|
self.lwin = grid.GetGridColLabelWindow()
|
||||||
self.lwin.PushEventHandler(self)
|
self.lwin.PushEventHandler(self)
|
||||||
self.colWin = None
|
self.colWin = None
|
||||||
self.ux = self.grid.GetScrollPixelsPerUnit()[0]
|
|
||||||
self.startX = -10
|
self.startX = -10
|
||||||
self.cellX = 0
|
self.cellX = 0
|
||||||
self.didMove = False
|
self.didMove = False
|
||||||
@@ -265,9 +264,10 @@ class GridColMover(wx.EvtHandler):
|
|||||||
and abs(evt.X - self.lastX) >= 3:
|
and abs(evt.X - self.lastX) >= 3:
|
||||||
self.lastX = evt.X
|
self.lastX = evt.X
|
||||||
self.didMove = True
|
self.didMove = True
|
||||||
|
ux = self.grid.GetScrollPixelsPerUnit()[0]
|
||||||
sx,y = self.grid.GetViewStart()
|
sx,y = self.grid.GetViewStart()
|
||||||
w,h = self.lwin.GetClientSize()
|
w,h = self.lwin.GetClientSize()
|
||||||
x = sx * self.ux
|
x = sx * ux
|
||||||
|
|
||||||
if (evt.X + x) < x:
|
if (evt.X + x) < x:
|
||||||
x = evt.X + x
|
x = evt.X + x
|
||||||
@@ -275,7 +275,7 @@ class GridColMover(wx.EvtHandler):
|
|||||||
x += evt.X - w
|
x += evt.X - w
|
||||||
|
|
||||||
if x < 1: x = 0
|
if x < 1: x = 0
|
||||||
else: x /= self.ux
|
else: x /= ux
|
||||||
|
|
||||||
if x != sx:
|
if x != sx:
|
||||||
if wx.Platform == '__WXMSW__':
|
if wx.Platform == '__WXMSW__':
|
||||||
@@ -303,7 +303,8 @@ class GridColMover(wx.EvtHandler):
|
|||||||
def OnPress(self,evt):
|
def OnPress(self,evt):
|
||||||
self.startX = self.lastX = evt.X
|
self.startX = self.lastX = evt.X
|
||||||
_rlSize = self.grid.GetRowLabelSize()
|
_rlSize = self.grid.GetRowLabelSize()
|
||||||
sx = self.grid.GetViewStart()[0] * self.ux
|
ux = self.grid.GetScrollPixelsPerUnit()[0]
|
||||||
|
sx = self.grid.GetViewStart()[0] * ux
|
||||||
sx -= _rlSize
|
sx -= _rlSize
|
||||||
px,py = self.lwin.ClientToScreen(evt.X,evt.Y)
|
px,py = self.lwin.ClientToScreen(evt.X,evt.Y)
|
||||||
px,py = self.grid.ScreenToClient(px,py)
|
px,py = self.grid.ScreenToClient(px,py)
|
||||||
@@ -339,7 +340,8 @@ class GridColMover(wx.EvtHandler):
|
|||||||
if not self.didMove:
|
if not self.didMove:
|
||||||
px = self.lwin.ClientToScreen(self.startX,0)[0]
|
px = self.lwin.ClientToScreen(self.startX,0)[0]
|
||||||
px = self.grid.ScreenToClient(px,0)[0]
|
px = self.grid.ScreenToClient(px,0)[0]
|
||||||
sx = self.grid.GetViewStart()[0] * self.ux
|
ux = self.grid.GetScrollPixelsPerUnit()[0]
|
||||||
|
sx = self.grid.GetViewStart()[0] * ux
|
||||||
sx -= self.grid.GetRowLabelSize()
|
sx -= self.grid.GetRowLabelSize()
|
||||||
col = self.grid.XToCol(px+sx)
|
col = self.grid.XToCol(px+sx)
|
||||||
|
|
||||||
@@ -373,7 +375,6 @@ class GridRowMover(wx.EvtHandler):
|
|||||||
self.lwin = grid.GetGridRowLabelWindow()
|
self.lwin = grid.GetGridRowLabelWindow()
|
||||||
self.lwin.PushEventHandler(self)
|
self.lwin.PushEventHandler(self)
|
||||||
self.rowWin = None
|
self.rowWin = None
|
||||||
self.uy = self.grid.GetScrollPixelsPerUnit()[1]
|
|
||||||
self.startY = -10
|
self.startY = -10
|
||||||
self.cellY = 0
|
self.cellY = 0
|
||||||
self.didMove = False
|
self.didMove = False
|
||||||
@@ -400,9 +401,10 @@ class GridRowMover(wx.EvtHandler):
|
|||||||
and abs(evt.Y - self.lastY) >= 3:
|
and abs(evt.Y - self.lastY) >= 3:
|
||||||
self.lastY = evt.Y
|
self.lastY = evt.Y
|
||||||
self.didMove = True
|
self.didMove = True
|
||||||
|
uy = self.grid.GetScrollPixelsPerUnit()[1]
|
||||||
x,sy = self.grid.GetViewStart()
|
x,sy = self.grid.GetViewStart()
|
||||||
w,h = self.lwin.GetClientSize()
|
w,h = self.lwin.GetClientSize()
|
||||||
y = sy * self.uy
|
y = sy * uy
|
||||||
|
|
||||||
if (evt.Y + y) < y:
|
if (evt.Y + y) < y:
|
||||||
y = evt.Y + y
|
y = evt.Y + y
|
||||||
@@ -412,7 +414,7 @@ class GridRowMover(wx.EvtHandler):
|
|||||||
if y < 1:
|
if y < 1:
|
||||||
y = 0
|
y = 0
|
||||||
else:
|
else:
|
||||||
y /= self.uy
|
y /= uy
|
||||||
|
|
||||||
if y != sy:
|
if y != sy:
|
||||||
if wx.Platform == '__WXMSW__':
|
if wx.Platform == '__WXMSW__':
|
||||||
@@ -441,7 +443,8 @@ class GridRowMover(wx.EvtHandler):
|
|||||||
def OnPress(self,evt):
|
def OnPress(self,evt):
|
||||||
self.startY = self.lastY = evt.Y
|
self.startY = self.lastY = evt.Y
|
||||||
_clSize = self.grid.GetColLabelSize()
|
_clSize = self.grid.GetColLabelSize()
|
||||||
sy = self.grid.GetViewStart()[1] * self.uy
|
uy = self.grid.GetScrollPixelsPerUnit()[1]
|
||||||
|
sy = self.grid.GetViewStart()[1] * uy
|
||||||
sy -= _clSize
|
sy -= _clSize
|
||||||
px,py = self.lwin.ClientToScreen(evt.X,evt.Y)
|
px,py = self.lwin.ClientToScreen(evt.X,evt.Y)
|
||||||
px,py = self.grid.ScreenToClient(px,py)
|
px,py = self.grid.ScreenToClient(px,py)
|
||||||
@@ -483,7 +486,8 @@ class GridRowMover(wx.EvtHandler):
|
|||||||
if not self.didMove:
|
if not self.didMove:
|
||||||
py = self.lwin.ClientToScreen(0,self.startY)[1]
|
py = self.lwin.ClientToScreen(0,self.startY)[1]
|
||||||
py = self.grid.ScreenToClient(0,py)[1]
|
py = self.grid.ScreenToClient(0,py)[1]
|
||||||
sy = self.grid.GetViewStart()[1] * self.uy
|
uy = self.grid.GetScrollPixelsPerUnit()[1]
|
||||||
|
sy = self.grid.GetViewStart()[1] * uy
|
||||||
sy -= self.grid.GetColLabelSize()
|
sy -= self.grid.GetColLabelSize()
|
||||||
row = self.grid.YToRow(py + sy)
|
row = self.grid.YToRow(py + sy)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user