| 1 |
/** |
| 2 |
* Furnace Tracker - multi-system chiptune tracker |
| 3 |
* Copyright (C) 2021-2025 tildearrow and contributors |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#define _USE_MATH_DEFINES |
| 21 |
#include "gui.h" |
| 22 |
#include "../fileutils.h" |
| 23 |
#include "IconsFontAwesome4.h" |
| 24 |
#include "furIcons.h" |
| 25 |
#include "misc/cpp/imgui_stdlib.h" |
| 26 |
#include <fmt/printf.h> |
| 27 |
|
| 28 |
// 0: all directions |
| 29 |
// 1: half |
| 30 |
// 2: half |
| 31 |
// 3: quarter |
| 32 |
const float mobileButtonAngles[4][8]={ |
| 33 |
{0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875}, |
| 34 |
{0.8333, 0.0, 0.1667, 0.8, 0.9, 0.0, 0.1, 0.2}, |
| 35 |
{0.0833, 0.25, 0.4167, 0.45, 0.35, 0.25, 0.15, 0.05}, |
| 36 |
{0.25, 0.125, 0.0, 0.25, 0.1875, 0.125, 0.0625, 0.0} |
| 37 |
}; |
| 38 |
|
| 39 |
const float mobileButtonDistances[4][8]={ |
| 40 |
{1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, |
| 41 |
{0.8, 0.75, 0.8, 1.5, 1.5, 1.5, 1.5, 1.5}, |
| 42 |
{0.8, 0.75, 0.8, 1.5, 1.5, 1.5, 1.5, 1.5}, |
| 43 |
{0.9, 1.0, 0.9, 1.78, 1.82, 1.95, 1.82, 1.78} |
| 44 |
}; |
| 45 |
|
| 46 |
const char* mobileButtonLabels[32]={ |
| 47 |
// page 1 |
| 48 |
_N("cut"), |
| 49 |
_N("copy"), |
| 50 |
_N("paste"), |
| 51 |
_N("delete"), |
| 52 |
_N("select\nall"), |
| 53 |
_N("piano"), |
| 54 |
_N("undo"), |
| 55 |
_N("redo"), |
| 56 |
|
| 57 |
// page 2 |
| 58 |
_N("paste\nmix"), |
| 59 |
_N("paste\nmix bg"), |
| 60 |
_N("paste\nins"), |
| 61 |
_N("paste\nins bg"), |
| 62 |
_N("paste\nflood"), |
| 63 |
_N("paste\noverflow"), |
| 64 |
_N("transpose\nnotes"), |
| 65 |
_N("transpose\nvalues"), |
| 66 |
|
| 67 |
// page 3 |
| 68 |
_N("change\nins"), |
| 69 |
_N("find/\nreplace"), |
| 70 |
_N("collapse"), |
| 71 |
_N("expand"), |
| 72 |
_N("flip"), |
| 73 |
_N("invert"), |
| 74 |
_N("interpolate"), |
| 75 |
_N("scale"), |
| 76 |
|
| 77 |
// page 4 |
| 78 |
_N("fade"), |
| 79 |
_N("randomize"), |
| 80 |
_N("opmask"), |
| 81 |
_N("scroll\nmode"), |
| 82 |
_N("input\nlatch"), |
| 83 |
_N("set\nlatch"), |
| 84 |
_N("clear\nlatch"), |
| 85 |
_N("clear") |
| 86 |
}; |
| 87 |
|
| 88 |
const int mobileButtonActions[32]={ |
| 89 |
// page 1 |
| 90 |
GUI_ACTION_PAT_CUT, |
| 91 |
GUI_ACTION_PAT_COPY, |
| 92 |
GUI_ACTION_PAT_PASTE, |
| 93 |
GUI_ACTION_PAT_DELETE, |
| 94 |
GUI_ACTION_PAT_SELECT_ALL, |
| 95 |
GUI_ACTION_WINDOW_PIANO, |
| 96 |
GUI_ACTION_UNDO, |
| 97 |
GUI_ACTION_REDO, |
| 98 |
|
| 99 |
// page 2 |
| 100 |
GUI_ACTION_PAT_PASTE_MIX, |
| 101 |
GUI_ACTION_PAT_PASTE_MIX_BG, |
| 102 |
0, |
| 103 |
0, |
| 104 |
GUI_ACTION_PAT_PASTE_FLOOD, |
| 105 |
GUI_ACTION_PAT_PASTE_OVERFLOW, |
| 106 |
0, |
| 107 |
0, |
| 108 |
|
| 109 |
// page 3 |
| 110 |
GUI_ACTION_CMDPAL_INSTRUMENT_CHANGE, |
| 111 |
GUI_ACTION_WINDOW_FIND, |
| 112 |
GUI_ACTION_PAT_COLLAPSE_ROWS, |
| 113 |
GUI_ACTION_PAT_EXPAND_ROWS, |
| 114 |
GUI_ACTION_PAT_FLIP_SELECTION, |
| 115 |
GUI_ACTION_PAT_INVERT_VALUES, |
| 116 |
GUI_ACTION_PAT_INTERPOLATE, |
| 117 |
0, |
| 118 |
|
| 119 |
// page 4 |
| 120 |
GUI_ACTION_PAT_FADE, |
| 121 |
0, |
| 122 |
0, |
| 123 |
GUI_ACTION_PAT_SCROLL_MODE, |
| 124 |
0, |
| 125 |
GUI_ACTION_PAT_LATCH, |
| 126 |
GUI_ACTION_PAT_CLEAR_LATCH, |
| 127 |
GUI_ACTION_CLEAR |
| 128 |
}; |
| 129 |
|
| 130 |
const bool mobileButtonPersist[32]={ |
| 131 |
// page 1 |
| 132 |
false, |
| 133 |
false, |
| 134 |
true, |
| 135 |
false, |
| 136 |
true, |
| 137 |
true, |
| 138 |
true, |
| 139 |
true, |
| 140 |
|
| 141 |
// page 2 |
| 142 |
false, |
| 143 |
false, |
| 144 |
false, |
| 145 |
false, |
| 146 |
false, |
| 147 |
false, |
| 148 |
false, |
| 149 |
false, |
| 150 |
|
| 151 |
// page 3 |
| 152 |
false, |
| 153 |
false, |
| 154 |
false, |
| 155 |
false, |
| 156 |
false, |
| 157 |
false, |
| 158 |
false, |
| 159 |
false, |
| 160 |
|
| 161 |
// page 4 |
| 162 |
false, |
| 163 |
false, |
| 164 |
false, |
| 165 |
true, |
| 166 |
false, |
| 167 |
false, |
| 168 |
false, |
| 169 |
false, |
| 170 |
}; |
| 171 |
|
| 172 |
void FurnaceGUI::drawMobileControls() { |
| 173 |
float timeScale=60.0*ImGui::GetIO().DeltaTime; |
| 174 |
if (dragMobileMenu) { |
| 175 |
if (portrait) { |
| 176 |
mobileMenuPos=(dragMobileMenuOrigin.y-ImGui::GetMousePos().y)/(canvasH*0.65); |
| 177 |
} else { |
| 178 |
mobileMenuPos=(ImGui::GetMousePos().x-dragMobileMenuOrigin.x)/(canvasW*0.65); |
| 179 |
} |
| 180 |
if (mobileMenuPos<0.0f) mobileMenuPos=0.0f; |
| 181 |
if (mobileMenuPos>1.0f) mobileMenuPos=1.0f; |
| 182 |
} else { |
| 183 |
if (mobileMenuOpen) { |
| 184 |
if (mobileMenuPos<0.999f) { |
| 185 |
WAKE_UP; |
| 186 |
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale; |
| 187 |
} else { |
| 188 |
mobileMenuPos=1.0f; |
| 189 |
} |
| 190 |
} else { |
| 191 |
if (mobileMenuPos>0.001f) { |
| 192 |
WAKE_UP; |
| 193 |
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale; |
| 194 |
} else { |
| 195 |
mobileMenuPos=0.0f; |
| 196 |
} |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
if (dragMobileEditButton) { |
| 201 |
if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr) { |
| 202 |
mobileEditButtonPos.x=((ImGui::GetMousePos().x/canvasW)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasW); |
| 203 |
mobileEditButtonPos.y=((ImGui::GetMousePos().y/canvasH)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasH); |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
if (mobileEditButtonPos.x<0) mobileEditButtonPos.x=0; |
| 208 |
if (mobileEditButtonPos.x>1) mobileEditButtonPos.x=1; |
| 209 |
if (mobileEditButtonPos.y<0) mobileEditButtonPos.y=0; |
| 210 |
if (mobileEditButtonPos.y>1) mobileEditButtonPos.y=1; |
| 211 |
|
| 212 |
if (mobileEdit) { |
| 213 |
mobileEditAnim+=ImGui::GetIO().DeltaTime*2.4; |
| 214 |
if (mobileEditAnim>1.0f) { |
| 215 |
mobileEditAnim=1.0f; |
| 216 |
} else { |
| 217 |
WAKE_UP; |
| 218 |
} |
| 219 |
} else { |
| 220 |
mobileEditAnim-=ImGui::GetIO().DeltaTime*2.4; |
| 221 |
if (mobileEditAnim<0.0f) { |
| 222 |
mobileEditAnim=0.0f; |
| 223 |
} else { |
| 224 |
WAKE_UP; |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
if (curWindowLast==GUI_WINDOW_PATTERN) { |
| 229 |
if (mobileEditAnim>0.0f) { |
| 230 |
ImGui::SetNextWindowPos(ImVec2(0.0f,0.0f)); |
| 231 |
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH)); |
| 232 |
} else { |
| 233 |
ImGui::SetNextWindowPos(ImVec2((mobileEditButtonPos.x+(portrait?0:(mobileMenuPos*0.65)))*canvasW,(mobileEditButtonPos.y-(portrait?(mobileMenuPos*0.65):0))*canvasH)); |
| 234 |
ImGui::SetNextWindowSize(portrait?ImVec2(0.16*canvasW,0.16*canvasW):ImVec2(0.16*canvasH,0.16*canvasH)); |
| 235 |
} |
| 236 |
|
| 237 |
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f)); |
| 238 |
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,mobileEditButtonSize.x); |
| 239 |
if (ImGui::Begin("MobileEdit",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoDecoration)) { |
| 240 |
bool mobileEditWas=mobileEdit; |
| 241 |
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && mobileEdit) { |
| 242 |
mobileEdit=false; |
| 243 |
} |
| 244 |
|
| 245 |
if (mobileEditAnim>0.0f) { |
| 246 |
int curButtonPos=0; |
| 247 |
float buttonDir, buttonDist; |
| 248 |
float buttonMirrorX=1.0f; |
| 249 |
float buttonMirrorY=1.0f; |
| 250 |
|
| 251 |
int buttonLayout=0; |
| 252 |
|
| 253 |
ImVec2 scaledButtonPos=ImVec2( |
| 254 |
mobileEditButtonPos.x+((mobileEditButtonSize.x*0.5)/(float)canvasW), |
| 255 |
mobileEditButtonPos.y+((mobileEditButtonSize.y*0.5)/(float)canvasH) |
| 256 |
); |
| 257 |
|
| 258 |
if (scaledButtonPos.x>0.25 && |
| 259 |
scaledButtonPos.x<0.75 && |
| 260 |
scaledButtonPos.y>0.2 && |
| 261 |
scaledButtonPos.y<0.8) { |
| 262 |
buttonLayout=0; |
| 263 |
} else if (scaledButtonPos.x>0.4 && scaledButtonPos.x<0.6) { |
| 264 |
buttonLayout=2; |
| 265 |
} else if (scaledButtonPos.y>0.25 && scaledButtonPos.y<0.75) { |
| 266 |
buttonLayout=1; |
| 267 |
} else { |
| 268 |
buttonLayout=3; |
| 269 |
} |
| 270 |
|
| 271 |
switch (buttonLayout) { |
| 272 |
case 1: |
| 273 |
if (mobileEditButtonPos.x>0.5) buttonMirrorX=-1.0f; |
| 274 |
break; |
| 275 |
case 2: |
| 276 |
if (mobileEditButtonPos.y>0.5) buttonMirrorY=-1.0f; |
| 277 |
break; |
| 278 |
case 3: |
| 279 |
if (mobileEditButtonPos.x>0.5) buttonMirrorX=-1.0f; |
| 280 |
if (mobileEditButtonPos.y>0.5) buttonMirrorY=-1.0f; |
| 281 |
break; |
| 282 |
} |
| 283 |
|
| 284 |
for (int i=0; i<8; i++) { |
| 285 |
float anim=(mobileEditAnim*1.5)-(float)i*0.05; |
| 286 |
if (anim<0.0f) anim=0.0f; |
| 287 |
if (anim>1.0f) anim=1.0f; |
| 288 |
anim=5*anim-7*pow(anim,2.0f)+3*pow(anim,3.0f); |
| 289 |
|
| 290 |
buttonDir=mobileButtonAngles[buttonLayout][curButtonPos]; |
| 291 |
buttonDist=mobileButtonDistances[buttonLayout][curButtonPos]*mobileEditButtonSize.x*1.6f; |
| 292 |
|
| 293 |
ImGui::SetCursorPos(ImVec2( |
| 294 |
(mobileEditButtonPos.x*canvasW)+cos(buttonDir*2.0*M_PI)*buttonDist*buttonMirrorX*anim, |
| 295 |
(mobileEditButtonPos.y*canvasH)+sin(buttonDir*2.0*M_PI)*buttonDist*buttonMirrorY*anim |
| 296 |
)); |
| 297 |
if (ImGui::Button(_(mobileButtonLabels[i+mobileEditPage*8]),mobileEditButtonSize)) { |
| 298 |
if (mobileButtonActions[i+mobileEditPage*8]) { |
| 299 |
doAction(mobileButtonActions[i+mobileEditPage*8]); |
| 300 |
} |
| 301 |
if (mobileButtonPersist[i+mobileEditPage*8]) { |
| 302 |
if (mobileMenuPos<=0.0) mobileEdit=true; |
| 303 |
} |
| 304 |
} |
| 305 |
|
| 306 |
curButtonPos++; |
| 307 |
} |
| 308 |
|
| 309 |
ImGui::SetCursorPos(ImVec2(mobileEditButtonPos.x*canvasW,mobileEditButtonPos.y*canvasH)); |
| 310 |
} else { |
| 311 |
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; |
| 312 |
mobileEditButtonSize=ImVec2(avail,avail); |
| 313 |
} |
| 314 |
|
| 315 |
if (ImGui::Button(ICON_FA_PENCIL "##Edit",mobileEditButtonSize)) { |
| 316 |
// click |
| 317 |
if (mobileEditWas) { |
| 318 |
if (++mobileEditPage>3) mobileEditPage=0; |
| 319 |
} |
| 320 |
if (ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]<=ImGui::GetIO().ConfigInertialScrollToleranceSqr) { |
| 321 |
if (mobileMenuPos<=0.0) mobileEdit=true; |
| 322 |
} |
| 323 |
} |
| 324 |
if (ImGui::IsItemClicked() && !mobileEdit && mobileMenuPos<=0.0) { |
| 325 |
dragMobileEditButton=true; |
| 326 |
} |
| 327 |
} |
| 328 |
ImGui::End(); |
| 329 |
ImGui::PopStyleVar(2); |
| 330 |
} |
| 331 |
|
| 332 |
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f)); |
| 333 |
ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH)); |
| 334 |
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags,_("Mobile Controls"))) { |
| 335 |
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; |
| 336 |
ImVec2 buttonSize=ImVec2(avail,avail); |
| 337 |
const char* mobButtonName=ICON_FA_CHEVRON_RIGHT "##MobileMenu"; |
| 338 |
if (portrait) mobButtonName=ICON_FA_CHEVRON_UP "##MobileMenu"; |
| 339 |
if (mobileMenuOpen) { |
| 340 |
if (portrait) { |
| 341 |
mobButtonName=ICON_FA_CHEVRON_DOWN "##MobileMenu"; |
| 342 |
} else { |
| 343 |
mobButtonName=ICON_FA_CHEVRON_LEFT "##MobileMenu"; |
| 344 |
} |
| 345 |
} |
| 346 |
if (ImGui::Button(mobButtonName,buttonSize)) { |
| 347 |
if (!dragMobileMenu) { |
| 348 |
mobileMenuOpen=!mobileMenuOpen; |
| 349 |
} |
| 350 |
} |
| 351 |
if (ImGui::IsItemActive() && ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr*2.0f) { |
| 352 |
if (!dragMobileMenu) { |
| 353 |
dragMobileMenu=true; |
| 354 |
dragMobileMenuOrigin=ImGui::GetMousePos(); |
| 355 |
if (portrait) { |
| 356 |
dragMobileMenuOrigin.y+=mobileMenuPos*canvasH*0.65f; |
| 357 |
} else { |
| 358 |
dragMobileMenuOrigin.x-=mobileMenuPos*canvasW*0.65f; |
| 359 |
} |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
if (!portrait) ImGui::Separator(); |
| 364 |
|
| 365 |
pushToggleColors(e->isPlaying()); |
| 366 |
if (portrait) ImGui::SameLine(); |
| 367 |
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) { |
| 368 |
play(); |
| 369 |
} |
| 370 |
popToggleColors(); |
| 371 |
if (portrait) ImGui::SameLine(); |
| 372 |
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) { |
| 373 |
stop(); |
| 374 |
} |
| 375 |
if (portrait) ImGui::SameLine(); |
| 376 |
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) { |
| 377 |
e->stepOne(cursor.y); |
| 378 |
pendingStepUpdate=1; |
| 379 |
} |
| 380 |
|
| 381 |
bool repeatPattern=e->getRepeatPattern(); |
| 382 |
pushToggleColors(repeatPattern); |
| 383 |
if (portrait) ImGui::SameLine(); |
| 384 |
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) { |
| 385 |
e->setRepeatPattern(!repeatPattern); |
| 386 |
} |
| 387 |
popToggleColors(); |
| 388 |
|
| 389 |
pushToggleColors(edit); |
| 390 |
if (portrait) ImGui::SameLine(); |
| 391 |
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) { |
| 392 |
edit=!edit; |
| 393 |
} |
| 394 |
popToggleColors(); |
| 395 |
|
| 396 |
bool metro=e->getMetronome(); |
| 397 |
pushToggleColors(metro); |
| 398 |
if (portrait) ImGui::SameLine(); |
| 399 |
if (ImGui::Button(ICON_FUR_METRONOME "##Metronome",buttonSize)) { |
| 400 |
e->setMetronome(!metro); |
| 401 |
} |
| 402 |
popToggleColors(); |
| 403 |
} |
| 404 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 405 |
ImGui::End(); |
| 406 |
|
| 407 |
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)):ImVec2(0.5*canvasW*(mobileMenuPos-1.0),0.0f)); |
| 408 |
ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.65*canvasH):ImVec2(0.5*canvasW,canvasH)); |
| 409 |
if (ImGui::Begin("Mobile Menu",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags,_("Mobile Menu"))) { |
| 410 |
if (ImGui::BeginTable("SceneSel",5)) { |
| 411 |
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,1.0f); |
| 412 |
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,1.0f); |
| 413 |
ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,1.0f); |
| 414 |
ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,1.0f); |
| 415 |
ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch,1.0f); |
| 416 |
|
| 417 |
ImGui::TableNextRow(); |
| 418 |
ImGui::TableNextColumn(); |
| 419 |
ImVec2 buttonSize=ImGui::GetContentRegionAvail(); |
| 420 |
buttonSize.y=30.0f*dpiScale; |
| 421 |
|
| 422 |
if (ImGui::Button(_("Pattern"),buttonSize)) { |
| 423 |
mobScene=GUI_SCENE_PATTERN; |
| 424 |
} |
| 425 |
ImGui::TableNextColumn(); |
| 426 |
if (ImGui::Button(_("Orders"),buttonSize)) { |
| 427 |
mobScene=GUI_SCENE_ORDERS; |
| 428 |
} |
| 429 |
ImGui::TableNextColumn(); |
| 430 |
if (ImGui::Button(_("Ins"),buttonSize)) { |
| 431 |
mobScene=GUI_SCENE_INSTRUMENT; |
| 432 |
} |
| 433 |
ImGui::TableNextColumn(); |
| 434 |
if (ImGui::Button(_("Wave"),buttonSize)) { |
| 435 |
mobScene=GUI_SCENE_WAVETABLE; |
| 436 |
} |
| 437 |
ImGui::TableNextColumn(); |
| 438 |
if (ImGui::Button(_("Sample"),buttonSize)) { |
| 439 |
mobScene=GUI_SCENE_SAMPLE; |
| 440 |
} |
| 441 |
ImGui::TableNextRow(); |
| 442 |
ImGui::TableNextColumn(); |
| 443 |
if (ImGui::Button(_("Song"),buttonSize)) { |
| 444 |
mobScene=GUI_SCENE_SONG; |
| 445 |
} |
| 446 |
ImGui::TableNextColumn(); |
| 447 |
if (ImGui::Button(_("Channels"),buttonSize)) { |
| 448 |
mobScene=GUI_SCENE_CHANNELS; |
| 449 |
} |
| 450 |
ImGui::TableNextColumn(); |
| 451 |
if (ImGui::Button(_("Chips"),buttonSize)) { |
| 452 |
mobScene=GUI_SCENE_CHIPS; |
| 453 |
} |
| 454 |
ImGui::TableNextColumn(); |
| 455 |
if (ImGui::Button(_("Mixer"),buttonSize)) { |
| 456 |
mobScene=GUI_SCENE_MIXER; |
| 457 |
} |
| 458 |
ImGui::TableNextColumn(); |
| 459 |
if (ImGui::Button(_("Other"),buttonSize)) { |
| 460 |
mobScene=GUI_SCENE_OTHER; |
| 461 |
} |
| 462 |
ImGui::EndTable(); |
| 463 |
} |
| 464 |
|
| 465 |
ImGui::Separator(); |
| 466 |
|
| 467 |
switch (mobScene) { |
| 468 |
case GUI_SCENE_PATTERN: |
| 469 |
case GUI_SCENE_ORDERS: |
| 470 |
case GUI_SCENE_INSTRUMENT: |
| 471 |
drawInsList(true); |
| 472 |
break; |
| 473 |
case GUI_SCENE_WAVETABLE: |
| 474 |
if (settings.unifiedDataView) { |
| 475 |
drawInsList(true); |
| 476 |
} else { |
| 477 |
drawWaveList(true); |
| 478 |
} |
| 479 |
break; |
| 480 |
case GUI_SCENE_SAMPLE: |
| 481 |
if (settings.unifiedDataView) { |
| 482 |
drawInsList(true); |
| 483 |
} else { |
| 484 |
drawSampleList(true); |
| 485 |
} |
| 486 |
break; |
| 487 |
case GUI_SCENE_SONG: { |
| 488 |
if (ImGui::Button(_("New"))) { |
| 489 |
mobileMenuOpen=false; |
| 490 |
//doAction(GUI_ACTION_NEW); |
| 491 |
if (modified) { |
| 492 |
showWarning(_("Unsaved changes! Save changes before creating a new song?"),GUI_WARN_NEW); |
| 493 |
} else { |
| 494 |
displayNew=true; |
| 495 |
} |
| 496 |
} |
| 497 |
ImGui::SameLine(); |
| 498 |
if (ImGui::Button(_("Open"))) { |
| 499 |
mobileMenuOpen=false; |
| 500 |
doAction(GUI_ACTION_OPEN); |
| 501 |
} |
| 502 |
ImGui::SameLine(); |
| 503 |
if (ImGui::Button(_("Save"))) { |
| 504 |
mobileMenuOpen=false; |
| 505 |
doAction(GUI_ACTION_SAVE); |
| 506 |
} |
| 507 |
ImGui::SameLine(); |
| 508 |
if (ImGui::Button(_("Save as..."))) { |
| 509 |
mobileMenuOpen=false; |
| 510 |
doAction(GUI_ACTION_SAVE_AS); |
| 511 |
} |
| 512 |
ImGui::SameLine(); |
| 513 |
if (ImGui::Button(_("Export"))) { |
| 514 |
doAction(GUI_ACTION_EXPORT); |
| 515 |
} |
| 516 |
|
| 517 |
if (ImGui::Button(_("Restore Backup"))) { |
| 518 |
mobileMenuOpen=false; |
| 519 |
doAction(GUI_ACTION_OPEN_BACKUP); |
| 520 |
} |
| 521 |
|
| 522 |
ImGui::Separator(); |
| 523 |
|
| 524 |
if (ImGui::BeginTabBar("MobileSong")) { |
| 525 |
if (ImGui::BeginTabItem(_("Song Info"))) { |
| 526 |
drawSongInfo(true); |
| 527 |
ImGui::EndTabItem(); |
| 528 |
} |
| 529 |
if (ImGui::BeginTabItem(_("Subsongs"))) { |
| 530 |
drawSubSongs(true); |
| 531 |
ImGui::EndTabItem(); |
| 532 |
} |
| 533 |
if (ImGui::BeginTabItem(_("Speed"))) { |
| 534 |
drawSpeed(true); |
| 535 |
ImGui::EndTabItem(); |
| 536 |
} |
| 537 |
if (ImGui::BeginTabItem(_("Comments"))) { |
| 538 |
drawNotes(true); |
| 539 |
ImGui::EndTabItem(); |
| 540 |
} |
| 541 |
ImGui::EndTabBar(); |
| 542 |
} |
| 543 |
break; |
| 544 |
} |
| 545 |
case GUI_SCENE_CHANNELS: |
| 546 |
ImGui::Text(_("Channels here...")); |
| 547 |
break; |
| 548 |
case GUI_SCENE_CHIPS: |
| 549 |
ImGui::Text(_("Chips here...")); |
| 550 |
ImGui::Text("Built"); |
| 551 |
break; |
| 552 |
case GUI_SCENE_MIXER: |
| 553 |
ImGui::Text(_("What the hell...")); |
| 554 |
break; |
| 555 |
case GUI_SCENE_OTHER: { |
| 556 |
if (ImGui::Button(_("Osc"))) { |
| 557 |
oscOpen=!oscOpen; |
| 558 |
} |
| 559 |
ImGui::SameLine(); |
| 560 |
if (ImGui::Button(_("ChanOsc"))) { |
| 561 |
chanOscOpen=!chanOscOpen; |
| 562 |
} |
| 563 |
ImGui::SameLine(); |
| 564 |
if (ImGui::Button(_("RegView"))) { |
| 565 |
regViewOpen=!regViewOpen; |
| 566 |
} |
| 567 |
ImGui::SameLine(); |
| 568 |
if (ImGui::Button(_("Stats"))) { |
| 569 |
statsOpen=!statsOpen; |
| 570 |
} |
| 571 |
ImGui::SameLine(); |
| 572 |
if (ImGui::Button(_("Grooves"))) { |
| 573 |
groovesOpen=!groovesOpen; |
| 574 |
} |
| 575 |
if (ImGui::Button(_("Compat Flags"))) { |
| 576 |
compatFlagsOpen=!compatFlagsOpen; |
| 577 |
} |
| 578 |
ImGui::SameLine(); |
| 579 |
if (ImGui::Button(_("XYOsc"))) { |
| 580 |
xyOscOpen=!xyOscOpen; |
| 581 |
} |
| 582 |
ImGui::SameLine(); |
| 583 |
if (ImGui::Button(_("Meter"))) { |
| 584 |
volMeterOpen=!volMeterOpen; |
| 585 |
} |
| 586 |
ImGui::SameLine(); |
| 587 |
if (ImGui::Button(_("Memory"))) { |
| 588 |
memoryOpen=!memoryOpen; |
| 589 |
} |
| 590 |
|
| 591 |
if (ImGui::Button(_("CV"))) { |
| 592 |
cvOpen=!cvOpen; |
| 593 |
} |
| 594 |
ImGui::SameLine(); |
| 595 |
if (ImGui::Button(_("Presets"))) { |
| 596 |
userPresetsOpen=!userPresetsOpen; |
| 597 |
} |
| 598 |
ImGui::SameLine(); |
| 599 |
if (ImGui::Button(_("PatManager"))) { |
| 600 |
patManagerOpen=!patManagerOpen; |
| 601 |
} |
| 602 |
ImGui::SameLine(); |
| 603 |
if (ImGui::Button(_("CSPlayer"))) { |
| 604 |
csPlayerOpen=!csPlayerOpen; |
| 605 |
} |
| 606 |
|
| 607 |
ImGui::Separator(); |
| 608 |
|
| 609 |
ImGui::Button(_("Panic")); |
| 610 |
ImGui::SameLine(); |
| 611 |
if (ImGui::Button(_("Settings"))) { |
| 612 |
mobileMenuOpen=false; |
| 613 |
settingsOpen=true; |
| 614 |
} |
| 615 |
ImGui::SameLine(); |
| 616 |
if (ImGui::Button(_("Log"))) { |
| 617 |
logOpen=!logOpen; |
| 618 |
} |
| 619 |
ImGui::SameLine(); |
| 620 |
if (ImGui::Button(_("Debug"))) { |
| 621 |
debugOpen=!debugOpen; |
| 622 |
} |
| 623 |
ImGui::SameLine(); |
| 624 |
if (ImGui::Button(_("About"))) { |
| 625 |
mobileMenuOpen=false; |
| 626 |
mobileMenuPos=0.0f; |
| 627 |
aboutOpen=true; |
| 628 |
} |
| 629 |
if (ImGui::Button(_("WelcPopup"))) { |
| 630 |
tutorial.protoWelcome=false; |
| 631 |
} |
| 632 |
ImGui::SameLine(); |
| 633 |
if (ImGui::Button(_("EffectList"))) { |
| 634 |
effectListOpen=!effectListOpen; |
| 635 |
} |
| 636 |
if (ImGui::Button(_("Switch to Desktop Mode"))) { |
| 637 |
toggleMobileUI(!mobileUI); |
| 638 |
} |
| 639 |
break; |
| 640 |
} |
| 641 |
} |
| 642 |
} |
| 643 |
ImGui::End(); |
| 644 |
} |
| 645 |
|
| 646 |
void FurnaceGUI::drawEditControls() { |
| 647 |
if (nextWindow==GUI_WINDOW_EDIT_CONTROLS) { |
| 648 |
editControlsOpen=true; |
| 649 |
ImGui::SetNextWindowFocus(); |
| 650 |
nextWindow=GUI_WINDOW_NOTHING; |
| 651 |
} |
| 652 |
if (!editControlsOpen) return; |
| 653 |
switch (settings.controlLayout) { |
| 654 |
case 0: // classic |
| 655 |
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,globalWinFlags,_("Play/Edit Controls"))) { |
| 656 |
if (ImGui::BeginTable("PlayEditAlign",2)) { |
| 657 |
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed); |
| 658 |
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch); |
| 659 |
|
| 660 |
ImGui::TableNextRow(); |
| 661 |
ImGui::TableNextColumn(); |
| 662 |
ImGui::AlignTextToFramePadding(); |
| 663 |
ImGui::Text(_("Octave")); |
| 664 |
ImGui::TableNextColumn(); |
| 665 |
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); |
| 666 |
if (ImGui::InputInt("##Octave",&curOctave,1,1)) { |
| 667 |
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX; |
| 668 |
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN; |
| 669 |
e->autoNoteOffAll(); |
| 670 |
failedNoteOn=false; |
| 671 |
|
| 672 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 673 |
nextWindow=GUI_WINDOW_PATTERN; |
| 674 |
} |
| 675 |
} |
| 676 |
|
| 677 |
ImGui::TableNextRow(); |
| 678 |
ImGui::TableNextColumn(); |
| 679 |
ImGui::AlignTextToFramePadding(); |
| 680 |
if (ImGui::SmallButton(changeCoarse?_("Coarse Step"):_("Edit Step"))) { |
| 681 |
changeCoarse=!changeCoarse; |
| 682 |
} |
| 683 |
ImGui::TableNextColumn(); |
| 684 |
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); |
| 685 |
if (changeCoarse) { |
| 686 |
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) { |
| 687 |
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1; |
| 688 |
if (editStepCoarse<0) editStepCoarse=0; |
| 689 |
|
| 690 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 691 |
nextWindow=GUI_WINDOW_PATTERN; |
| 692 |
} |
| 693 |
} |
| 694 |
} else { |
| 695 |
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { |
| 696 |
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; |
| 697 |
if (editStep<0) editStep=0; |
| 698 |
|
| 699 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 700 |
nextWindow=GUI_WINDOW_PATTERN; |
| 701 |
} |
| 702 |
} |
| 703 |
} |
| 704 |
|
| 705 |
ImGui::EndTable(); |
| 706 |
} |
| 707 |
|
| 708 |
pushToggleColors(e->isPlaying()); |
| 709 |
if (ImGui::Button(ICON_FA_PLAY "##Play")) { |
| 710 |
play(); |
| 711 |
} |
| 712 |
if (ImGui::IsItemHovered()) { |
| 713 |
ImGui::SetTooltip(_("Play")); |
| 714 |
} |
| 715 |
popToggleColors(); |
| 716 |
ImGui::SameLine(); |
| 717 |
if (ImGui::Button(ICON_FA_STOP "##Stop")) { |
| 718 |
stop(); |
| 719 |
} |
| 720 |
if (ImGui::IsItemHovered()) { |
| 721 |
ImGui::SetTooltip(_("Stop")); |
| 722 |
} |
| 723 |
ImGui::SameLine(); |
| 724 |
ImGui::Checkbox(_("Edit"),&edit); |
| 725 |
ImGui::SameLine(); |
| 726 |
bool ol=orderLock; |
| 727 |
if (ImGui::Checkbox(_("Lock"),&ol)) { |
| 728 |
doAction(GUI_ACTION_ORDER_LOCK); |
| 729 |
} |
| 730 |
ImGui::SameLine(); |
| 731 |
bool metro=e->getMetronome(); |
| 732 |
if (ImGui::Checkbox(_("Metronome"),&metro)) { |
| 733 |
e->setMetronome(metro); |
| 734 |
} |
| 735 |
|
| 736 |
ImGui::AlignTextToFramePadding(); |
| 737 |
ImGui::Text(_("Follow")); |
| 738 |
ImGui::SameLine(); |
| 739 |
unimportant(ImGui::Checkbox(_("Orders"),&followOrders)); |
| 740 |
ImGui::SameLine(); |
| 741 |
unimportant(ImGui::Checkbox(_("Pattern"),&followPattern)); |
| 742 |
|
| 743 |
bool repeatPattern=e->getRepeatPattern(); |
| 744 |
if (ImGui::Checkbox(_("Repeat pattern"),&repeatPattern)) { |
| 745 |
e->setRepeatPattern(repeatPattern); |
| 746 |
} |
| 747 |
ImGui::SameLine(); |
| 748 |
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { |
| 749 |
e->stepOne(cursor.y); |
| 750 |
pendingStepUpdate=1; |
| 751 |
} |
| 752 |
if (ImGui::IsItemHovered()) { |
| 753 |
ImGui::SetTooltip(_("Step one row")); |
| 754 |
} |
| 755 |
|
| 756 |
ImGui::SameLine(); |
| 757 |
pushToggleColors(noteInputPoly); |
| 758 |
if (ImGui::Button(noteInputPoly?(_("Poly##PolyInput")):(_("Mono##PolyInput")))) { |
| 759 |
noteInputPoly=!noteInputPoly; |
| 760 |
e->setAutoNotePoly(noteInputPoly); |
| 761 |
} |
| 762 |
if (ImGui::IsItemHovered()) { |
| 763 |
ImGui::SetTooltip(_("Polyphony")); |
| 764 |
} |
| 765 |
popToggleColors(); |
| 766 |
} |
| 767 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 768 |
ImGui::End(); |
| 769 |
break; |
| 770 |
case 1: // compact |
| 771 |
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags,_("Play/Edit Controls"))) { |
| 772 |
if (ImGui::Button(ICON_FA_STOP "##Stop")) { |
| 773 |
stop(); |
| 774 |
} |
| 775 |
if (ImGui::IsItemHovered()) { |
| 776 |
ImGui::SetTooltip(_("Stop")); |
| 777 |
} |
| 778 |
ImGui::SameLine(); |
| 779 |
pushToggleColors(e->isPlaying()); |
| 780 |
if (ImGui::Button(ICON_FA_PLAY "##Play")) { |
| 781 |
play(); |
| 782 |
} |
| 783 |
if (ImGui::IsItemHovered()) { |
| 784 |
ImGui::SetTooltip(_("Play")); |
| 785 |
} |
| 786 |
popToggleColors(); |
| 787 |
ImGui::SameLine(); |
| 788 |
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { |
| 789 |
e->stepOne(cursor.y); |
| 790 |
pendingStepUpdate=1; |
| 791 |
} |
| 792 |
if (ImGui::IsItemHovered()) { |
| 793 |
ImGui::SetTooltip(_("Step one row")); |
| 794 |
} |
| 795 |
|
| 796 |
ImGui::SameLine(); |
| 797 |
bool repeatPattern=e->getRepeatPattern(); |
| 798 |
pushToggleColors(repeatPattern); |
| 799 |
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern")) { |
| 800 |
e->setRepeatPattern(!repeatPattern); |
| 801 |
} |
| 802 |
if (ImGui::IsItemHovered()) { |
| 803 |
ImGui::SetTooltip(_("Repeat pattern")); |
| 804 |
} |
| 805 |
popToggleColors(); |
| 806 |
|
| 807 |
ImGui::SameLine(); |
| 808 |
pushToggleColors(edit); |
| 809 |
if (ImGui::Button(ICON_FA_CIRCLE "##Edit")) { |
| 810 |
edit=!edit; |
| 811 |
} |
| 812 |
if (ImGui::IsItemHovered()) { |
| 813 |
ImGui::SetTooltip(_("Edit")); |
| 814 |
} |
| 815 |
popToggleColors(); |
| 816 |
|
| 817 |
ImGui::SameLine(); |
| 818 |
pushToggleColors(orderLock); |
| 819 |
if (ImGui::Button(ICON_FA_LOCK "##OrderLock")) { |
| 820 |
doAction(GUI_ACTION_ORDER_LOCK); |
| 821 |
} |
| 822 |
if (ImGui::IsItemHovered()) { |
| 823 |
ImGui::SetTooltip(_("Lock cursor/selection to this order")); |
| 824 |
} |
| 825 |
popToggleColors(); |
| 826 |
|
| 827 |
ImGui::SameLine(); |
| 828 |
bool metro=e->getMetronome(); |
| 829 |
pushToggleColors(metro); |
| 830 |
if (ImGui::Button(ICON_FUR_METRONOME "##Metronome")) { |
| 831 |
e->setMetronome(!metro); |
| 832 |
} |
| 833 |
if (ImGui::IsItemHovered()) { |
| 834 |
ImGui::SetTooltip(_("Metronome")); |
| 835 |
} |
| 836 |
popToggleColors(); |
| 837 |
|
| 838 |
ImGui::SameLine(); |
| 839 |
ImGui::Text(_("Octave")); |
| 840 |
ImGui::SameLine(); |
| 841 |
ImGui::SetNextItemWidth(96.0f*dpiScale); |
| 842 |
if (ImGui::InputInt("##Octave",&curOctave,1,1)) { |
| 843 |
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX; |
| 844 |
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN; |
| 845 |
e->autoNoteOffAll(); |
| 846 |
failedNoteOn=false; |
| 847 |
|
| 848 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 849 |
nextWindow=GUI_WINDOW_PATTERN; |
| 850 |
} |
| 851 |
} |
| 852 |
|
| 853 |
ImGui::SameLine(); |
| 854 |
if (ImGui::SmallButton(changeCoarse?_("Coarse Step"):_("Edit Step"))) { |
| 855 |
changeCoarse=!changeCoarse; |
| 856 |
} |
| 857 |
ImGui::SameLine(); |
| 858 |
ImGui::SetNextItemWidth(96.0f*dpiScale); |
| 859 |
if (changeCoarse) { |
| 860 |
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) { |
| 861 |
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1; |
| 862 |
if (editStepCoarse<0) editStepCoarse=0; |
| 863 |
|
| 864 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 865 |
nextWindow=GUI_WINDOW_PATTERN; |
| 866 |
} |
| 867 |
} |
| 868 |
} else { |
| 869 |
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { |
| 870 |
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; |
| 871 |
if (editStep<0) editStep=0; |
| 872 |
|
| 873 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 874 |
nextWindow=GUI_WINDOW_PATTERN; |
| 875 |
} |
| 876 |
} |
| 877 |
} |
| 878 |
|
| 879 |
ImGui::SameLine(); |
| 880 |
ImGui::Text(_("Follow")); |
| 881 |
ImGui::SameLine(); |
| 882 |
unimportant(ImGui::Checkbox(_("Orders"),&followOrders)); |
| 883 |
ImGui::SameLine(); |
| 884 |
unimportant(ImGui::Checkbox(_("Pattern"),&followPattern)); |
| 885 |
|
| 886 |
ImGui::SameLine(); |
| 887 |
pushToggleColors(noteInputPoly); |
| 888 |
if (ImGui::Button(noteInputPoly?_("Poly##PolyInput"):_("Mono##PolyInput"))) { |
| 889 |
noteInputPoly=!noteInputPoly; |
| 890 |
e->setAutoNotePoly(noteInputPoly); |
| 891 |
} |
| 892 |
if (ImGui::IsItemHovered()) { |
| 893 |
ImGui::SetTooltip(_("Polyphony")); |
| 894 |
} |
| 895 |
popToggleColors(); |
| 896 |
} |
| 897 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 898 |
ImGui::End(); |
| 899 |
break; |
| 900 |
case 2: // compact vertical |
| 901 |
if (ImGui::Begin("Play/Edit Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags,_("Play/Edit Controls"))) { |
| 902 |
ImVec2 buttonSize=ImVec2(ImGui::GetContentRegionAvail().x,0.0f); |
| 903 |
pushToggleColors(e->isPlaying()); |
| 904 |
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) { |
| 905 |
play(); |
| 906 |
} |
| 907 |
if (ImGui::IsItemHovered()) { |
| 908 |
ImGui::SetTooltip(_("Play")); |
| 909 |
} |
| 910 |
popToggleColors(); |
| 911 |
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) { |
| 912 |
stop(); |
| 913 |
} |
| 914 |
if (ImGui::IsItemHovered()) { |
| 915 |
ImGui::SetTooltip(_("Stop")); |
| 916 |
} |
| 917 |
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) { |
| 918 |
e->stepOne(cursor.y); |
| 919 |
pendingStepUpdate=1; |
| 920 |
} |
| 921 |
if (ImGui::IsItemHovered()) { |
| 922 |
ImGui::SetTooltip(_("Step one row")); |
| 923 |
} |
| 924 |
|
| 925 |
bool repeatPattern=e->getRepeatPattern(); |
| 926 |
pushToggleColors(repeatPattern); |
| 927 |
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) { |
| 928 |
e->setRepeatPattern(!repeatPattern); |
| 929 |
} |
| 930 |
if (ImGui::IsItemHovered()) { |
| 931 |
ImGui::SetTooltip(_("Repeat pattern")); |
| 932 |
} |
| 933 |
popToggleColors(); |
| 934 |
|
| 935 |
pushToggleColors(edit); |
| 936 |
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) { |
| 937 |
edit=!edit; |
| 938 |
} |
| 939 |
if (ImGui::IsItemHovered()) { |
| 940 |
ImGui::SetTooltip(_("Edit")); |
| 941 |
} |
| 942 |
popToggleColors(); |
| 943 |
|
| 944 |
pushToggleColors(orderLock); |
| 945 |
if (ImGui::Button(ICON_FA_LOCK "##OrderLock",buttonSize)) { |
| 946 |
doAction(GUI_ACTION_ORDER_LOCK); |
| 947 |
} |
| 948 |
if (ImGui::IsItemHovered()) { |
| 949 |
ImGui::SetTooltip(_("Lock cursor/selection to this order")); |
| 950 |
} |
| 951 |
popToggleColors(); |
| 952 |
|
| 953 |
bool metro=e->getMetronome(); |
| 954 |
pushToggleColors(metro); |
| 955 |
if (ImGui::Button(ICON_FUR_METRONOME "##Metronome",buttonSize)) { |
| 956 |
e->setMetronome(!metro); |
| 957 |
} |
| 958 |
if (ImGui::IsItemHovered()) { |
| 959 |
ImGui::SetTooltip(_("Metronome")); |
| 960 |
} |
| 961 |
popToggleColors(); |
| 962 |
|
| 963 |
ImGui::Text(_("Oct.")); |
| 964 |
if (ImGui::IsItemHovered()) { |
| 965 |
ImGui::SetTooltip(_("Octave")); |
| 966 |
} |
| 967 |
float avail=ImGui::GetContentRegionAvail().x; |
| 968 |
ImGui::SetNextItemWidth(avail); |
| 969 |
if (ImGui::InputInt("##Octave",&curOctave,0,0)) { |
| 970 |
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX; |
| 971 |
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN; |
| 972 |
e->autoNoteOffAll(); |
| 973 |
failedNoteOn=false; |
| 974 |
|
| 975 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 976 |
nextWindow=GUI_WINDOW_PATTERN; |
| 977 |
} |
| 978 |
} |
| 979 |
|
| 980 |
if (ImGui::SmallButton(changeCoarse?_("Coarse"):_("Step"))) { |
| 981 |
changeCoarse=!changeCoarse; |
| 982 |
} |
| 983 |
ImGui::SetNextItemWidth(avail); |
| 984 |
if (changeCoarse) { |
| 985 |
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) { |
| 986 |
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1; |
| 987 |
if (editStepCoarse<0) editStepCoarse=0; |
| 988 |
|
| 989 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 990 |
nextWindow=GUI_WINDOW_PATTERN; |
| 991 |
} |
| 992 |
} |
| 993 |
} else { |
| 994 |
if (ImGui::InputInt("##EditStep",&editStep,0,0)) { |
| 995 |
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; |
| 996 |
if (editStep<0) editStep=0; |
| 997 |
|
| 998 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 999 |
nextWindow=GUI_WINDOW_PATTERN; |
| 1000 |
} |
| 1001 |
} |
| 1002 |
} |
| 1003 |
|
| 1004 |
ImGui::Text(_("Foll.")); |
| 1005 |
if (ImGui::IsItemHovered()) { |
| 1006 |
ImGui::SetTooltip(_("Follow")); |
| 1007 |
} |
| 1008 |
pushToggleColors(followOrders); |
| 1009 |
if (ImGui::Button(_("Ord##FollowOrders"),buttonSize)) { handleUnimportant |
| 1010 |
followOrders=!followOrders; |
| 1011 |
} |
| 1012 |
if (ImGui::IsItemHovered()) { |
| 1013 |
ImGui::SetTooltip(_("Orders")); |
| 1014 |
} |
| 1015 |
popToggleColors(); |
| 1016 |
pushToggleColors(followPattern); |
| 1017 |
if (ImGui::Button(_("Pat##FollowPattern"),buttonSize)) { handleUnimportant |
| 1018 |
followPattern=!followPattern; |
| 1019 |
} |
| 1020 |
if (ImGui::IsItemHovered()) { |
| 1021 |
ImGui::SetTooltip(_("Pattern")); |
| 1022 |
} |
| 1023 |
popToggleColors(); |
| 1024 |
|
| 1025 |
pushToggleColors(noteInputPoly); |
| 1026 |
if (ImGui::Button(noteInputPoly?_("Poly##PolyInput"):_("Mono##PolyInput"))) { |
| 1027 |
noteInputPoly=!noteInputPoly; |
| 1028 |
e->setAutoNotePoly(noteInputPoly); |
| 1029 |
} |
| 1030 |
if (ImGui::IsItemHovered()) { |
| 1031 |
ImGui::SetTooltip(_("Polyphony")); |
| 1032 |
} |
| 1033 |
popToggleColors(); |
| 1034 |
} |
| 1035 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 1036 |
ImGui::End(); |
| 1037 |
break; |
| 1038 |
case 3: // split |
| 1039 |
if (ImGui::Begin("Play Controls",&editControlsOpen,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags,_("Play Controls"))) { |
| 1040 |
if (e->isPlaying()) { |
| 1041 |
pushToggleColors(true); |
| 1042 |
if (ImGui::Button(ICON_FA_STOP "##Stop")) { |
| 1043 |
stop(); |
| 1044 |
} |
| 1045 |
if (ImGui::IsItemHovered()) { |
| 1046 |
ImGui::SetTooltip(_("Stop")); |
| 1047 |
} |
| 1048 |
popToggleColors(); |
| 1049 |
} else { |
| 1050 |
if (ImGui::Button(ICON_FA_PLAY "##Play")) { |
| 1051 |
play(oldRow); |
| 1052 |
} |
| 1053 |
if (ImGui::IsItemHovered()) { |
| 1054 |
ImGui::SetTooltip(_("Play")); |
| 1055 |
} |
| 1056 |
} |
| 1057 |
ImGui::SameLine(); |
| 1058 |
if (ImGui::Button(ICON_FA_PLAY_CIRCLE "##PlayAgain")) { |
| 1059 |
e->setRepeatPattern(false); |
| 1060 |
play(0); |
| 1061 |
} |
| 1062 |
if (ImGui::IsItemHovered()) { |
| 1063 |
ImGui::SetTooltip(_("Play from the beginning of this pattern")); |
| 1064 |
} |
| 1065 |
ImGui::SameLine(); |
| 1066 |
if (ImGui::Button(ICON_FA_STEP_FORWARD "##PlayRepeat")) { |
| 1067 |
e->setRepeatPattern(true); |
| 1068 |
play(0); |
| 1069 |
} |
| 1070 |
if (ImGui::IsItemHovered()) { |
| 1071 |
ImGui::SetTooltip(_("Repeat from the beginning of this pattern")); |
| 1072 |
} |
| 1073 |
ImGui::SameLine(); |
| 1074 |
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne")) { |
| 1075 |
e->stepOne(cursor.y); |
| 1076 |
pendingStepUpdate=1; |
| 1077 |
} |
| 1078 |
if (ImGui::IsItemHovered()) { |
| 1079 |
ImGui::SetTooltip(_("Step one row")); |
| 1080 |
} |
| 1081 |
|
| 1082 |
ImGui::SameLine(); |
| 1083 |
pushToggleColors(edit); |
| 1084 |
if (ImGui::Button(ICON_FA_CIRCLE "##Edit")) { |
| 1085 |
edit=!edit; |
| 1086 |
} |
| 1087 |
if (ImGui::IsItemHovered()) { |
| 1088 |
ImGui::SetTooltip(_("Edit")); |
| 1089 |
} |
| 1090 |
popToggleColors(); |
| 1091 |
|
| 1092 |
ImGui::SameLine(); |
| 1093 |
pushToggleColors(orderLock); |
| 1094 |
if (ImGui::Button(ICON_FA_LOCK "##OrderLock")) { |
| 1095 |
doAction(GUI_ACTION_ORDER_LOCK); |
| 1096 |
} |
| 1097 |
if (ImGui::IsItemHovered()) { |
| 1098 |
ImGui::SetTooltip(_("Lock cursor/selection to this order")); |
| 1099 |
} |
| 1100 |
popToggleColors(); |
| 1101 |
|
| 1102 |
bool metro=e->getMetronome(); |
| 1103 |
ImGui::SameLine(); |
| 1104 |
pushToggleColors(metro); |
| 1105 |
if (ImGui::Button(ICON_FUR_METRONOME "##Metronome")) { |
| 1106 |
e->setMetronome(!metro); |
| 1107 |
} |
| 1108 |
if (ImGui::IsItemHovered()) { |
| 1109 |
ImGui::SetTooltip(_("Metronome")); |
| 1110 |
} |
| 1111 |
popToggleColors(); |
| 1112 |
|
| 1113 |
ImGui::SameLine(); |
| 1114 |
bool repeatPattern=e->getRepeatPattern(); |
| 1115 |
pushToggleColors(repeatPattern); |
| 1116 |
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern")) { |
| 1117 |
e->setRepeatPattern(!repeatPattern); |
| 1118 |
} |
| 1119 |
if (ImGui::IsItemHovered()) { |
| 1120 |
ImGui::SetTooltip(_("Repeat pattern")); |
| 1121 |
} |
| 1122 |
popToggleColors(); |
| 1123 |
|
| 1124 |
ImGui::SameLine(); |
| 1125 |
pushToggleColors(noteInputPoly); |
| 1126 |
if (ImGui::Button(noteInputPoly?_("Poly##PolyInput"):_("Mono##PolyInput"))) { |
| 1127 |
noteInputPoly=!noteInputPoly; |
| 1128 |
e->setAutoNotePoly(noteInputPoly); |
| 1129 |
} |
| 1130 |
if (ImGui::IsItemHovered()) { |
| 1131 |
ImGui::SetTooltip(_("Polyphony")); |
| 1132 |
} |
| 1133 |
popToggleColors(); |
| 1134 |
} |
| 1135 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 1136 |
ImGui::End(); |
| 1137 |
|
| 1138 |
if (ImGui::Begin("Edit Controls",&editControlsOpen,globalWinFlags,_("Edit Controls"))) { |
| 1139 |
ImGui::Columns(2); |
| 1140 |
ImGui::AlignTextToFramePadding(); |
| 1141 |
ImGui::Text(_("Octave")); |
| 1142 |
ImGui::SameLine(); |
| 1143 |
float cursor=ImGui::GetCursorPosX(); |
| 1144 |
float avail=ImGui::GetContentRegionAvail().x; |
| 1145 |
ImGui::SetNextItemWidth(avail); |
| 1146 |
if (ImGui::InputInt("##Octave",&curOctave,1,1)) { |
| 1147 |
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX; |
| 1148 |
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN; |
| 1149 |
e->autoNoteOffAll(); |
| 1150 |
failedNoteOn=false; |
| 1151 |
|
| 1152 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 1153 |
nextWindow=GUI_WINDOW_PATTERN; |
| 1154 |
} |
| 1155 |
} |
| 1156 |
|
| 1157 |
ImGui::AlignTextToFramePadding(); |
| 1158 |
if (ImGui::SmallButton(changeCoarse?_("Coarse"):_("Step"))) { |
| 1159 |
changeCoarse=!changeCoarse; |
| 1160 |
} |
| 1161 |
ImGui::SameLine(); |
| 1162 |
ImGui::SetCursorPosX(cursor); |
| 1163 |
ImGui::SetNextItemWidth(avail); |
| 1164 |
if (changeCoarse) { |
| 1165 |
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) { |
| 1166 |
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1; |
| 1167 |
if (editStepCoarse<0) editStepCoarse=0; |
| 1168 |
|
| 1169 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 1170 |
nextWindow=GUI_WINDOW_PATTERN; |
| 1171 |
} |
| 1172 |
} |
| 1173 |
} else { |
| 1174 |
if (ImGui::InputInt("##EditStep",&editStep,1,1)) { |
| 1175 |
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1; |
| 1176 |
if (editStep<0) editStep=0; |
| 1177 |
|
| 1178 |
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) { |
| 1179 |
nextWindow=GUI_WINDOW_PATTERN; |
| 1180 |
} |
| 1181 |
} |
| 1182 |
} |
| 1183 |
ImGui::NextColumn(); |
| 1184 |
|
| 1185 |
unimportant(ImGui::Checkbox(_("Follow orders"),&followOrders)); |
| 1186 |
unimportant(ImGui::Checkbox(_("Follow pattern"),&followPattern)); |
| 1187 |
} |
| 1188 |
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS; |
| 1189 |
ImGui::End(); |
| 1190 |
break; |
| 1191 |
} |
| 1192 |
} |