Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions src/Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,14 @@ struct EditorImpl : public Editor, public InputHandler {
if (gSimfile->isClosed()) return false;

// Make a list of all simfiles in the current pack.
fs::path packDir = fs::path(gSimfile->getDir());
fs::path this_dir = fs::path(gSimfile->getDir());
fs::path packDir = this_dir.parent_path();
auto songDirs = File::findDirs(packDir, false);

// Find the current simfile.
int index = -1;
for (int i = 0; i < songDirs.size(); ++i) {
if (songDirs[i].u8string() == packDir.u8string()) {
if (fs::equivalent(songDirs[i], this_dir)) {
index = i;
}
}
Expand All @@ -540,28 +541,33 @@ struct EditorImpl : public Editor, public InputHandler {

// Find the previous/next simfile with a different directory.
fs::path path;
int start_index = index;
if (iterateForward) {
while (++index < songDirs.size()) {
while (++index != start_index) {
if (index == songDirs.size()) {
HudInfo("Looping to the first simfile.");
index = -1;
continue;
}
path = findSimfile(songDirs[index], true);
if (path.empty()) break;
}
if (index == songDirs.size()) {
HudInfo("This is the last simfile.");
return false;
if (!path.empty()) break;
}
} else {
while (--index >= 0) {
while (--index != start_index) {
if (index < 0) {
HudInfo("Looping to the last simfile.");
index = songDirs.size();
continue;
}
path = findSimfile(songDirs[index], true);
if (path.empty()) break;
}
if (index < 0) {
HudInfo("This is the first simfile.");
return false;
if (!path.empty()) break;
}
}

// Open the simfile.
return openSimfile(path);
if (index == start_index) {
HudInfo("No valid simfiles found.");
return false;
} else
return openSimfile(path);
}

bool saveSimfile(bool showSaveAsDialog) override {
Expand Down
13 changes: 9 additions & 4 deletions src/Editor/Notefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ static int RoundUp(int value, int multiple) {

struct TweakInfoBox : public InfoBox {
void draw(recti r) override;
int height() override { return 100; }
int height() override {
return static_cast<int>(100 * gSystem->getScaleFactor());
}
};

struct DrawPosHelper {
Expand Down Expand Up @@ -846,8 +848,11 @@ void TweakInfoBox::draw(recti r) {
Str::fmt str("Tweak %1 :: %2");
str.arg(name[mode]).arg(gTempo->getTweakValue(), 3, 3);

const int init_off_h = static_cast<int>(16 * gSystem->getScaleFactor());
const int text_row_h = static_cast<int>(14 * gSystem->getScaleFactor());

Text::arrange(Text::MC, str);
Text::draw(vec2i{r.x, r.y + 16});
Text::draw(vec2i{r.x, r.y + init_off_h});

const char* keys[] = {
"scrollwheel + shift",
Expand All @@ -866,11 +871,11 @@ void TweakInfoBox::draw(recti r) {
for (int i = 0; i < 4; ++i) {
textStyle.textColor = RGBAtoColor32(255, 255, 255, 128);
Text::arrange(Text::TR, textStyle, keys[i]);
Text::draw(vec2i{r.x - 8, r.y + 32 + i * 14});
Text::draw(vec2i{r.x - 8, r.y + init_off_h * 2 + i * text_row_h});

textStyle.textColor = Colors::white;
Text::arrange(Text::TL, textStyle, desc[i]);
Text::draw(vec2i{r.x + 8, r.y + 32 + i * 14});
Text::draw(vec2i{r.x + 8, r.y + init_off_h * 2 + i * text_row_h});
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/Editor/TextOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ struct TextOverlayImpl : public TextOverlay {
vec2i view = gSystem->getWindowSize();
int x = view.x / 2, y = 8;
for (auto& box : infoBoxes_) {
vec2i size = {280, box->height()};
vec2i size = {static_cast<int>(280 * gSystem->getScaleFactor()),
box->height()};
recti r = {x - size.x / 2, y, size.x, size.y};
recti r2 = {r.x - 4, r.y - 4, r.w + 8, r.h + 8};

Expand All @@ -418,7 +419,7 @@ struct TextOverlayImpl : public TextOverlay {

box->draw(r);

y += size.y + 12;
y += size.y + static_cast<int>(280 * gSystem->getScaleFactor());
}

x = 4, y = 4;
Expand Down
6 changes: 3 additions & 3 deletions src/Managers/TempoMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ struct TempoManImpl : public TempoMan {
void startTweakingOffset() override {
if (myTweakMode == TWEAK_OFFSET || !myTempo) return;

stopTweaking(false);
stopTweaking(true);
myTweakTempo = new Tempo;
myTweakTempo->copy(myTempo);
myTweakMode = TWEAK_OFFSET;
Expand All @@ -563,7 +563,7 @@ struct TempoManImpl : public TempoMan {

if ((myTweakMode == TWEAK_BPM && myTweakRow == row) || !myTempo) return;

stopTweaking(false);
stopTweaking(true);
myTweakTempo = new Tempo;
myTweakTempo->copy(myTempo);
myTweakMode = TWEAK_BPM;
Expand All @@ -575,7 +575,7 @@ struct TempoManImpl : public TempoMan {
if ((myTweakMode == TWEAK_STOP && myTweakRow == row) || !myTempo)
return;

stopTweaking(false);
stopTweaking(true);
myTweakTempo = new Tempo;
myTweakTempo->copy(myTempo);
myTweakMode = TWEAK_STOP;
Expand Down
Loading