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

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java (-1 / +2 lines)
Lines 1019-1025 Link Here
1019
	 *            the shell
1019
	 *            the shell
1020
	 */
1020
	 */
1021
	protected void createDefaultContents(final Shell shell) {
1021
	protected void createDefaultContents(final Shell shell) {
1022
		defaultLayout = new TrimLayout();
1022
		defaultLayout = new TrimLayout(
1023
				getWindowConfigurer().getPresentationFactory().getTrimAreaData());
1023
		shell.setLayout(defaultLayout);
1024
		shell.setLayout(defaultLayout);
1024
1025
1025
		Menu menuBar = getMenuBarManager().createMenuBar(shell);
1026
		Menu menuBar = getMenuBarManager().createMenuBar(shell);
(-)Eclipse UI/org/eclipse/ui/internal/layout/TrimLayout.java (-7 / +7 lines)
Lines 109-127 Link Here
109
	/**
109
	/**
110
	 * Creates a new (initially empty) trim layout.
110
	 * Creates a new (initially empty) trim layout.
111
	 */
111
	 */
112
	public TrimLayout() {
112
	public TrimLayout(TrimAreaData trimData) {
113
		// Determine whether or not the trim is 'locked'
113
		// Determine whether or not the trim is 'locked'
114
		final IPreferenceStore store = PlatformUI.getPreferenceStore();
114
		final IPreferenceStore store = PlatformUI.getPreferenceStore();
115
        trimLocked = store.getBoolean(IWorkbenchPreferenceConstants.LOCK_TRIM);
115
        trimLocked = store.getBoolean(IWorkbenchPreferenceConstants.LOCK_TRIM);
116
		
116
		
117
		createTrimArea(TOP_ID, TOP_ID.toString());
117
		createTrimArea(TOP_ID, TOP_ID.toString(), trimData);
118
		createTrimArea(BOTTOM_ID, BOTTOM_ID.toString());
118
		createTrimArea(BOTTOM_ID, BOTTOM_ID.toString(), trimData);
119
		createTrimArea(LEFT_ID, LEFT_ID.toString());
119
		createTrimArea(LEFT_ID, LEFT_ID.toString(), trimData);
120
		createTrimArea(RIGHT_ID, RIGHT_ID.toString());
120
		createTrimArea(RIGHT_ID, RIGHT_ID.toString(), trimData);
121
	}
121
	}
122
122
123
	private void createTrimArea(Integer id, String displayName) {
123
	private void createTrimArea(Integer id, String displayName, TrimAreaData trimData) {
124
		TrimArea top = new TrimArea(id.intValue(), displayName);
124
		TrimArea top = new TrimArea(id.intValue(), displayName, trimData);
125
		fTrimArea.put(id, top);
125
		fTrimArea.put(id, top);
126
	}
126
	}
127
127
(-)Eclipse UI/org/eclipse/ui/internal/layout/TrimArea.java (-17 / +18 lines)
Lines 138-148 Link Here
138
	/** Each trimArea is an ordered list of TrimDescriptors. */
138
	/** Each trimArea is an ordered list of TrimDescriptors. */
139
	private ArrayList fTrim;
139
	private ArrayList fTrim;
140
140
141
	/** The layout information */
142
	private TrimAreaData fTrimData = new TrimAreaData();
143
	
141
	// layout constants
144
	// layout constants
142
	private static final String PREFSIZE_DATA_ID = "prefSize"; //$NON-NLS-1$
145
	private static final String PREFSIZE_DATA_ID = "prefSize"; //$NON-NLS-1$
143
	private static final int MIN_BANNER_LEFT = 150;
144
	private static int TILE_SPACING = 2;
145
	private static int LINE_SPACING = 2;
146
	
146
	
147
	private Rectangle curRect = new Rectangle(0,0,0,0);
147
	private Rectangle curRect = new Rectangle(0,0,0,0);
148
148
Lines 153-162 Link Here
153
	 * @param displayName
153
	 * @param displayName
154
	 *            the NLS display name
154
	 *            the NLS display name
155
	 */
155
	 */
156
	public TrimArea(int id, String displayName) {
156
	public TrimArea(int id, String displayName, TrimAreaData trimData) {
157
		fTrim = new ArrayList();
157
		fTrim = new ArrayList();
158
		fId = id;
158
		fId = id;
159
		fDisplayName = displayName;
159
		fDisplayName = displayName;
160
		fTrimData = trimData;
160
	}
161
	}
161
162
162
	/**
163
	/**
Lines 234-240 Link Here
234
			// the banner will occupy is calculated
235
			// the banner will occupy is calculated
235
			if (ctrl instanceof CBanner) {
236
			if (ctrl instanceof CBanner) {
236
				CBanner banner = (CBanner) ctrl;
237
				CBanner banner = (CBanner) ctrl;
237
				prefSize.x = banner.getRightWidth() + banner.getBorderWidth() + MIN_BANNER_LEFT;
238
				prefSize.x = banner.getRightWidth() + banner.getBorderWidth() + fTrimData.minBannerLeft;
238
				prefSize.y = 0;  // No height for now, computed later
239
				prefSize.y = 0;  // No height for now, computed later
239
			}
240
			}
240
			else if (getData(ctrl).getId().equals("org.eclipse.jface.action.StatusLineManager")) { //$NON-NLS-1$
241
			else if (getData(ctrl).getId().equals("org.eclipse.jface.action.StatusLineManager")) { //$NON-NLS-1$
Lines 319-325 Link Here
319
			}
320
			}
320
			
321
			
321
			// Space out the controls
322
			// Space out the controls
322
			tileLength += TILE_SPACING;
323
			tileLength += fTrimData.horizontalSpacing;
323
324
324
			// Place the control into the 'current' line if it'll fit or if
325
			// Place the control into the 'current' line if it'll fit or if
325
			// it's the -first- control (this handles the case where a control is too
326
			// it's the -first- control (this handles the case where a control is too
Lines 345-351 Link Here
345
		totalMinor += curLine.terminate();
346
		totalMinor += curLine.terminate();
346
347
347
		// Finally, add enough room to provide spacing between the lines
348
		// Finally, add enough room to provide spacing between the lines
348
		totalMinor += (lines.size() + 1) * LINE_SPACING;
349
		totalMinor += (lines.size() + 1) * fTrimData.verticalSpacing;
349
		
350
		
350
		return totalMinor;
351
		return totalMinor;
351
	}
352
	}
Lines 371-382 Link Here
371
		int tileY = anchorY;
372
		int tileY = anchorY;
372
		
373
		
373
		if (isHorizontal) {
374
		if (isHorizontal) {
374
			tileX += TILE_SPACING;
375
			tileX += fTrimData.horizontalSpacing;
375
			tileY += LINE_SPACING;
376
			tileY += fTrimData.verticalSpacing;
376
		}
377
		}
377
		else {
378
		else {
378
			tileY += TILE_SPACING;
379
			tileY += fTrimData.horizontalSpacing;
379
			tileX += LINE_SPACING;
380
			tileX += fTrimData.verticalSpacing;
380
		}
381
		}
381
		
382
		
382
		for (Iterator lineIter = lines.iterator(); lineIter.hasNext();) {
383
		for (Iterator lineIter = lines.iterator(); lineIter.hasNext();) {
Lines 419-437 Link Here
419
				// Adjust the TILE_SPACING (unless it's a handle)
420
				// Adjust the TILE_SPACING (unless it's a handle)
420
				if (!(ctrl instanceof TrimCommonUIHandle)) {
421
				if (!(ctrl instanceof TrimCommonUIHandle)) {
421
					if (isHorizontal)
422
					if (isHorizontal)
422
						tileX += TILE_SPACING;
423
						tileX += fTrimData.horizontalSpacing;
423
					else
424
					else
424
						tileY += TILE_SPACING;
425
						tileY += fTrimData.horizontalSpacing;
425
				}
426
				}
426
			}
427
			}
427
			
428
			
428
			if (isHorizontal) {
429
			if (isHorizontal) {
429
				tileY += (line.minorMax + LINE_SPACING);
430
				tileY += (line.minorMax + fTrimData.verticalSpacing);
430
				tileX = anchorX + TILE_SPACING;
431
				tileX = anchorX + fTrimData.horizontalSpacing;
431
			}
432
			}
432
			else {
433
			else {
433
				tileX += (line.minorMax + LINE_SPACING);
434
				tileX += (line.minorMax + fTrimData.verticalSpacing);
434
				tileY = anchorY + TILE_SPACING;
435
				tileY = anchorY + fTrimData.horizontalSpacing;
435
			}
436
			}
436
		}
437
		}
437
		
438
		
(-)Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java (+12 lines)
Lines 17-22 Link Here
17
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Control;
19
import org.eclipse.swt.widgets.Sash;
19
import org.eclipse.swt.widgets.Sash;
20
import org.eclipse.ui.internal.layout.TrimAreaData;
20
21
21
/**
22
/**
22
 * This is a factory for presentation objects that control the appearance of
23
 * This is a factory for presentation objects that control the appearance of
Lines 162-165 Link Here
162
    public int getSashSize(int style) {
163
    public int getSashSize(int style) {
163
    	return SASH_SIZE;
164
    	return SASH_SIZE;
164
    }
165
    }
166
    
167
    /**
168
     * Returns the a descriptor with all the layout constants for the proper positioning
169
	 * of the presentation stacks within a window.
170
 	 *
171
     * @return
172
     * @since 3.4
173
     */
174
    public TrimAreaData getTrimAreaData() {
175
    	return new TrimAreaData();
176
    }
165
}
177
}
(-)Eclipse (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.ui.internal.layout;
13
14
/**
15
 * <code>TrimAreaData</code> is the layout data object associated with 
16
 * <code>TrimArea</code>.
17
 * @since 3.4
18
 *
19
 */
20
public class TrimAreaData {
21
22
	/**
23
     * Minimum size of the left most area (default = 150)
24
	 */
25
	public int minBannerLeft = 150;
26
27
	/**
28
     * Number of pixels between two horizontally adjacent tiles (default = 2)
29
	 */
30
	public int horizontalSpacing = 2;
31
	
32
	/**
33
     * Number of pixels between two vertically adjacent tiles (default = 2)
34
	 */
35
	public int verticalSpacing = 2;
36
37
	public TrimAreaData() {
38
        // Use the default values for all fields.		
39
	}
40
}

Return to bug 229840