GUI: prepare to display loop start/end hints

valid loop start/end positions, that is (for SNES, NES, Amiga and other
chips/systems with loop position restrictions)
This commit is contained in:
tildearrow 2025-08-16 23:55:28 -05:00
parent b52aed25dd
commit 72247f93fb

View file

@ -216,6 +216,9 @@ void FurnaceGUI::drawSampleEdit() {
memset(isMemVisible,0,DIV_MAX_CHIPS*DIV_MAX_SAMPLE_TYPE*sizeof(bool)); memset(isMemVisible,0,DIV_MAX_CHIPS*DIV_MAX_SAMPLE_TYPE*sizeof(bool));
memset(isMemWarning,0,DIV_MAX_CHIPS*DIV_MAX_SAMPLE_TYPE*sizeof(bool)); memset(isMemWarning,0,DIV_MAX_CHIPS*DIV_MAX_SAMPLE_TYPE*sizeof(bool));
bool displayLoopStartHints=false;
bool displayLoopEndHints=false;
for (int i=0; i<e->song.systemLen; i++) { for (int i=0; i<e->song.systemLen; i++) {
DivDispatch* dispatch=e->getDispatch(i); DivDispatch* dispatch=e->getDispatch(i);
@ -753,9 +756,13 @@ void FurnaceGUI::drawSampleEdit() {
if (ImGui::IsItemActive()) { if (ImGui::IsItemActive()) {
keepLoopAlive=true; keepLoopAlive=true;
sampleCheckLoopStart=false; sampleCheckLoopStart=false;
displayLoopStartHints=true;
} else { } else {
sampleCheckLoopStart=true; sampleCheckLoopStart=true;
} }
if (ImGui::IsItemHovered()) {
displayLoopStartHints=true;
}
if (ImGui::IsItemHovered() && (!warnLoopPos.empty() || (!warnLoopStart.empty() && sampleCheckLoopStart) || sample->depth==DIV_SAMPLE_DEPTH_BRR)) { if (ImGui::IsItemHovered() && (!warnLoopPos.empty() || (!warnLoopStart.empty() && sampleCheckLoopStart) || sample->depth==DIV_SAMPLE_DEPTH_BRR)) {
if (ImGui::BeginTooltip()) { if (ImGui::BeginTooltip()) {
if (sample->depth==DIV_SAMPLE_DEPTH_BRR) { if (sample->depth==DIV_SAMPLE_DEPTH_BRR) {
@ -792,9 +799,13 @@ void FurnaceGUI::drawSampleEdit() {
if (ImGui::IsItemActive()) { if (ImGui::IsItemActive()) {
keepLoopAlive=true; keepLoopAlive=true;
sampleCheckLoopEnd=false; sampleCheckLoopEnd=false;
displayLoopEndHints=true;
} else { } else {
sampleCheckLoopEnd=true; sampleCheckLoopEnd=true;
} }
if (ImGui::IsItemHovered()) {
displayLoopEndHints=true;
}
if (ImGui::IsItemHovered() && (!warnLoopPos.empty() || (!warnLoopEnd.empty() && sampleCheckLoopEnd) || sample->depth==DIV_SAMPLE_DEPTH_BRR)) { if (ImGui::IsItemHovered() && (!warnLoopPos.empty() || (!warnLoopEnd.empty() && sampleCheckLoopEnd) || sample->depth==DIV_SAMPLE_DEPTH_BRR)) {
if (ImGui::BeginTooltip()) { if (ImGui::BeginTooltip()) {
if (sample->depth==DIV_SAMPLE_DEPTH_BRR) { if (sample->depth==DIV_SAMPLE_DEPTH_BRR) {
@ -2031,6 +2042,14 @@ void FurnaceGUI::drawSampleEdit() {
} }
dl->PopClipRect(); dl->PopClipRect();
if (displayLoopStartHints) {
dl->AddText(ImVec2(minArea.x,minArea.y),0xffffffff,"Loop start hints.");
}
if (displayLoopEndHints) {
dl->AddText(ImVec2(minArea.x,minArea.y),0xffffffff,"Loop end hints.");
}
if (drawSelection) { if (drawSelection) {
int start=sampleSelStart; int start=sampleSelStart;
int end=sampleSelEnd; int end=sampleSelEnd;