GUI: change color of destructive actions

This commit is contained in:
tildearrow 2023-06-22 19:49:45 -05:00
parent 6c36fb6e40
commit aeeaa9ca1d
6 changed files with 45 additions and 2 deletions

View File

@ -693,6 +693,7 @@ void FurnaceGUI::drawInsList(bool asChild) {
}
}
ImGui::SameLine();
pushDestColor();
if (ImGui::Button(ICON_FA_TIMES "##InsDelete")) {
if (settings.unifiedDataView) {
switch (lastAssetType) {
@ -710,6 +711,7 @@ void FurnaceGUI::drawInsList(bool asChild) {
doAction(GUI_ACTION_INS_LIST_DELETE);
}
}
popDestColor();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Delete");
}
@ -930,9 +932,11 @@ void FurnaceGUI::drawWaveList(bool asChild) {
}
}
ImGui::SameLine();
pushDestColor();
if (ImGui::Button(ICON_FA_TIMES "##WaveDelete")) {
doAction(GUI_ACTION_WAVE_LIST_DELETE);
}
popDestColor();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Delete");
}
@ -1070,9 +1074,11 @@ void FurnaceGUI::drawSampleList(bool asChild) {
}
}
ImGui::SameLine();
pushDestColor();
if (ImGui::Button(ICON_FA_TIMES "##SampleDelete")) {
doAction(GUI_ACTION_SAMPLE_LIST_DELETE);
}
popDestColor();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Delete");
}

View File

@ -6575,6 +6575,7 @@ FurnaceGUI::FurnaceGUI():
portrait(false),
injectBackUp(false),
mobileMenuOpen(false),
warnColorPushed(false),
wantCaptureKeyboard(false),
oldWantCaptureKeyboard(false),
displayMacroMenu(false),

View File

@ -1299,7 +1299,7 @@ class FurnaceGUI {
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
bool vgmExportDirectStream, displayInsTypeList;
bool portrait, injectBackUp, mobileMenuOpen;
bool portrait, injectBackUp, mobileMenuOpen, warnColorPushed;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
@ -2084,6 +2084,11 @@ class FurnaceGUI {
void pushAccentColors(const ImVec4& one, const ImVec4& two, const ImVec4& border, const ImVec4& borderShadow);
void popAccentColors();
void pushDestColor();
void popDestColor();
void pushWarningColor(bool warnCond, bool errorCond=false);
void popWarningColor();
float calcBPM(const DivGroovePattern& speeds, float hz, int vN, int vD);
void patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord, const DivPattern** patCache, bool inhibitSel);

View File

@ -742,7 +742,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
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_SONG_LOOP,"",ImVec4(0.3f,0.5f,0.8f,0.4f)),
D(GUI_COLOR_DESTRUCTIVE,"",ImVec4(0.8f,0.3f,0.3f,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_ERROR,"",ImVec4(0.98f,0.06f,0.11f,1.0f)),

View File

@ -3495,6 +3495,35 @@ void FurnaceGUI::popAccentColors() {
ImGui::PopStyleColor(24);
}
void FurnaceGUI::pushDestColor() {
pushAccentColors(uiColors[GUI_COLOR_DESTRUCTIVE],uiColors[GUI_COLOR_DESTRUCTIVE],uiColors[GUI_COLOR_DESTRUCTIVE],ImVec4(0.0f,0.0f,0.0f,0.0f));
}
void FurnaceGUI::popDestColor() {
popAccentColors();
}
void FurnaceGUI::pushWarningColor(bool warnCond, bool errorCond) {
if (warnColorPushed) {
logE("warnColorPushed");
abort();
}
if (errorCond) {
pushAccentColors(uiColors[GUI_COLOR_ERROR],uiColors[GUI_COLOR_ERROR],uiColors[GUI_COLOR_ERROR],ImVec4(0.0f,0.0f,0.0f,0.0f));
warnColorPushed=true;
} else if (warnCond) {
pushAccentColors(uiColors[GUI_COLOR_WARNING],uiColors[GUI_COLOR_WARNING],uiColors[GUI_COLOR_WARNING],ImVec4(0.0f,0.0f,0.0f,0.0f));
warnColorPushed=true;
}
}
void FurnaceGUI::popWarningColor() {
if (warnColorPushed) {
popAccentColors();
warnColorPushed=false;
}
}
#define IGFD_FileStyleByExtension IGFD_FileStyleByExtention
#ifdef _WIN32

View File

@ -92,6 +92,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
ImGui::SetTooltip("Add");
}
ImGui::SameLine();
pushDestColor();
if (ImGui::Button(ICON_FA_MINUS "##SubSongDel")) {
if (e->song.subsong.size()<=1) {
showError("this is the only subsong!");
@ -99,6 +100,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
showWarning("are you sure you want to remove this subsong?",GUI_WARN_SUBSONG_DEL);
}
}
popDestColor();
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Remove");
}