mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 15:03:01 +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";
|
||||
bool drawSelection=false;
|
||||
|
||||
if (!sampleDragMode) {
|
||||
if (sampleSelStart>=0 && sampleSelEnd>=0) {
|
||||
if (sampleSelStart>=0 && sampleSelEnd>=0 && sampleSelStart!=sampleSelEnd) {
|
||||
int start=sampleSelStart;
|
||||
int end=sampleSelEnd;
|
||||
if (start>end) {
|
||||
|
@ -384,6 +385,7 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
start^=end;
|
||||
}
|
||||
statusBar+=fmt::sprintf(" (%d-%d)",start,end);
|
||||
drawSelection=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,6 +405,24 @@ void FurnaceGUI::drawSampleEdit() {
|
|||
statusBar+=fmt::sprintf(" | (%d, %d)",posX,posY);
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue