Package org.fife.ui.rsyntaxtextarea.folding

Examples of org.fife.ui.rsyntaxtextarea.folding.FoldManager$Listener


         private final boolean hidePrivate = vizState.hidePrivate(), hideMeta = vizState.hideMeta();
         {
            do_start();
            setRootVisible(false);
            setShowsRootHandles(false);
            listeners.add(new Listener() {
               public Object do_action(Object sender, Event event) { return null; }
               public Object do_action(Object sender, Event event, Object arg) { zoom(arg); return null; }
            });
         }
         @Override public String convertValueToText(Object value, boolean sel, boolean expand, boolean leaf, int i, boolean focus) {
View Full Code Here


   */
  public Shape getChildAllocationImpl(int line, Shape a) {

    Rectangle alloc = getInsideAllocation(a);
    host = (RSyntaxTextArea)getContainer();
    FoldManager fm = host.getFoldManager();
    int y = alloc.y;

    // TODO: Make cached getOffset() calls for Y_AXIS valid even for
    // folding, to speed this up!
    for (int i=0; i<line; i++) {
      y += getSpan(Y_AXIS, i);
      Fold fold = fm.getFoldForLine(i);
      if (fold!=null && fold.isCollapsed()) {
        i += fold.getCollapsedLineCount();
      }
    }

View Full Code Here

      host = (RSyntaxTextArea)getContainer();
      if (host.isCodeFoldingEnabled()) {
        // TODO: Cache y-offsets again to speed this up
        //System.out.println("y-axis baby");
        int lineCount = host.getLineCount();
        FoldManager fm = host.getFoldManager();
        for (int i=0; i<lineCount; i++) {
          if (fm.isLineHidden(i)) {
            span -= getSpan(View.Y_AXIS, i);
          }
        }
      }
    }
View Full Code Here

  protected View getViewAtPoint(int x, int y, Rectangle alloc) {

    int lineCount = getViewCount();
    int curY = alloc.y + getOffset(Y_AXIS, 0); // Always at least 1 line
    host = (RSyntaxTextArea)getContainer();
    FoldManager fm = host.getFoldManager();

    for (int line=1; line<lineCount; line++) {
      int span = getSpan(Y_AXIS, line-1);
      if (y<curY+span) {
        childAllocation2(line-1, curY, alloc);
        return getView(line-1);
      }
      curY += span;
      Fold fold = fm.getFoldForLine(line-1);
      if (fold!=null && fold.isCollapsed()) {
        line += fold.getCollapsedLineCount();
      }
    }
View Full Code Here

    Graphics2D g2d = (Graphics2D)g;
    host = (RSyntaxTextArea)getContainer();
    int ascent = host.getMaxAscent();
    int fontHeight = host.getLineHeight();
    FoldManager fm = host.getFoldManager();

    int n = getViewCount()// Number of lines.
    int x = alloc.x + getLeftInset();
    tempRect.y = alloc.y + getTopInset();
    Rectangle clip = g.getClipBounds();
    for (int i = 0; i < n; i++) {
      tempRect.x = x + getOffset(X_AXIS, i);
      //tempRect.y = y + getOffset(Y_AXIS, i);
      tempRect.width = getSpan(X_AXIS, i);
      tempRect.height = getSpan(Y_AXIS, i);
      //System.err.println("For line " + i + ": tempRect==" + tempRect);
      if (tempRect.intersects(clip)) {
        View view = getView(i);
        drawView(g2d, alloc, view, fontHeight, tempRect.y+ascent);
      }
      tempRect.y += tempRect.height;
      Fold possibleFold = fm.getFoldForLine(i);
      if (possibleFold!=null && possibleFold.isCollapsed()) {
        i += possibleFold.getCollapsedLineCount();
        // Visible indicator of collapsed lines
        Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
        if (c!=null) {
View Full Code Here

      // to speed this back up!
      Rectangle r = (Rectangle)modelToView(offs, alloc, Bias.Forward);
      if (r!=null) {
        if (host.isCodeFoldingEnabled()) {
          int line = host.getLineOfOffset(offs);
          FoldManager fm = host.getFoldManager();
          if (fm.isLineHidden(line)) {
            return -1;
          }
        }
        return r.y;
      }
View Full Code Here

    lastBracketMatchPos = -1;
    setSelectionColor(getDefaultSelectionColor());
    setTabLineColor(null);
    setMarkOccurrencesColor(MarkOccurrencesSupport.DEFAULT_COLOR);

    foldManager = new FoldManager(this);

    // Set auto-indent related stuff.
    setAutoIndentEnabled(true);
    setCloseCurlyBraces(true);
    setCloseMarkupTags(true);
View Full Code Here

   */
  public Token getTokenListForPhysicalLineAbove(int offset) {
    RSyntaxDocument document = (RSyntaxDocument)getDocument();
    Element map = document.getDefaultRootElement();
int line = map.getElementIndex(offset);
FoldManager fm = host.getFoldManager();
if (fm==null) {
  line--;
  if (line>=0) {
    return document.getTokenListForLine(line);
  }
}
else {
  line = fm.getVisibleLineAbove(line);
  if (line>=0) {
    return document.getTokenListForLine(line);
  }
}
//    int line = map.getElementIndex(offset) - 1;
View Full Code Here

  if (line<lineCount-1) {
    return document.getTokenListForLine(line+1);
  }
}
else {
  FoldManager fm = host.getFoldManager();
  line = fm.getVisibleLineBelow(line);
  if (line>=0 && line<lineCount) {
    return document.getTokenListForLine(line);
  }
}
//    int line = map.getElementIndex(offset);
View Full Code Here

      // NOTE:  lineHeight is not initially set here, leading to the
      // current line not being highlighted when a document is first
      // opened.  So, we set it here just in case.
      lineHeight = host!=null ? host.getLineHeight() : lineHeight;
if (host.isCodeFoldingEnabled()) {
  FoldManager fm = host.getFoldManager();
  int hiddenCount = fm.getHiddenLineCountAbove(line);
  line -= hiddenCount;
}
      r = new Rectangle(alloc.x, alloc.y + line*lineHeight,
                  alloc.width, lineHeight);
    }
View Full Code Here

TOP

Related Classes of org.fife.ui.rsyntaxtextarea.folding.FoldManager$Listener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.