diff --git a/src/gui/newPattern.cpp b/src/gui/newPattern.cpp index 990ebd8fd..8d79df60b 100644 --- a/src/gui/newPattern.cpp +++ b/src/gui/newPattern.cpp @@ -118,6 +118,7 @@ void FurnaceGUI::drawPatternNew() { } ImDrawList* dl=ImGui::GetWindowDrawList(); + float patFineOffsets[DIV_MAX_COLS]; char id[64]; int firstOrd=curOrder; int chans=e->getTotalChannelCount(); @@ -155,6 +156,21 @@ void FurnaceGUI::drawPatternNew() { effectValCellSize=twoChars; effectValCellSize.x+=(float)settings.effectValCellSpacing*dpiScale; + float cellSizeAccum=0.0f; + patFineOffsets[DIV_PAT_NOTE]=cellSizeAccum; + cellSizeAccum+=noteCellSize.x; + patFineOffsets[DIV_PAT_INS]=cellSizeAccum; + cellSizeAccum+=insCellSize.x; + patFineOffsets[DIV_PAT_VOL]=cellSizeAccum; + cellSizeAccum+=volCellSize.x; + for (int i=0; i=top.x && pointerPos.xcurSubSong->chanShow[i]) continue; + if (pointerPos.x>=patChanX[i] && pointerPos.x=noteCellSize.x && e->curSubSong->chanCollapse[i]<3) { + pointer.xFine=1; + fineOffset-=noteCellSize.x; + + if (fineOffset>=insCellSize.x && e->curSubSong->chanCollapse[i]<2) { + pointer.xFine=2; + fineOffset-=insCellSize.x; + + if (fineOffset>=volCellSize.x && e->curSubSong->chanCollapse[i]<1) { + pointer.xFine=3; + fineOffset-=volCellSize.x; + + for (int k=0; kcurPat[i].effectCols; k++) { + if (fineOffset>=effectCellSize.x) { + pointer.xFine++; + fineOffset-=effectCellSize.x; + if (fineOffset>=effectValCellSize.x) { + pointer.xFine++; + fineOffset-=effectValCellSize.x; + } else { + break; + } + } else { + break; + } + } + + if (pointer.xFine>2+2*e->curPat[i].effectCols) pointer.xFine=2+2*e->curPat[i].effectCols; + } + } + } + + break; + } + } + + { + int ord=firstOrd; + int row=firstRow; + pos=top; + for (int j=0; j=0 && ordcurSubSong->ordersLen) { + if (pointerPos.y>=pos.y && pointerPos.y<(pos.y+lineHeight)) { + pointer.order=ord; + pointer.y=row; + break; + } + } + if (++row>=e->curSubSong->patLen) { + row=0; + ord++; + } + pos.y+=lineHeight; + } + } + + String debugText=fmt::sprintf("CURSOR: %d:%d, %d/%d",pointer.xCoarse,pointer.xFine,pointer.order,pointer.y); + dl->AddText(top+ImGui::GetCurrentWindow()->Scroll,0xffffffff,debugText.c_str()); + // row number and highlights { int ord=firstOrd; int row=firstRow; bool isPlaying=e->isPlaying(); + pos=top; SETUP_ORDER_ALPHA; for (int j=0; j=0 && ordcurSubSong->ordersLen) { @@ -244,11 +338,13 @@ void FurnaceGUI::drawPatternNew() { } // selection background - { + if (sel1.xCoarse>=0 && sel1.xCoarse=0 && sel2.xCoarseAddRectFilled( selRect.Min, selRect.Max, - ImGui::GetColorU32(uiColors[GUI_COLOR_PATTERN_SELECTION]) + ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_PATTERN_SELECTION]) ); curSelFindStage=3; break; @@ -289,6 +384,31 @@ void FurnaceGUI::drawPatternNew() { } } + // cursor background + if (cursor.xCoarse>=0 && cursor.xCoarseAddRectFilled( + ImVec2(top.x+patChanX[cursor.xCoarse]+patFineOffsets[cursor.xFine&31],pos.y), + ImVec2(top.x+patChanX[cursor.xCoarse]+patFineOffsets[(1+cursor.xFine)&31],pos.y+lineHeight), + ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_PATTERN_CURSOR]) + ); + break; + } + + if (++row>=e->curSubSong->patLen) { + row=0; + ord++; + SETUP_ORDER_ALPHA; + } + pos.y+=lineHeight; + } + } + // channels and borders for (int i=0; icurSubSong->chanShow[i]) continue; @@ -428,6 +548,24 @@ void FurnaceGUI::drawPatternNew() { ); ImGui::GetStyle().Alpha=origAlpha; + + // test for selection + //if (pointer. + if (ImGui::IsWindowHovered(/*ImGuiHoveredFlags_AllowWhenBlockedByActiveItem*/)) { + if (ImRect(dl->GetClipRectMin(),dl->GetClipRectMax()).Contains(ImGui::GetMousePos())) { + dl->AddText(top+ImVec2(0,lineHeight),0xffffffff,"Hovered!!!!!!!"); + } + //updateSelection(0,0,i,ord,true); + } + /* + if (ImGui::IsWindowClicked()) { + //startSelection(0,0,i,ord,true); + } + if (ImGui::IsWindowActive() && CHECK_LONG_HOLD) { + ImGui::InhibitInertialScroll(); + NOTIFY_LONG_HOLD; + mobilePatSel=true; + }*/ } ImGui::PopFont(); }