From ac5b3073f1a4176c356aae7d03950685a72ef471 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 20 Apr 2024 23:31:54 +0200 Subject: [PATCH] Some enhancements on rulers: pasted ruler is selected now, 'duplicate_interactive' now working on rulers too --- src/ant/ant/antService.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index 11b0d2fb7..b42ae5012 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -2198,15 +2198,29 @@ Service::paste () } } + std::vector new_objects; + for (db::Clipboard::iterator c = db::Clipboard::instance ().begin (); c != db::Clipboard::instance ().end (); ++c) { const db::ClipboardValue *value = dynamic_cast *> (*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 (); + + } + } }