mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-05 20:35:06 +00:00
GUI: prepare for replace undo
This commit is contained in:
parent
64f5343289
commit
bdbebc99f1
3 changed files with 19 additions and 2 deletions
|
@ -66,6 +66,8 @@ void FurnaceGUI::prepareUndo(ActionType action) {
|
||||||
e->curPat[i].getPattern(e->curOrders->ord[i][curOrder],false)->copyOn(oldPat[i]);
|
e->curPat[i].getPattern(e->curOrders->ord[i][curOrder],false)->copyOn(oldPat[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GUI_UNDO_REPLACE: // this is handled by doReplace()
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +88,7 @@ void FurnaceGUI::makeUndo(ActionType action) {
|
||||||
if (oldOrders.ord[i][j]!=e->curOrders->ord[i][j]) {
|
if (oldOrders.ord[i][j]!=e->curOrders->ord[i][j]) {
|
||||||
s.ord.push_back(UndoOrderData(subSong,i,j,oldOrders.ord[i][j],e->curOrders->ord[i][j]));
|
s.ord.push_back(UndoOrderData(subSong,i,j,oldOrders.ord[i][j],e->curOrders->ord[i][j]));
|
||||||
}
|
}
|
||||||
}
|
}SATGDIOPTASDIOKP;ASDTG
|
||||||
}
|
}
|
||||||
s.oldOrdersLen=oldOrdersLen;
|
s.oldOrdersLen=oldOrdersLen;
|
||||||
s.newOrdersLen=e->curSubSong->ordersLen;
|
s.newOrdersLen=e->curSubSong->ordersLen;
|
||||||
|
@ -126,6 +128,8 @@ void FurnaceGUI::makeUndo(ActionType action) {
|
||||||
doPush=true;
|
doPush=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GUI_UNDO_REPLACE: // this is handled by doReplace()
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (doPush) {
|
if (doPush) {
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
|
@ -943,6 +947,7 @@ void FurnaceGUI::doUndo() {
|
||||||
case GUI_UNDO_PATTERN_FLIP:
|
case GUI_UNDO_PATTERN_FLIP:
|
||||||
case GUI_UNDO_PATTERN_COLLAPSE:
|
case GUI_UNDO_PATTERN_COLLAPSE:
|
||||||
case GUI_UNDO_PATTERN_EXPAND:
|
case GUI_UNDO_PATTERN_EXPAND:
|
||||||
|
case GUI_UNDO_REPLACE:
|
||||||
for (UndoPatternData& i: us.pat) {
|
for (UndoPatternData& i: us.pat) {
|
||||||
e->changeSongP(i.subSong);
|
e->changeSongP(i.subSong);
|
||||||
DivPattern* p=e->curPat[i.chan].getPattern(i.pat,true);
|
DivPattern* p=e->curPat[i.chan].getPattern(i.pat,true);
|
||||||
|
@ -991,6 +996,7 @@ void FurnaceGUI::doRedo() {
|
||||||
case GUI_UNDO_PATTERN_FLIP:
|
case GUI_UNDO_PATTERN_FLIP:
|
||||||
case GUI_UNDO_PATTERN_COLLAPSE:
|
case GUI_UNDO_PATTERN_COLLAPSE:
|
||||||
case GUI_UNDO_PATTERN_EXPAND:
|
case GUI_UNDO_PATTERN_EXPAND:
|
||||||
|
case GUI_UNDO_REPLACE:
|
||||||
for (UndoPatternData& i: us.pat) {
|
for (UndoPatternData& i: us.pat) {
|
||||||
e->changeSongP(i.subSong);
|
e->changeSongP(i.subSong);
|
||||||
DivPattern* p=e->curPat[i.chan].getPattern(i.pat,true);
|
DivPattern* p=e->curPat[i.chan].getPattern(i.pat,true);
|
||||||
|
|
|
@ -189,6 +189,12 @@ void FurnaceGUI::doFind() {
|
||||||
queryViewingResults=true;
|
queryViewingResults=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* issues with the find and replace function:
|
||||||
|
- doesn't mark the module as modified
|
||||||
|
- can't undo
|
||||||
|
- replace notes to anything starting from C-0 to lower notes will have an octave higher, so set it to replace to C-0 it will becom C-1, b_1 will become B-0 and so on
|
||||||
|
*/
|
||||||
|
|
||||||
void FurnaceGUI::doReplace() {
|
void FurnaceGUI::doReplace() {
|
||||||
doFind();
|
doFind();
|
||||||
queryViewingResults=false;
|
queryViewingResults=false;
|
||||||
|
@ -399,6 +405,10 @@ void FurnaceGUI::doReplace() {
|
||||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||||
if (touched[i]!=NULL) delete[] touched[i];
|
if (touched[i]!=NULL) delete[] touched[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!curQueryResults.empty()) {
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FIRST_VISIBLE(x) (x==GUI_QUERY_MATCH || x==GUI_QUERY_MATCH_NOT || x==GUI_QUERY_RANGE || x==GUI_QUERY_RANGE_NOT)
|
#define FIRST_VISIBLE(x) (x==GUI_QUERY_MATCH || x==GUI_QUERY_MATCH_NOT || x==GUI_QUERY_RANGE || x==GUI_QUERY_RANGE_NOT)
|
||||||
|
|
|
@ -566,7 +566,8 @@ enum ActionType {
|
||||||
GUI_UNDO_PATTERN_INVERT_VAL,
|
GUI_UNDO_PATTERN_INVERT_VAL,
|
||||||
GUI_UNDO_PATTERN_FLIP,
|
GUI_UNDO_PATTERN_FLIP,
|
||||||
GUI_UNDO_PATTERN_COLLAPSE,
|
GUI_UNDO_PATTERN_COLLAPSE,
|
||||||
GUI_UNDO_PATTERN_EXPAND
|
GUI_UNDO_PATTERN_EXPAND,
|
||||||
|
GUI_UNDO_REPLACE
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UndoPatternData {
|
struct UndoPatternData {
|
||||||
|
|
Loading…
Reference in a new issue