mirror of https://github.com/KLayout/klayout.git
Enhancement: 'copy interactive' will maintain selection
This commit is contained in:
parent
4a475a7e21
commit
10f3380023
|
|
@ -5308,7 +5308,7 @@ LayoutViewBase::paste ()
|
|||
}
|
||||
|
||||
void
|
||||
LayoutViewBase::paste_interactive ()
|
||||
LayoutViewBase::paste_interactive (bool transient_mode)
|
||||
{
|
||||
clear_selection ();
|
||||
|
||||
|
|
@ -5320,7 +5320,7 @@ LayoutViewBase::paste_interactive ()
|
|||
// operations.
|
||||
trans->close ();
|
||||
|
||||
if (mp_move_service->begin_move (trans.release (), false)) {
|
||||
if (mp_move_service->begin_move (trans.release (), transient_mode)) {
|
||||
switch_mode (-1); // move mode
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ public:
|
|||
/**
|
||||
* @brief Pastes from clipboard and initiates a move
|
||||
*/
|
||||
void paste_interactive ();
|
||||
void paste_interactive (bool transient_mode = false);
|
||||
|
||||
/**
|
||||
* @brief Copies to clipboard
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ MoveService::mouse_press_event (const db::DPoint &p, unsigned int buttons, bool
|
|||
}
|
||||
|
||||
bool
|
||||
MoveService::begin_move (db::Transaction *transaction, bool selected_after_move)
|
||||
MoveService::begin_move (db::Transaction *transaction, bool transient_selection)
|
||||
{
|
||||
if (m_dragging) {
|
||||
return false;
|
||||
|
|
@ -248,16 +248,28 @@ MoveService::begin_move (db::Transaction *transaction, bool selected_after_move)
|
|||
|
||||
std::unique_ptr<db::Transaction> trans_holder (transaction);
|
||||
|
||||
bool drag_transient = ! selected_after_move;
|
||||
if (! mp_editables->has_selection ()) {
|
||||
// try to use the transient selection for the real one
|
||||
mp_editables->transient_to_selection ();
|
||||
drag_transient = true;
|
||||
}
|
||||
bool drag_transient = false;
|
||||
|
||||
if (! transaction) {
|
||||
|
||||
// unless in "continue with move" use case try to establish a selection
|
||||
|
||||
if (! mp_editables->has_selection ()) {
|
||||
// try to use the transient selection for the real one
|
||||
mp_editables->transient_to_selection ();
|
||||
drag_transient = true;
|
||||
}
|
||||
|
||||
if (! mp_editables->has_selection ()) {
|
||||
// still nothing selected
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// inherit transient selection mode from previous operation
|
||||
drag_transient = transient_selection;
|
||||
|
||||
if (! mp_editables->has_selection ()) {
|
||||
// still nothing selected
|
||||
return false;
|
||||
}
|
||||
|
||||
db::DBox bbox = mp_editables->selection_bbox ();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
~MoveService ();
|
||||
|
||||
virtual bool configure (const std::string &name, const std::string &value);
|
||||
bool begin_move (db::Transaction *transaction = 0, bool selected_after_move = true);
|
||||
bool begin_move (db::Transaction *transaction = 0, bool transient_selection = false);
|
||||
|
||||
private:
|
||||
virtual bool mouse_press_event (const db::DPoint &p, unsigned int buttons, bool prio);
|
||||
|
|
|
|||
|
|
@ -1177,11 +1177,12 @@ LayoutViewFunctions::do_cm_duplicate (bool interactive)
|
|||
db::Clipboard::instance ().swap (saved_clipboard);
|
||||
|
||||
try {
|
||||
bool transient_mode = ! view ()->has_selection ();
|
||||
view ()->copy_view_objects ();
|
||||
view ()->clear_selection ();
|
||||
view ()->cancel ();
|
||||
if (interactive) {
|
||||
view ()->paste_interactive ();
|
||||
view ()->paste_interactive (transient_mode);
|
||||
} else {
|
||||
view ()->paste ();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue