| 499 | } |
| 500 | |
| 501 | bool |
| 502 | Editables::begin_move (const db::DPoint &p, lay::angle_constraint_type ac) |
| 503 | { |
| 504 | cancel_edits (); |
| 505 | clear_previous_selection (); |
| 506 | |
| 507 | m_move_start = p; |
| 508 | m_move_transform = db::DFTrans (); |
| 509 | |
| 510 | m_move_selection = false; |
| 511 | m_any_move_operation = false; |
| 512 | |
| 513 | // In a first pass evaluate the point selection proximity value to select |
| 514 | // those plugins that are close to the given point. This code is a copy of the code for the single-point selection below. |
| 515 | std::vector< std::pair <double, iterator> > plugins; |
| 516 | |
| 517 | for (iterator e = begin (); e != end (); ++e) { |
| 518 | if (m_enabled.find (&*e) != m_enabled.end ()) { |
| 519 | plugins.push_back (std::make_pair (e->click_proximity (p, lay::Editable::Replace), e)); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | // sort the plugins found by the proximity |
| 524 | std::sort (plugins.begin (), plugins.end (), first_of_pair_cmp_f<double, iterator> ()); |
| 525 | |
| 526 | if (has_selection () && selection_catch_bbox ().contains (p)) { |
| 527 | |
| 528 | // if anything is selected and we are within the selection bbox, |
| 529 | // issue a move operation on all editables: first try a Partial mode begin_move |
| 530 | for (std::vector< std::pair<double, iterator> >::const_iterator pi = plugins.begin (); pi != plugins.end (); ++pi) { |
| 531 | |
| 532 | if (pi->second->begin_move (Editable::Partial, p, ac)) { |
| 533 | |
| 534 | // clear the selection on all other plugins, because we focus on one plugin |
| 535 | for (std::vector< std::pair<double, iterator> >::const_iterator pii = plugins.begin (); pii != plugins.end (); ++pii) { |
| 536 | if (pii->second != pi->second) { |
| 537 | pii->second->select (db::DBox (), lay::Editable::Reset); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | return true; |
| 542 | |
| 543 | } |
| 544 | |
| 545 | } |
| 546 | |
| 547 | // if something is selected, issue a move operation on all editables |
| 548 | for (iterator e = begin (); e != end (); ++e) { |
| 549 | e->begin_move (Editable::Selected, p, ac); |
| 550 | } |
| 551 | |
| 552 | return true; |
| 553 | |
| 554 | } else { |
| 555 | |
| 556 | // don't move the selection - clear the existing one first |
| 557 | clear_selection (); |
| 558 |
no test coverage detected