/** * Scrolls text to the right to use new space made available by a resize. */ void claimRightFreeSpace() { int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area // align the right end of the item with the right border of the // client area (window is scrolled right). scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) {
/** * Scrolls text to the right to use new space made available by a resize. */ void claimRightFreeSpace() { int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area // align the right end of the item with the right border of the // client area (window is scrolled right). scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) {
/** * Scrolls text to the right to use new space made available by a resize. */ void claimRightFreeSpace() { int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area // align the right end of the item with the right border of the // client area (window is scrolled right). scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) {
/** * Scrolls text to the right to use new space made available by a resize. */ void claimRightFreeSpace() { int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area // align the right end of the item with the right border of the // client area (window is scrolled right). scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) {
/** * Scrolls text to the right to use new space made available by a resize. */ void claimRightFreeSpace() { int newHorizontalOffset = Math.max(0, renderer.getWidth() - clientAreaWidth); if (newHorizontalOffset < horizontalScrollOffset) { // item is no longer drawn past the right border of the client area // align the right end of the item with the right border of the // client area (window is scrolled right). scrollHorizontal(newHorizontalOffset - horizontalScrollOffset, true); } } void clearBlockSelection(boolean reset, boolean sendEvent) {
boolean showLocation(Rectangle rect, boolean scrollPage) { boolean scrolled = false; if (rect.y < topMargin) { scrolled = scrollVertical(rect.y - topMargin, true); } else if (rect.y + rect.height > clientAreaHeight - bottomMargin) { if (clientAreaHeight - topMargin - bottomMargin <= 0) { scrolled = scrollVertical(rect.y - topMargin, true); } else { scrolled = scrollVertical(rect.y + rect.height - (clientAreaHeight - bottomMargin), true); } } int width = clientAreaWidth - rightMargin - leftMargin; if (width > 0) { int minScroll = scrollPage ? width / 4 : 0; if (rect.x < leftMargin) { int scrollWidth = Math.max(leftMargin - rect.x, minScroll); int maxScroll = horizontalScrollOffset; scrolled = scrollHorizontal(-Math.min(maxScroll, scrollWidth), true); } else if (rect.x + rect.width > (clientAreaWidth - rightMargin)) { int scrollWidth = Math.max(rect.x + rect.width - (clientAreaWidth - rightMargin), minScroll); int maxScroll = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; scrolled = scrollHorizontal(Math.min(maxScroll, scrollWidth), true); } } return scrolled; } /**
boolean showLocation(Rectangle rect, boolean scrollPage) { boolean scrolled = false; if (rect.y < topMargin) { scrolled = scrollVertical(rect.y - topMargin, true); } else if (rect.y + rect.height > clientAreaHeight - bottomMargin) { if (clientAreaHeight - topMargin - bottomMargin <= 0) { scrolled = scrollVertical(rect.y - topMargin, true); } else { scrolled = scrollVertical(rect.y + rect.height - (clientAreaHeight - bottomMargin), true); } } int width = clientAreaWidth - rightMargin - leftMargin; if (width > 0) { int minScroll = scrollPage ? width / 4 : 0; if (rect.x < leftMargin) { int scrollWidth = Math.max(leftMargin - rect.x, minScroll); int maxScroll = horizontalScrollOffset; scrolled = scrollHorizontal(-Math.min(maxScroll, scrollWidth), true); } else if (rect.x + rect.width > (clientAreaWidth - rightMargin)) { int scrollWidth = Math.max(rect.x + rect.width - (clientAreaWidth - rightMargin), minScroll); int maxScroll = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; scrolled = scrollHorizontal(Math.min(maxScroll, scrollWidth), true); } } return scrolled; } /**
boolean showLocation(Rectangle rect, boolean scrollPage) { boolean scrolled = false; if (rect.y < topMargin) { scrolled = scrollVertical(rect.y - topMargin, true); } else if (rect.y + rect.height > clientAreaHeight - bottomMargin) { if (clientAreaHeight - topMargin - bottomMargin <= 0) { scrolled = scrollVertical(rect.y - topMargin, true); } else { scrolled = scrollVertical(rect.y + rect.height - (clientAreaHeight - bottomMargin), true); } } int width = clientAreaWidth - rightMargin - leftMargin; if (width > 0) { int minScroll = scrollPage ? width / 4 : 0; if (rect.x < leftMargin) { int scrollWidth = Math.max(leftMargin - rect.x, minScroll); int maxScroll = horizontalScrollOffset; scrolled = scrollHorizontal(-Math.min(maxScroll, scrollWidth), true); } else if (rect.x + rect.width > (clientAreaWidth - rightMargin)) { int scrollWidth = Math.max(rect.x + rect.width - (clientAreaWidth - rightMargin), minScroll); int maxScroll = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; scrolled = scrollHorizontal(Math.min(maxScroll, scrollWidth), true); } } return scrolled; } /**
boolean showLocation(Rectangle rect, boolean scrollPage) { boolean scrolled = false; if (rect.y < topMargin) { scrolled = scrollVertical(rect.y - topMargin, true); } else if (rect.y + rect.height > clientAreaHeight - bottomMargin) { if (clientAreaHeight - topMargin - bottomMargin <= 0) { scrolled = scrollVertical(rect.y - topMargin, true); } else { scrolled = scrollVertical(rect.y + rect.height - (clientAreaHeight - bottomMargin), true); } } int width = clientAreaWidth - rightMargin - leftMargin; if (width > 0) { int minScroll = scrollPage ? width / 4 : 0; if (rect.x < leftMargin) { int scrollWidth = Math.max(leftMargin - rect.x, minScroll); int maxScroll = horizontalScrollOffset; scrolled = scrollHorizontal(-Math.min(maxScroll, scrollWidth), true); } else if (rect.x + rect.width > (clientAreaWidth - rightMargin)) { int scrollWidth = Math.max(rect.x + rect.width - (clientAreaWidth - rightMargin), minScroll); int maxScroll = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; scrolled = scrollHorizontal(Math.min(maxScroll, scrollWidth), true); } } return scrolled; } /**
public void run() { if (autoScrollDirection == ST.COLUMN_NEXT) { if (blockSelection) { int x = blockXLocation - horizontalScrollOffset; int max = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; int pixels = Math.min(autoScrollDistance, Math.max(0,max)); if (pixels != 0) { setBlockSelectionLocation(x + pixels, blockYLocation - getVerticalScrollOffset(), true); scrollHorizontal(pixels, true); } } else { doVisualNext(); setMouseWordSelectionAnchor(); doMouseSelection(); } display.timerExec(H_SCROLL_RATE, this); } } };
@Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the * widget itself has been disposed. */ if (isDisposed()) return; if (autoScrollDirection == ST.COLUMN_NEXT) { if (blockSelection) { int x = blockXLocation - horizontalScrollOffset; int max = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; int pixels = Math.min(autoScrollDistance, Math.max(0,max)); if (pixels != 0) { setBlockSelectionLocation(x + pixels, blockYLocation - getVerticalScrollOffset(), true); scrollHorizontal(pixels, true); } } else { doVisualNext(); setMouseWordSelectionAnchor(); doMouseSelection(); } display.timerExec(H_SCROLL_RATE, this); } } };
@Override public void run() { /* Bug 437357 - NPE in StyledText.getCaretLine * StyledText.content is null at times, probably because the * widget itself has been disposed. */ if (isDisposed()) return; if (autoScrollDirection == ST.COLUMN_NEXT) { if (blockSelection) { int x = blockXLocation - horizontalScrollOffset; int max = renderer.getWidth() - horizontalScrollOffset - clientAreaWidth; int pixels = Math.min(autoScrollDistance, Math.max(0,max)); if (pixels != 0) { setBlockSelectionLocation(x + pixels, blockYLocation - getVerticalScrollOffset(), true); scrollHorizontal(pixels, true); } } else { doVisualNext(); setMouseWordSelectionAnchor(); doMouseSelection(); } display.timerExec(H_SCROLL_RATE, this); } } };
void setAlignment() { if ((getStyle() & SWT.SINGLE) == 0) return; int alignment = renderer.getLineAlignment(0, this.alignment); int newAlignmentMargin = 0; if (alignment != SWT.LEFT) { renderer.calculate(0, 1); int width = renderer.getWidth() - alignmentMargin; newAlignmentMargin = clientAreaWidth - width; if (newAlignmentMargin < 0) newAlignmentMargin = 0; if (alignment == SWT.CENTER) newAlignmentMargin /= 2; } if (alignmentMargin != newAlignmentMargin) { leftMargin -= alignmentMargin; leftMargin += newAlignmentMargin; alignmentMargin = newAlignmentMargin; resetCache(0, 1); setCaretLocation(); super.redraw(); } } /**
void setAlignment() { if ((getStyle() & SWT.SINGLE) == 0) return; int alignment = renderer.getLineAlignment(0, this.alignment); int newAlignmentMargin = 0; if (alignment != SWT.LEFT) { renderer.calculate(0, 1); int width = renderer.getWidth() - alignmentMargin; newAlignmentMargin = clientAreaWidth - width; if (newAlignmentMargin < 0) newAlignmentMargin = 0; if (alignment == SWT.CENTER) newAlignmentMargin /= 2; } if (alignmentMargin != newAlignmentMargin) { leftMargin -= alignmentMargin; leftMargin += newAlignmentMargin; alignmentMargin = newAlignmentMargin; resetCache(0, 1); setCaretLocation(); super.redraw(); } } /**
void setAlignment() { if ((getStyle() & SWT.SINGLE) == 0) return; int alignment = renderer.getLineAlignment(0, this.alignment); int newAlignmentMargin = 0; if (alignment != SWT.LEFT) { renderer.calculate(0, 1); int width = renderer.getWidth() - alignmentMargin; newAlignmentMargin = clientAreaWidth - width; if (newAlignmentMargin < 0) newAlignmentMargin = 0; if (alignment == SWT.CENTER) newAlignmentMargin /= 2; } if (alignmentMargin != newAlignmentMargin) { leftMargin -= alignmentMargin; leftMargin += newAlignmentMargin; alignmentMargin = newAlignmentMargin; resetCache(0, 1); setCaretLocation(); super.redraw(); } } /**
void setAlignment() { if ((getStyle() & SWT.SINGLE) == 0) return; int alignment = renderer.getLineAlignment(0, this.alignment); int newAlignmentMargin = 0; if (alignment != SWT.LEFT) { renderer.calculate(0, 1); int width = renderer.getWidth() - alignmentMargin; newAlignmentMargin = clientAreaWidth - width; if (newAlignmentMargin < 0) newAlignmentMargin = 0; if (alignment == SWT.CENTER) newAlignmentMargin /= 2; } if (alignmentMargin != newAlignmentMargin) { leftMargin -= alignmentMargin; leftMargin += newAlignmentMargin; alignmentMargin = newAlignmentMargin; resetCache(0, 1); setCaretLocation(); super.redraw(); } } /**
void setAlignment() { if ((getStyle() & SWT.SINGLE) == 0) return; int alignment = renderer.getLineAlignment(0, this.alignment); int newAlignmentMargin = 0; if (alignment != SWT.LEFT) { renderer.calculate(0, 1); int width = renderer.getWidth() - alignmentMargin; newAlignmentMargin = clientAreaWidth - width; if (newAlignmentMargin < 0) newAlignmentMargin = 0; if (alignment == SWT.CENTER) newAlignmentMargin /= 2; } if (alignmentMargin != newAlignmentMargin) { leftMargin -= alignmentMargin; leftMargin += newAlignmentMargin; alignmentMargin = newAlignmentMargin; resetCache(0, 1); setCaretLocation(); super.redraw(); } } /**
/** * Selects all the text. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void selectAll() { checkWidget(); if (blockSelection) { renderer.calculate(0, content.getLineCount()); setScrollBars(false); int verticalScrollOffset = getVerticalScrollOffset(); int left = leftMargin - horizontalScrollOffset; int top = topMargin - verticalScrollOffset; int right = renderer.getWidth() - rightMargin - horizontalScrollOffset; int bottom = renderer.getHeight() - bottomMargin - verticalScrollOffset; setBlockSelectionLocation(left, top, right, bottom, false); return; } setSelection(0, Math.max(getCharCount(),0)); } /**
/** * Selects all the text. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void selectAll() { checkWidget(); if (blockSelection) { renderer.calculate(0, content.getLineCount()); setScrollBars(false); int verticalScrollOffset = getVerticalScrollOffset(); int left = leftMargin - horizontalScrollOffset; int top = topMargin - verticalScrollOffset; int right = renderer.getWidth() - rightMargin - horizontalScrollOffset; int bottom = renderer.getHeight() - bottomMargin - verticalScrollOffset; setBlockSelectionLocation(left, top, right, bottom, false); return; } setSelection(0, Math.max(getCharCount(),0)); } /**
/** * Selects all the text. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void selectAll() { checkWidget(); if (blockSelection) { renderer.calculate(0, content.getLineCount()); setScrollBars(false); int verticalScrollOffset = getVerticalScrollOffset(); int left = leftMargin - horizontalScrollOffset; int top = topMargin - verticalScrollOffset; int right = renderer.getWidth() - rightMargin - horizontalScrollOffset; int bottom = renderer.getHeight() - bottomMargin - verticalScrollOffset; setBlockSelectionLocation(left, top, right, bottom, false); return; } setSelection(0, Math.max(getCharCount(),0)); } /**