View | Details | Raw Unified | Return to bug 290600 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/text/source/OverviewRuler.java (-7 / +26 lines)
Lines 257-267 Link Here
257
		}
257
		}
258
258
259
		private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
259
		private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
260
			gc.setForeground(topLeft == null ? fSeparatorColor : topLeft);
260
			gc.setForeground(topLeft);
261
			gc.drawLine(x, y, x + w -1, y);
261
			gc.drawLine(x, y, x + w -1, y);
262
			gc.drawLine(x, y, x, y + h -1);
262
			gc.drawLine(x, y, x, y + h -1);
263
263
264
			gc.setForeground(bottomRight == null ? fSeparatorColor : bottomRight);
264
			gc.setForeground(bottomRight);
265
			gc.drawLine(x + w, y, x + w, y + h);
265
			gc.drawLine(x + w, y, x + w, y + h);
266
			gc.drawLine(x, y + h, x + w, y + h);
266
			gc.drawLine(x, y + h, x + w, y + h);
267
		}
267
		}
Lines 273-288 Link Here
273
			Point s= fHeader.getSize();
273
			Point s= fHeader.getSize();
274
274
275
			e.gc.setBackground(fIndicatorColor);
275
			e.gc.setBackground(fIndicatorColor);
276
			Rectangle r= new Rectangle(INSET, (s.y - (2*ANNOTATION_HEIGHT)) / 2, s.x - (2*INSET), 2*ANNOTATION_HEIGHT);
276
			
277
			boolean isOnTop= fHeader.getParent().getClientArea().y == fHeader.getLocation().y;
278
			boolean isTall= s.y > s.x + 2*ANNOTATION_HEIGHT;
279
			int y;
280
			if (!isOnTop) {
281
				// not on top -> attach to bottom
282
				y= s.y - 3*ANNOTATION_HEIGHT;
283
			} else if (isTall) {
284
				// attach to top
285
				y= ANNOTATION_HEIGHT;
286
			} else {
287
				// center
288
				y= (s.y - (2*ANNOTATION_HEIGHT)) / 2;
289
			}
290
			Rectangle r= new Rectangle(INSET, y, s.x - (2*INSET), 2*ANNOTATION_HEIGHT);
277
			e.gc.fillRectangle(r);
291
			e.gc.fillRectangle(r);
278
			Display d= fHeader.getDisplay();
292
279
			if (d != null)
293
//			Display d= fHeader.getDisplay();
294
//			if (d != null)
280
//				drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
295
//				drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
281
				drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, null, null);
296
			drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, fSeparatorColor, fSeparatorColor);
282
297
283
			e.gc.setForeground(fSeparatorColor);
298
			e.gc.setForeground(fSeparatorColor);
284
			e.gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
299
			e.gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
285
			e.gc.drawLine(0, s.y -1, s.x -1, s.y -1);
300
301
			if (!isOnTop || !isTall) {
302
				// only draw separator if at bottom or if gap is small
303
				e.gc.drawLine(0, s.y -1, s.x -1, s.y -1);
304
			}
286
		}
305
		}
287
	}
306
	}
288
307
(-)src/org/eclipse/jface/text/source/SourceViewer.java (-8 / +27 lines)
Lines 15-26 Link Here
15
import java.util.Stack;
15
import java.util.Stack;
16
16
17
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.graphics.Point;
19
import org.eclipse.swt.graphics.Point;
19
import org.eclipse.swt.graphics.Rectangle;
20
import org.eclipse.swt.graphics.Rectangle;
20
import org.eclipse.swt.widgets.Canvas;
21
import org.eclipse.swt.widgets.Canvas;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.swt.widgets.Layout;
24
import org.eclipse.swt.widgets.Layout;
25
import org.eclipse.swt.widgets.ScrollBar;
24
26
25
import org.eclipse.jface.internal.text.NonDeletingPositionUpdater;
27
import org.eclipse.jface.internal.text.NonDeletingPositionUpdater;
26
import org.eclipse.jface.internal.text.StickyHoverManager;
28
import org.eclipse.jface.internal.text.StickyHoverManager;
Lines 113-133 Link Here
113
		 */
