Commit 88410daa authored by twanvl's avatar twanvl

Card preview on style panel is refreshed when styling changes

parent f431e8f0
......@@ -38,6 +38,10 @@ void CardViewer::redraw(const ValueViewer& v) {
}
void CardViewer::onChange() {
redraw();
}
void CardViewer::redraw() {
if (drawing) return;
up_to_date = false;
Refresh(false);
......
......@@ -30,6 +30,8 @@ class CardViewer : public wxControl, public DataViewer {
/** May NOT be called while in onPaint/draw */
shared_ptr<DC> overdrawDC();
/// Invalidate and redraw the entire viewer
void redraw();
/// Invalidate and redraw (the area of) a single value viewer
virtual void redraw(const ValueViewer&);
......
......@@ -16,6 +16,9 @@
#include <data/card.hpp>
#include <data/stylesheet.hpp>
#include <data/action/set.hpp>
#include <data/action/value.hpp>
DECLARE_TYPEOF_COLLECTION(FieldP);
// ----------------------------------------------------------------------------- : StylePanel
......@@ -68,6 +71,17 @@ void StylePanel::onAction(const Action& action, bool undone) {
editor->showCard(card);
}
}
TYPE_CASE(action, ValueAction) {
// is it a styling action?
const StyleSheet& s = set->stylesheetFor(card);
FOR_EACH_CONST(f, s.styling_fields) {
if (action.valueP->fieldP == f) {
// refresh the viewer
preview->redraw();
return;
}
}
}
use_for_all->Enable(card && card->stylesheet);
use_custom_options->Enable(card);
use_custom_options->SetValue(card->has_styling);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment