Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 72434

Summary: [Workbench] Toolbars in CTabItems not rendering in RIGHT_TO_LEFT
Product: [Eclipse Project] Platform Reporter: Tod Creasey <Tod_Creasey>
Component: UIAssignee: 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 Flags
Screenshot
none
Floating toolbars not placed correctly none

Description Tod Creasey CLA 2004-08-23 10:18:27 EDT
M1

If I set the orientation of the CTabItems in the Eclipse window id 
RIGHT_TO_LEFT they are not rendering - they wither have whitespace or cutoff 
entries.

STEPS
1) Apply the patches in Bug 72426
2) Start Eclipse

I will attach a screenshot
Comment 1 Tod Creasey CLA 2004-08-23 10:20:27 EDT
Created attachment 14120 [details]
Screenshot
Comment 2 Veronika Irvine CLA 2004-08-23 12:29:11 EDT
The title says Toolbar and CTabFOlder - do you mean just CTabFolder?
Comment 3 Tod Creasey CLA 2004-08-23 14:02:22 EDT
No both - the Toolbar we have in the CTabFolder is not rendering and the tabs 
draw in incorrect places - see the screenshot
Comment 4 Veronika Irvine CLA 2004-08-23 16:18:53 EDT
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.
Comment 5 Semion Chichelnitsky CLA 2004-10-13 14:46:05 EDT
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);
            }
Comment 6 Tod Creasey CLA 2004-10-26 13:45:03 EDT
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.
Comment 7 Tod Creasey CLA 2004-10-26 13:51:43 EDT
Fix released for build >20041026
Comment 8 Tod Creasey CLA 2004-11-03 11:35:43 EST
Verified in 20041102