Conversion to new ScriptableImage complete, this affected quite a bit, including the evil thumbnail thread;

Added StyleListener, so style changes are only propagated to interested viewers.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@329 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-10 00:47:27 +00:00
parent 71adbf8545
commit 00b3e3a3cd
28 changed files with 282 additions and 531 deletions
+13 -8
View File
@@ -34,15 +34,19 @@ void DataViewer::draw(DC& dc) {
}
void DataViewer::draw(RotatedDC& dc, const Color& background) {
if (!set) return; // no set specified, don't draw anything
drawing = true;
// fill with background color
clearDC(dc.getDC(), background);
// update style scripts
//%% if (card) set->updateFor(card);
Context& ctx = getContext();
FOR_EACH(v, viewers) {
if (v->getStyle()->update(ctx)) {
v->onStyleChange();
try {
Context& ctx = getContext();
FOR_EACH(v, viewers) {
if (v->getStyle()->update(ctx)) {
v->getStyle()->tellListeners();
}
}
} catch (const Error& e) {
handle_error(e, false, false);
}
// draw values
FOR_EACH(v, viewers) { // draw low z index fields first
@@ -54,6 +58,7 @@ void DataViewer::draw(RotatedDC& dc, const Color& background) {
}
}
}
drawing = false;
}
void DataViewer::drawViewer(RotatedDC& dc, ValueViewer& v) {
v.draw(dc);
@@ -159,16 +164,16 @@ void DataViewer::onAction(const Action& action, bool undone) {
}
}
}
TYPE_CASE(action, ScriptStyleEvent) {
/*//% TYPE_CASE(action, ScriptStyleEvent) {
if (action.stylesheet == stylesheet.get()) {
FOR_EACH(v, viewers) {
if (v->getStyle().get() == action.style) {
// refresh the viewer
v->onStyleChange();
onChange();
if (!drawing) onChange();
return;
}
}
}
}
}*/
}