2022-03-21 22:34:43 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
2023-01-20 00:18:40 +00:00
|
|
|
* Copyright (C) 2021-2023 tildearrow and contributors
|
2022-03-21 22:34:43 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2022-12-15 04:38:38 +00:00
|
|
|
#define _USE_MATH_DEFINES
|
2022-03-21 22:34:43 +00:00
|
|
|
#include "gui.h"
|
|
|
|
#include "IconsFontAwesome4.h"
|
2022-12-09 23:47:49 +00:00
|
|
|
#include <fmt/printf.h>
|
|
|
|
|
|
|
|
// 0: all directions
|
|
|
|
// 1: half
|
2022-12-11 09:03:22 +00:00
|
|
|
// 2: half
|
|
|
|
// 3: quarter
|
2022-12-11 17:36:41 +00:00
|
|
|
const float mobileButtonAngles[4][8]={
|
2022-12-09 23:47:49 +00:00
|
|
|
{0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875},
|
2022-12-11 09:03:22 +00:00
|
|
|
{0.8333, 0.0, 0.1667, 0.8, 0.9, 0.0, 0.1, 0.2},
|
|
|
|
{0.0833, 0.25, 0.4167, 0.45, 0.35, 0.25, 0.15, 0.05},
|
|
|
|
{0.25, 0.125, 0.0, 0.25, 0.1875, 0.125, 0.0625, 0.0}
|
2022-12-09 23:47:49 +00:00
|
|
|
};
|
|
|
|
|
2022-12-11 17:36:41 +00:00
|
|
|
const float mobileButtonDistances[4][8]={
|
2022-12-09 23:47:49 +00:00
|
|
|
{1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0},
|
2022-12-11 09:03:22 +00:00
|
|
|
{0.8, 0.75, 0.8, 1.5, 1.5, 1.5, 1.5, 1.5},
|
|
|
|
{0.8, 0.75, 0.8, 1.5, 1.5, 1.5, 1.5, 1.5},
|
|
|
|
{0.9, 1.0, 0.9, 1.78, 1.82, 1.95, 1.82, 1.78}
|
2022-12-09 23:47:49 +00:00
|
|
|
};
|
2022-03-21 22:34:43 +00:00
|
|
|
|
2022-12-11 17:36:41 +00:00
|
|
|
const char* mobileButtonLabels[32]={
|
|
|
|
// page 1
|
|
|
|
"cut",
|
|
|
|
"copy",
|
|
|
|
"paste",
|
|
|
|
"delete",
|
|
|
|
"select\nall",
|
|
|
|
"piano",
|
|
|
|
"undo",
|
|
|
|
"redo",
|
|
|
|
|
|
|
|
// page 2
|
|
|
|
"paste\nmix",
|
|
|
|
"paste\nmix bg",
|
|
|
|
"paste\nins",
|
|
|
|
"paste\nins bg",
|
|
|
|
"paste\nflood",
|
|
|
|
"paste\noverflow",
|
|
|
|
"transpose\nnotes",
|
|
|
|
"transpose\nvalues",
|
|
|
|
|
|
|
|
// page 3
|
|
|
|
"change\nins",
|
|
|
|
"find/\nreplace",
|
|
|
|
"collapse",
|
|
|
|
"expand",
|
|
|
|
"flip",
|
|
|
|
"invert",
|
|
|
|
"interpolate",
|
|
|
|
"scale",
|
|
|
|
|
|
|
|
// page 4
|
|
|
|
"fade",
|
|
|
|
"randomize",
|
|
|
|
"opmask",
|
|
|
|
"scroll\nmode",
|
|
|
|
"input\nlatch",
|
|
|
|
"set\nlatch",
|
|
|
|
"clear\nlatch",
|
|
|
|
"clear"
|
|
|
|
};
|
|
|
|
|
|
|
|
const int mobileButtonActions[32]={
|
|
|
|
// page 1
|
|
|
|
GUI_ACTION_PAT_CUT,
|
|
|
|
GUI_ACTION_PAT_COPY,
|
|
|
|
GUI_ACTION_PAT_PASTE,
|
|
|
|
GUI_ACTION_PAT_DELETE,
|
|
|
|
GUI_ACTION_PAT_SELECT_ALL,
|
2023-02-20 00:11:31 +00:00
|
|
|
GUI_ACTION_WINDOW_PIANO,
|
2022-12-11 17:36:41 +00:00
|
|
|
GUI_ACTION_UNDO,
|
|
|
|
GUI_ACTION_REDO,
|
|
|
|
|
|
|
|
// page 2
|
|
|
|
GUI_ACTION_PAT_PASTE_MIX,
|
|
|
|
GUI_ACTION_PAT_PASTE_MIX_BG,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
GUI_ACTION_PAT_PASTE_FLOOD,
|
|
|
|
GUI_ACTION_PAT_PASTE_OVERFLOW,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
// page 3
|
|
|
|
0,
|
|
|
|
GUI_ACTION_WINDOW_FIND,
|
|
|
|
GUI_ACTION_PAT_COLLAPSE_ROWS,
|
|
|
|
GUI_ACTION_PAT_EXPAND_ROWS,
|
|
|
|
GUI_ACTION_PAT_FLIP_SELECTION,
|
|
|
|
GUI_ACTION_PAT_INVERT_VALUES,
|
|
|
|
GUI_ACTION_PAT_INTERPOLATE,
|
|
|
|
0,
|
|
|
|
|
|
|
|
// page 4
|
|
|
|
GUI_ACTION_PAT_FADE,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
GUI_ACTION_PAT_SCROLL_MODE,
|
|
|
|
0,
|
|
|
|
GUI_ACTION_PAT_LATCH,
|
|
|
|
GUI_ACTION_PAT_CLEAR_LATCH,
|
|
|
|
GUI_ACTION_CLEAR
|
|
|
|
};
|
|
|
|
|
|
|
|
const bool mobileButtonPersist[32]={
|
|
|
|
// page 1
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
|
|
|
|
// page 2
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
|
|
|
|
// page 3
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
|
|
|
|
// page 4
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
};
|
|
|
|
|
2022-05-19 03:49:21 +00:00
|
|
|
void FurnaceGUI::drawMobileControls() {
|
2022-09-09 00:15:19 +00:00
|
|
|
float timeScale=1.0f/(60.0f*ImGui::GetIO().DeltaTime);
|
2022-12-04 22:19:21 +00:00
|
|
|
if (dragMobileMenu) {
|
|
|
|
if (portrait) {
|
|
|
|
mobileMenuPos=(dragMobileMenuOrigin.y-ImGui::GetMousePos().y)/(canvasH*0.65);
|
2022-09-09 00:15:19 +00:00
|
|
|
} else {
|
2022-12-04 22:19:21 +00:00
|
|
|
mobileMenuPos=(ImGui::GetMousePos().x-dragMobileMenuOrigin.x)/(canvasW*0.65);
|
2022-09-09 00:15:19 +00:00
|
|
|
}
|
2022-12-04 22:19:21 +00:00
|
|
|
if (mobileMenuPos<0.0f) mobileMenuPos=0.0f;
|
|
|
|
if (mobileMenuPos>1.0f) mobileMenuPos=1.0f;
|
2022-09-09 00:15:19 +00:00
|
|
|
} else {
|
2022-12-04 22:19:21 +00:00
|
|
|
if (mobileMenuOpen) {
|
|
|
|
if (mobileMenuPos<0.999f) {
|
|
|
|
WAKE_UP;
|
|
|
|
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
|
|
|
|
} else {
|
|
|
|
mobileMenuPos=1.0f;
|
|
|
|
}
|
2022-09-09 00:15:19 +00:00
|
|
|
} else {
|
2022-12-04 22:19:21 +00:00
|
|
|
if (mobileMenuPos>0.001f) {
|
|
|
|
WAKE_UP;
|
|
|
|
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale;
|
|
|
|
} else {
|
|
|
|
mobileMenuPos=0.0f;
|
|
|
|
}
|
2022-09-09 00:15:19 +00:00
|
|
|
}
|
|
|
|
}
|
2022-12-08 23:04:18 +00:00
|
|
|
|
2022-12-07 03:40:23 +00:00
|
|
|
if (dragMobileEditButton) {
|
2022-12-08 23:04:18 +00:00
|
|
|
if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr) {
|
|
|
|
mobileEditButtonPos.x=((ImGui::GetMousePos().x/canvasW)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasW);
|
|
|
|
mobileEditButtonPos.y=((ImGui::GetMousePos().y/canvasH)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasH);
|
|
|
|
}
|
2022-12-07 03:40:23 +00:00
|
|
|
}
|
2022-12-08 23:04:18 +00:00
|
|
|
|
2022-12-07 03:40:23 +00:00
|
|
|
if (mobileEditButtonPos.x<0) mobileEditButtonPos.x=0;
|
|
|
|
if (mobileEditButtonPos.x>1) mobileEditButtonPos.x=1;
|
|
|
|
if (mobileEditButtonPos.y<0) mobileEditButtonPos.y=0;
|
|
|
|
if (mobileEditButtonPos.y>1) mobileEditButtonPos.y=1;
|
2022-12-08 23:04:18 +00:00
|
|
|
|
|
|
|
if (mobileEdit) {
|
2022-12-11 00:24:32 +00:00
|
|
|
mobileEditAnim+=ImGui::GetIO().DeltaTime*2.4;
|
2022-12-09 23:47:49 +00:00
|
|
|
if (mobileEditAnim>1.0f) {
|
|
|
|
mobileEditAnim=1.0f;
|
|
|
|
} else {
|
|
|
|
WAKE_UP;
|
|
|
|
}
|
2022-12-08 23:04:18 +00:00
|
|
|
} else {
|
2022-12-11 00:24:32 +00:00
|
|
|
mobileEditAnim-=ImGui::GetIO().DeltaTime*2.4;
|
2022-12-09 23:47:49 +00:00
|
|
|
if (mobileEditAnim<0.0f) {
|
|
|
|
mobileEditAnim=0.0f;
|
|
|
|
} else {
|
|
|
|
WAKE_UP;
|
|
|
|
}
|
2022-12-08 23:04:18 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
if (curWindowLast==GUI_WINDOW_PATTERN) {
|
|
|
|
if (mobileEditAnim>0.0f) {
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(0.0f,0.0f));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH));
|
|
|
|
} else {
|
2022-12-11 23:22:39 +00:00
|
|
|
ImGui::SetNextWindowPos(ImVec2((mobileEditButtonPos.x+(portrait?0:(mobileMenuPos*0.65)))*canvasW,(mobileEditButtonPos.y-(portrait?(mobileMenuPos*0.65):0))*canvasH));
|
2022-12-11 21:29:22 +00:00
|
|
|
ImGui::SetNextWindowSize(portrait?ImVec2(0.16*canvasW,0.16*canvasW):ImVec2(0.16*canvasH,0.16*canvasH));
|
2022-12-08 23:04:18 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,mobileEditButtonSize.x);
|
|
|
|
if (ImGui::Begin("MobileEdit",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoDecoration)) {
|
|
|
|
bool mobileEditWas=mobileEdit;
|
|
|
|
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && mobileEdit) {
|
|
|
|
mobileEdit=false;
|
2022-12-11 09:03:22 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
if (mobileEditAnim>0.0f) {
|
|
|
|
int curButtonPos=0;
|
|
|
|
float buttonDir, buttonDist;
|
|
|
|
float buttonMirrorX=1.0f;
|
|
|
|
float buttonMirrorY=1.0f;
|
|
|
|
|
|
|
|
int buttonLayout=0;
|
|
|
|
|
|
|
|
ImVec2 scaledButtonPos=ImVec2(
|
|
|
|
mobileEditButtonPos.x+((mobileEditButtonSize.x*0.5)/(float)canvasW),
|
|
|
|
mobileEditButtonPos.y+((mobileEditButtonSize.y*0.5)/(float)canvasH)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (scaledButtonPos.x>0.25 &&
|
|
|
|
scaledButtonPos.x<0.75 &&
|
|
|
|
scaledButtonPos.y>0.2 &&
|
|
|
|
scaledButtonPos.y<0.8) {
|
|
|
|
buttonLayout=0;
|
|
|
|
} else if (scaledButtonPos.x>0.4 && scaledButtonPos.x<0.6) {
|
|
|
|
buttonLayout=2;
|
|
|
|
} else if (scaledButtonPos.y>0.25 && scaledButtonPos.y<0.75) {
|
|
|
|
buttonLayout=1;
|
|
|
|
} else {
|
|
|
|
buttonLayout=3;
|
|
|
|
}
|
2022-12-11 09:03:22 +00:00
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
switch (buttonLayout) {
|
|
|
|
case 1:
|
|
|
|
if (mobileEditButtonPos.x>0.5) buttonMirrorX=-1.0f;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (mobileEditButtonPos.y>0.5) buttonMirrorY=-1.0f;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (mobileEditButtonPos.x>0.5) buttonMirrorX=-1.0f;
|
|
|
|
if (mobileEditButtonPos.y>0.5) buttonMirrorY=-1.0f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i=0; i<8; i++) {
|
|
|
|
float anim=(mobileEditAnim*1.5)-(float)i*0.05;
|
|
|
|
if (anim<0.0f) anim=0.0f;
|
|
|
|
if (anim>1.0f) anim=1.0f;
|
|
|
|
anim=5*anim-7*pow(anim,2.0f)+3*pow(anim,3.0f);
|
|
|
|
|
|
|
|
buttonDir=mobileButtonAngles[buttonLayout][curButtonPos];
|
|
|
|
buttonDist=mobileButtonDistances[buttonLayout][curButtonPos]*mobileEditButtonSize.x*1.6f;
|
|
|
|
|
|
|
|
ImGui::SetCursorPos(ImVec2(
|
|
|
|
(mobileEditButtonPos.x*canvasW)+cos(buttonDir*2.0*M_PI)*buttonDist*buttonMirrorX*anim,
|
|
|
|
(mobileEditButtonPos.y*canvasH)+sin(buttonDir*2.0*M_PI)*buttonDist*buttonMirrorY*anim
|
|
|
|
));
|
|
|
|
if (ImGui::Button(mobileButtonLabels[i+mobileEditPage*8],mobileEditButtonSize)) {
|
|
|
|
if (mobileButtonActions[i+mobileEditPage*8]) {
|
|
|
|
doAction(mobileButtonActions[i+mobileEditPage*8]);
|
|
|
|
}
|
|
|
|
if (mobileButtonPersist[i+mobileEditPage*8]) {
|
2022-12-11 23:22:39 +00:00
|
|
|
if (mobileMenuPos<=0.0) mobileEdit=true;
|
2022-12-11 21:29:22 +00:00
|
|
|
}
|
2022-12-11 17:36:41 +00:00
|
|
|
}
|
2022-12-11 21:29:22 +00:00
|
|
|
|
|
|
|
curButtonPos++;
|
2022-12-11 17:36:41 +00:00
|
|
|
}
|
2022-12-09 23:47:49 +00:00
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
ImGui::SetCursorPos(ImVec2(mobileEditButtonPos.x*canvasW,mobileEditButtonPos.y*canvasH));
|
|
|
|
} else {
|
|
|
|
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
|
|
|
|
mobileEditButtonSize=ImVec2(avail,avail);
|
2022-12-09 23:47:49 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 21:29:22 +00:00
|
|
|
if (ImGui::Button(ICON_FA_PENCIL "##Edit",mobileEditButtonSize)) {
|
|
|
|
// click
|
|
|
|
if (mobileEditWas) {
|
|
|
|
if (++mobileEditPage>3) mobileEditPage=0;
|
|
|
|
}
|
|
|
|
if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]<=ImGui::GetIO().ConfigInertialScrollToleranceSqr) {
|
2022-12-11 23:22:39 +00:00
|
|
|
if (mobileMenuPos<=0.0) mobileEdit=true;
|
2022-12-11 21:29:22 +00:00
|
|
|
}
|
2022-12-11 17:36:41 +00:00
|
|
|
}
|
2022-12-11 23:22:39 +00:00
|
|
|
if (ImGui::IsItemClicked() && !mobileEdit && mobileMenuPos<=0.0) {
|
2022-12-11 21:29:22 +00:00
|
|
|
dragMobileEditButton=true;
|
2022-12-07 03:40:23 +00:00
|
|
|
}
|
|
|
|
}
|
2022-12-11 21:29:22 +00:00
|
|
|
ImGui::End();
|
|
|
|
ImGui::PopStyleVar(2);
|
2022-12-07 03:40:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-20 07:34:14 +00:00
|
|
|
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f));
|
|
|
|
ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH));
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
2022-09-09 00:15:19 +00:00
|
|
|
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
|
|
|
|
ImVec2 buttonSize=ImVec2(avail,avail);
|
|
|
|
const char* mobButtonName=ICON_FA_CHEVRON_RIGHT "##MobileMenu";
|
|
|
|
if (portrait) mobButtonName=ICON_FA_CHEVRON_UP "##MobileMenu";
|
|
|
|
if (mobileMenuOpen) {
|
|
|
|
if (portrait) {
|
|
|
|
mobButtonName=ICON_FA_CHEVRON_DOWN "##MobileMenu";
|
|
|
|
} else {
|
|
|
|
mobButtonName=ICON_FA_CHEVRON_LEFT "##MobileMenu";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ImGui::Button(mobButtonName,buttonSize)) {
|
2022-12-04 22:19:21 +00:00
|
|
|
if (!dragMobileMenu) {
|
|
|
|
mobileMenuOpen=!mobileMenuOpen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ImGui::IsItemActive() && ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr*2.0f) {
|
|
|
|
if (!dragMobileMenu) {
|
|
|
|
dragMobileMenu=true;
|
|
|
|
dragMobileMenuOrigin=ImGui::GetMousePos();
|
|
|
|
if (portrait) {
|
|
|
|
dragMobileMenuOrigin.y+=mobileMenuPos*canvasH*0.65f;
|
|
|
|
} else {
|
|
|
|
dragMobileMenuOrigin.x-=mobileMenuPos*canvasW*0.65f;
|
|
|
|
}
|
|
|
|
}
|
2022-05-19 03:49:21 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 00:15:19 +00:00
|
|
|
if (!portrait) ImGui::Separator();
|
2022-05-19 03:49:21 +00:00
|
|
|
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(e->isPlaying());
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) {
|
|
|
|
play();
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) {
|
|
|
|
stop();
|
|
|
|
}
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
|
|
|
|
e->stepOne(cursor.y);
|
|
|
|
pendingStepUpdate=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool repeatPattern=e->getRepeatPattern();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(repeatPattern);
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) {
|
|
|
|
e->setRepeatPattern(!repeatPattern);
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-05-19 03:49:21 +00:00
|
|
|
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(edit);
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) {
|
|
|
|
edit=!edit;
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-05-19 03:49:21 +00:00
|
|
|
|
|
|
|
bool metro=e->getMetronome();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(metro);
|
2022-09-09 00:15:19 +00:00
|
|
|
if (portrait) ImGui::SameLine();
|
2022-05-19 03:49:21 +00:00
|
|
|
if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) {
|
|
|
|
e->setMetronome(!metro);
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-09-09 00:15:19 +00:00
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
|
2022-10-20 07:34:14 +00:00
|
|
|
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)):ImVec2(0.5*canvasW*(mobileMenuPos-1.0),0.0f));
|
|
|
|
ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.65*canvasH):ImVec2(0.5*canvasW,canvasH));
|
2022-09-09 00:15:19 +00:00
|
|
|
if (ImGui::Begin("Mobile Menu",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
2022-09-09 20:31:29 +00:00
|
|
|
if (ImGui::BeginTable("SceneSel",5)) {
|
|
|
|
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,1.0f);
|
|
|
|
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,1.0f);
|
|
|
|
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,1.0f);
|
|
|
|
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,1.0f);
|
|
|
|
ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch,1.0f);
|
|
|
|
|
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImVec2 buttonSize=ImGui::GetContentRegionAvail();
|
|
|
|
buttonSize.y=30.0f*dpiScale;
|
|
|
|
|
|
|
|
if (ImGui::Button("Pattern",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_PATTERN;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Orders",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_ORDERS;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Ins",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_INSTRUMENT;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Wave",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_WAVETABLE;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Sample",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_SAMPLE;
|
|
|
|
}
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Song",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_SONG;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Channels",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_CHANNELS;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Chips",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_CHIPS;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
2023-01-07 21:26:36 +00:00
|
|
|
if (ImGui::Button("Mixer",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_MIXER;
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
2022-09-10 00:23:53 +00:00
|
|
|
if (ImGui::Button("Other",buttonSize)) {
|
|
|
|
mobScene=GUI_SCENE_OTHER;
|
|
|
|
}
|
2022-09-09 20:31:29 +00:00
|
|
|
ImGui::EndTable();
|
|
|
|
}
|
2022-09-09 00:15:19 +00:00
|
|
|
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::Separator();
|
|
|
|
|
2022-09-09 23:53:20 +00:00
|
|
|
if (settings.unifiedDataView) {
|
|
|
|
drawInsList(true);
|
|
|
|
} else {
|
|
|
|
switch (mobScene) {
|
2022-09-10 00:23:53 +00:00
|
|
|
case GUI_SCENE_PATTERN:
|
|
|
|
case GUI_SCENE_ORDERS:
|
|
|
|
case GUI_SCENE_INSTRUMENT:
|
|
|
|
drawInsList(true);
|
|
|
|
break;
|
2022-09-09 23:53:20 +00:00
|
|
|
case GUI_SCENE_WAVETABLE:
|
|
|
|
drawWaveList(true);
|
|
|
|
break;
|
|
|
|
case GUI_SCENE_SAMPLE:
|
|
|
|
drawSampleList(true);
|
|
|
|
break;
|
2022-09-10 00:23:53 +00:00
|
|
|
case GUI_SCENE_SONG: {
|
|
|
|
if (ImGui::Button("New")) {
|
|
|
|
mobileMenuOpen=false;
|
|
|
|
//doAction(GUI_ACTION_NEW);
|
|
|
|
if (modified) {
|
|
|
|
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
|
|
|
|
} else {
|
|
|
|
displayNew=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Open")) {
|
|
|
|
mobileMenuOpen=false;
|
|
|
|
doAction(GUI_ACTION_OPEN);
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Save")) {
|
|
|
|
mobileMenuOpen=false;
|
|
|
|
doAction(GUI_ACTION_SAVE);
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Save as...")) {
|
|
|
|
mobileMenuOpen=false;
|
|
|
|
doAction(GUI_ACTION_SAVE_AS);
|
|
|
|
}
|
2022-09-09 21:41:00 +00:00
|
|
|
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::Button("1.1+ .dmf");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::Button("Legacy .dmf");
|
|
|
|
ImGui::SameLine();
|
2023-01-17 23:12:58 +00:00
|
|
|
if (ImGui::Button("Export Audio")) {
|
|
|
|
openFileDialog(GUI_FILE_EXPORT_AUDIO_ONE);
|
|
|
|
}
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::SameLine();
|
2022-11-21 21:12:29 +00:00
|
|
|
if (ImGui::Button("Export VGM")) {
|
|
|
|
openFileDialog(GUI_FILE_EXPORT_VGM);
|
|
|
|
}
|
2022-09-09 00:15:19 +00:00
|
|
|
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::Button("CmdStream");
|
2022-09-09 00:15:19 +00:00
|
|
|
|
2022-09-10 00:23:53 +00:00
|
|
|
ImGui::Separator();
|
2022-09-09 00:15:19 +00:00
|
|
|
|
2022-11-29 23:30:48 +00:00
|
|
|
drawSongInfo(true);
|
2022-09-10 00:23:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GUI_SCENE_CHANNELS:
|
|
|
|
ImGui::Text("Channels here...");
|
|
|
|
break;
|
|
|
|
case GUI_SCENE_CHIPS:
|
|
|
|
ImGui::Text("Chips here...");
|
|
|
|
break;
|
2023-01-07 21:26:36 +00:00
|
|
|
case GUI_SCENE_MIXER:
|
|
|
|
ImGui::Text("What the hell...");
|
|
|
|
break;
|
2022-09-10 00:23:53 +00:00
|
|
|
case GUI_SCENE_OTHER: {
|
|
|
|
if (ImGui::Button("Osc")) {
|
|
|
|
oscOpen=!oscOpen;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("ChanOsc")) {
|
|
|
|
chanOscOpen=!chanOscOpen;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("RegView")) {
|
|
|
|
regViewOpen=!regViewOpen;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Stats")) {
|
|
|
|
statsOpen=!statsOpen;
|
|
|
|
}
|
2022-12-28 20:15:19 +00:00
|
|
|
if (ImGui::Button("Compat Flags")) {
|
|
|
|
compatFlagsOpen=!compatFlagsOpen;
|
|
|
|
}
|
2022-09-10 00:23:53 +00:00
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
|
|
|
ImGui::Button("Panic");
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Settings")) {
|
|
|
|
mobileMenuOpen=false;
|
2022-11-07 22:05:16 +00:00
|
|
|
settingsOpen=true;
|
2022-09-10 00:23:53 +00:00
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-11-05 23:17:54 +00:00
|
|
|
if (ImGui::Button("Log")) {
|
|
|
|
logOpen=!logOpen;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button("Debug")) {
|
|
|
|
debugOpen=!debugOpen;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-09-10 00:23:53 +00:00
|
|
|
if (ImGui::Button("About")) {
|
|
|
|
mobileMenuOpen=false;
|
|
|
|
mobileMenuPos=0.0f;
|
|
|
|
aboutOpen=true;
|
|
|
|
}
|
|
|
|
if (ImGui::Button("Switch to Desktop Mode")) {
|
|
|
|
toggleMobileUI(!mobileUI);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-05-19 03:49:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
|
2022-03-21 22:34:43 +00:00
|
|
|
void FurnaceGUI::drawEditControls() {
|
|
|
|
if (nextWindow==GUI_WINDOW_EDIT_CONTROLS) {
|
|
|
|
editControlsOpen=true;
|
|
|
|
ImGui::SetNextWindowFocus();
|
|
|
|
nextWindow=GUI_WINDOW_NOTHING;
|
|
|
|
}
|
|
|
|
if (!editControlsOpen) return;
|
|
|
|
switch (settings.controlLayout) {
|
|
|
|
case 0: // classic
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,globalWinFlags)) {
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::BeginTable("PlayEditAlign",2)) {
|
|
|
|
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed);
|
|
|
|
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch);
|
|
|
|
|
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("Octave");
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
|
|
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
|
|
|
if (curOctave>7) curOctave=7;
|
|
|
|
if (curOctave<-5) curOctave=-5;
|
|
|
|
e->autoNoteOffAll();
|
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 08:06:17 +00:00
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("Edit Step");
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
|
|
|
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
|
|
|
|
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
|
|
|
|
if (editStep<0) editStep=0;
|
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-05-24 08:06:17 +00:00
|
|
|
|
|
|
|
ImGui::EndTable();
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(e->isPlaying());
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_PLAY "##Play")) {
|
|
|
|
play();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Play");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_STOP "##Stop")) {
|
|
|
|
stop();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Stop");
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::Checkbox("Edit",&edit);
|
|
|
|
ImGui::SameLine();
|
|
|
|
bool metro=e->getMetronome();
|
|
|
|
if (ImGui::Checkbox("Metronome",&metro)) {
|
|
|
|
e->setMetronome(metro);
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("Follow");
|
|
|
|
ImGui::SameLine();
|
|
|
|
unimportant(ImGui::Checkbox("Orders",&followOrders));
|
|
|
|
ImGui::SameLine();
|
|
|
|
unimportant(ImGui::Checkbox("Pattern",&followPattern));
|
|
|
|
|
|
|
|
bool repeatPattern=e->getRepeatPattern();
|
|
|
|
if (ImGui::Checkbox("Repeat pattern",&repeatPattern)) {
|
|
|
|
e->setRepeatPattern(repeatPattern);
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
|
|
|
|
e->stepOne(cursor.y);
|
2022-04-14 08:05:58 +00:00
|
|
|
pendingStepUpdate=true;
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
2022-12-11 02:09:13 +00:00
|
|
|
ImGui::SetTooltip("Step one row");
|
2022-12-10 19:32:51 +00:00
|
|
|
}
|
2022-06-03 23:05:07 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(noteInputPoly);
|
2022-06-05 05:42:14 +00:00
|
|
|
if (ImGui::Button(noteInputPoly?("Poly##PolyInput"):("Mono##PolyInput"))) {
|
2022-06-03 23:05:07 +00:00
|
|
|
noteInputPoly=!noteInputPoly;
|
|
|
|
e->setAutoNotePoly(noteInputPoly);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Polyphony");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
break;
|
|
|
|
case 1: // compact
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_STOP "##Stop")) {
|
|
|
|
stop();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Stop");
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(e->isPlaying());
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_PLAY "##Play")) {
|
|
|
|
play();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Play");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
|
|
|
|
e->stepOne(cursor.y);
|
2022-04-14 08:05:58 +00:00
|
|
|
pendingStepUpdate=true;
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
2022-12-11 02:09:13 +00:00
|
|
|
ImGui::SetTooltip("Step one row");
|
2022-12-10 19:32:51 +00:00
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
bool repeatPattern=e->getRepeatPattern();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(repeatPattern);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern")) {
|
|
|
|
e->setRepeatPattern(!repeatPattern);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Repeat pattern");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(edit);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_CIRCLE "##Edit")) {
|
|
|
|
edit=!edit;
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Edit");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
bool metro=e->getMetronome();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(metro);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_BELL_O "##Metronome")) {
|
|
|
|
e->setMetronome(!metro);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Metronome");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::Text("Octave");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SetNextItemWidth(96.0f*dpiScale);
|
|
|
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
|
|
|
if (curOctave>7) curOctave=7;
|
|
|
|
if (curOctave<-5) curOctave=-5;
|
2022-04-16 05:10:52 +00:00
|
|
|
e->autoNoteOffAll();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::Text("Edit Step");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SetNextItemWidth(96.0f*dpiScale);
|
|
|
|
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
|
2022-05-15 06:42:49 +00:00
|
|
|
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
|
2022-03-21 22:34:43 +00:00
|
|
|
if (editStep<0) editStep=0;
|
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::Text("Follow");
|
|
|
|
ImGui::SameLine();
|
|
|
|
unimportant(ImGui::Checkbox("Orders",&followOrders));
|
|
|
|
ImGui::SameLine();
|
|
|
|
unimportant(ImGui::Checkbox("Pattern",&followPattern));
|
2022-06-03 23:05:07 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(noteInputPoly);
|
2022-06-05 05:42:14 +00:00
|
|
|
if (ImGui::Button(noteInputPoly?("Poly##PolyInput"):("Mono##PolyInput"))) {
|
2022-06-03 23:05:07 +00:00
|
|
|
noteInputPoly=!noteInputPoly;
|
|
|
|
e->setAutoNotePoly(noteInputPoly);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Polyphony");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
break;
|
|
|
|
case 2: // compact vertical
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
2022-05-24 08:06:17 +00:00
|
|
|
ImVec2 buttonSize=ImVec2(ImGui::GetContentRegionAvail().x,0.0f);
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(e->isPlaying());
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
play();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Play");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
stop();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Stop");
|
|
|
|
}
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
e->stepOne(cursor.y);
|
2022-04-14 08:05:58 +00:00
|
|
|
pendingStepUpdate=true;
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
2022-12-11 02:09:13 +00:00
|
|
|
ImGui::SetTooltip("Step one row");
|
2022-12-10 19:32:51 +00:00
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
bool repeatPattern=e->getRepeatPattern();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(repeatPattern);
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
e->setRepeatPattern(!repeatPattern);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Repeat pattern");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(edit);
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
edit=!edit;
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Edit");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
bool metro=e->getMetronome();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(metro);
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
e->setMetronome(!metro);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Metronome");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::Text("Oct.");
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Octave");
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
float avail=ImGui::GetContentRegionAvail().x;
|
|
|
|
ImGui::SetNextItemWidth(avail);
|
|
|
|
if (ImGui::InputInt("##Octave",&curOctave,0,0)) {
|
|
|
|
if (curOctave>7) curOctave=7;
|
|
|
|
if (curOctave<-5) curOctave=-5;
|
2022-04-16 05:10:52 +00:00
|
|
|
e->autoNoteOffAll();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("Step");
|
|
|
|
ImGui::SetNextItemWidth(avail);
|
|
|
|
if (ImGui::InputInt("##EditStep",&editStep,0,0)) {
|
2022-05-15 06:42:49 +00:00
|
|
|
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
|
2022-03-21 22:34:43 +00:00
|
|
|
if (editStep<0) editStep=0;
|
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("Foll.");
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Follow");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(followOrders);
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button("Ord##FollowOrders",buttonSize)) { handleUnimportant
|
2022-03-21 22:34:43 +00:00
|
|
|
followOrders=!followOrders;
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Orders");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
|
|
|
pushToggleColors(followPattern);
|
2022-05-24 08:06:17 +00:00
|
|
|
if (ImGui::Button("Pat##FollowPattern",buttonSize)) { handleUnimportant
|
2022-03-21 22:34:43 +00:00
|
|
|
followPattern=!followPattern;
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Pattern");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-06-03 23:05:07 +00:00
|
|
|
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(noteInputPoly);
|
2022-06-05 05:42:14 +00:00
|
|
|
if (ImGui::Button(noteInputPoly?("Poly##PolyInput"):("Mono##PolyInput"))) {
|
2022-06-03 23:05:07 +00:00
|
|
|
noteInputPoly=!noteInputPoly;
|
|
|
|
e->setAutoNotePoly(noteInputPoly);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Polyphony");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
break;
|
|
|
|
case 3: // split
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Play Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
if (e->isPlaying()) {
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(true);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_STOP "##Stop")) {
|
|
|
|
stop();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Stop");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
} else {
|
|
|
|
if (ImGui::Button(ICON_FA_PLAY "##Play")) {
|
2022-04-12 22:01:41 +00:00
|
|
|
play(oldRow);
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Play");
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_PLAY_CIRCLE "##PlayAgain")) {
|
2022-04-12 22:01:41 +00:00
|
|
|
e->setRepeatPattern(false);
|
|
|
|
play();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Play from the beginning of this pattern");
|
|
|
|
}
|
2022-04-12 22:01:41 +00:00
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_STEP_FORWARD "##PlayRepeat")) {
|
|
|
|
e->setRepeatPattern(true);
|
2022-03-21 22:34:43 +00:00
|
|
|
play();
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Repeat from the beginning of this pattern");
|
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::SameLine();
|
|
|
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) {
|
|
|
|
e->stepOne(cursor.y);
|
2022-04-14 08:05:58 +00:00
|
|
|
pendingStepUpdate=true;
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
2022-12-11 02:09:13 +00:00
|
|
|
ImGui::SetTooltip("Step one row");
|
2022-12-10 19:32:51 +00:00
|
|
|
}
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(edit);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_CIRCLE "##Edit")) {
|
|
|
|
edit=!edit;
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Edit");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
bool metro=e->getMetronome();
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(metro);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_BELL_O "##Metronome")) {
|
|
|
|
e->setMetronome(!metro);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Metronome");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
bool repeatPattern=e->getRepeatPattern();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(repeatPattern);
|
2022-03-21 22:34:43 +00:00
|
|
|
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern")) {
|
|
|
|
e->setRepeatPattern(!repeatPattern);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Repeat pattern");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-06-03 23:05:07 +00:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2022-09-11 04:50:53 +00:00
|
|
|
pushToggleColors(noteInputPoly);
|
2022-06-05 05:42:14 +00:00
|
|
|
if (ImGui::Button(noteInputPoly?("Poly##PolyInput"):("Mono##PolyInput"))) {
|
2022-06-03 23:05:07 +00:00
|
|
|
noteInputPoly=!noteInputPoly;
|
|
|
|
e->setAutoNotePoly(noteInputPoly);
|
|
|
|
}
|
2022-12-10 19:32:51 +00:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::SetTooltip("Polyphony");
|
|
|
|
}
|
2022-09-11 04:50:53 +00:00
|
|
|
popToggleColors();
|
2022-03-21 22:34:43 +00:00
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
|
2022-05-19 21:35:00 +00:00
|
|
|
if (ImGui::Begin("Edit Controls",&editControlsOpen,globalWinFlags)) {
|
2022-03-21 22:34:43 +00:00
|
|
|
ImGui::Columns(2);
|
|
|
|
ImGui::Text("Octave");
|
|
|
|
ImGui::SameLine();
|
|
|
|
float cursor=ImGui::GetCursorPosX();
|
|
|
|
float avail=ImGui::GetContentRegionAvail().x;
|
|
|
|
ImGui::SetNextItemWidth(avail);
|
|
|
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
|
|
|
if (curOctave>7) curOctave=7;
|
|
|
|
if (curOctave<-5) curOctave=-5;
|
2022-04-16 05:10:52 +00:00
|
|
|
e->autoNoteOffAll();
|
2022-03-21 22:34:43 +00:00
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("Step");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SetCursorPosX(cursor);
|
|
|
|
ImGui::SetNextItemWidth(avail);
|
|
|
|
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
|
2022-05-15 06:42:49 +00:00
|
|
|
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
|
2022-03-21 22:34:43 +00:00
|
|
|
if (editStep<0) editStep=0;
|
|
|
|
|
|
|
|
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
|
|
|
|
nextWindow=GUI_WINDOW_PATTERN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::NextColumn();
|
|
|
|
|
|
|
|
unimportant(ImGui::Checkbox("Follow orders",&followOrders));
|
|
|
|
unimportant(ImGui::Checkbox("Follow pattern",&followPattern));
|
|
|
|
}
|
|
|
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
|
|
|
ImGui::End();
|
|
|
|
break;
|
|
|
|
}
|
2022-05-19 03:49:21 +00:00
|
|
|
}
|