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 |
|