Rework how effect-blocking modules (scram) work to properly support undoing

This commit is contained in:
DarkPhoenix
2019-04-29 20:25:28 +03:00
parent 72fe52e560
commit 4eb8973c31
16 changed files with 195 additions and 106 deletions

View File

@@ -680,20 +680,20 @@ class FittingView(d.Display):
change State
"""
row, _, col = self.HitTestSubItem(event.Position)
clickedRow, _, col = self.HitTestSubItem(event.Position)
# only do State column and ignore invalid rows
if row != -1 and row not in self.blanks and col == self.getColIndex(State):
sel = []
curr = self.GetFirstSelected()
if clickedRow != -1 and clickedRow not in self.blanks and col == self.getColIndex(State):
selectedRows = []
currentRow = self.GetFirstSelected()
while curr != -1 and row not in self.blanks:
sel.append(curr)
curr = self.GetNextSelected(curr)
while currentRow != -1 and clickedRow not in self.blanks:
selectedRows.append(currentRow)
currentRow = self.GetNextSelected(currentRow)
if row not in sel:
if clickedRow not in selectedRows:
try:
selectedMods = [self.mods[row]]
selectedMods = [self.mods[clickedRow]]
except IndexError:
return
else:
@@ -702,7 +702,7 @@ class FittingView(d.Display):
click = "ctrl" if event.GetModifiers() == wx.MOD_CONTROL or event.middleIsDown else "right" if event.GetButton() == 3 else "left"
try:
mainMod = self.mods[row]
mainMod = self.mods[clickedRow]
except IndexError:
return
if mainMod.isEmpty:
@@ -726,7 +726,7 @@ class FittingView(d.Display):
click=click))
# update state tooltip
tooltip = self.activeColumns[col].getToolTip(self.mods[row])
tooltip = self.activeColumns[col].getToolTip(self.mods[clickedRow])
if tooltip:
self.SetToolTip(tooltip)