Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 151493 Details for
Bug 290600
[rulers] overview ruler and scroll bar thumb not properly synchronized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
first stab
290600_patch.txt (text/plain), 5.48 KB, created by
Markus Keller
on 2009-11-05 15:39:10 EST
(
hide
)
Description:
first stab
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2009-11-05 15:39:10 EST
Size:
5.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.text >Index: src/org/eclipse/jface/text/source/OverviewRuler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java,v >retrieving revision 1.71 >diff -u -r1.71 OverviewRuler.java >--- src/org/eclipse/jface/text/source/OverviewRuler.java 13 Oct 2009 12:39:46 -0000 1.71 >+++ src/org/eclipse/jface/text/source/OverviewRuler.java 5 Nov 2009 20:35:15 -0000 >@@ -273,16 +273,35 @@ > Point s= fHeader.getSize(); > > e.gc.setBackground(fIndicatorColor); >- Rectangle r= new Rectangle(INSET, (s.y - (2*ANNOTATION_HEIGHT)) / 2, s.x - (2*INSET), 2*ANNOTATION_HEIGHT); >+ >+ boolean isOnTop= fHeader.getParent().getClientArea().y == fHeader.getLocation().y; >+ boolean isTall= s.y > s.x + ANNOTATION_HEIGHT; >+ int y; >+ if (!isOnTop) { >+ // not on top -> attach to bottom >+ y= s.y - 3*ANNOTATION_HEIGHT; >+ } else if (isTall) { >+ // attach to top >+ y= INSET; >+ } else { >+ // center >+ y= (s.y - (2*ANNOTATION_HEIGHT)) / 2; >+ } >+ Rectangle r= new Rectangle(INSET, y, s.x - (2*INSET), 2*ANNOTATION_HEIGHT); > e.gc.fillRectangle(r); >- Display d= fHeader.getDisplay(); >- if (d != null) >+ >+// Display d= fHeader.getDisplay(); >+// if (d != null) > // 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)); >- drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, null, null); >+ drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, null, null); > > e.gc.setForeground(fSeparatorColor); > e.gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance >- e.gc.drawLine(0, s.y -1, s.x -1, s.y -1); >+ >+ if (!isOnTop || !isTall) { >+ // only draw separator if at bottom or if gap is small >+ e.gc.drawLine(0, s.y -1, s.x -1, s.y -1); >+ } > } > } > >Index: src/org/eclipse/jface/text/source/SourceViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java,v >retrieving revision 1.87 >diff -u -r1.87 SourceViewer.java >--- src/org/eclipse/jface/text/source/SourceViewer.java 17 Jun 2009 12:59:14 -0000 1.87 >+++ src/org/eclipse/jface/text/source/SourceViewer.java 5 Nov 2009 20:35:15 -0000 >@@ -15,12 +15,14 @@ > import java.util.Stack; > > import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.StyledText; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Canvas; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Layout; >+import org.eclipse.swt.widgets.ScrollBar; > > import org.eclipse.jface.internal.text.NonDeletingPositionUpdater; > import org.eclipse.jface.internal.text.StickyHoverManager; >@@ -113,21 +115,20 @@ > */ > protected void layout(Composite composite, boolean flushCache) { > Rectangle clArea= composite.getClientArea(); >- Rectangle trim= getTextWidget().computeTrim(0, 0, 0, 0); >+ StyledText textWidget= getTextWidget(); >+ Rectangle trim= textWidget.computeTrim(0, 0, 0, 0); > int topTrim= - trim.y; >- int scrollbarHeight= trim.height - topTrim; // scrollbar is only under the client area >+ int scrollbarHeight= trim.height - topTrim; // horizontal scroll bar is only under the client area > > int x= clArea.x; > int width= clArea.width; > >+ int overviewRulerWidth= -1; > if (fOverviewRuler != null && fIsOverviewRulerVisible) { >- int overviewRulerWidth= fOverviewRuler.getWidth(); >- fOverviewRuler.getControl().setBounds(clArea.x + clArea.width - overviewRulerWidth - 1, clArea.y + scrollbarHeight, overviewRulerWidth, clArea.height - 3*scrollbarHeight); >- fOverviewRuler.getHeaderControl().setBounds(clArea.x + clArea.width - overviewRulerWidth - 1, clArea.y, overviewRulerWidth, scrollbarHeight); >- >+ overviewRulerWidth= fOverviewRuler.getWidth(); > width -= overviewRulerWidth + fGap; > } >- >+ > if (fVerticalRuler != null && fIsVerticalRulerVisible) { > int verticalRulerWidth= fVerticalRuler.getWidth(); > final Control verticalRulerControl= fVerticalRuler.getControl(); >@@ -140,7 +141,25 @@ > width -= verticalRulerWidth + fGap; > } > >- getTextWidget().setBounds(x, clArea.y, width, clArea.height); >+ textWidget.setBounds(x, clArea.y, width, clArea.height); >+ >+ if (overviewRulerWidth != -1) { >+ ScrollBar verticalBar= textWidget.getVerticalBar(); >+ Rectangle thumbTrackBounds= verticalBar.getThumbTrackBounds(); >+ int topArrowHeight= thumbTrackBounds.y; >+ int bottomArrowHeight= clArea.y + clArea.height - scrollbarHeight - (thumbTrackBounds.y + thumbTrackBounds.height); >+ >+ int overviewRulerX= clArea.x + clArea.width - overviewRulerWidth - 1; >+ fOverviewRuler.getControl().setBounds(overviewRulerX, clArea.y + topArrowHeight, overviewRulerWidth, clArea.height - topArrowHeight - bottomArrowHeight - scrollbarHeight); >+ >+ Control headerControl= fOverviewRuler.getHeaderControl(); >+ if (topArrowHeight < bottomArrowHeight && topArrowHeight < scrollbarHeight) { >+ // not enough space for header at top => move to bottom >+ headerControl.setBounds(overviewRulerX, clArea.y + clArea.height - bottomArrowHeight - scrollbarHeight, overviewRulerWidth, bottomArrowHeight); >+ } else { >+ headerControl.setBounds(overviewRulerX, clArea.y, overviewRulerWidth, topArrowHeight); >+ } >+ } > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 290600
:
148172
|
151493
|
151546