diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc b/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc index 5f0be90ab..8dea893fe 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25Plugin.cc @@ -32,34 +32,6 @@ namespace lay { -class D25Plugin - : public lay::Plugin -{ -public: - D25Plugin (Plugin *parent, lay::LayoutView *view) - : lay::Plugin (parent), mp_view (view) - { - mp_dialog = new lay::D25View (0); - } - - ~D25Plugin () - { - delete mp_dialog; - mp_dialog = 0; - } - - void menu_activated (const std::string &symbol) - { - if (symbol == "lay::d25_view") { - mp_dialog->exec_dialog (mp_view); - } - } - -private: - lay::LayoutView *mp_view; - lay::D25View *mp_dialog; -}; - class D25PluginDeclaration : public lay::PluginDeclaration { @@ -98,7 +70,7 @@ public: lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutView *view) const { - return new D25Plugin (root, view); + return new D25View (root, view); } }; diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25View.cc b/src/plugins/tools/view_25d/lay_plugin/layD25View.cc index aa5ee091b..de6df7550 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25View.cc +++ b/src/plugins/tools/view_25d/lay_plugin/layD25View.cc @@ -34,8 +34,8 @@ namespace lay const double initial_elevation = 15.0; -D25View::D25View (QWidget *parent) - : QDialog (parent) +D25View::D25View (lay::Dispatcher *root, lay::LayoutView *view) + : lay::Browser (root, view, "d25_view") { mp_ui = new Ui::D25View (); mp_ui->setupUi (this); @@ -68,6 +68,24 @@ D25View::~D25View () mp_ui = 0; } +void +D25View::menu_activated (const std::string &symbol) +{ + if (symbol == "lay::net_trace") { + + const lay::CellView &cv = view ()->cellview (view ()->active_cellview_index ()); + if (cv.is_valid ()) { + show (); + activateWindow (); + raise (); + activate (); + } + + } else { + lay::Browser::menu_activated (symbol); + } +} + static QString scale_factor_to_string (double f) { QString s; @@ -183,6 +201,27 @@ D25View::exec_dialog (lay::LayoutView *view) return ret; } +D25View::deactivated () +{ + mp_ui->d25_view->attach_view (0); +} + +void +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."))); + } + + 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 (); +} + void D25View::fit_button_clicked () { diff --git a/src/plugins/tools/view_25d/lay_plugin/layD25View.h b/src/plugins/tools/view_25d/lay_plugin/layD25View.h index ff38bbf43..95b6fd405 100644 --- a/src/plugins/tools/view_25d/lay_plugin/layD25View.h +++ b/src/plugins/tools/view_25d/lay_plugin/layD25View.h @@ -26,6 +26,7 @@ #include #include "tlObject.h" +#include "layBrowser.h" namespace Ui { @@ -41,15 +42,17 @@ namespace lay { class D25View - : public QDialog + : public lay::Browser { Q_OBJECT public: - D25View (QWidget *parent); + D25View (lay::Dispatcher *root, lay::LayoutView *view); ~D25View (); - int exec_dialog (lay::LayoutView *view); + virtual void menu_activated (const std::string &symbol); + virtual void deactivated (); + virtual void activated (); protected: void accept (); @@ -67,7 +70,6 @@ private slots: private: Ui::D25View *mp_ui; - tl::weak_ptr mp_view; }; }