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