negate selection
parent
29b0367dfb
commit
ab811c363c
2
notes
2
notes
|
@ -45,7 +45,7 @@ TODO {
|
|||
- fix strut not working except to overwrite another param
|
||||
|
||||
- add negate function to param columns
|
||||
multi select negate
|
||||
- multi select negate
|
||||
|
||||
revert-to-saved menu action
|
||||
|
||||
|
|
|
@ -238,6 +238,30 @@ bool PatternEditorItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *m
|
|||
|
||||
return cc->commit("delete selection");
|
||||
}
|
||||
if (k == Qt::Key_Minus) {
|
||||
dc->cancel();
|
||||
SelectionBounds s(sel);
|
||||
auto cc = (new CompositeCommand())->reserve((1 + s.y2 - s.y1) * (1 + s.ch2 - s.ch1));
|
||||
|
||||
for (int c = s.ch1; c <= s.ch2; c++) {
|
||||
if (c == s.ch2 && s.x2 < 2) continue; // no params selected here
|
||||
for (int r = s.y1; r <= s.y2; r++) {
|
||||
auto dc = new PatternDeltaCommand(p, c, r-1);
|
||||
//auto min = c == s.ch1 ? std::max(0, s.x1 - 2) : 0;
|
||||
//auto max = c == s.ch2 ? s.x2 - 2 : PatternEditorModel::paramSoftCap;
|
||||
|
||||
for (auto i = 0; i < static_cast<int>(dc->row.numParams()); i++) {
|
||||
if (s.paramSelected(c, i)) {
|
||||
auto& pr = dc->row.param(i);
|
||||
if (pr[0] != ' ') pr[1] *= -1;
|
||||
}
|
||||
}
|
||||
cc->compose(dc);
|
||||
}
|
||||
}
|
||||
|
||||
return cc->commit("negate selection");
|
||||
}
|
||||
|
||||
// for all other commands, reset selection to cursor and defer
|
||||
sm->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
|
||||
|
|
Loading…
Reference in New Issue