diff --git a/src/edt/edt/edtEditorOptionsPages.cc b/src/edt/edt/edtEditorOptionsPages.cc index ede46467e..c9397fe59 100644 --- a/src/edt/edt/edtEditorOptionsPages.cc +++ b/src/edt/edt/edtEditorOptionsPages.cc @@ -579,13 +579,18 @@ void EditorOptionsInst::update_cell_edits () { db::Layout *layout = 0; + lay::LayoutView *view = lay::LayoutView::current (); // find the layout the cell has to be looked up: that is either the layout of the current instance or // the library selected if (mp_ui->lib_cbx->current_library ()) { layout = &mp_ui->lib_cbx->current_library ()->layout (); - } else { - layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout (); + } else if (view && view->cellview (m_cv_index).is_valid ()) { + layout = &view->cellview (m_cv_index)->layout (); + } + + if (! layout) { + return; } std::pair pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ()); diff --git a/src/edt/edt/edtPlugin.cc b/src/edt/edt/edtPlugin.cc index 8e579a759..d1e1c970f 100644 --- a/src/edt/edt/edtPlugin.cc +++ b/src/edt/edt/edtPlugin.cc @@ -403,11 +403,10 @@ activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool return; } - // @@@ TODO: this is very inefficient as each "activate" will regenerate the tabs + // TODO: this is very inefficient as each "activate" will regenerate the tabs for (std::vector::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) { (*op)->activate (((*op)->plugin_declaration () == pd || ! (*op)->plugin_declaration ()) && active); } - } void diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 6ff3d246c..2e5b07755 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -537,12 +537,11 @@ MainWindow::MainWindow (QApplication *app, lay::Plugin *plugin_parent, const cha m_libs_visible = true; mp_eo_dock_widget = new QDockWidget (QObject::tr ("Editor Options"), this); - mp_eo_dock_widget->hide (); mp_eo_dock_widget->setObjectName (QString::fromUtf8 ("eo_dock_widget")); mp_eo_stack = new ControlWidgetStack (mp_eo_dock_widget, "eo_stack"); mp_eo_dock_widget->setWidget (mp_eo_stack); connect (mp_eo_dock_widget, SIGNAL (visibilityChanged (bool)), this, SLOT (dock_widget_visibility_changed (bool))); - m_eo_visible = false; + m_eo_visible = true; mp_bm_dock_widget = new QDockWidget (QObject::tr ("Bookmarks"), this); mp_bm_dock_widget->setObjectName (QString::fromUtf8 ("bookmarks_dock_widget")); @@ -939,6 +938,7 @@ MainWindow::show () void MainWindow::close_all () { + cancel (); mp_layer_toolbox->set_view (0); // try a smooth shutdown of the current view @@ -1151,9 +1151,18 @@ MainWindow::config_finalize () // Not set the window state: this ensures we have handled cfg_window_geometry // before we restore the state if (! m_config_window_state.empty ()) { + QByteArray state = QByteArray::fromBase64 (m_config_window_state.c_str ()); m_config_window_state.clear (); + + bool eo_visible = m_eo_visible; + restoreState (state); + + // Keep the editor options visibility state + m_eo_visible = eo_visible; + show_dock_widget (mp_eo_dock_widget, m_eo_visible); + } // Update the default grids menu if necessary @@ -3025,6 +3034,8 @@ MainWindow::close_view (int index) { if (view (index)) { + cancel (); + // this suppresses view_selected events that would otherwise be created bool f = m_disable_tab_selected; m_disable_tab_selected = true;