Do not duplicate cells+layers on "Duplicate"

See https://www.klayout.de/forum/discussion/2335 for the rationale
This commit is contained in:
Matthias Koefferlein 2023-07-30 13:50:49 +02:00
parent ae48740107
commit 2ae01a3e91
3 changed files with 15 additions and 6 deletions

View File

@ -5297,11 +5297,7 @@ LayoutViewBase::paste_interactive ()
std::unique_ptr<db::Transaction> trans (new db::Transaction (manager (), tl::to_string (tr ("Paste and move")))); std::unique_ptr<db::Transaction> trans (new db::Transaction (manager (), tl::to_string (tr ("Paste and move"))));
{ lay::Editables::paste ();
// let the receivers sort out who is pasting what ..
do_paste ();
lay::Editables::paste ();
}
// temporarily close the transaction and pass to the move service for appending it's own // temporarily close the transaction and pass to the move service for appending it's own
// operations. // operations.
@ -5314,6 +5310,12 @@ LayoutViewBase::paste_interactive ()
void void
LayoutViewBase::copy () LayoutViewBase::copy ()
{
copy_view_objects ();
}
void
LayoutViewBase::copy_view_objects ()
{ {
cancel_edits (); cancel_edits ();
if (! lay::Editables::has_selection ()) { if (! lay::Editables::has_selection ()) {

View File

@ -264,6 +264,13 @@ public:
*/ */
virtual void copy (); virtual void copy ();
/**
* @brief Copies to clipboard (view objects only)
*
* This version does not look for copy sources in the tree views.
*/
void copy_view_objects ();
/** /**
* @brief Cuts to clipboard * @brief Cuts to clipboard
* *

View File

@ -1177,7 +1177,7 @@ LayoutViewFunctions::do_cm_duplicate (bool interactive)
db::Clipboard::instance ().swap (saved_clipboard); db::Clipboard::instance ().swap (saved_clipboard);
try { try {
view ()->copy (); view ()->copy_view_objects ();
view ()->clear_selection (); view ()->clear_selection ();
view ()->cancel (); view ()->cancel ();
if (interactive) { if (interactive) {