GUI: add some oscilloscope settings
This commit is contained in:
parent
7bb0743598
commit
224d8e11e5
|
@ -779,6 +779,9 @@ class FurnaceGUI {
|
||||||
int titleBarSys;
|
int titleBarSys;
|
||||||
int frameBorders;
|
int frameBorders;
|
||||||
int effectDeletionAltersValue;
|
int effectDeletionAltersValue;
|
||||||
|
int oscRoundedCorners;
|
||||||
|
int oscTakesEntireWindow;
|
||||||
|
int oscBorder;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String patFontPath;
|
String patFontPath;
|
||||||
|
@ -839,6 +842,9 @@ class FurnaceGUI {
|
||||||
titleBarSys(1),
|
titleBarSys(1),
|
||||||
frameBorders(0),
|
frameBorders(0),
|
||||||
effectDeletionAltersValue(1),
|
effectDeletionAltersValue(1),
|
||||||
|
oscRoundedCorners(1),
|
||||||
|
oscTakesEntireWindow(0),
|
||||||
|
oscBorder(1),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
patFontPath(""),
|
patFontPath(""),
|
||||||
|
|
|
@ -73,9 +73,11 @@ void FurnaceGUI::drawOsc() {
|
||||||
}
|
}
|
||||||
if (!oscOpen) return;
|
if (!oscOpen) return;
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale));
|
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale));
|
||||||
/*ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0));
|
if (settings.oscTakesEntireWindow) {
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing,ImVec2(0,0));*/
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing,ImVec2(0,0));
|
||||||
|
}
|
||||||
if (ImGui::Begin("Oscilloscope",&oscOpen)) {
|
if (ImGui::Begin("Oscilloscope",&oscOpen)) {
|
||||||
if (oscZoomSlider) {
|
if (oscZoomSlider) {
|
||||||
if (ImGui::VSliderFloat("##OscZoom",ImVec2(20.0f*dpiScale,ImGui::GetContentRegionAvail().y),&oscZoom,0.5,2.0)) {
|
if (ImGui::VSliderFloat("##OscZoom",ImVec2(20.0f*dpiScale,ImGui::GetContentRegionAvail().y),&oscZoom,0.5,2.0)) {
|
||||||
|
@ -110,7 +112,7 @@ void FurnaceGUI::drawOsc() {
|
||||||
if (ImGui::ItemAdd(rect,ImGui::GetID("wsDisplay"))) {
|
if (ImGui::ItemAdd(rect,ImGui::GetID("wsDisplay"))) {
|
||||||
// https://github.com/ocornut/imgui/issues/3710
|
// https://github.com/ocornut/imgui/issues/3710
|
||||||
const int v0 = dl->VtxBuffer.Size;
|
const int v0 = dl->VtxBuffer.Size;
|
||||||
dl->AddRectFilled(inRect.Min,inRect.Max,0xffffffff,8.0f*dpiScale);
|
dl->AddRectFilled(inRect.Min,inRect.Max,0xffffffff,settings.oscRoundedCorners?(8.0f*dpiScale):0.0f);
|
||||||
const int v1 = dl->VtxBuffer.Size;
|
const int v1 = dl->VtxBuffer.Size;
|
||||||
|
|
||||||
for (int i=v0; i<v1; i++) {
|
for (int i=v0; i<v1; i++) {
|
||||||
|
@ -166,13 +168,17 @@ void FurnaceGUI::drawOsc() {
|
||||||
waveform[i]=ImLerp(rect.Min,rect.Max,ImVec2(x,0.5f-y));
|
waveform[i]=ImLerp(rect.Min,rect.Max,ImVec2(x,0.5f-y));
|
||||||
}
|
}
|
||||||
dl->AddPolyline(waveform,512,color,ImDrawFlags_None,dpiScale);
|
dl->AddPolyline(waveform,512,color,ImDrawFlags_None,dpiScale);
|
||||||
dl->AddRect(rect.Min,rect.Max,borderColor,8.0f*dpiScale,0,2.0f*dpiScale);
|
if (settings.oscBorder) {
|
||||||
|
dl->AddRect(inRect.Min,inRect.Max,borderColor,settings.oscRoundedCorners?(8.0f*dpiScale):0.0f,0,1.5f*dpiScale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
||||||
oscZoomSlider=!oscZoomSlider;
|
oscZoomSlider=!oscZoomSlider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ImGui::PopStyleVar(3);
|
if (settings.oscTakesEntireWindow) {
|
||||||
|
ImGui::PopStyleVar(3);
|
||||||
|
}
|
||||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_OSCILLOSCOPE;
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_OSCILLOSCOPE;
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
|
@ -896,6 +896,25 @@ void FurnaceGUI::drawSettings() {
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
ImGui::Text("Oscilloscope settings:");
|
||||||
|
|
||||||
|
bool oscRoundedCornersB=settings.oscRoundedCorners;
|
||||||
|
if (ImGui::Checkbox("Rounded corners",&oscRoundedCornersB)) {
|
||||||
|
settings.oscRoundedCorners=oscRoundedCornersB;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oscTakesEntireWindowB=settings.oscTakesEntireWindow;
|
||||||
|
if (ImGui::Checkbox("Fill entire window",&oscTakesEntireWindowB)) {
|
||||||
|
settings.oscTakesEntireWindow=oscTakesEntireWindowB;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oscBorderB=settings.oscBorder;
|
||||||
|
if (ImGui::Checkbox("Border",&oscBorderB)) {
|
||||||
|
settings.oscBorder=oscBorderB;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
if (ImGui::TreeNode("Color scheme")) {
|
if (ImGui::TreeNode("Color scheme")) {
|
||||||
if (ImGui::Button("Import")) {
|
if (ImGui::Button("Import")) {
|
||||||
openFileDialog(GUI_FILE_IMPORT_COLORS);
|
openFileDialog(GUI_FILE_IMPORT_COLORS);
|
||||||
|
@ -1486,6 +1505,9 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.titleBarSys=e->getConfInt("titleBarSys",1);
|
settings.titleBarSys=e->getConfInt("titleBarSys",1);
|
||||||
settings.frameBorders=e->getConfInt("frameBorders",0);
|
settings.frameBorders=e->getConfInt("frameBorders",0);
|
||||||
settings.effectDeletionAltersValue=e->getConfInt("effectDeletionAltersValue",1);
|
settings.effectDeletionAltersValue=e->getConfInt("effectDeletionAltersValue",1);
|
||||||
|
settings.oscRoundedCorners=e->getConfInt("oscRoundedCorners",1);
|
||||||
|
settings.oscTakesEntireWindow=e->getConfInt("oscTakesEntireWindow",0);
|
||||||
|
settings.oscBorder=e->getConfInt("oscBorder",1);
|
||||||
|
|
||||||
clampSetting(settings.mainFontSize,2,96);
|
clampSetting(settings.mainFontSize,2,96);
|
||||||
clampSetting(settings.patFontSize,2,96);
|
clampSetting(settings.patFontSize,2,96);
|
||||||
|
@ -1613,6 +1635,9 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("titleBarSys",settings.titleBarSys);
|
e->setConf("titleBarSys",settings.titleBarSys);
|
||||||
e->setConf("frameBorders",settings.frameBorders);
|
e->setConf("frameBorders",settings.frameBorders);
|
||||||
e->setConf("effectDeletionAltersValue",settings.effectDeletionAltersValue);
|
e->setConf("effectDeletionAltersValue",settings.effectDeletionAltersValue);
|
||||||
|
e->setConf("oscRoundedCorners",settings.oscRoundedCorners);
|
||||||
|
e->setConf("oscTakesEntireWindow",settings.oscTakesEntireWindow);
|
||||||
|
e->setConf("oscBorder",settings.oscBorder);
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||||
|
|
Loading…
Reference in a new issue