private void paintBackgroundAndFoldingLine(Graphics g, Rectangle clipBounds) {
    Graphics2D g2d = (Graphics2D) g;
    g.setColor(getBackground());
    g.fillRect(
        clipBounds.x,
        clipBounds.y,
        Math.min(clipBounds.width, myFoldingLineX - clipBounds.x),
        clipBounds.height);
    g.setColor(getEditorComponent().getBackground());
    g.fillRect(
        Math.max(clipBounds.x, myFoldingLineX),
        clipBounds.y,
        clipBounds.width - Math.max(0, myFoldingLineX - clipBounds.x),
        clipBounds.height);

    // same as in EditorComponent.paint() method
    EditorCell deepestCell = myEditorComponent.getDeepestSelectedCell();
    if (deepestCell instanceof EditorCell_Label) {
      int selectedCellY = deepestCell.getY();
      int selectedCellHeight =
          deepestCell.getHeight() - deepestCell.getTopInset() - deepestCell.getBottomInset();
      if (g.hitClip(clipBounds.x, selectedCellY, clipBounds.width, selectedCellHeight)) {
        g.setColor(EditorSettings.getInstance().getCaretRowColor());
        g.fillRect(clipBounds.x, selectedCellY, clipBounds.width, selectedCellHeight);
        // Drawing folding line
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            clipBounds.y,
            selectedCellY,
            getBackground(),
            EditorSettings.getInstance().getLeftHighlighterTearLineColor());
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY,
            selectedCellY + selectedCellHeight,
            EditorSettings.getInstance().getCaretRowColor(),
            EditorSettings.getInstance().getLeftHighlighterTearLineColor());
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY + selectedCellHeight,
            clipBounds.y + clipBounds.height,
            getBackground(),
            EditorSettings.getInstance().getLeftHighlighterTearLineColor());
        return;
      }
    }
    // Drawing folding line
    // COLORS: Remove hardcoded color
    UIUtil.drawVDottedLine(
        g2d,
        myFoldingLineX,
        clipBounds.y,
        clipBounds.y + clipBounds.height,
        getBackground(),
        Color.gray);
  }
Example #2
0
 protected void paintWithColor(Graphics g, EditorCell cell, Color color) {
   int x = cell.getX() + cell.getLeftInset();
   int y = cell.getY();
   int width = cell.getWidth() - cell.getLeftInset() - cell.getRightInset() - 1;
   int height = cell.getHeight() - cell.getTopInset() - cell.getBottomInset() - 1;
   g.setColor(color);
   g.drawRect(x, y, width, height);
   color = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() / 5);
   g.setColor(color);
   g.fillRect(x, y, width, height);
 }