mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-30 16:33:01 +00:00
GUI: work on chip manager
This commit is contained in:
parent
897a61db85
commit
be9385f701
3 changed files with 55 additions and 34 deletions
|
@ -4161,6 +4161,16 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GUI_WARN_SYSTEM_DEL:
|
||||||
|
if (ImGui::Button("Yes")) {
|
||||||
|
e->removeSystem(sysToDelete,preserveChanPos);
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("No")) {
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GUI_WARN_GENERIC:
|
case GUI_WARN_GENERIC:
|
||||||
if (ImGui::Button("OK")) {
|
if (ImGui::Button("OK")) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -4956,6 +4966,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
eventTimeEnd(0),
|
eventTimeEnd(0),
|
||||||
eventTimeDelta(0),
|
eventTimeDelta(0),
|
||||||
chanToMove(-1),
|
chanToMove(-1),
|
||||||
|
sysToMove(-1),
|
||||||
|
sysToDelete(-1),
|
||||||
transposeAmount(0),
|
transposeAmount(0),
|
||||||
randomizeMin(0),
|
randomizeMin(0),
|
||||||
randomizeMax(255),
|
randomizeMax(255),
|
||||||
|
|
|
@ -310,6 +310,7 @@ enum FurnaceGUIWarnings {
|
||||||
GUI_WARN_CLOSE_SETTINGS,
|
GUI_WARN_CLOSE_SETTINGS,
|
||||||
GUI_WARN_CLEAR,
|
GUI_WARN_CLEAR,
|
||||||
GUI_WARN_SUBSONG_DEL,
|
GUI_WARN_SUBSONG_DEL,
|
||||||
|
GUI_WARN_SYSTEM_DEL,
|
||||||
GUI_WARN_GENERIC
|
GUI_WARN_GENERIC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1433,7 +1434,7 @@ class FurnaceGUI {
|
||||||
int renderTimeBegin, renderTimeEnd, renderTimeDelta;
|
int renderTimeBegin, renderTimeEnd, renderTimeDelta;
|
||||||
int eventTimeBegin, eventTimeEnd, eventTimeDelta;
|
int eventTimeBegin, eventTimeEnd, eventTimeDelta;
|
||||||
|
|
||||||
int chanToMove;
|
int chanToMove, sysToMove, sysToDelete;
|
||||||
|
|
||||||
ImVec2 patWindowPos, patWindowSize;
|
ImVec2 patWindowPos, patWindowSize;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,9 @@
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "misc/cpp/imgui_stdlib.h"
|
#include "misc/cpp/imgui_stdlib.h"
|
||||||
#include "IconsFontAwesome4.h"
|
#include "IconsFontAwesome4.h"
|
||||||
|
#include <fmt/printf.h>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
static int _src, _dest;
|
|
||||||
static bool _preserveOrder;
|
|
||||||
|
|
||||||
void FurnaceGUI::drawSysManager() {
|
void FurnaceGUI::drawSysManager() {
|
||||||
if (nextWindow==GUI_WINDOW_SYS_MANAGER) {
|
if (nextWindow==GUI_WINDOW_SYS_MANAGER) {
|
||||||
sysManagerOpen=true;
|
sysManagerOpen=true;
|
||||||
|
@ -33,61 +31,71 @@ void FurnaceGUI::drawSysManager() {
|
||||||
}
|
}
|
||||||
if (!sysManagerOpen) return;
|
if (!sysManagerOpen) return;
|
||||||
if (ImGui::Begin("Chip Manager",&sysManagerOpen,globalWinFlags)) {
|
if (ImGui::Begin("Chip Manager",&sysManagerOpen,globalWinFlags)) {
|
||||||
ImGui::Text("Call swapSystem() with arguments:");
|
ImGui::Checkbox("Preserve channel order",&preserveChanPos);
|
||||||
ImGui::InputInt("src",&_src);
|
|
||||||
ImGui::InputInt("dest",&_dest);
|
|
||||||
ImGui::Checkbox("preserveOrder",&_preserveOrder);
|
|
||||||
if (ImGui::Button("Call")) {
|
|
||||||
if (!e->swapSystem(_src,_dest,_preserveOrder)) {
|
|
||||||
showError(e->getLastError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginTable("SystemList",3)) {
|
if (ImGui::BeginTable("SystemList",3)) {
|
||||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed,0.0);
|
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.0);
|
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch);
|
||||||
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthFixed,48.0f*dpiScale);
|
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("Visible");
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("Name");
|
ImGui::Text("Name");
|
||||||
for (int i=0; i<e->getTotalChannelCount(); i++) {
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("Actions");
|
||||||
|
for (unsigned char i=0; i<e->song.systemLen; i++) {
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Checkbox("##Visible",&e->curSubSong->chanShow[i]);
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button(ICON_FA_ARROWS)) {
|
if (ImGui::Button(ICON_FA_ARROWS)) {
|
||||||
}
|
}
|
||||||
if (ImGui::BeginDragDropSource()) {
|
if (ImGui::BeginDragDropSource()) {
|
||||||
chanToMove=i;
|
sysToMove=i;
|
||||||
ImGui::SetDragDropPayload("FUR_CHAN",NULL,0,ImGuiCond_Once);
|
ImGui::SetDragDropPayload("FUR_SYS",NULL,0,ImGuiCond_Once);
|
||||||
ImGui::Button(ICON_FA_ARROWS "##ChanDrag");
|
ImGui::Button(ICON_FA_ARROWS "##SysDrag");
|
||||||
ImGui::EndDragDropSource();
|
ImGui::EndDragDropSource();
|
||||||
} else if (ImGui::IsItemHovered()) {
|
} else if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("%s #%d\n(drag to swap channels)",e->getSystemName(e->sysOfChan[i]),e->dispatchChanOfChan[i]);
|
ImGui::SetTooltip("(drag to swap chips)");
|
||||||
}
|
}
|
||||||
if (ImGui::BeginDragDropTarget()) {
|
if (ImGui::BeginDragDropTarget()) {
|
||||||
const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_CHAN");
|
const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_SYS");
|
||||||
if (dragItem!=NULL) {
|
if (dragItem!=NULL) {
|
||||||
if (dragItem->IsDataType("FUR_CHAN")) {
|
if (dragItem->IsDataType("FUR_SYS")) {
|
||||||
if (chanToMove!=i && chanToMove>=0) {
|
if (sysToMove!=i && sysToMove>=0) {
|
||||||
e->swapChannelsP(chanToMove,i);
|
e->swapSystem(sysToMove,i,preserveChanPos);
|
||||||
}
|
}
|
||||||
chanToMove=-1;
|
sysToMove=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndDragDropTarget();
|
ImGui::EndDragDropTarget();
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSM%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {
|
||||||
ImGui::InputTextWithHint("##ChanName",e->getChannelName(i),&e->curSubSong->chanName[i]);
|
drawSysConf(i,e->song.system[i],e->song.systemFlags[i],true);
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::Button(ICON_FA_CHEVRON_DOWN "##SysChange");
|
||||||
ImGui::InputTextWithHint("##ChanShortName",e->getChannelShortName(i),&e->curSubSong->chanShortName[i]);
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Change");
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginDisabled(e->song.systemLen<=1);
|
||||||
|
if (ImGui::Button(ICON_FA_TIMES "##SysRemove")) {
|
||||||
|
sysToDelete=i;
|
||||||
|
showWarning("Are you sure you want to remove this chip?",GUI_WARN_SYSTEM_DEL);
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::SetTooltip("Remove");
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
if (e->song.systemLen<32) {
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Button(ICON_FA_PLUS "##SysAdd");
|
||||||
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue