GUI: prepare to add auto-clone feature
This commit is contained in:
parent
74d2e7e329
commit
d5da4d7e52
|
@ -3970,6 +3970,10 @@ bool FurnaceGUI::loop() {
|
||||||
ImGui_ImplSDL2_NewFrame(sdlWin);
|
ImGui_ImplSDL2_NewFrame(sdlWin);
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
// one second counter
|
||||||
|
secondTimer+=ImGui::GetIO().DeltaTime;
|
||||||
|
if (secondTimer>=1.0f) secondTimer=fmod(secondTimer,1.0f);
|
||||||
|
|
||||||
curWindowLast=curWindow;
|
curWindowLast=curWindow;
|
||||||
curWindow=GUI_WINDOW_NOTHING;
|
curWindow=GUI_WINDOW_NOTHING;
|
||||||
editOptsVisible=false;
|
editOptsVisible=false;
|
||||||
|
@ -3987,6 +3991,19 @@ bool FurnaceGUI::loop() {
|
||||||
oldRow=nextOldRow;
|
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) {
|
if (!mobileUI) {
|
||||||
ImGui::BeginMainMenuBar();
|
ImGui::BeginMainMenuBar();
|
||||||
if (ImGui::BeginMenu(settings.capitalMenuBar?"File":"file")) {
|
if (ImGui::BeginMenu(settings.capitalMenuBar?"File":"file")) {
|
||||||
|
@ -7106,6 +7123,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
warnQuit(false),
|
warnQuit(false),
|
||||||
willCommit(false),
|
willCommit(false),
|
||||||
edit(false),
|
edit(false),
|
||||||
|
editClone(false),
|
||||||
|
isPatUnique(false),
|
||||||
modified(false),
|
modified(false),
|
||||||
displayError(false),
|
displayError(false),
|
||||||
displayExporting(false),
|
displayExporting(false),
|
||||||
|
@ -7152,6 +7171,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
wheelCalmDown(0),
|
wheelCalmDown(0),
|
||||||
shallDetectScale(0),
|
shallDetectScale(0),
|
||||||
cpuCores(0),
|
cpuCores(0),
|
||||||
|
secondTimer(0.0f),
|
||||||
userEvents(0xffffffff),
|
userEvents(0xffffffff),
|
||||||
mobileMenuPos(0.0f),
|
mobileMenuPos(0.0f),
|
||||||
autoButtonSize(0.0f),
|
autoButtonSize(0.0f),
|
||||||
|
|
|
@ -127,6 +127,7 @@ enum FurnaceGUIColors {
|
||||||
GUI_COLOR_TOGGLE_OFF,
|
GUI_COLOR_TOGGLE_OFF,
|
||||||
GUI_COLOR_TOGGLE_ON,
|
GUI_COLOR_TOGGLE_ON,
|
||||||
GUI_COLOR_EDITING,
|
GUI_COLOR_EDITING,
|
||||||
|
GUI_COLOR_EDITING_CLONE,
|
||||||
GUI_COLOR_SONG_LOOP,
|
GUI_COLOR_SONG_LOOP,
|
||||||
GUI_COLOR_DESTRUCTIVE,
|
GUI_COLOR_DESTRUCTIVE,
|
||||||
GUI_COLOR_WARNING,
|
GUI_COLOR_WARNING,
|
||||||
|
@ -1344,7 +1345,7 @@ class FurnaceGUI {
|
||||||
std::vector<String> availRenderDrivers;
|
std::vector<String> availRenderDrivers;
|
||||||
std::vector<String> availAudioDrivers;
|
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 vgmExportDirectStream, displayInsTypeList;
|
||||||
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
|
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
|
||||||
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||||
|
@ -1367,6 +1368,7 @@ class FurnaceGUI {
|
||||||
int wheelCalmDown;
|
int wheelCalmDown;
|
||||||
int shallDetectScale;
|
int shallDetectScale;
|
||||||
int cpuCores;
|
int cpuCores;
|
||||||
|
float secondTimer;
|
||||||
unsigned int userEvents;
|
unsigned int userEvents;
|
||||||
float mobileMenuPos, autoButtonSize, mobileEditAnim;
|
float mobileMenuPos, autoButtonSize, mobileEditAnim;
|
||||||
ImVec2 mobileEditButtonPos, mobileEditButtonSize;
|
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_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_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,"",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_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_DESTRUCTIVE,"",ImVec4(1.0f,0.2f,0.2f,1.0f)),
|
||||||
D(GUI_COLOR_WARNING,"",ImVec4(0.98f,0.98f,0.06f,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
|
// check overflow highlight
|
||||||
if (settings.overflowHighlight) {
|
if (settings.overflowHighlight) {
|
||||||
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
||||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
|
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) {
|
} else if (isPlaying && oldRow==i && ord==playOrder) {
|
||||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
||||||
} else if (e->curSubSong->hilightB>0 && !(i%e->curSubSong->hilightB)) {
|
} 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 {
|
} else {
|
||||||
isPushing=true;
|
isPushing=true;
|
||||||
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
if (edit && cursor.y==i && curWindowLast==GUI_WINDOW_PATTERN) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING]));
|
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) {
|
} else if (isPlaying && oldRow==i && ord==playOrder) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
ImGui::PushStyleColor(ImGuiCol_Header,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_PLAY_HEAD]));
|
||||||
} else if (e->curSubSong->hilightB>0 && !(i%e->curSubSong->hilightB)) {
|
} 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_ON,"Toggle on");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,"Toggle off");
|
UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,"Toggle off");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_EDITING,"Editing");
|
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_SONG_LOOP,"Song loop");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,"Playback status");
|
UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,"Playback status");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,"Destructive hint");
|
UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,"Destructive hint");
|
||||||
|
|
Loading…
Reference in a new issue