mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
GUI: prepare to add auto-clone feature
This commit is contained in:
parent
74d2e7e329
commit
d5da4d7e52
5 changed files with 35 additions and 3 deletions
|
@ -3970,6 +3970,10 @@ bool FurnaceGUI::loop() {
|
|||
ImGui_ImplSDL2_NewFrame(sdlWin);
|
||||
ImGui::NewFrame();
|
||||
|
||||
// one second counter
|
||||
secondTimer+=ImGui::GetIO().DeltaTime;
|
||||
if (secondTimer>=1.0f) secondTimer=fmod(secondTimer,1.0f);
|
||||
|
||||
curWindowLast=curWindow;
|
||||
curWindow=GUI_WINDOW_NOTHING;
|
||||
editOptsVisible=false;
|
||||
|
@ -3987,6 +3991,19 @@ bool FurnaceGUI::loop() {
|
|||
oldRow=nextOldRow;
|
||||
}
|
||||
|
||||
// check whether pattern of channel(s) at cursor/selection is/are unique
|
||||
isPatUnique=true;
|
||||
if (curOrder>=0 && curOrder<e->curSubSong->ordersLen && selStart.xCoarse>=0 && selStart.xCoarse<e->getTotalChannelCount() && selEnd.xCoarse>=0 && selEnd.xCoarse<e->getTotalChannelCount()) {
|
||||
for (int i=0; i<e->curSubSong->ordersLen; i++) {
|
||||
if (i==curOrder) continue;
|
||||
for (int j=selStart.xCoarse; j<=selEnd.xCoarse; j++) {
|
||||
if (e->curSubSong->orders.ord[j][i]==e->curSubSong->orders.ord[j][curOrder]) isPatUnique=false;
|
||||
break;
|
||||
}
|
||||
if (!isPatUnique) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mobileUI) {
|
||||
ImGui::BeginMainMenuBar();
|
||||
if (ImGui::BeginMenu(settings.capitalMenuBar?"File":"file")) {
|
||||
|
@ -7106,6 +7123,8 @@ FurnaceGUI::FurnaceGUI():
|
|||
warnQuit(false),
|
||||
willCommit(false),
|
||||
edit(false),
|
||||
editClone(false),
|
||||
isPatUnique(false),
|
||||
modified(false),
|
||||
displayError(false),
|
||||
displayExporting(false),
|
||||
|
@ -7152,6 +7171,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
wheelCalmDown(0),
|
||||
shallDetectScale(0),
|
||||
cpuCores(0),
|
||||
secondTimer(0.0f),
|
||||
userEvents(0xffffffff),
|
||||
mobileMenuPos(0.0f),
|
||||
autoButtonSize(0.0f),
|
||||
|
|
|
@ -127,6 +127,7 @@ enum FurnaceGUIColors {
|
|||
GUI_COLOR_TOGGLE_OFF,
|
||||
GUI_COLOR_TOGGLE_ON,
|
||||
GUI_COLOR_EDITING,
|
||||
GUI_COLOR_EDITING_CLONE,
|
||||
GUI_COLOR_SONG_LOOP,
|
||||
GUI_COLOR_DESTRUCTIVE,
|
||||
GUI_COLOR_WARNING,
|
||||
|
@ -1344,7 +1345,7 @@ class FurnaceGUI {
|
|||
std::vector<String> availRenderDrivers;
|
||||
std::vector<String> availAudioDrivers;
|
||||
|
||||
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, zsmExportOptimize, vgmExportPatternHints;
|
||||
bool quit, warnQuit, willCommit, edit, editClone, isPatUnique, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, zsmExportOptimize, vgmExportPatternHints;
|
||||
bool vgmExportDirectStream, displayInsTypeList;
|
||||
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
|
||||
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||
|
@ -1367,6 +1368,7 @@ class FurnaceGUI {
|
|||
int wheelCalmDown;
|
||||
int shallDetectScale;
|
||||
int cpuCores;
|
||||
float secondTimer;
|
||||
unsigned int userEvents;
|
||||
float mobileMenuPos, autoButtonSize, mobileEditAnim;
|
||||
ImVec2 mobileEditButtonPos, mobileEditButtonSize;
|
||||
|
|
|
@ -810,6 +810,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
|
|||
D(GUI_COLOR_TOGGLE_OFF,"",ImVec4(0.2f,0.2f,0.2f,1.0f)),
|
||||
D(GUI_COLOR_TOGGLE_ON,"",ImVec4(0.2f,0.6f,0.2f,1.0f)),
|
||||
D(GUI_COLOR_EDITING,"",ImVec4(0.2f,0.1f,0.1f,1.0f)),
|
||||
D(GUI_COLOR_EDITING_CLONE,"",ImVec4(0.2f,0.1f,0.3f,1.0f)),
|
||||
D(GUI_COLOR_SONG_LOOP,"",ImVec4(0.3f,0.5f,0.8f,0.4f)),
|
||||
D(GUI_COLOR_DESTRUCTIVE,"",ImVec4(1.0f,0.2f,0.2f,1.0f)),
|
||||
D(GUI_COLOR_WARNING,"",ImVec4(0.98f,0.98f,0.06f,1.0f)),
|
||||
|
|
|
@ -101,7 +101,11 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
// check overflow highlight
|
||||
if (settings.overflowHighlight) {
|
||||
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
||||
if (editClone && !isPatUnique && secondTimer<0.5) {
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING_CLONE]));
|
||||
} else {
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
|
||||
}
|
||||
} else if (isPlaying && oldRow==i && ord==playOrder) {
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
||||
} else if (e->curSubSong->hilightB>0 && !(i%e->curSubSong->hilightB)) {
|
||||
|
@ -112,7 +116,11 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
} else {
|
||||
isPushing=true;
|
||||
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
||||
if (editClone && !isPatUnique && secondTimer<0.5) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING_CLONE]));
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
|
||||
}
|
||||
} else if (isPlaying && oldRow==i && ord==playOrder) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
||||
} else if (e->curSubSong->hilightB>0 && !(i%e->curSubSong->hilightB)) {
|
||||
|
|
|
@ -3158,6 +3158,7 @@ void FurnaceGUI::drawSettings() {
|
|||
UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_ON,"Toggle on");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,"Toggle off");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_EDITING,"Editing");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,"Editing (will clone)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,"Song loop");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,"Playback status");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,"Destructive hint");
|
||||
|
|
Loading…
Reference in a new issue