GUI: better presets organization
to-do: - fix system detection - fix search
This commit is contained in:
parent
02bddfb894
commit
db45b0d7d7
|
@ -2549,7 +2549,7 @@ class FurnaceGUI {
|
||||||
void waveListItem(int index, float* wavePreview, int dir, int asset);
|
void waveListItem(int index, float* wavePreview, int dir, int asset);
|
||||||
void sampleListItem(int index, int dir, int asset);
|
void sampleListItem(int index, int dir, int asset);
|
||||||
|
|
||||||
void drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted);
|
void drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted, std::vector<int>& sysDefStack);
|
||||||
|
|
||||||
void toggleMobileUI(bool enable, bool force=false);
|
void toggleMobileUI(bool enable, bool force=false);
|
||||||
|
|
||||||
|
|
|
@ -22,24 +22,44 @@
|
||||||
#include <fmt/printf.h>
|
#include <fmt/printf.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void FurnaceGUI::drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted) {
|
String sysDefID;
|
||||||
|
|
||||||
|
void FurnaceGUI::drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& accepted, std::vector<int>& sysDefStack) {
|
||||||
|
int index=0;
|
||||||
|
String sysDefIDLeader="##NS";
|
||||||
|
for (int i: sysDefStack) {
|
||||||
|
sysDefIDLeader+=fmt::sprintf("/%d",i);
|
||||||
|
}
|
||||||
for (FurnaceGUISysDef& i: category) {
|
for (FurnaceGUISysDef& i: category) {
|
||||||
bool treeNode=false;
|
bool treeNode=false;
|
||||||
bool isHovered=false;
|
bool isHovered=false;
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (!i.subDefs.empty()) {
|
if (!i.subDefs.empty()) {
|
||||||
treeNode=ImGui::TreeNode("##TreeShit");
|
if (i.orig.empty()) {
|
||||||
|
sysDefID=fmt::sprintf("%s%s/%dS",i.name,sysDefIDLeader,index);
|
||||||
|
} else {
|
||||||
|
sysDefID=fmt::sprintf("%s/%dS",sysDefIDLeader,index);
|
||||||
|
}
|
||||||
|
treeNode=ImGui::TreeNode(sysDefID.c_str());
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
if (ImGui::Selectable(i.name,false,ImGuiSelectableFlags_DontClosePopups)) {
|
if (!i.orig.empty()) {
|
||||||
nextDesc=i.definition;
|
sysDefID=fmt::sprintf("%s%s/%d",i.name,sysDefIDLeader,index);
|
||||||
nextDescName=i.name;
|
if (ImGui::Selectable(sysDefID.c_str(),false,ImGuiSelectableFlags_DontClosePopups)) {
|
||||||
accepted=true;
|
nextDesc=i.definition;
|
||||||
|
nextDescName=i.name;
|
||||||
|
accepted=true;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) isHovered=true;
|
||||||
|
} else if (i.subDefs.empty()) {
|
||||||
|
ImGui::TextUnformatted(i.name);
|
||||||
|
if (ImGui::IsItemHovered()) isHovered=true;
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) isHovered=true;
|
|
||||||
if (treeNode) {
|
if (treeNode) {
|
||||||
drawSysDefs(i.subDefs,accepted);
|
sysDefStack.push_back(index);
|
||||||
|
drawSysDefs(i.subDefs,accepted,sysDefStack);
|
||||||
|
sysDefStack.erase(sysDefStack.end()-1);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
|
@ -69,11 +89,13 @@ void FurnaceGUI::drawSysDefs(std::vector<FurnaceGUISysDef>& category, bool& acce
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::drawNewSong() {
|
void FurnaceGUI::drawNewSong() {
|
||||||
bool accepted=false;
|
bool accepted=false;
|
||||||
|
std::vector<int> sysDefStack;
|
||||||
|
|
||||||
ImGui::PushFont(bigFont);
|
ImGui::PushFont(bigFont);
|
||||||
ImGui::SetCursorPosX((ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize("Choose a System!").x)*0.5);
|
ImGui::SetCursorPosX((ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize("Choose a System!").x)*0.5);
|
||||||
|
@ -155,7 +177,9 @@ void FurnaceGUI::drawNewSong() {
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::BeginTable("Systems",1,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollY)) {
|
if (ImGui::BeginTable("Systems",1,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollY)) {
|
||||||
std::vector<FurnaceGUISysDef>& category=(newSongQuery.empty())?(sysCategories[newSongCategory].systems):(newSongSearchResults);
|
std::vector<FurnaceGUISysDef>& category=(newSongQuery.empty())?(sysCategories[newSongCategory].systems):(newSongSearchResults);
|
||||||
drawSysDefs(category,accepted);
|
sysDefStack.push_back(newSongQuery.empty()?newSongCategory:-1);
|
||||||
|
drawSysDefs(category,accepted,sysDefStack);
|
||||||
|
sysDefStack.erase(sysDefStack.end()-1);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -469,7 +469,10 @@ void FurnaceGUI::drawPattern() {
|
||||||
nextAddScroll=0.0f;
|
nextAddScroll=0.0f;
|
||||||
}
|
}
|
||||||
ImDrawList* tdl=NULL;
|
ImDrawList* tdl=NULL;
|
||||||
if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea|((settings.cursorFollowsWheel || wheelCalmDown)?ImGuiTableFlags_NoScrollWithMouse:0))) {
|
|
||||||
|
if (chans<1) {
|
||||||
|
ImGui::Text("there aren't any channels to show.");
|
||||||
|
} else if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea|((settings.cursorFollowsWheel || wheelCalmDown)?ImGuiTableFlags_NoScrollWithMouse:0))) {
|
||||||
ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed);
|
||||||
char chanID[2048];
|
char chanID[2048];
|
||||||
float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale);
|
float lineHeight=(ImGui::GetTextLineHeight()+2*dpiScale);
|
||||||
|
|
4371
src/gui/presets.cpp
4371
src/gui/presets.cpp
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue