| 1570 | } |
| 1571 | } |
| 1572 | static void DrawTranslucentSelection(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, |
| 1573 | Sci::Line line, PRectangle rcLine, int subLine, Range lineRange, int xStart) { |
| 1574 | if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA)) { |
| 1575 | const Sci::Position posLineStart = model.pdoc->LineStart(line); |
| 1576 | const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; |
| 1577 | // For each selection draw |
| 1578 | Sci::Position virtualSpaces = 0; |
| 1579 | if (subLine == (ll->lines - 1)) { |
| 1580 | virtualSpaces = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)); |
| 1581 | } |
| 1582 | const SelectionPosition posStart(posLineStart + lineRange.start); |
| 1583 | const SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces); |
| 1584 | const SelectionSegment virtualSpaceRange(posStart, posEnd); |
| 1585 | for (size_t r = 0; r < model.sel.Count(); r++) { |
| 1586 | const int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; |
| 1587 | if (alpha != SC_ALPHA_NOALPHA) { |
| 1588 | const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); |
| 1589 | if (!portion.Empty()) { |
| 1590 | const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; |
| 1591 | PRectangle rcSegment = rcLine; |
| 1592 | rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - |
| 1593 | static_cast<XYPOSITION>(subLineStart)+portion.start.VirtualSpace() * spaceWidth; |
| 1594 | rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - |
| 1595 | static_cast<XYPOSITION>(subLineStart)+portion.end.VirtualSpace() * spaceWidth; |
| 1596 | if ((ll->wrapIndent != 0) && (lineRange.start != 0)) { |
| 1597 | if ((portion.start.Position() - posLineStart) == lineRange.start && model.sel.Range(r).ContainsCharacter(portion.start.Position() - 1)) |
| 1598 | rcSegment.left -= static_cast<int>(ll->wrapIndent); // indentation added to xStart was truncated to int, so we do the same here |
| 1599 | } |
| 1600 | rcSegment.left = (rcSegment.left > rcLine.left) ? rcSegment.left : rcLine.left; |
| 1601 | rcSegment.right = (rcSegment.right < rcLine.right) ? rcSegment.right : rcLine.right; |
| 1602 | if (rcSegment.right > rcLine.left) |
| 1603 | SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection), alpha); |
| 1604 | } |
| 1605 | } |
| 1606 | } |
| 1607 | } |
| 1608 | } |
| 1609 | |
| 1610 | // Draw any translucent whole line states |
| 1611 | static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, |
no test coverage detected