mirror of https://github.com/KLayout/klayout.git
Some enhancements for image editing (e.g. selection remains after moving handles)
This commit is contained in:
parent
df562f502a
commit
79868c40cd
|
|
@ -418,7 +418,7 @@ Service::Service (db::Manager *manager, lay::LayoutViewBase *view)
|
|||
mp_transient_view (0),
|
||||
m_move_mode (Service::move_none),
|
||||
m_moved_landmark (0),
|
||||
m_keep_selection_for_landmark (false),
|
||||
m_keep_selection_for_move (false),
|
||||
m_images_visible (true)
|
||||
{
|
||||
// place images behind the grid
|
||||
|
|
@ -623,7 +623,7 @@ Service::begin_move (lay::Editable::MoveMode mode, const db::DPoint &p, lay::ang
|
|||
|
||||
m_move_mode = mm;
|
||||
m_moved_landmark = ml;
|
||||
m_keep_selection_for_landmark = true;
|
||||
m_keep_selection_for_move = true;
|
||||
|
||||
// found a handle of one of the selected object: make the moved image the selection
|
||||
clear_selection ();
|
||||
|
|
@ -660,7 +660,7 @@ Service::begin_move (lay::Editable::MoveMode mode, const db::DPoint &p, lay::ang
|
|||
|
||||
m_move_mode = mm;
|
||||
m_moved_landmark = ml;
|
||||
m_keep_selection_for_landmark = false;
|
||||
m_keep_selection_for_move = false;
|
||||
|
||||
// found anything: make the moved image the selection
|
||||
clear_selection ();
|
||||
|
|
@ -893,7 +893,7 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
|||
image_changed_event (id);
|
||||
|
||||
// clear the selection (that was artificially created before)
|
||||
if (! m_keep_selection_for_landmark) {
|
||||
if (! m_keep_selection_for_move) {
|
||||
clear_selection ();
|
||||
} else {
|
||||
selection_to_view ();
|
||||
|
|
@ -907,7 +907,11 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type)
|
|||
image_changed_event (id);
|
||||
|
||||
// clear the selection (that was artificially created before)
|
||||
clear_selection ();
|
||||
if (! m_keep_selection_for_move) {
|
||||
clear_selection ();
|
||||
} else {
|
||||
selection_to_view ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -956,6 +960,7 @@ Service::find_image (const db::DPoint &p, const db::DBox &search_box, double l,
|
|||
void
|
||||
Service::selection_to_view (img::View::Mode mode)
|
||||
{
|
||||
clear_transient_selection ();
|
||||
image_selection_changed_event ();
|
||||
|
||||
// the selection objects need to be recreated since we destroyed the old images
|
||||
|
|
@ -1006,8 +1011,10 @@ Service::transform (const db::DCplxTrans &trans)
|
|||
void
|
||||
Service::edit_cancel ()
|
||||
{
|
||||
m_move_mode = move_none;
|
||||
selection_to_view ();
|
||||
if (m_move_mode != move_none) {
|
||||
m_move_mode = move_none;
|
||||
selection_to_view ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ private:
|
|||
// The index of the landmark being moved
|
||||
size_t m_moved_landmark;
|
||||
// Flag indicating that we want to keep the selection after the landmark was moved
|
||||
bool m_keep_selection_for_landmark;
|
||||
bool m_keep_selection_for_move;
|
||||
// Flag indicating whether images are visible
|
||||
bool m_images_visible;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,6 @@ Editables::transient_to_selection ()
|
|||
{
|
||||
bool had_transient_selection = false;
|
||||
bool had_selection = false;
|
||||
cancel_edits ();
|
||||
for (iterator e = begin (); e != end (); ++e) {
|
||||
if (e->has_selection ()) {
|
||||
had_selection = true;
|
||||
|
|
|
|||
|
|
@ -5290,6 +5290,7 @@ LayoutViewBase::paste_interactive ()
|
|||
void
|
||||
LayoutViewBase::copy ()
|
||||
{
|
||||
cancel_edits ();
|
||||
if (! lay::Editables::has_selection ()) {
|
||||
// try to use the transient selection for the real one
|
||||
lay::Editables::transient_to_selection ();
|
||||
|
|
@ -5301,6 +5302,7 @@ LayoutViewBase::copy ()
|
|||
void
|
||||
LayoutViewBase::cut ()
|
||||
{
|
||||
cancel_edits ();
|
||||
if (! lay::Editables::has_selection ()) {
|
||||
// try to use the transient selection for the real one
|
||||
lay::Editables::transient_to_selection ();
|
||||
|
|
|
|||
|
|
@ -590,6 +590,7 @@ LayoutView::show_properties ()
|
|||
return;
|
||||
}
|
||||
|
||||
cancel_edits ();
|
||||
if (! has_selection ()) {
|
||||
// try to use the transient selection for the real one
|
||||
transient_to_selection ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue