Esempio n. 1
0
    @Override
    protected void paintWithColor(Graphics graphics, EditorCell cell, Color color) {
      int x = cell.getX() + cell.getLeftInset();
      int y = cell.getY() + cell.getTopInset();
      int width = cell.getWidth() - cell.getLeftInset() - cell.getRightInset() - 1;
      int height = cell.getHeight() - cell.getTopInset() - cell.getBottomInset() - 1;

      graphics.setColor(color);
      ColorAndGraphicsUtil.drawDashedRect(graphics, x, y, width, height);
    }
Esempio n. 2
0
  @Override
  public void moveTo(int x, int y) {
    if (x == myX && y == myY) {
      return;
    }

    int xOld = myX;
    int yOld = myY;
    super.moveTo(x, y);
    for (jetbrains.mps.nodeEditor.cells.EditorCell myEditorCell : getCells()) {
      myEditorCell.moveTo(myEditorCell.getX() + x - xOld, myEditorCell.getY() + y - yOld);
      if (((EditorCell_Basic) myEditorCell).isNeedsRelayout()) {
        markNeedsRelayout();
      }
    }
    adjustNeedsRelayout(xOld, yOld, x, y);
  }
Esempio n. 3
0
  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(EditorComponent.CARET_ROW_COLOR);
        g.fillRect(clipBounds.x, selectedCellY, clipBounds.width, selectedCellHeight);
        // Drawing folding line
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            clipBounds.y,
            selectedCellY,
            getBackground(),
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY,
            selectedCellY + selectedCellHeight,
            EditorComponent.CARET_ROW_COLOR,
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        UIUtil.drawVDottedLine(
            g2d,
            myFoldingLineX,
            selectedCellY + selectedCellHeight,
            clipBounds.y + clipBounds.height,
            getBackground(),
            EditorColorsManager.getInstance()
                .getGlobalScheme()
                .getColor(EditorColors.TEARLINE_COLOR));
        return;
      }
    }
    // Drawing folding line
    // COLORS: Remove hardcoded color
    UIUtil.drawVDottedLine(
        g2d,
        myFoldingLineX,
        clipBounds.y,
        clipBounds.y + clipBounds.height,
        getBackground(),
        Color.gray);
  }