GUI: collapse/expand pattern/song

This commit is contained in:
tildearrow 2023-04-27 01:23:54 -05:00
parent f3a71c6eba
commit 24487936de
6 changed files with 315 additions and 59 deletions

View file

@ -721,6 +721,8 @@ enum NoteCtrl {
struct SelectionPoint {
int xCoarse, xFine;
int y;
SelectionPoint(int xc, int xf, int yp):
xCoarse(xc), xFine(xf), y(yp) {}
SelectionPoint():
xCoarse(0), xFine(0), y(0) {}
};
@ -742,10 +744,17 @@ enum ActionType {
GUI_UNDO_PATTERN_FLIP,
GUI_UNDO_PATTERN_COLLAPSE,
GUI_UNDO_PATTERN_EXPAND,
GUI_UNDO_PATTERN_COLLAPSE_SONG,
GUI_UNDO_PATTERN_EXPAND_SONG,
GUI_UNDO_PATTERN_DRAG,
GUI_UNDO_REPLACE
};
enum UndoOtherTarget {
GUI_UNDO_TARGET_SONG,
GUI_UNDO_TARGET_SUBSONG
};
struct UndoPatternData {
int subSong, chan, pat, row, col;
short oldVal, newVal;
@ -770,6 +779,19 @@ struct UndoOrderData {
newVal(v2) {}
};
struct UndoOtherData {
UndoOtherTarget target;
int subtarget;
size_t off;
unsigned char oldVal, newVal;
UndoOtherData(UndoOtherTarget t, int st, size_t o, unsigned char v1, unsigned char v2):
target(t),
subtarget(st),
off(o),
oldVal(v1),
newVal(v2) {}
};
struct UndoStep {
ActionType type;
SelectionPoint cursor, selStart, selEnd;
@ -779,6 +801,7 @@ struct UndoStep {
int oldPatLen, newPatLen;
std::vector<UndoOrderData> ord;
std::vector<UndoPatternData> pat;
std::vector<UndoOtherData> other;
};
// -1 = any
@ -2064,8 +2087,10 @@ class FurnaceGUI {
void doScale(float top);
void doRandomize(int bottom, int top, bool mode);
void doFlip();
void doCollapse(int divider);
void doExpand(int multiplier);
void doCollapse(int divider, const SelectionPoint& sStart, const SelectionPoint& sEnd);
void doExpand(int multiplier, const SelectionPoint& sStart, const SelectionPoint& sEnd);
void doCollapseSong(int divider);
void doExpandSong(int multiplier);
void doUndo();
void doRedo();
void doFind();