Skip to content
2 changes: 1 addition & 1 deletion sources/Application/Model/BuildNumber.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_COUNT "003"
#define BUILD_COUNT "001"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to change this as this is just a placeholder value that is replaced in GitHub CI (Actions)

6 changes: 3 additions & 3 deletions sources/Application/Model/Phrase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <string.h>

Phrase::Phrase() {
for (int i = 0; i < PHRASE_COUNT * 16; i++) {
note_[i] = 0xFF;
instr_[i] = 0xFF;
for (int i = 0; i < PHRASE_COUNT * PHRASE_ROW_COUNT; i++) {
note_[i] = NO_NOTE_ASSIGNED;
instr_[i] = NO_INSTRUMENT_ASSIGNED;
cmd1_[i] = FourCC::InstrumentCommandNone;
param1_[i] = 0x00;
cmd2_[i] = FourCC::InstrumentCommandNone;
Expand Down
15 changes: 9 additions & 6 deletions sources/Application/Model/Phrase.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "Foundation/Types/Types.h"
#define PHRASE_COUNT 0x80
#define NO_MORE_PHRASE 0x81
#define PHRASE_ROW_COUNT 16
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

#define NO_NOTE_ASSIGNED 0xFF
#define NO_INSTRUMENT_ASSIGNED 0xFF

class Phrase {
public:
Expand All @@ -14,12 +17,12 @@ class Phrase {
void SetUsed(uchar c);
void ClearAllocation();

uchar note_[PHRASE_COUNT * 16];
uchar instr_[PHRASE_COUNT * 16];
FourCC cmd1_[PHRASE_COUNT * 16];
ushort param1_[PHRASE_COUNT * 16];
FourCC cmd2_[PHRASE_COUNT * 16];
ushort param2_[PHRASE_COUNT * 16];
uchar note_[PHRASE_COUNT * PHRASE_ROW_COUNT];
uchar instr_[PHRASE_COUNT * PHRASE_ROW_COUNT];
FourCC cmd1_[PHRASE_COUNT * PHRASE_ROW_COUNT];
ushort param1_[PHRASE_COUNT * PHRASE_ROW_COUNT];
FourCC cmd2_[PHRASE_COUNT * PHRASE_ROW_COUNT];
ushort param2_[PHRASE_COUNT * PHRASE_ROW_COUNT];

private:
bool isUsed_[PHRASE_COUNT];
Expand Down
2 changes: 1 addition & 1 deletion sources/Application/Model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Foundation/Variables/VariableContainer.h"
#include "Song.h"

#define PROJECT_NUMBER "2.1-BETA1"
#define PROJECT_NUMBER "2.1-JumpSection"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine to change in your local test builds but please dont commit this into the PR branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove the commit changing this completely from the commit-history in the PR branch? Or is reverting it sufficient? (e.g. if PRs are being squashed anyways)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just reverting or a new commit putting the old line back is fine since yes we do squash merge PRs so the commits in a PR branch arent kept anyways

#define PROJECT_RELEASE "r"
// BUILD_COUNT define comes from BuildNumber.h

Expand Down
135 changes: 134 additions & 1 deletion sources/Application/Views/PhraseView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,134 @@ void PhraseView::pasteLast() {
}
}

void PhraseView::jumpToNextSection(int direction) {
int phraseStart = viewData_->currentPhrase_ * PHRASE_ROW_COUNT;
int current = row_;
bool foundGap = false;

// Find a gap and then find non-gap item in the chosen direction
switch (col_) {
// Note column
case 0: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
uchar note = phrase_->note_[phraseStart + current];
if (foundGap && note != NO_NOTE_ASSIGNED) {
break;
} else if (note == NO_NOTE_ASSIGNED) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

// Instrument column
case 1: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
uchar instrument = phrase_->instr_[phraseStart + current];
if (foundGap && instrument != NO_INSTRUMENT_ASSIGNED) {
break;
} else if (instrument == NO_INSTRUMENT_ASSIGNED) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

// Command1 column
case 2: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
FourCC command = phrase_->cmd1_[phraseStart + current];
if (foundGap && command != FourCC::InstrumentCommandNone) {
break;
} else if (command == FourCC::InstrumentCommandNone) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

// Param1 column
case 3: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
ushort param = phrase_->param1_[phraseStart + current];
if (foundGap && param != 0) {
break;
} else if (param == 0) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

// Command2 column
case 4: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
FourCC command = phrase_->cmd2_[phraseStart + current];
if (foundGap && command != FourCC::InstrumentCommandNone) {
break;
} else if (command == FourCC::InstrumentCommandNone) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

// Param2 column
case 5: {
for (int i = 0; i < PHRASE_ROW_COUNT; i++) {
ushort param = phrase_->param2_[phraseStart + current];
if (foundGap && param != 0) {
break;
} else if (param == 0) {
foundGap = true;
}
current += direction;
if (current < 0)
current += PHRASE_ROW_COUNT;
if (current >= PHRASE_ROW_COUNT)
current -= PHRASE_ROW_COUNT;
}
break;
}

default: {
Trace::Error("PHRASEVIEW: jumpToNextSection received unexpected value for "
"col %d not implemented",
col_);
return;
}
}

// update view
row_ = current;
isDirty_ = true;
}

void PhraseView::cutPosition() {

clipboard_.active_ = true;
Expand Down Expand Up @@ -964,7 +1092,12 @@ void PhraseView::processNormalButtonMask(unsigned short mask) {
} else {
// L Modifier
if (mask & EPBM_ALT) {

if (mask & EPBM_DOWN) {
jumpToNextSection(1);
}
if (mask & EPBM_UP) {
jumpToNextSection(-1);
}
} else {
// No modifier

Expand Down
2 changes: 2 additions & 0 deletions sources/Application/Views/PhraseView.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class PhraseView : public ScreenView {
void cutPosition();
void pasteLast();

void jumpToNextSection(int dir);

void extendSelection();

GUIRect getSelectionRect();
Expand Down