GUI: early mobile UI
This commit is contained in:
parent
e1bd5b03f3
commit
51d09ba407
2
TODO.md
2
TODO.md
|
@ -1,6 +1,6 @@
|
||||||
# to-do for 0.6pre1
|
# to-do for 0.6pre1
|
||||||
|
|
||||||
- finish ExtCh on OPN/OPNA
|
- finish ExtCh on OPNA
|
||||||
- RF5C68 system
|
- RF5C68 system
|
||||||
- ZX beeper system overlay percussion
|
- ZX beeper system overlay percussion
|
||||||
- ADPCM chips
|
- ADPCM chips
|
||||||
|
|
|
@ -2206,6 +2206,21 @@ void FurnaceGUI::editOptions(bool topMenu) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::toggleMobileUI(bool enable, bool force) {
|
||||||
|
if (mobileUI!=enable || force) {
|
||||||
|
if (!mobileUI && enable) {
|
||||||
|
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
||||||
|
}
|
||||||
|
mobileUI=enable;
|
||||||
|
if (mobileUI) {
|
||||||
|
ImGui::GetIO().IniFilename=NULL;
|
||||||
|
} else {
|
||||||
|
ImGui::GetIO().IniFilename=finalLayoutPath;
|
||||||
|
ImGui::LoadIniSettingsFromDisk(finalLayoutPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int _processEvent(void* instance, SDL_Event* event) {
|
int _processEvent(void* instance, SDL_Event* event) {
|
||||||
return ((FurnaceGUI*)instance)->processEvent(event);
|
return ((FurnaceGUI*)instance)->processEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -2711,6 +2726,7 @@ bool FurnaceGUI::loop() {
|
||||||
curWindow=GUI_WINDOW_NOTHING;
|
curWindow=GUI_WINDOW_NOTHING;
|
||||||
editOptsVisible=false;
|
editOptsVisible=false;
|
||||||
|
|
||||||
|
if (!mobileUI) {
|
||||||
ImGui::BeginMainMenuBar();
|
ImGui::BeginMainMenuBar();
|
||||||
if (ImGui::BeginMenu("file")) {
|
if (ImGui::BeginMenu("file")) {
|
||||||
if (ImGui::MenuItem("new...")) {
|
if (ImGui::MenuItem("new...")) {
|
||||||
|
@ -2867,11 +2883,11 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("settings")) {
|
if (ImGui::BeginMenu("settings")) {
|
||||||
#ifndef IS_MOBILE
|
#ifndef IS_MOBILE
|
||||||
if (ImGui::MenuItem("full screen",BIND_FOR(GUI_ACTION_FULLSCREEN),fullScreen)) {
|
if (ImGui::MenuItem("full screen",BIND_FOR(GUI_ACTION_FULLSCREEN),fullScreen)) {
|
||||||
doAction(GUI_ACTION_FULLSCREEN);
|
doAction(GUI_ACTION_FULLSCREEN);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ImGui::MenuItem("lock layout (not working!)",NULL,lockLayout)) {
|
if (ImGui::MenuItem("lock layout (not working!)",NULL,lockLayout)) {
|
||||||
lockLayout=!lockLayout;
|
lockLayout=!lockLayout;
|
||||||
}
|
}
|
||||||
|
@ -2995,9 +3011,49 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui::Text("| modified");
|
ImGui::Text("| modified");
|
||||||
}
|
}
|
||||||
ImGui::EndMainMenuBar();
|
ImGui::EndMainMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mobileUI) {
|
||||||
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
|
ImGui::DockSpaceOverViewport(NULL,lockLayout?(ImGuiDockNodeFlags_NoResize|ImGuiDockNodeFlags_NoCloseButton|ImGuiDockNodeFlags_NoDocking|ImGuiDockNodeFlags_NoDockingSplitMe|ImGuiDockNodeFlags_NoDockingSplitOther):0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobileUI) {
|
||||||
|
ImGuiViewport* mainView=ImGui::GetMainViewport();
|
||||||
|
ImGui::SetNextWindowPos(mainView->Pos);
|
||||||
|
ImGui::SetNextWindowSize(mainView->Size);
|
||||||
|
ImGui::SetNextWindowViewport(mainView->ID);
|
||||||
|
ImGuiID dockID=ImGui::GetID("MobileUISpace");
|
||||||
|
ImGuiWindowFlags muiFlags=ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoBringToFrontOnFocus|ImGuiWindowFlags_NoNavFocus;
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
|
ImGui::Begin("MobileUI",NULL,muiFlags);
|
||||||
|
ImGui::PopStyleVar(3);
|
||||||
|
if (ImGui::DockBuilderGetNode(dockID)==NULL) {
|
||||||
|
ImGui::DockBuilderRemoveNode(dockID);
|
||||||
|
ImGuiID dn=ImGui::DockBuilderAddNode(dockID);
|
||||||
|
ImGuiID upper, lower, left, right;
|
||||||
|
ImGui::DockBuilderSplitNode(dn,ImGuiDir_Left,0.1f,&left,&right);
|
||||||
|
ImGui::DockBuilderSplitNode(right,ImGuiDir_Down,0.2f,&lower,&upper);
|
||||||
|
ImGui::DockBuilderDockWindow("Mobile Controls",left);
|
||||||
|
ImGui::DockBuilderDockWindow("Pattern",upper);
|
||||||
|
ImGui::DockBuilderDockWindow("Piano",lower);
|
||||||
|
ImGui::DockBuilderFinish(dn);
|
||||||
|
}
|
||||||
|
ImGui::DockSpace(dockID);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
if (ImGui::Begin("Mobile Controls")) {
|
||||||
|
ImGui::Text("Hi!");
|
||||||
|
if (ImGui::Button("Get me out of here")) {
|
||||||
|
toggleMobileUI(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
drawPattern();
|
||||||
|
drawPiano();
|
||||||
|
} else {
|
||||||
drawSubSongs();
|
drawSubSongs();
|
||||||
drawPattern();
|
drawPattern();
|
||||||
drawEditControls();
|
drawEditControls();
|
||||||
|
@ -3026,6 +3082,7 @@ bool FurnaceGUI::loop() {
|
||||||
drawRegView();
|
drawRegView();
|
||||||
drawLog();
|
drawLog();
|
||||||
drawEffectList();
|
drawEffectList();
|
||||||
|
}
|
||||||
|
|
||||||
if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen);
|
if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen);
|
||||||
|
|
||||||
|
@ -3543,9 +3600,11 @@ bool FurnaceGUI::loop() {
|
||||||
case GUI_WARN_RESET_LAYOUT:
|
case GUI_WARN_RESET_LAYOUT:
|
||||||
if (ImGui::Button("Yes")) {
|
if (ImGui::Button("Yes")) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
if (!mobileUI) {
|
||||||
ImGui::LoadIniSettingsFromMemory(defaultLayout);
|
ImGui::LoadIniSettingsFromMemory(defaultLayout);
|
||||||
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("No")) {
|
if (ImGui::Button("No")) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -3943,8 +4002,7 @@ bool FurnaceGUI::init() {
|
||||||
prepareLayout();
|
prepareLayout();
|
||||||
|
|
||||||
ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_DockingEnable;
|
ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_DockingEnable;
|
||||||
ImGui::GetIO().IniFilename=finalLayoutPath;
|
toggleMobileUI(mobileUI,true);
|
||||||
ImGui::LoadIniSettingsFromDisk(finalLayoutPath);
|
|
||||||
|
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
|
||||||
|
@ -3972,7 +4030,9 @@ bool FurnaceGUI::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::finish() {
|
bool FurnaceGUI::finish() {
|
||||||
|
if (!mobileUI) {
|
||||||
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
||||||
|
}
|
||||||
ImGui_ImplSDLRenderer_Shutdown();
|
ImGui_ImplSDLRenderer_Shutdown();
|
||||||
ImGui_ImplSDL2_Shutdown();
|
ImGui_ImplSDL2_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
|
|
|
@ -806,7 +806,7 @@ class FurnaceGUI {
|
||||||
|
|
||||||
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile;
|
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile;
|
||||||
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport, workingDirVGMExport, workingDirFont, workingDirColors, workingDirKeybinds, workingDirLayout, workingDirROM;
|
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport, workingDirVGMExport, workingDirFont, workingDirColors, workingDirKeybinds, workingDirLayout, workingDirROM;
|
||||||
String mmlString[17];
|
String mmlString[32];
|
||||||
String mmlStringW;
|
String mmlStringW;
|
||||||
|
|
||||||
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||||
|
@ -1264,6 +1264,8 @@ class FurnaceGUI {
|
||||||
void actualWaveList();
|
void actualWaveList();
|
||||||
void actualSampleList();
|
void actualSampleList();
|
||||||
|
|
||||||
|
void toggleMobileUI(bool enable, bool force=false);
|
||||||
|
|
||||||
void drawEditControls();
|
void drawEditControls();
|
||||||
void drawSongInfo();
|
void drawSongInfo();
|
||||||
void drawOrders();
|
void drawOrders();
|
||||||
|
|
|
@ -1139,13 +1139,6 @@ void FurnaceGUI::drawSettings() {
|
||||||
settings.oplStandardWaveNames=oplStandardWaveNamesB;
|
settings.oplStandardWaveNames=oplStandardWaveNamesB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonLatchNibble) {
|
|
||||||
bool hiddenSystemsB=settings.hiddenSystems;
|
|
||||||
if (ImGui::Checkbox(":smile: :star_struck: :sunglasses: :ok_hand:",&hiddenSystemsB)) {
|
|
||||||
settings.hiddenSystems=hiddenSystemsB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool overflowHighlightB=settings.overflowHighlight;
|
bool overflowHighlightB=settings.overflowHighlight;
|
||||||
if (ImGui::Checkbox("Overflow pattern highlights",&overflowHighlightB)) {
|
if (ImGui::Checkbox("Overflow pattern highlights",&overflowHighlightB)) {
|
||||||
settings.overflowHighlight=overflowHighlightB;
|
settings.overflowHighlight=overflowHighlightB;
|
||||||
|
@ -1799,6 +1792,47 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
if (nonLatchNibble) {
|
||||||
|
// ok, so you decided to read the code.
|
||||||
|
// these are the cheat codes:
|
||||||
|
// "Debug" - toggles mobile UI
|
||||||
|
// "Nice Amiga cover of the song!" - enables hidden systems (YMU759/SoundUnit/Dummy)
|
||||||
|
if (ImGui::BeginTabItem("Cheat Codes")) {
|
||||||
|
ImVec2 settingsViewSize=ImGui::GetContentRegionAvail();
|
||||||
|
settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y;
|
||||||
|
if (ImGui::BeginChild("SettingsView",settingsViewSize)) {
|
||||||
|
ImGui::Text("Enter code:");
|
||||||
|
ImGui::InputText("##CheatCode",&mmlString[31]);
|
||||||
|
if (ImGui::Button("Submit")) {
|
||||||
|
unsigned int checker=0x11111111;
|
||||||
|
unsigned int checker1=0;
|
||||||
|
int index=0;
|
||||||
|
mmlString[30]="invalid code";
|
||||||
|
|
||||||
|
for (char& i: mmlString[31]) {
|
||||||
|
checker^=((unsigned int)i)<<index;
|
||||||
|
checker1+=i;
|
||||||
|
checker=(checker>>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31);
|
||||||
|
checker1<<=1;
|
||||||
|
index=(index+1)&31;
|
||||||
|
}
|
||||||
|
if (checker==0x90888b65 && checker1==0x1482) {
|
||||||
|
mmlString[30]="toggled alternate UI";
|
||||||
|
toggleMobileUI(!mobileUI);
|
||||||
|
}
|
||||||
|
if (checker==0x5a42a113 && checker1==0xe4ef451e) {
|
||||||
|
mmlString[30]=":smile: :star_struck: :sunglasses: :ok_hand:";
|
||||||
|
settings.hiddenSystems=!settings.hiddenSystems;
|
||||||
|
}
|
||||||
|
|
||||||
|
mmlString[31]="";
|
||||||
|
}
|
||||||
|
ImGui::Text("%s",mmlString[30].c_str());
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
@ -2292,6 +2326,10 @@ bool FurnaceGUI::exportKeybinds(String path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::importLayout(String path) {
|
bool FurnaceGUI::importLayout(String path) {
|
||||||
|
if (mobileUI) {
|
||||||
|
logW("but you are on the mobile UI!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
FILE* f=ps_fopen(path.c_str(),"rb");
|
FILE* f=ps_fopen(path.c_str(),"rb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
logW("error while opening keybind file for import: %s",strerror(errno));
|
logW("error while opening keybind file for import: %s",strerror(errno));
|
||||||
|
@ -2338,6 +2376,10 @@ bool FurnaceGUI::importLayout(String path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::exportLayout(String path) {
|
bool FurnaceGUI::exportLayout(String path) {
|
||||||
|
if (mobileUI) {
|
||||||
|
logW("but you are on the mobile UI!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
FILE* f=ps_fopen(path.c_str(),"wb");
|
FILE* f=ps_fopen(path.c_str(),"wb");
|
||||||
if (f==NULL) {
|
if (f==NULL) {
|
||||||
logW("error while opening layout file for export: %s",strerror(errno));
|
logW("error while opening layout file for export: %s",strerror(errno));
|
||||||
|
|
|
@ -42,16 +42,19 @@ void FurnaceGUI::drawSongInfo() {
|
||||||
if (ImGui::InputText("##Name",&e->song.name)) { MARK_MODIFIED
|
if (ImGui::InputText("##Name",&e->song.name)) { MARK_MODIFIED
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
}
|
}
|
||||||
if (e->song.name.size()==27) {
|
if (e->song.insLen==2) {
|
||||||
unsigned int checker=0x11111111;
|
unsigned int checker=0x11111111;
|
||||||
unsigned int checker1=0;
|
unsigned int checker1=0;
|
||||||
for (int i=0; i<27; i++) {
|
DivInstrument* ins=e->getIns(1);
|
||||||
checker^=e->song.name[i]<<i;
|
if (ins->name.size()==15 && e->curSubSong->ordersLen==8) {
|
||||||
checker1+=e->song.name[i];
|
for (int i=0; i<15; i++) {
|
||||||
|
checker^=ins->name[i]<<i;
|
||||||
|
checker1+=ins->name[i];
|
||||||
checker=(checker>>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31);
|
checker=(checker>>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31);
|
||||||
checker1<<=1;
|
checker1<<=1;
|
||||||
}
|
}
|
||||||
if (checker==0x94ffb4f7 && checker1==0x801c68a6) nonLatchNibble=true;
|
if (checker==0x5ec4497d && checker1==0x6347ee) nonLatchNibble=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
Loading…
Reference in a new issue