Lines 52-60
Link Here
|
52 |
private GraphicsSource graphicsSource; |
52 |
private GraphicsSource graphicsSource; |
53 |
private List invalidFigures = new ArrayList(); |
53 |
private List invalidFigures = new ArrayList(); |
54 |
private IFigure root; |
54 |
private IFigure root; |
55 |
private boolean updateQueued = false; |
55 |
private boolean updateQueued; |
56 |
|
56 |
|
57 |
private boolean updating; |
57 |
private boolean updating; |
|
|
58 |
private boolean validating; |
58 |
private RunnableChain afterUpdate; |
59 |
private RunnableChain afterUpdate; |
59 |
|
60 |
|
60 |
private static class RunnableChain { |
61 |
private static class RunnableChain { |
Lines 136-154
Link Here
|
136 |
} |
137 |
} |
137 |
|
138 |
|
138 |
void paint(GC gc) { |
139 |
void paint(GC gc) { |
139 |
SWTGraphics graphics = new SWTGraphics(gc); |
140 |
if (!validating) { |
140 |
if (!updating) { |
141 |
SWTGraphics graphics = new SWTGraphics(gc); |
141 |
/** |
142 |
if (!updating) { |
142 |
* If a paint occurs not as part of an update, we should notify that the region |
143 |
/** |
143 |
* is being painted. Otherwise, notification already occurs in repairDamage(). |
144 |
* If a paint occurs not as part of an update, we should notify that the region |
|
|
145 |
* is being painted. Otherwise, notification already occurs in repairDamage(). |
146 |
*/ |
147 |
Rectangle rect = graphics.getClip(new Rectangle()); |
148 |
HashMap map = new HashMap(); |
149 |
map.put(root, rect); |
150 |
firePainting(rect, map); |
151 |
} |
152 |
performValidation(); |
153 |
root.paint(graphics); |
154 |
graphics.dispose(); |
155 |
} else { |
156 |
/* |
157 |
* If figures are being validated then we can simply |
158 |
* add a dirty region here and update will repaint this region with other |
159 |
* dirty regions when it gets to painting. We can't paint if we're not sure |
160 |
* that all figures are valid. |
144 |
*/ |
161 |
*/ |
145 |
HashMap map = new HashMap(); |
162 |
addDirtyRegion(root, new Rectangle(gc.getClipping())); |
146 |
Rectangle rect = graphics.getClip(new Rectangle()); |
|
|
147 |
map.put(root, rect); |
148 |
firePainting(rect, map); |
149 |
} |
163 |
} |
150 |
root.paint(graphics); |
|
|
151 |
graphics.dispose(); |
152 |
} |
164 |
} |
153 |
|
165 |
|
154 |
/** |
166 |
/** |
Lines 181-190
Link Here
|
181 |
* @see UpdateManager#performValidation() |
193 |
* @see UpdateManager#performValidation() |
182 |
*/ |
194 |
*/ |
183 |
public void performValidation() { |
195 |
public void performValidation() { |
184 |
if (invalidFigures.isEmpty()) |
196 |
if (invalidFigures.isEmpty() || validating) |
185 |
return; |
197 |
return; |
186 |
try { |
198 |
try { |
187 |
IFigure fig; |
199 |
IFigure fig; |
|
|
200 |
validating = true; |
188 |
fireValidating(); |
201 |
fireValidating(); |
189 |
for (int i = 0; i < invalidFigures.size(); i++) { |
202 |
for (int i = 0; i < invalidFigures.size(); i++) { |
190 |
fig = (IFigure) invalidFigures.get(i); |
203 |
fig = (IFigure) invalidFigures.get(i); |
Lines 193-198
Link Here
|
193 |
} |
206 |
} |
194 |
} finally { |
207 |
} finally { |
195 |
invalidFigures.clear(); |
208 |
invalidFigures.clear(); |
|
|
209 |
validating = false; |
196 |
} |
210 |
} |
197 |
} |
211 |
} |
198 |
|
212 |
|