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)); |