src/ldtypes.cpp

changeset 446
608948d27e57
parent 445
15c3af0b5cb7
child 447
b2bd8fb41781
equal deleted inserted replaced
445:15c3af0b5cb7 446:608948d27e57
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; 642 long idx;
643 643
644 if (obj->file() && (idx = obj->getIndex()) != -1) { 644 if (obj->file()) {
645 str before = obj->raw(); 645 str before = obj->raw();
646 *ptr = val; 646 *ptr = val;
647 str after = obj->raw(); 647 str after = obj->raw();
648 648
649 obj->file()->addToHistory (new EditHistory (idx, before, after)); 649 obj->file()->addToHistory (new EditHistory (idx, before, after));

mercurial