| Summary: | [Workbench] Toolbars in CTabItems not rendering in RIGHT_TO_LEFT | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Tod Creasey <Tod_Creasey> | ||||||
| Component: | UI | Assignee: | Tod Creasey <Tod_Creasey> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P2 | CC: | matial, michaelvanmeekeren, salexb, semion, sxenos | ||||||
| Version: | 3.0 | ||||||||
| Target Milestone: | 3.1 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 72426 | ||||||||
| Attachments: |
|
||||||||
|
Description
Tod Creasey
Created attachment 14120 [details]
Screenshot
The title says Toolbar and CTabFOlder - do you mean just CTabFolder? No both - the Toolbar we have in the CTabFolder is not rendering and the tabs draw in incorrect places - see the screenshot Created attachment 14133 [details]
Floating toolbars not placed correctly
The problem is not with CTabFolder or ViewForm. See the attached image. The
CTabFolder and ViewForm are correctly placing the controls but the workbench is
not positioning its "floating toolbars" correctly over the SWT custom widget
locations.
Problem is caused by using Geometry.toControl() and Geometry.toDisplay(),
which map origin of rectangle and add its width. It is wrong for control with
rtl orientation:
public static Rectangle toControl(Control coordinateSystem,
Rectangle toConvert) {
/* old code
Point start = coordinateSystem.toControl(toConvert.x, toConvert.y);
return new Rectangle(start.x, start.y, toConvert.width,
toConvert.height);
*/
return(coordinateSystem.getDisplay().map
(null,coordinateSystem,toConvert)); //suggested code
}
public static Rectangle toDisplay(Control coordinateSystem,
Rectangle toConvert) {
/* old code
Point start = coordinateSystem.toDisplay(toConvert.x, toConvert.y);
return new Rectangle(start.x, start.y, toConvert.width,
toConvert.height);
*/
return(coordinateSystem.getDisplay().map
(coordinateSystem,null,toConvert)); //suggested code
}
The second problem appears, when PaneFolder in its method layout() arranges
controls in the title bar. It performs mapping control -> display -> control,
and as result positions of center and right top components are not mirrored.
As far as I understand, we don't need here any additional mapping, because we
try to determine positions inside of one and the same control:
.......
/* old code, which uses Geometry.toDisplay()
Rectangle titleArea = DragUtil.getDisplayBounds(titleAreaProxy);
*/
Rectangle titleArea = titleAreaProxy.getBounds();
......
if (topRight != null) {
// topRight.setBounds(Geometry.toControl(topRight.getParent(),
// topRightArea));
topRight.setBounds(topRightArea);
}
if (topCenter != null) {
// Rectangle localCoords = Geometry.toControl(topCenter
// .getParent(), topCenterArea);
// topCenter.setBounds(localCoords);
topCenter.setBounds(topCenterArea);
}
Stefan and I have reviewed Semions changes so I will take ownership of this issue. The ones to Geometry are all that we need to fix this issue - the fixes in PartLayout look like a good optimization but Stefan felt we should wait until that method is generally revisited in the near future. Thanks again Semion for all of your help. Fix released for build >20041026 Verified in 20041102 |