[consider merging] Bugfix: internal error when copying while move/copy operation of images and rulers

This commit is contained in:
Matthias Koefferlein 2025-08-30 21:30:15 +02:00
parent 0187abfafc
commit 6a9269a9ae
4 changed files with 20 additions and 2 deletions

View File

@ -1766,6 +1766,7 @@ Service::edit_cancel ()
if (m_move_mode != MoveNone) {
m_move_mode = MoveNone;
m_selected.clear ();
selection_to_view ();
}

View File

@ -1080,6 +1080,7 @@ Service::edit_cancel ()
{
if (m_move_mode != move_none) {
m_move_mode = move_none;
m_selected.clear ();
selection_to_view ();
}
}
@ -1118,14 +1119,27 @@ Service::paste ()
{
if (db::Clipboard::instance ().begin () != db::Clipboard::instance ().end ()) {
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<img::Object> *value = dynamic_cast<const db::ClipboardValue<img::Object> *> (*c);
if (value) {
img::Object *image = new img::Object (value->get ());
mp_view->annotation_shapes ().insert (db::DUserObject (image));
new_objects.push_back (&mp_view->annotation_shapes ().insert (db::DUserObject (image)));
}
}
// make new objects selected
if (! new_objects.empty ()) {
for (auto r = new_objects.begin (); r != new_objects.end (); ++r) {
m_selected.insert (mp_view->annotation_shapes ().iterator_from_pointer (*r));
}
selection_to_view ();
}
}
}

View File

@ -1173,6 +1173,8 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
"\n"
"Menu items created this way will send a configuration request with 'cname' as the configuration parameter name "
"and 'cvalue' as the configuration parameter value.\n"
"If 'cvalue' is a string with a single question mark (\"?\"), the item is a check box that reflects the boolean "
"value of the configuration item.\n"
"\n"
"This method has been introduced in version 0.27."
) +

View File

@ -1191,6 +1191,8 @@ LayoutViewFunctions::cm_remove_unused ()
void
LayoutViewFunctions::do_cm_duplicate (bool interactive)
{
view ()->cancel_edits ();
// Do duplicate simply by concatenating copy & paste currently.
// Save the clipboard state before in order to preserve the current content
db::Clipboard saved_clipboard;
@ -1199,7 +1201,6 @@ LayoutViewFunctions::do_cm_duplicate (bool interactive)
try {
bool transient_mode = ! view ()->has_selection ();
view ()->copy_view_objects ();
view ()->cancel_edits ();
if (interactive) {
view ()->paste_interactive (transient_mode);
} else {