mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 15:03:01 +00:00
GUI: improve wavetable editor, part 2
This commit is contained in:
parent
962dab012c
commit
191a0dedf9
3 changed files with 55 additions and 24 deletions
|
@ -4116,6 +4116,7 @@ bool FurnaceGUI::init() {
|
|||
|
||||
tempoView=e->getConfBool("tempoView",true);
|
||||
waveHex=e->getConfBool("waveHex",false);
|
||||
waveGenVisible=e->getConfBool("waveGenVisible",false);
|
||||
waveEditStyle=e->getConfInt("waveEditStyle",0);
|
||||
lockLayout=e->getConfBool("lockLayout",false);
|
||||
#ifdef IS_MOBILE
|
||||
|
@ -4360,6 +4361,7 @@ bool FurnaceGUI::finish() {
|
|||
|
||||
e->setConf("tempoView",tempoView);
|
||||
e->setConf("waveHex",waveHex);
|
||||
e->setConf("waveGenVisible",waveGenVisible);
|
||||
e->setConf("waveEditStyle",waveEditStyle);
|
||||
e->setConf("lockLayout",lockLayout);
|
||||
e->setConf("fullScreen",fullScreen);
|
||||
|
@ -4535,6 +4537,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
firstFrame(true),
|
||||
tempoView(true),
|
||||
waveHex(false),
|
||||
waveGenVisible(false),
|
||||
lockLayout(false),
|
||||
editOptsVisible(false),
|
||||
latchNibble(false),
|
||||
|
|
|
@ -1222,7 +1222,7 @@ class FurnaceGUI {
|
|||
|
||||
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
|
||||
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
|
||||
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
||||
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
|
||||
FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
|
||||
float peak[2];
|
||||
float patChanX[DIV_MAX_CHANS+1];
|
||||
|
|
|
@ -96,6 +96,11 @@ void FurnaceGUI::drawWaveEdit() {
|
|||
MARK_MODIFIED;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(waveGenVisible?(ICON_FA_CHEVRON_RIGHT "##WEWaveGen"):(ICON_FA_CHEVRON_LEFT "##WEWaveGen"))) {
|
||||
waveGenVisible=!waveGenVisible;
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
|
@ -105,31 +110,54 @@ void FurnaceGUI::drawWaveEdit() {
|
|||
}
|
||||
if (wave->len>0) wavePreview[wave->len]=wave->data[wave->len-1];
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f));
|
||||
if (ImGui::BeginTable("WEWaveSection",waveGenVisible?2:1)) {
|
||||
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch);
|
||||
if (waveGenVisible) ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed,250.0f*dpiScale);
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImVec2 contentRegion=ImGui::GetContentRegionAvail(); // wavetable graph size determined here
|
||||
contentRegion.y-=ImGui::GetFrameHeightWithSpacing()+ImGui::GetStyle().WindowPadding.y;
|
||||
/*if (ImGui::GetContentRegionAvail().y > (ImGui::GetContentRegionAvail().x / 2.0f)) {
|
||||
contentRegion=ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().x / 2.0f);
|
||||
}*/
|
||||
if (waveEditStyle) {
|
||||
PlotNoLerp("##Waveform",wavePreview,wave->len+1,0,NULL,0,wave->max,contentRegion);
|
||||
} else {
|
||||
PlotCustom("##Waveform",wavePreview,wave->len+1,0,NULL,0,wave->max,contentRegion,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,true);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f));
|
||||
|
||||
ImVec2 contentRegion=ImGui::GetContentRegionAvail(); // wavetable graph size determined here
|
||||
contentRegion.y-=ImGui::GetFrameHeightWithSpacing()+ImGui::GetStyle().WindowPadding.y;
|
||||
if (waveEditStyle) {
|
||||
PlotNoLerp("##Waveform",wavePreview,wave->len+1,0,NULL,0,wave->max,contentRegion);
|
||||
} else {
|
||||
PlotCustom("##Waveform",wavePreview,wave->len,0,NULL,0,wave->max,contentRegion,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,true);
|
||||
}
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
||||
waveDragStart=ImGui::GetItemRectMin();
|
||||
waveDragAreaSize=contentRegion;
|
||||
waveDragMin=0;
|
||||
waveDragMax=wave->max;
|
||||
waveDragLen=wave->len;
|
||||
waveDragActive=true;
|
||||
waveDragTarget=wave->data;
|
||||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||
e->notifyWaveChange(curWave);
|
||||
modified=true;
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
if (waveGenVisible) {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (ImGui::BeginTabBar("WaveGenOpt")) {
|
||||
if (ImGui::BeginTabItem("Shapes")) {
|
||||
ImGui::Button("Square");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("FM")) {
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Mangle")) {
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
||||
waveDragStart=ImGui::GetItemRectMin();
|
||||
waveDragAreaSize=contentRegion;
|
||||
waveDragMin=0;
|
||||
waveDragMax=wave->max;
|
||||
waveDragLen=wave->len;
|
||||
waveDragActive=true;
|
||||
waveDragTarget=wave->data;
|
||||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||
e->notifyWaveChange(curWave);
|
||||
modified=true;
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
if (ImGui::RadioButton("Dec",!waveHex)) {
|
||||
waveHex=false;
|
||||
|
|
Loading…
Reference in a new issue