Skip to content

Commit

Permalink
Merge pull request #1824 from KLayout/bugfix/issue-1823
Browse files Browse the repository at this point in the history
Fixed bug #1823 (select_all not working)
  • Loading branch information
klayoutmatthias authored Aug 10, 2024
2 parents ea6ffb9 + 3e0d0ad commit 857fbc8
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutVi
"\n"
"This method has been introduced in version 0.26.2\n"
) +
gsi::method ("select_all", (void (lay::LayoutViewBase::*) ()) &lay::LayoutViewBase::select,
gsi::method ("select_all", (void (lay::LayoutViewBase::*) ()) &lay::LayoutViewBase::select_all,
"@brief Selects all objects from the view\n"
"\n"
"This method has been introduced in version 0.27\n"
Expand Down
17 changes: 0 additions & 17 deletions src/laybasic/laybasic/layEditable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -369,23 +369,6 @@ Editables::clear_selection ()
}
}

void
Editables::select ()
{
cancel_edits ();
clear_transient_selection ();
clear_previous_selection ();

for (iterator e = begin (); e != end (); ++e) {
if (m_enabled.find (&*e) != m_enabled.end ()) {
e->select (db::DBox (), lay::Editable::Replace); // select "all"
}
}

// send a signal to the observers
signal_selection_changed ();
}

void
Editables::select (const db::DBox &box, lay::Editable::SelectionMode mode)
{
Expand Down
5 changes: 0 additions & 5 deletions src/laybasic/laybasic/layEditable.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,6 @@ class LAYBASIC_PUBLIC Editables
*/
void clear_previous_selection ();

/**
* @brief Select "all"
*/
void select ();

/**
* @brief Select geometrically by a rectangle
*/
Expand Down
2 changes: 1 addition & 1 deletion src/laybasic/laybasic/layFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ ShapeFinder::find (LayoutViewBase *view, const db::DBox &region_mu)
m_cells_with_context.clear ();

lay::TextInfo text_info (view);
mp_text_info = (m_flags & db::ShapeIterator::Texts) != 0 ? &text_info : 0;
mp_text_info = (m_flags & db::ShapeIterator::Texts) != 0 && point_mode () ? &text_info : 0;

std::vector<lay::LayerPropertiesConstIterator> lprops;
for (lay::LayerPropertiesConstIterator lp = view->begin_layers (); ! lp.at_end (); ++lp) {
Expand Down
6 changes: 6 additions & 0 deletions src/laybasic/laybasic/layLayoutViewBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3767,6 +3767,12 @@ LayoutViewBase::full_box () const
return bbox;
}

void
LayoutViewBase::select_all ()
{
select (full_box (), lay::Editable::Replace);
}

void
LayoutViewBase::zoom_fit ()
{
Expand Down
5 changes: 5 additions & 0 deletions src/laybasic/laybasic/layLayoutViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2631,6 +2631,11 @@ class LAYBASIC_PUBLIC LayoutViewBase :
*/
db::DBox full_box () const;

/**
* @brief Selects everything
*/
void select_all ();

/**
* @brief Gets called when a menu item is activated
*/
Expand Down
2 changes: 1 addition & 1 deletion src/layui/layui/layLayoutViewFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ LayoutViewFunctions::menu_activated (const std::string &symbol)
} else if (symbol == "cm_unselect_all") {
view ()->select (db::DBox (), lay::Editable::Reset);
} else if (symbol == "cm_select_all") {
view ()->select (view ()->full_box (), lay::Editable::Replace);
view ()->select_all ();
} else if (symbol == "cm_select_next_item") {
view ()->repeat_selection (lay::Editable::Replace);
} else if (symbol == "cm_select_next_item_add") {
Expand Down
12 changes: 9 additions & 3 deletions testdata/ruby/layLayoutView.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,22 @@ def test_2
view.set_config("search-range", "0")
view.select_from(RBA::DBox::new(-2.5, -2.5, 2.5, 2.5))
assert_equal(selection_changed, 1)
assert_equal(view.selection_size, 2)
assert_equal(view.selection_size, 4)
assert_equal(view.has_selection?, true)

view.select_from(RBA::DPoint::new(0, 0), RBA::LayoutView::Invert)
assert_equal(selection_changed, 2)
assert_equal(view.selection_size, 3)
assert_equal(view.selection_size, 5)
assert_equal(view.has_selection?, true)

view.clear_selection
assert_equal(selection_changed, 3)
view.select_all
assert_equal(selection_changed, 4)
assert_equal(view.has_selection?, true)
assert_equal(view.selection_size, 20)

view.clear_selection
assert_equal(selection_changed, 5)
assert_equal(view.has_selection?, false)
assert_equal(view.selection_size, 0)
selection_changed = 0
Expand Down

0 comments on commit 857fbc8

Please sign in to comment.