mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 05:25:12 +00:00
GUI: add ability to colorize rows per highlight
This commit is contained in:
parent
dab164f09e
commit
48838440ba
4 changed files with 37 additions and 7 deletions
|
@ -132,8 +132,14 @@ enum FurnaceGUIColors {
|
|||
GUI_COLOR_PATTERN_HI_1,
|
||||
GUI_COLOR_PATTERN_HI_2,
|
||||
GUI_COLOR_PATTERN_ROW_INDEX,
|
||||
GUI_COLOR_PATTERN_ROW_INDEX_HI1,
|
||||
GUI_COLOR_PATTERN_ROW_INDEX_HI2,
|
||||
GUI_COLOR_PATTERN_ACTIVE,
|
||||
GUI_COLOR_PATTERN_INACTIVE,
|
||||
GUI_COLOR_PATTERN_ACTIVE_HI1,
|
||||
GUI_COLOR_PATTERN_INACTIVE_HI1,
|
||||
GUI_COLOR_PATTERN_ACTIVE_HI2,
|
||||
GUI_COLOR_PATTERN_INACTIVE_HI2,
|
||||
GUI_COLOR_PATTERN_INS,
|
||||
GUI_COLOR_PATTERN_INS_WARN,
|
||||
GUI_COLOR_PATTERN_INS_ERROR,
|
||||
|
|
|
@ -438,8 +438,14 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
|
|||
D(GUI_COLOR_PATTERN_HI_1,"",ImVec4(0.6f,0.6f,0.6f,0.2f)),
|
||||
D(GUI_COLOR_PATTERN_HI_2,"",ImVec4(0.5f,0.8f,1.0f,0.2f)),
|
||||
D(GUI_COLOR_PATTERN_ROW_INDEX,"",ImVec4(0.5f,0.8f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_ROW_INDEX_HI1,"",ImVec4(0.5f,0.8f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_ROW_INDEX_HI2,"",ImVec4(0.5f,0.8f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_ACTIVE,"",ImVec4(1.0f,1.0f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INACTIVE,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_ACTIVE_HI1,"",ImVec4(1.0f,1.0f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INACTIVE_HI1,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_ACTIVE_HI2,"",ImVec4(1.0f,1.0f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INACTIVE_HI2,"",ImVec4(0.5f,0.5f,0.5f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INS,"",ImVec4(0.4f,0.7f,1.0f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INS_WARN,"",ImVec4(1.0f,1.0f,0.1f,1.0f)),
|
||||
D(GUI_COLOR_PATTERN_INS_ERROR,"",ImVec4(1.0f,0.1f,0.1f,1.0f)),
|
||||
|
|
|
@ -105,6 +105,18 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
return;
|
||||
}
|
||||
bool isPushing=false;
|
||||
ImVec4 activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE];
|
||||
ImVec4 inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE];
|
||||
ImVec4 rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX];
|
||||
if (e->song.hilightB>0 && !(i%e->song.hilightB)) {
|
||||
activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE_HI2];
|
||||
inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE_HI2];
|
||||
rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX_HI2];
|
||||
} else if (e->song.hilightA>0 && !(i%e->song.hilightA)) {
|
||||
activeColor=uiColors[GUI_COLOR_PATTERN_ACTIVE_HI1];
|
||||
inactiveColor=uiColors[GUI_COLOR_PATTERN_INACTIVE_HI1];
|
||||
rowIndexColor=uiColors[GUI_COLOR_PATTERN_ROW_INDEX_HI1];
|
||||
}
|
||||
// check overflow highlight
|
||||
if (settings.overflowHighlight) {
|
||||
if (edit && cursor.y==i) {
|
||||
|
@ -132,9 +144,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
}
|
||||
// row number
|
||||
if (settings.patRowsBase==1) {
|
||||
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %.2X ",i);
|
||||
ImGui::TextColored(rowIndexColor," %.2X ",i);
|
||||
} else {
|
||||
ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX],"%3d ",i);
|
||||
ImGui::TextColored(rowIndexColor,"%3d ",i);
|
||||
}
|
||||
// for each column
|
||||
for (int j=0; j<chans; j++) {
|
||||
|
@ -163,9 +175,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
// note
|
||||
sprintf(id,"%s##PN_%d_%d",noteName(pat->data[i][0],pat->data[i][1]),i,j);
|
||||
if (pat->data[i][0]==0 && pat->data[i][1]==0) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INACTIVE]);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_ACTIVE]);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,activeColor);
|
||||
}
|
||||
if (cursorNote) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_CURSOR]);
|
||||
|
@ -191,7 +203,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
if (!e->song.chanCollapse[j]) {
|
||||
// instrument
|
||||
if (pat->data[i][2]==-1) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INACTIVE]);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
sprintf(id,"..##PI_%d_%d",i,j);
|
||||
} else {
|
||||
if (pat->data[i][2]<0 || pat->data[i][2]>=e->song.insLen) {
|
||||
|
@ -230,7 +242,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
// volume
|
||||
if (pat->data[i][3]==-1) {
|
||||
sprintf(id,"..##PV_%d_%d",i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INACTIVE]);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
int volColor=(pat->data[i][3]*127)/chanVolMax;
|
||||
if (volColor>127) volColor=127;
|
||||
|
@ -270,7 +282,7 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
|
|||
// effect
|
||||
if (pat->data[i][index]==-1) {
|
||||
sprintf(id,"..##PE%d_%d_%d",k,i,j);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INACTIVE]);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,inactiveColor);
|
||||
} else {
|
||||
sprintf(id,"%.2X##PE%d_%d_%d",pat->data[i][index],k,i,j);
|
||||
if (pat->data[i][index]<0x10) {
|
||||
|
|
|
@ -1008,8 +1008,14 @@ void FurnaceGUI::drawSettings() {
|
|||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_1,"Highlight 1");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_2,"Highlight 2");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX,"Row number");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI1,"Row number (highlight 1)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI2,"Row number (highlight 2)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE,"Note");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI1,"Note (highlight 1)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI2,"Note (highlight 2)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE,"Blank");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI1,"Blank (highlight 1)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI2,"Blank (highlight 2)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS,"Instrument");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_WARN,"Instrument (invalid type)");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_ERROR,"Instrument (out of range)");
|
||||
|
|
Loading…
Reference in a new issue