Some enhancements on rulers: pasted ruler is selected now, 'duplicate_interactive' now working on rulers too

This commit is contained in:
Matthias Koefferlein 2024-04-20 23:31:54 +02:00
parent a18a6be181
commit ac5b3073f1
1 changed files with 15 additions and 1 deletions

View File

@ -2198,15 +2198,29 @@ Service::paste ()
}
}
std::vector<const db::DUserObject *> new_objects;
for (db::Clipboard::iterator c = db::Clipboard::instance ().begin (); c != db::Clipboard::instance ().end (); ++c) {
const db::ClipboardValue<ant::Object> *value = dynamic_cast<const db::ClipboardValue<ant::Object> *> (*c);
if (value) {
ant::Object *ruler = new ant::Object (value->get ());
ruler->id (++idmax);
mp_view->annotation_shapes ().insert (db::DUserObject (ruler));
new_objects.push_back (&mp_view->annotation_shapes ().insert (db::DUserObject (ruler)));
}
}
// make new objects selected
if (! new_objects.empty ()) {
for (auto r = new_objects.begin (); r != new_objects.end (); ++r) {
m_selected.insert (std::make_pair (mp_view->annotation_shapes ().iterator_from_pointer (*r), 0));
}
selection_to_view ();
}
}
}