| 1547 | } |
| 1548 | |
| 1549 | void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) |
| 1550 | { |
| 1551 | const auto &viewInfo = ViewInfo::Get( *GetProject() ); |
| 1552 | const auto &playRegion = viewInfo.playRegion; |
| 1553 | const auto playRegionBounds = std::pair{ |
| 1554 | playRegion.GetLastActiveStart(), playRegion.GetLastActiveEnd() }; |
| 1555 | mLastDrawnH = viewInfo.hpos; |
| 1556 | mLastDrawnZoom = viewInfo.GetZoom(); |
| 1557 | mLastDrawnPlayRegion = playRegionBounds; |
| 1558 | mLastDrawnSelectedRegion = viewInfo.selectedRegion; |
| 1559 | // To do, note other fisheye state when we have that |
| 1560 | |
| 1561 | wxPaintDC dc(this); |
| 1562 | |
| 1563 | auto &backDC = GetBackingDCForRepaint(); |
| 1564 | |
| 1565 | DoDrawBackground(&backDC); |
| 1566 | |
| 1567 | // Find play region rectangle, selected rectangle, and their overlap |
| 1568 | const auto rectP = PlayRegionRectangle(), |
| 1569 | rectS = SelectedRegionRectangle(), |
| 1570 | rectO = rectP.Intersect(rectS); |
| 1571 | |
| 1572 | // What's left and right of the overlap? Assume same tops and bottoms |
| 1573 | const auto top = rectP.GetTop(), |
| 1574 | bottom = rectP.GetBottom(); |
| 1575 | wxRect rectL = mInner; |
| 1576 | wxRect rectR = {}; |
| 1577 | if (!rectO.IsEmpty()) { |
| 1578 | rectR = { wxPoint{ rectO.GetRight() + 1, top }, rectL.GetBottomRight() }; |
| 1579 | rectL = { rectL.GetTopLeft(), wxPoint{ rectO.GetLeft() - 1, bottom } }; |
| 1580 | } |
| 1581 | |
| 1582 | DoDrawPlayRegion(&backDC, rectP, rectL, rectR); |
| 1583 | DoDrawOverlap(&backDC, rectO); |
| 1584 | DoDrawSelection(&backDC, rectS, rectL, rectR); |
| 1585 | |
| 1586 | DoDrawPlayRegionLimits(&backDC, rectP); |
| 1587 | |
| 1588 | DoDrawMarks(&backDC, true); |
| 1589 | |
| 1590 | DoDrawEdge(&backDC); |
| 1591 | |
| 1592 | DisplayBitmap(dc); |
| 1593 | |
| 1594 | // Stroke extras direct to the client area, |
| 1595 | // maybe outside of the damaged area |
| 1596 | // As with TrackPanel, do not make a NEW wxClientDC or else Mac flashes badly! |
| 1597 | dc.DestroyClippingRegion(); |
| 1598 | DrawOverlays(true, &dc); |
| 1599 | } |
| 1600 | |
| 1601 | void AdornedRulerPanel::OnSize(wxSizeEvent &evt) |
| 1602 | { |