|
Lines 26-31
Link Here
|
| 26 |
import org.eclipse.draw2d.ScaledGraphics; |
26 |
import org.eclipse.draw2d.ScaledGraphics; |
| 27 |
import org.eclipse.draw2d.UpdateListener; |
27 |
import org.eclipse.draw2d.UpdateListener; |
| 28 |
import org.eclipse.draw2d.geometry.Dimension; |
28 |
import org.eclipse.draw2d.geometry.Dimension; |
|
|
29 |
import org.eclipse.draw2d.geometry.Point; |
| 29 |
import org.eclipse.draw2d.geometry.Rectangle; |
30 |
import org.eclipse.draw2d.geometry.Rectangle; |
| 30 |
|
31 |
|
| 31 |
/** |
32 |
/** |
|
Lines 39-45
Link Here
|
| 39 |
extends Figure |
40 |
extends Figure |
| 40 |
implements UpdateListener |
41 |
implements UpdateListener |
| 41 |
{ |
42 |
{ |
| 42 |
|
43 |
/** |
|
|
44 |
* keeps track of the location of the source Rectangle. It is used so that |
| 45 |
* the Thumbnail is only redrawn on an actual change not on a scroll |
| 46 |
*/ |
| 47 |
private Point oldSourceRectLoc = null; |
| 43 |
/** |
48 |
/** |
| 44 |
* This updates the Thumbnail by breaking the thumbnail {@link Image} into |
49 |
* This updates the Thumbnail by breaking the thumbnail {@link Image} into |
| 45 |
* several tiles and updating each tile individually. |
50 |
* several tiles and updating each tile individually. |
|
Lines 229-235
Link Here
|
| 229 |
sourceFigure.isMirrored() ? SWT.RIGHT_TO_LEFT : SWT.NONE); |
234 |
sourceFigure.isMirrored() ? SWT.RIGHT_TO_LEFT : SWT.NONE); |
| 230 |
thumbnailGraphics = new ScaledGraphics(new SWTGraphics(thumbnailGC)); |
235 |
thumbnailGraphics = new ScaledGraphics(new SWTGraphics(thumbnailGC)); |
| 231 |
thumbnailGraphics.scale(getScaleX()); |
236 |
thumbnailGraphics.scale(getScaleX()); |
| 232 |
thumbnailGraphics.translate(getSourceRectangle().getLocation().negate()); |
237 |
|
|
|
238 |
/** |
| 239 |
* this value is used to check whether the figure has been scrolled |
| 240 |
*/ |
| 241 |
oldSourceRectLoc = getSourceRectangle().getLocation(); |
| 242 |
thumbnailGraphics.translate(oldSourceRectLoc.negate()); |
| 233 |
|
243 |
|
| 234 |
Color color = sourceFigure.getForegroundColor(); |
244 |
Color color = sourceFigure.getForegroundColor(); |
| 235 |
if (color != null) |
245 |
if (color != null) |
|
Lines 433-450
Link Here
|
| 433 |
* @see org.eclipse.draw2d.UpdateListener#notifyPainting(Rectangle, Map) |
443 |
* @see org.eclipse.draw2d.UpdateListener#notifyPainting(Rectangle, Map) |
| 434 |
*/ |
444 |
*/ |
| 435 |
public void notifyPainting(Rectangle damage, Map dirtyRegions) { |
445 |
public void notifyPainting(Rectangle damage, Map dirtyRegions) { |
| 436 |
Iterator dirtyFigures = dirtyRegions.keySet().iterator(); |
446 |
/** |
| 437 |
while (dirtyFigures.hasNext()) { |
447 |
* The method first checks to see whether the Figure is being moved. |
| 438 |
IFigure current = (IFigure)dirtyFigures.next(); |
448 |
* If it is, it updates the stored location of the Figure. If notifyPainting |
| 439 |
while (current != null) { |
449 |
* has been called for a reason other than a scroll movement, it repaints |
| 440 |
if (current == getSource()) { |
450 |
*/ |
| 441 |
setDirty(true); |
451 |
Point sourceRectLoc = getSourceRectangle().getLocation(); |
| 442 |
repaint(); |
452 |
if (oldSourceRectLoc==null||oldSourceRectLoc.equals(sourceRectLoc)) |
| 443 |
return; |
453 |
{ |
|
|
454 |
Iterator dirtyFigures = dirtyRegions.keySet().iterator(); |
| 455 |
while (dirtyFigures.hasNext()) { |
| 456 |
IFigure current = (IFigure)dirtyFigures.next(); |
| 457 |
while (current != null) { |
| 458 |
if (current == getSource()) { |
| 459 |
setDirty(true); |
| 460 |
repaint(); |
| 461 |
return; |
| 462 |
} |
| 463 |
current = current.getParent(); |
| 444 |
} |
464 |
} |
| 445 |
current = current.getParent(); |
|
|
| 446 |
} |
465 |
} |
| 447 |
} |
466 |
} |
|
|
467 |
else |
| 468 |
oldSourceRectLoc = sourceRectLoc; |
| 448 |
} |
469 |
} |
| 449 |
|
470 |
|
| 450 |
/** |
471 |
/** |