mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-16 17:45:10 +00:00
GUI: display sample selection - NOT FINISHED
This commit is contained in:
parent
b04e1f2870
commit
ef3bf8f924
1 changed files with 21 additions and 1 deletions
|
@ -373,9 +373,10 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String statusBar=sampleDragMode?"Draw":"Select";
|
String statusBar=sampleDragMode?"Draw":"Select";
|
||||||
|
bool drawSelection=false;
|
||||||
|
|
||||||
if (!sampleDragMode) {
|
if (!sampleDragMode) {
|
||||||
if (sampleSelStart>=0 && sampleSelEnd>=0) {
|
if (sampleSelStart>=0 && sampleSelEnd>=0 && sampleSelStart!=sampleSelEnd) {
|
||||||
int start=sampleSelStart;
|
int start=sampleSelStart;
|
||||||
int end=sampleSelEnd;
|
int end=sampleSelEnd;
|
||||||
if (start>end) {
|
if (start>end) {
|
||||||
|
@ -384,6 +385,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
start^=end;
|
start^=end;
|
||||||
}
|
}
|
||||||
statusBar+=fmt::sprintf(" (%d-%d)",start,end);
|
statusBar+=fmt::sprintf(" (%d-%d)",start,end);
|
||||||
|
drawSelection=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +406,24 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (drawSelection) {
|
||||||
|
int start=sampleSelStart;
|
||||||
|
int end=sampleSelEnd;
|
||||||
|
if (start>end) {
|
||||||
|
start^=end;
|
||||||
|
end^=start;
|
||||||
|
start^=end;
|
||||||
|
}
|
||||||
|
ImDrawList* dl=ImGui::GetWindowDrawList();
|
||||||
|
ImVec2 p1=ImGui::GetItemRectMin();
|
||||||
|
p1.x+=start/sampleZoom-samplePos;
|
||||||
|
|
||||||
|
ImVec2 p2=ImVec2(ImGui::GetItemRectMin().x+end/sampleZoom-samplePos,ImGui::GetItemRectMax().y);
|
||||||
|
|
||||||
|
// TODO: color
|
||||||
|
dl->AddRectFilled(p1,p2,0xc0c0c0c0);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("%s",statusBar.c_str());
|
ImGui::Text("%s",statusBar.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue