GUI: new pattern cursor logic, part 21
This commit is contained in:
parent
e5ad462cd2
commit
f09e060c33
|
@ -53,7 +53,10 @@ const char* FurnaceGUI::noteNameNormal(short note, short octave) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::prepareUndo(ActionType action, UndoRegion region) {
|
void FurnaceGUI::prepareUndo(ActionType action, UndoRegion region) {
|
||||||
prevCursor=cursor;
|
undoCursor=cursor;
|
||||||
|
undoSelStart=selStart;
|
||||||
|
undoSelEnd=selEnd;
|
||||||
|
undoOrder=curOrder;
|
||||||
|
|
||||||
if (region.begin.ord==-1) {
|
if (region.begin.ord==-1) {
|
||||||
region.begin.ord=selStart.order;
|
region.begin.ord=selStart.order;
|
||||||
|
@ -128,11 +131,16 @@ void FurnaceGUI::makeUndo(ActionType action, UndoRegion region) {
|
||||||
bool shallWalk=false;
|
bool shallWalk=false;
|
||||||
UndoStep s;
|
UndoStep s;
|
||||||
s.type=action;
|
s.type=action;
|
||||||
s.cursor=prevCursor;
|
s.oldCursor=undoCursor;
|
||||||
s.selStart=selStart;
|
s.oldSelStart=undoSelStart;
|
||||||
s.selEnd=selEnd;
|
s.oldSelEnd=undoSelEnd;
|
||||||
s.scroll=patScroll;
|
s.oldScroll=patScroll;
|
||||||
s.order=curOrder;
|
s.oldOrder=undoOrder;
|
||||||
|
s.newCursor=cursor;
|
||||||
|
s.newSelStart=selStart;
|
||||||
|
s.newSelEnd=selEnd;
|
||||||
|
s.newScroll=(nextScroll>=0.0f)?nextScroll:patScroll;
|
||||||
|
s.newOrder=curOrder;
|
||||||
s.oldOrdersLen=oldOrdersLen;
|
s.oldOrdersLen=oldOrdersLen;
|
||||||
s.newOrdersLen=e->curSubSong->ordersLen;
|
s.newOrdersLen=e->curSubSong->ordersLen;
|
||||||
s.nibble=curNibble;
|
s.nibble=curNibble;
|
||||||
|
@ -2134,6 +2142,7 @@ void FurnaceGUI::moveSelected(int x, int y) {
|
||||||
void FurnaceGUI::doUndo() {
|
void FurnaceGUI::doUndo() {
|
||||||
if (undoHist.empty()) return;
|
if (undoHist.empty()) return;
|
||||||
UndoStep& us=undoHist.back();
|
UndoStep& us=undoHist.back();
|
||||||
|
redoHist.push_back(us);
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
|
|
||||||
switch (us.type) {
|
switch (us.type) {
|
||||||
|
@ -2170,13 +2179,13 @@ void FurnaceGUI::doUndo() {
|
||||||
}
|
}
|
||||||
if (us.type!=GUI_UNDO_REPLACE) {
|
if (us.type!=GUI_UNDO_REPLACE) {
|
||||||
if (!e->isPlaying() || !followPattern) {
|
if (!e->isPlaying() || !followPattern) {
|
||||||
cursor=us.cursor;
|
cursor=us.oldCursor;
|
||||||
selStart=us.selStart;
|
selStart=us.oldSelStart;
|
||||||
selEnd=us.selEnd;
|
selEnd=us.oldSelEnd;
|
||||||
curNibble=us.nibble;
|
curNibble=us.nibble;
|
||||||
setOrder(us.order);
|
setOrder(us.oldOrder);
|
||||||
if (us.scroll>=0.0f) {
|
if (us.oldScroll>=0.0f) {
|
||||||
updateScrollRaw(us.scroll);
|
updateScrollRaw(us.oldScroll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2199,21 +2208,12 @@ void FurnaceGUI::doUndo() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shallReplay && e->isPlaying()) play();
|
if (shallReplay && e->isPlaying()) play();
|
||||||
|
|
||||||
if (cursor.order!=curOrder) {
|
|
||||||
e->setOrder(cursor.order);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curOrder>=e->curSubSong->ordersLen) {
|
if (curOrder>=e->curSubSong->ordersLen) {
|
||||||
curOrder=e->curSubSong->ordersLen-1;
|
curOrder=e->curSubSong->ordersLen-1;
|
||||||
e->setOrder(curOrder);
|
e->setOrder(curOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reverse state for redo
|
|
||||||
us.cursor=cursor;
|
|
||||||
us.scroll=patScroll;
|
|
||||||
redoHist.push_back(us);
|
|
||||||
|
|
||||||
undoHist.pop_back();
|
undoHist.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2257,13 +2257,13 @@ void FurnaceGUI::doRedo() {
|
||||||
}
|
}
|
||||||
if (us.type!=GUI_UNDO_REPLACE) {
|
if (us.type!=GUI_UNDO_REPLACE) {
|
||||||
if (!e->isPlaying() || !followPattern) {
|
if (!e->isPlaying() || !followPattern) {
|
||||||
cursor=us.cursor;
|
cursor=us.newCursor;
|
||||||
selStart=us.selStart;
|
selStart=us.newSelStart;
|
||||||
selEnd=us.selEnd;
|
selEnd=us.newSelEnd;
|
||||||
curNibble=us.nibble;
|
curNibble=us.nibble;
|
||||||
setOrder(us.order);
|
setOrder(us.newOrder);
|
||||||
if (us.scroll>=0.0f) {
|
if (us.newScroll>=0.0f) {
|
||||||
updateScrollRaw(us.scroll);
|
updateScrollRaw(us.newScroll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2287,10 +2287,6 @@ void FurnaceGUI::doRedo() {
|
||||||
}
|
}
|
||||||
if (shallReplay && e->isPlaying()) play();
|
if (shallReplay && e->isPlaying()) play();
|
||||||
|
|
||||||
if (cursor.order!=curOrder) {
|
|
||||||
e->setOrder(cursor.order);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curOrder>=e->curSubSong->ordersLen) {
|
if (curOrder>=e->curSubSong->ordersLen) {
|
||||||
curOrder=e->curSubSong->ordersLen-1;
|
curOrder=e->curSubSong->ordersLen-1;
|
||||||
e->setOrder(curOrder);
|
e->setOrder(curOrder);
|
||||||
|
|
|
@ -8636,6 +8636,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
isClipping(0),
|
isClipping(0),
|
||||||
newSongCategory(0),
|
newSongCategory(0),
|
||||||
latchTarget(0),
|
latchTarget(0),
|
||||||
|
undoOrder(0),
|
||||||
wheelX(0),
|
wheelX(0),
|
||||||
wheelY(0),
|
wheelY(0),
|
||||||
dragSourceX(0),
|
dragSourceX(0),
|
||||||
|
|
|
@ -1097,9 +1097,10 @@ struct UndoOtherData {
|
||||||
|
|
||||||
struct UndoStep {
|
struct UndoStep {
|
||||||
ActionType type;
|
ActionType type;
|
||||||
SelectionPoint cursor, selStart, selEnd;
|
SelectionPoint oldCursor, oldSelStart, oldSelEnd;
|
||||||
float scroll;
|
SelectionPoint newCursor, newSelStart, newSelEnd;
|
||||||
int order;
|
float oldScroll, newScroll;
|
||||||
|
int oldOrder, newOrder;
|
||||||
bool nibble;
|
bool nibble;
|
||||||
int oldOrdersLen, newOrdersLen;
|
int oldOrdersLen, newOrdersLen;
|
||||||
int oldPatLen, newPatLen;
|
int oldPatLen, newPatLen;
|
||||||
|
@ -1109,11 +1110,16 @@ struct UndoStep {
|
||||||
|
|
||||||
UndoStep():
|
UndoStep():
|
||||||
type(GUI_UNDO_CHANGE_ORDER),
|
type(GUI_UNDO_CHANGE_ORDER),
|
||||||
cursor(),
|
oldCursor(),
|
||||||
selStart(),
|
oldSelStart(),
|
||||||
selEnd(),
|
oldSelEnd(),
|
||||||
scroll(-1.0f),
|
newCursor(),
|
||||||
order(0),
|
newSelStart(),
|
||||||
|
newSelEnd(),
|
||||||
|
oldScroll(-1.0f),
|
||||||
|
newScroll(-1.0f),
|
||||||
|
oldOrder(0),
|
||||||
|
newOrder(0),
|
||||||
nibble(false),
|
nibble(false),
|
||||||
oldOrdersLen(0),
|
oldOrdersLen(0),
|
||||||
newOrdersLen(0),
|
newOrdersLen(0),
|
||||||
|
@ -2346,7 +2352,7 @@ class FurnaceGUI {
|
||||||
FixedQueue<bool*,64> pendingLayoutImportReopen;
|
FixedQueue<bool*,64> pendingLayoutImportReopen;
|
||||||
|
|
||||||
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, editStepCoarse, soloChan, orderEditMode, orderCursor;
|
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, editStepCoarse, soloChan, orderEditMode, orderCursor;
|
||||||
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget;
|
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget, undoOrder;
|
||||||
int wheelX, wheelY, dragSourceX, dragSourceXFine, dragSourceY, dragSourceOrder, dragDestinationX, dragDestinationXFine, dragDestinationY, dragDestinationOrder, oldBeat, oldBar;
|
int wheelX, wheelY, dragSourceX, dragSourceXFine, dragSourceY, dragSourceOrder, dragDestinationX, dragDestinationXFine, dragDestinationY, dragDestinationOrder, oldBeat, oldBar;
|
||||||
int curGroove, exitDisabledTimer;
|
int curGroove, exitDisabledTimer;
|
||||||
int curPaletteChoice, curPaletteType;
|
int curPaletteChoice, curPaletteType;
|
||||||
|
@ -2373,7 +2379,8 @@ class FurnaceGUI {
|
||||||
bool clockShowReal, clockShowRow, clockShowBeat, clockShowMetro, clockShowTime;
|
bool clockShowReal, clockShowRow, clockShowBeat, clockShowMetro, clockShowTime;
|
||||||
float clockMetroTick[16];
|
float clockMetroTick[16];
|
||||||
|
|
||||||
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd, prevCursor;
|
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
|
||||||
|
SelectionPoint undoSelStart, undoSelEnd, undoCursor;
|
||||||
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, wasFollowing, changeAllOrders, mobileUI;
|
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, wasFollowing, changeAllOrders, mobileUI;
|
||||||
bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
bool collapseWindow, demandScrollX, fancyPattern, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
||||||
bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus;
|
bool keepLoopAlive, keepGrooveAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton, wantGrooveListFocus;
|
||||||
|
|
Loading…
Reference in a new issue