possibly solve vZoom/vScroll issue

move these to a new DivInstrumentTemp struct
this way, undo history is not altered every time these change

issue #2179
This commit is contained in:
tildearrow 2025-03-10 12:35:05 -05:00
parent b7a8745581
commit b46a60e96d
4 changed files with 82 additions and 111 deletions

View file

@ -358,7 +358,6 @@ void copyMacro(DivInstrument* ins, DivInstrumentMacro* from, int macro_type, int
to->len = from->len;
to->delay = from->delay;
to->lenMemory = from->lenMemory;
to->mode = from->mode;
to->rel = from->rel;
to->speed = from->speed;
@ -390,7 +389,6 @@ void copyMacro(DivInstrument* ins, DivInstrumentMacro* from, int macro_type, int
wave->len = to->len;
wave->delay = to->delay;
wave->lenMemory = to->lenMemory;
wave->mode = to->mode;
wave->rel = to->rel;
wave->speed = to->speed;

View file

@ -266,11 +266,6 @@ struct DivInstrumentMacro {
// 0-31: normal
// 32+: operator (top 3 bits select operator, starting from 1)
unsigned char macroType;
// the following variables are used by the GUI and not saved in the file
int vScroll, vZoom;
int typeMemory[16];
unsigned char lenMemory;
explicit DivInstrumentMacro(unsigned char initType, bool initOpen=false):
mode(0),
@ -280,12 +275,8 @@ struct DivInstrumentMacro {
speed(1),
loop(255),
rel(255),
macroType(initType),
vScroll(0),
vZoom(-1),
lenMemory(0) {
macroType(initType) {
memset(val,0,256*sizeof(int));
memset(typeMemory,0,16*sizeof(int));
}
};
@ -1002,6 +993,20 @@ struct DivInstrumentPOD {
}
};
struct DivInstrumentTemp {
// the following variables are used by the GUI and not saved in the file
int vScroll[160];
int vZoom[160];
int typeMemory[160][16];
unsigned char lenMemory[160];
DivInstrumentTemp() {
memset(vScroll,0,160*sizeof(int));
memset(vZoom,-1,160*sizeof(int));
memset(typeMemory,0,160*16*sizeof(int));
memset(lenMemory,0,160*sizeof(int));
}
};
struct MemPatch {
MemPatch() :
data(NULL)
@ -1044,6 +1049,8 @@ struct DivInstrumentUndoStep {
struct DivInstrument : DivInstrumentPOD {
String name;
DivInstrumentTemp temp;
DivInstrument() :
name("") {
// clear and construct DivInstrumentPOD so it doesn't have any garbage in the padding