Fixed bug #1823 (select_all not working)

1. Fixed "LayoutView#select_all"
2. Box selection now will select texts at their origin again:
   this way it is included in the bounding box. Point mode still
   takes the text's glyph area.
This commit is contained in:
Matthias Koefferlein 2024-08-08 23:26:05 +02:00
parent a5ea8eb590
commit f218c009a0
7 changed files with 14 additions and 25 deletions

View File

@ -1058,7 +1058,7 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutVi
"\n" "\n"
"This method has been introduced in version 0.26.2\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" "@brief Selects all objects from the view\n"
"\n" "\n"
"This method has been introduced in version 0.27\n" "This method has been introduced in version 0.27\n"

View File

@ -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 void
Editables::select (const db::DBox &box, lay::Editable::SelectionMode mode) Editables::select (const db::DBox &box, lay::Editable::SelectionMode mode)
{ {

View File

@ -507,11 +507,6 @@ public:
*/ */
void clear_previous_selection (); void clear_previous_selection ();
/**
* @brief Select "all"
*/
void select ();
/** /**
* @brief Select geometrically by a rectangle * @brief Select geometrically by a rectangle
*/ */

View File

@ -324,7 +324,7 @@ ShapeFinder::find (LayoutViewBase *view, const db::DBox &region_mu)
m_cells_with_context.clear (); m_cells_with_context.clear ();
lay::TextInfo text_info (view); 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; std::vector<lay::LayerPropertiesConstIterator> lprops;
for (lay::LayerPropertiesConstIterator lp = view->begin_layers (); ! lp.at_end (); ++lp) { for (lay::LayerPropertiesConstIterator lp = view->begin_layers (); ! lp.at_end (); ++lp) {

View File

@ -3753,6 +3753,12 @@ LayoutViewBase::full_box () const
return bbox; return bbox;
} }
void
LayoutViewBase::select_all ()
{
select (full_box (), lay::Editable::Replace);
}
void void
LayoutViewBase::zoom_fit () LayoutViewBase::zoom_fit ()
{ {

View File

@ -2623,6 +2623,11 @@ public:
*/ */
db::DBox full_box () const; db::DBox full_box () const;
/**
* @brief Selects everything
*/
void select_all ();
/** /**
* @brief Gets called when a menu item is activated * @brief Gets called when a menu item is activated
*/ */

View File

@ -135,7 +135,7 @@ LayoutViewFunctions::menu_activated (const std::string &symbol)
} else if (symbol == "cm_unselect_all") { } else if (symbol == "cm_unselect_all") {
view ()->select (db::DBox (), lay::Editable::Reset); view ()->select (db::DBox (), lay::Editable::Reset);
} else if (symbol == "cm_select_all") { } else if (symbol == "cm_select_all") {
view ()->select (view ()->full_box (), lay::Editable::Replace); view ()->select_all ();
} else if (symbol == "cm_select_next_item") { } else if (symbol == "cm_select_next_item") {
view ()->repeat_selection (lay::Editable::Replace); view ()->repeat_selection (lay::Editable::Replace);
} else if (symbol == "cm_select_next_item_add") { } else if (symbol == "cm_select_next_item_add") {