115
		 */
114
		protected void layout(Composite composite, boolean flushCache) {
116
		protected void layout(Composite composite, boolean flushCache) {
115
			Rectangle clArea= composite.getClientArea();
117
			Rectangle clArea= composite.getClientArea();
116
			Rectangle trim= getTextWidget().computeTrim(0, 0, 0, 0);
118
			StyledText textWidget= getTextWidget();
119
			Rectangle trim= textWidget.computeTrim(0, 0, 0, 0);
117
			int topTrim= - trim.y;
120
			int topTrim= - trim.y;
118
			int scrollbarHeight= trim.height - topTrim; // scrollbar is only under the client area
121
			int scrollbarHeight= trim.height - topTrim; // horizontal scroll bar is only under the client area
119
122
120
			int x= clArea.x;
123
			int x= clArea.x;
121
			int width= clArea.width;
124
			int width= clArea.width;
122
125
126
			int overviewRulerWidth= -1;
123
			if (fOverviewRuler != null && fIsOverviewRulerVisible) {
127
			if (fOverviewRuler != null && fIsOverviewRulerVisible) {
124
				int overviewRulerWidth= fOverviewRuler.getWidth();
128
				overviewRulerWidth= fOverviewRuler.getWidth();
125
				fOverviewRuler.getControl().setBounds(clArea.x + clArea.width - overviewRulerWidth - 1, clArea.y + scrollbarHeight, overviewRulerWidth, clArea.height - 3*scrollbarHeight);
126
				fOverviewRuler.getHeaderControl().setBounds(clArea.x + clArea.width - overviewRulerWidth - 1, clArea.y, overviewRulerWidth, scrollbarHeight);
127
128
				width -= overviewRulerWidth + fGap;
129
				width -= overviewRulerWidth + fGap;
129
			}
130
			}
130
131
			
131
			if (fVerticalRuler != null && fIsVerticalRulerVisible) {
132
			if (fVerticalRuler != null && fIsVerticalRulerVisible) {
132
				int verticalRulerWidth= fVerticalRuler.getWidth();
133
				int verticalRulerWidth= fVerticalRuler.getWidth();
133
				final Control verticalRulerControl= fVerticalRuler.getControl();
134
				final Control verticalRulerControl= fVerticalRuler.getControl();
Lines 140-146 Link Here
140
				width -= verticalRulerWidth + fGap;
141
				width -= verticalRulerWidth + fGap;
141
			}
142
			}
142
143
143
			getTextWidget().setBounds(x, clArea.y, width, clArea.height);
144
			textWidget.setBounds(x, clArea.y, width, clArea.height);
145
146
			if (overviewRulerWidth != -1) {
147
				ScrollBar verticalBar= textWidget.getVerticalBar();
148
				Rectangle thumbTrackBounds= verticalBar.getThumbTrackBounds();
149
				int topArrowHeight= thumbTrackBounds.y;
150
				int bottomArrowHeight= clArea.y + clArea.height - scrollbarHeight - (thumbTrackBounds.y + thumbTrackBounds.height);
151
152
				int overviewRulerX= clArea.x + clArea.width - overviewRulerWidth - 1;
153
				fOverviewRuler.getControl().setBounds(overviewRulerX, clArea.y + topArrowHeight, overviewRulerWidth, clArea.height - topArrowHeight - bottomArrowHeight - scrollbarHeight);
154
				
155
				Control headerControl= fOverviewRuler.getHeaderControl();
156
				if (topArrowHeight < bottomArrowHeight && topArrowHeight < scrollbarHeight && bottomArrowHeight > scrollbarHeight) {
157
					// not enough space for header at top => move to bottom
158
					headerControl.setBounds(overviewRulerX, clArea.y + clArea.height - bottomArrowHeight - scrollbarHeight, overviewRulerWidth, bottomArrowHeight);
159
				} else {
160
					headerControl.setBounds(overviewRulerX, clArea.y, overviewRulerWidth, topArrowHeight);
161
				}
162
			}
144
		}
163
		}
145
	}
164
	}
146
165

Return to bug 290600