mirror of https://github.com/KLayout/klayout.git
Search feature for library browser plus two bugfixes
Bugfixes:
1.) A crash due to wrong key_event_handler pointer
(relevant for hierarchy view)
2.) When switching cellview the focus wasn't changed
and selection stayed in old cellview
This commit is contained in:
parent
4428ef808b
commit
a567002e6c
|
|
@ -526,6 +526,10 @@ HierarchyControlPanel::search_prev ()
|
||||||
void
|
void
|
||||||
HierarchyControlPanel::search_editing_finished ()
|
HierarchyControlPanel::search_editing_finished ()
|
||||||
{
|
{
|
||||||
|
if (! mp_search_frame->isVisible ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
||||||
CellTreeModel *m = dynamic_cast<CellTreeModel *> ((*v)->model ());
|
CellTreeModel *m = dynamic_cast<CellTreeModel *> ((*v)->model ());
|
||||||
if (m) {
|
if (m) {
|
||||||
|
|
@ -733,6 +737,8 @@ HierarchyControlPanel::selection_changed (int index)
|
||||||
{
|
{
|
||||||
if (index != m_active_index) {
|
if (index != m_active_index) {
|
||||||
|
|
||||||
|
search_editing_finished ();
|
||||||
|
|
||||||
m_active_index = index;
|
m_active_index = index;
|
||||||
|
|
||||||
bool split_mode = m_split_mode;
|
bool split_mode = m_split_mode;
|
||||||
|
|
@ -744,6 +750,9 @@ HierarchyControlPanel::selection_changed (int index)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::vector <QFrame *>::const_iterator f = mp_cell_list_frames.begin (); f != mp_cell_list_frames.end (); ++f, ++i) {
|
for (std::vector <QFrame *>::const_iterator f = mp_cell_list_frames.begin (); f != mp_cell_list_frames.end (); ++f, ++i) {
|
||||||
(*f)->setVisible (i == index || split_mode);
|
(*f)->setVisible (i == index || split_mode);
|
||||||
|
if (i == index) {
|
||||||
|
mp_cell_lists [i]->setFocus ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
||||||
|
|
@ -449,6 +449,17 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
|
||||||
vbl->setMargin (0);
|
vbl->setMargin (0);
|
||||||
vbl->setSpacing (0);
|
vbl->setSpacing (0);
|
||||||
|
|
||||||
|
mp_canvas = new lay::LayoutCanvas (this, this);
|
||||||
|
vbl->addWidget (mp_canvas);
|
||||||
|
connect (mp_canvas, SIGNAL (left_arrow_key_pressed ()), this, SLOT (pan_left ()));
|
||||||
|
connect (mp_canvas, SIGNAL (up_arrow_key_pressed ()), this, SLOT (pan_up ()));
|
||||||
|
connect (mp_canvas, SIGNAL (right_arrow_key_pressed ()), this, SLOT (pan_right ()));
|
||||||
|
connect (mp_canvas, SIGNAL (down_arrow_key_pressed ()), this, SLOT (pan_down ()));
|
||||||
|
connect (mp_canvas, SIGNAL (left_arrow_key_pressed_with_shift ()), this, SLOT (pan_left_fast ()));
|
||||||
|
connect (mp_canvas, SIGNAL (up_arrow_key_pressed_with_shift ()), this, SLOT (pan_up_fast ()));
|
||||||
|
connect (mp_canvas, SIGNAL (right_arrow_key_pressed_with_shift ()), this, SLOT (pan_right_fast ()));
|
||||||
|
connect (mp_canvas, SIGNAL (down_arrow_key_pressed_with_shift ()), this, SLOT (pan_down_fast ()));
|
||||||
|
|
||||||
if ((m_options & LV_NoHierarchyPanel) == 0 && (m_options & LV_Naked) == 0) {
|
if ((m_options & LV_NoHierarchyPanel) == 0 && (m_options & LV_Naked) == 0) {
|
||||||
|
|
||||||
QFrame *hierarchy_frame = new QFrame (0);
|
QFrame *hierarchy_frame = new QFrame (0);
|
||||||
|
|
@ -514,17 +525,6 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_canvas = new lay::LayoutCanvas (this, this);
|
|
||||||
vbl->addWidget (mp_canvas);
|
|
||||||
connect (mp_canvas, SIGNAL (left_arrow_key_pressed ()), this, SLOT (pan_left ()));
|
|
||||||
connect (mp_canvas, SIGNAL (up_arrow_key_pressed ()), this, SLOT (pan_up ()));
|
|
||||||
connect (mp_canvas, SIGNAL (right_arrow_key_pressed ()), this, SLOT (pan_right ()));
|
|
||||||
connect (mp_canvas, SIGNAL (down_arrow_key_pressed ()), this, SLOT (pan_down ()));
|
|
||||||
connect (mp_canvas, SIGNAL (left_arrow_key_pressed_with_shift ()), this, SLOT (pan_left_fast ()));
|
|
||||||
connect (mp_canvas, SIGNAL (up_arrow_key_pressed_with_shift ()), this, SLOT (pan_up_fast ()));
|
|
||||||
connect (mp_canvas, SIGNAL (right_arrow_key_pressed_with_shift ()), this, SLOT (pan_right_fast ()));
|
|
||||||
connect (mp_canvas, SIGNAL (down_arrow_key_pressed_with_shift ()), this, SLOT (pan_down_fast ()));
|
|
||||||
|
|
||||||
// occupy services and editables:
|
// occupy services and editables:
|
||||||
// these services get deleted by the canvas destructor automatically:
|
// these services get deleted by the canvas destructor automatically:
|
||||||
if ((m_options & LV_NoTracker) == 0) {
|
if ((m_options & LV_NoTracker) == 0) {
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,6 @@ void
|
||||||
LibrariesView::search_triggered (const QString &t)
|
LibrariesView::search_triggered (const QString &t)
|
||||||
{
|
{
|
||||||
mp_search_model = 0;
|
mp_search_model = 0;
|
||||||
#if 0 // @@@
|
|
||||||
lay::LibraryTreeWidget *w = dynamic_cast<lay::LibraryTreeWidget *> (sender ());
|
lay::LibraryTreeWidget *w = dynamic_cast<lay::LibraryTreeWidget *> (sender ());
|
||||||
if (w) {
|
if (w) {
|
||||||
for (size_t i = 0; i < mp_cell_lists.size (); ++i) {
|
for (size_t i = 0; i < mp_cell_lists.size (); ++i) {
|
||||||
|
|
@ -425,7 +424,6 @@ LibrariesView::search_triggered (const QString &t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // @@@
|
|
||||||
|
|
||||||
if (mp_search_model) {
|
if (mp_search_model) {
|
||||||
mp_search_close_cb->setChecked (true);
|
mp_search_close_cb->setChecked (true);
|
||||||
|
|
@ -491,6 +489,10 @@ LibrariesView::search_prev ()
|
||||||
void
|
void
|
||||||
LibrariesView::search_editing_finished ()
|
LibrariesView::search_editing_finished ()
|
||||||
{
|
{
|
||||||
|
if (! mp_search_frame->isVisible ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
for (std::vector <QTreeView *>::const_iterator v = mp_cell_lists.begin (); v != mp_cell_lists.end (); ++v) {
|
||||||
CellTreeModel *m = dynamic_cast<CellTreeModel *> ((*v)->model ());
|
CellTreeModel *m = dynamic_cast<CellTreeModel *> ((*v)->model ());
|
||||||
if (m) {
|
if (m) {
|
||||||
|
|
@ -498,7 +500,6 @@ LibrariesView::search_editing_finished ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // @@@
|
|
||||||
// give back the focus to the cell list
|
// give back the focus to the cell list
|
||||||
for (size_t i = 0; i < mp_cell_lists.size (); ++i) {
|
for (size_t i = 0; i < mp_cell_lists.size (); ++i) {
|
||||||
if (mp_cell_lists [i]->model () == mp_search_model) {
|
if (mp_cell_lists [i]->model () == mp_search_model) {
|
||||||
|
|
@ -506,7 +507,6 @@ LibrariesView::search_editing_finished ()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
mp_search_frame->hide ();
|
mp_search_frame->hide ();
|
||||||
mp_search_model = 0;
|
mp_search_model = 0;
|
||||||
|
|
@ -816,8 +816,8 @@ LibrariesView::do_update_content (int lib_index)
|
||||||
connect (cell_list, SIGNAL (cell_clicked (const QModelIndex &)), this, SLOT (clicked (const QModelIndex &)));
|
connect (cell_list, SIGNAL (cell_clicked (const QModelIndex &)), this, SLOT (clicked (const QModelIndex &)));
|
||||||
connect (cell_list, SIGNAL (cell_double_clicked (const QModelIndex &)), this, SLOT (double_clicked (const QModelIndex &)));
|
connect (cell_list, SIGNAL (cell_double_clicked (const QModelIndex &)), this, SLOT (double_clicked (const QModelIndex &)));
|
||||||
connect (cell_list, SIGNAL (cell_middle_clicked (const QModelIndex &)), this, SLOT (middle_clicked (const QModelIndex &)));
|
connect (cell_list, SIGNAL (cell_middle_clicked (const QModelIndex &)), this, SLOT (middle_clicked (const QModelIndex &)));
|
||||||
connect (cell_list, SIGNAL (search_triggered (const QString &)), this, SLOT (search_triggered (const QString &)));
|
|
||||||
#endif
|
#endif
|
||||||
|
connect (cell_list, SIGNAL (search_triggered (const QString &)), this, SLOT (search_triggered (const QString &)));
|
||||||
|
|
||||||
mp_cell_lists.push_back (cell_list);
|
mp_cell_lists.push_back (cell_list);
|
||||||
mp_cell_list_frames.push_back (cl_frame);
|
mp_cell_list_frames.push_back (cl_frame);
|
||||||
|
|
@ -920,6 +920,8 @@ LibrariesView::selection_changed (int index)
|
||||||
{
|
{
|
||||||
if (index != m_active_index) {
|
if (index != m_active_index) {
|
||||||
|
|
||||||
|
search_editing_finished ();
|
||||||
|
|
||||||
m_active_index = index;
|
m_active_index = index;
|
||||||
|
|
||||||
bool split_mode = m_split_mode;
|
bool split_mode = m_split_mode;
|
||||||
|
|
@ -931,6 +933,9 @@ LibrariesView::selection_changed (int index)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::vector <QFrame *>::const_iterator f = mp_cell_list_frames.begin (); f != mp_cell_list_frames.end (); ++f, ++i) {
|
for (std::vector <QFrame *>::const_iterator f = mp_cell_list_frames.begin (); f != mp_cell_list_frames.end (); ++f, ++i) {
|
||||||
(*f)->setVisible (i == index || split_mode);
|
(*f)->setVisible (i == index || split_mode);
|
||||||
|
if (i == index) {
|
||||||
|
mp_cell_lists [i]->setFocus ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue