diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1cf8c24ca..0338634db 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3103,6 +3103,246 @@ void FurnaceGUI::drawVolMeter() { ImGui::End(); } +// draw a pattern row +inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord) { + static char id[32]; + bool selectedRow=(i>=sel1.y && i<=sel2.y); + ImGui::TableNextRow(0,lineHeight); + ImGui::TableNextColumn(); + float cursorPosY=ImGui::GetCursorPos().y-ImGui::GetScrollY(); + // check if the row is visible + if (cursorPosY<-lineHeight || cursorPosY>ImGui::GetWindowSize().y) { + return; + } + // check if we are in range + if (ord<0 || ord>=e->song.ordersLen) { + return; + } + if (i<0 || i>=e->song.patLen) { + return; + } + // check overflow highlight + if (settings.overflowHighlight) { + if (edit && cursor.y==i) { + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_EDITING])); + } else if (isPlaying && oldRow==i) { + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,0x40ffffff); + } else if (e->song.hilightB>0 && !(i%e->song.hilightB)) { + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_2])); + } else if (e->song.hilightA>0 && !(i%e->song.hilightA)) { + ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0,ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_HI_1])); + } + } + // row number + if (settings.patRowsBase==1) { + ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX]," %.2X ",i); + } else { + ImGui::TextColored(uiColors[GUI_COLOR_PATTERN_ROW_INDEX],"%3d ",i); + } + // for each column + for (int j=0; j