src/ldtypes.cpp

changeset 447
b2bd8fb41781
parent 446
608948d27e57
child 455
c5d14d112034
equal deleted inserted replaced
446:608948d27e57 447:b2bd8fb41781
637 // ============================================================================= 637 // =============================================================================
638 // Hook the set accessors of certain properties to this changeProperty function. 638 // Hook the set accessors of certain properties to this changeProperty function.
639 // It takes care of history management so we can capture low-level changes, this 639 // It takes care of history management so we can capture low-level changes, this
640 // makes history stuff work out of the box. 640 // makes history stuff work out of the box.
641 template<class T> void changeProperty (LDObject* obj, T* ptr, const T& val) { 641 template<class T> void changeProperty (LDObject* obj, T* ptr, const T& val) {
642 long idx;
643
644 if (obj->file()) { 642 if (obj->file()) {
643 long idx = obj->getIndex();
645 str before = obj->raw(); 644 str before = obj->raw();
646 *ptr = val; 645 *ptr = val;
647 str after = obj->raw(); 646 str after = obj->raw();
648 647
649 obj->file()->addToHistory (new EditHistory (idx, before, after)); 648 obj->file()->addToHistory (new EditHistory (idx, before, after));

mercurial