This commit is contained in:
Matthias Koefferlein 2021-09-21 22:52:13 +02:00
parent 5f188f7f5a
commit 9531376b7a
3 changed files with 48 additions and 35 deletions

View File

@ -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);
}
};

View File

@ -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 ()
{

View File

@ -26,6 +26,7 @@
#include <QDialog>
#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<lay::LayoutView> mp_view;
};
}