diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25View.cc b/src/plugins/tools/view_25d/lay_plugin/layD25View.cc index de6df7550..b0b4888fe 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25View.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25View.cc @@ -71,14 +71,22 @@ D25View::~D25View () void D25View::menu_activated (const std::string &symbol) { - if (symbol == "lay::net_trace") { + if (symbol == "lay::d25_view") { const lay::CellView &cv = view ()->cellview (view ()->active_cellview_index ()); if (cv.is_valid ()) { + show (); activateWindow (); raise (); - activate (); + + try { + activate (); + } catch (...) { + deactivate (); + throw; + } + } } else { @@ -164,43 +172,7 @@ D25View::vscale_factor_changed (double f) mp_ui->vzoom_slider->blockSignals (false); } -int -D25View::exec_dialog (lay::LayoutView *view) -{ - int ret = 0; - - try { - - mp_view.reset (view); - bool any = mp_ui->d25_view->attach_view (view); - - if (! any) { - - mp_view.reset (0); - mp_ui->d25_view->attach_view (0); - - throw tl::Exception (tl::to_string (tr ("No z data configured for the layers in the view.\nUse \"Tools/Manage Technologies\" to set up a z stack."))); - - } - - mp_ui->d25_view->reset (); - mp_ui->d25_view->set_cam_azimuth (0.0); - mp_ui->d25_view->set_cam_elevation (-initial_elevation); - mp_ui->d25_view->fit (); - - ret = QDialog::exec (); - - mp_ui->d25_view->attach_view (0); - mp_view.reset (0); - - } catch (...) { - mp_ui->d25_view->attach_view (0); - mp_view.reset (0); - } - - return ret; -} - +void D25View::deactivated () { mp_ui->d25_view->attach_view (0); @@ -211,7 +183,6 @@ D25View::activated () { bool any = mp_ui->d25_view->attach_view (view ()); if (! any) { - // @@@ mp_ui->d25_view->attach_view (0); throw tl::Exception (tl::to_string (tr ("No z data configured for the layers in the view.\nUse \"Tools/Manage Technologies\" to set up a z stack."))); } diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc b/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc index fb0781a10..8bf19c87d 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25ViewWidget.cc @@ -938,6 +938,10 @@ D25ViewWidget::do_initialize_gl () void D25ViewWidget::paintGL () { + if (! mp_view) { + return; + } + const qreal retina_scale = devicePixelRatio (); glViewport (0, 0, width () * retina_scale, height () * retina_scale); diff --git a/src/plugins/tools/view_25d/unit_tests/layD25CameraTests.cc b/src/plugins/tools/view_25d/unit_tests/layD25CameraTests.cc index 981c5ddd7..e4ea76cc8 100644 --- a/src/plugins/tools/view_25d/unit_tests/layD25CameraTests.cc +++ b/src/plugins/tools/view_25d/unit_tests/layD25CameraTests.cc @@ -34,11 +34,6 @@ static std::string v2s (const QVector3D &v) return tl::to_string (v.x ()) + "," + tl::to_string (v.y ()) + "," + tl::to_string (v.z ()); } -static std::string v2s_2d (const QVector3D &v) -{ - return tl::to_string (v.x ()) + "," + tl::to_string (v.y ()); -} - TEST(1_Transformations) { lay::D25Camera cam;