Merge pull request #1147 from KLayout/wip

Wip
This commit is contained in:
Matthias Köfferlein
2022-09-04 09:08:08 +02:00
committed by GitHub
144 changed files with 47108 additions and 1554 deletions
@@ -27,6 +27,7 @@
#include "layPlugin.h"
#include "layTipDialog.h"
#include "layLayoutViewBase.h"
#include "layMainWindow.h"
#include "dbShapeProcessor.h"
@@ -35,12 +36,17 @@
namespace lay
{
static QWidget *parent_widget ()
{
return QApplication::activeWindow ();
}
class BooleanOperationsPlugin
: public lay::Plugin
{
public:
BooleanOperationsPlugin (Plugin *parent, lay::LayoutViewBase *view)
: lay::Plugin (parent), mp_view (view)
BooleanOperationsPlugin (lay::LayoutViewBase *view)
: lay::Plugin (view), mp_view (view)
{
m_boolean_cva = -1;
m_boolean_cvb = -1;
@@ -100,7 +106,7 @@ public:
}
lay::BooleanOptionsDialog dialog (mp_view->widget ());
lay::BooleanOptionsDialog dialog (parent_widget ());
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvb, m_boolean_layerb, m_boolean_cvr, m_boolean_layerr, m_boolean_mode, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
@@ -237,7 +243,7 @@ public:
}
lay::MergeOptionsDialog dialog (mp_view->widget ());
lay::MergeOptionsDialog dialog (parent_widget ());
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_minwc, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
@@ -352,7 +358,7 @@ public:
}
lay::SizingOptionsDialog dialog (mp_view->widget ());
lay::SizingOptionsDialog dialog (parent_widget ());
if (dialog.exec_dialog (mp_view, m_boolean_cva, m_boolean_layera, m_boolean_cvr, m_boolean_layerr, m_boolean_sizex, m_boolean_sizey, m_boolean_size_mode, m_boolean_hier_mode, m_boolean_mincoh)) {
mp_view->cancel ();
@@ -494,9 +500,9 @@ public:
// .. nothing yet ..
}
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const
{
return new BooleanOperationsPlugin (root, view);
return new BooleanOperationsPlugin (view);
}
};
@@ -27,6 +27,8 @@
#include "layLayoutViewBase.h"
#include "layUtils.h"
#include <QPointer>
namespace lay
{
@@ -34,20 +36,19 @@ class DiffPlugin
: public lay::Plugin
{
public:
DiffPlugin (Plugin *parent, lay::LayoutViewBase *view)
: lay::Plugin (parent), mp_view (view)
DiffPlugin (lay::LayoutViewBase *view)
: lay::Plugin (view), mp_view (view)
{
if (lay::has_gui ()) {
mp_dialog = new lay::DiffToolDialog (0);
} else {
mp_dialog = 0;
}
}
~DiffPlugin ()
{
delete mp_dialog;
mp_dialog = 0;
if (mp_dialog) {
delete mp_dialog.data ();
}
}
void menu_activated (const std::string &symbol)
@@ -65,7 +66,7 @@ public:
private:
lay::LayoutViewBase *mp_view;
lay::DiffToolDialog *mp_dialog;
QPointer<lay::DiffToolDialog> mp_dialog;
};
class DiffPluginDeclaration
@@ -108,9 +109,9 @@ public:
// .. nothing yet ..
}
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const
{
return new DiffPlugin (root, view);
return new DiffPlugin (view);
}
};
@@ -25,6 +25,8 @@
#include "layD25View.h"
#include "layLayoutView.h"
#include "layConverters.h"
#include "laybasicConfig.h"
#include "layQtTools.h"
#include "ui_D25View.h"
@@ -38,7 +40,7 @@ namespace lay
const double initial_elevation = 15.0;
D25View::D25View (lay::Dispatcher *root, LayoutViewBase *view)
D25View::D25View (Dispatcher *root, LayoutViewBase *view)
: lay::Browser (root, view, "d25_view"),
dm_rerun_macro (this, &D25View::rerun_macro),
dm_fit (this, &D25View::fit)
@@ -77,11 +79,6 @@ D25View::D25View (lay::Dispatcher *root, LayoutViewBase *view)
view->cellviews_changed_event.add (this, &D25View::cellviews_changed);
view->layer_list_changed_event.add (this, &D25View::layer_properties_changed);
QPalette palette = mp_ui->material_list->palette ();
palette.setColor (QPalette::Base, Qt::black);
palette.setColor (QPalette::Text, Qt::white);
mp_ui->material_list->setPalette (palette);
QFont font = mp_ui->material_list->font ();
font.setWeight (QFont::Bold);
mp_ui->material_list->setFont (font);
@@ -119,6 +116,27 @@ D25View::layer_properties_changed (int)
// .. nothing yet ..
}
bool D25View::configure(const std::string &name, const std::string &value)
{
if (name == lay::cfg_background_color) {
lay::ColorConverter lc;
tl::Color bg;
lc.from_string (value, bg);
QPalette palette = mp_ui->material_list->palette ();
palette.setColor (QPalette::Base, bg.to_qc ());
palette.setColor (QPalette::Text, bg.to_mono () ? Qt::black : Qt::white);
mp_ui->material_list->setPalette (palette);
mp_ui->d25_view->update ();
}
return lay::Browser::configure (name, value);
}
void
D25View::menu_activated (const std::string &symbol)
{
@@ -60,6 +60,7 @@ public:
D25View (lay::Dispatcher *root, lay::LayoutViewBase *view);
~D25View ();
virtual bool configure (const std::string &name, const std::string &value);
virtual void menu_activated (const std::string &symbol);
virtual void deactivated ();
virtual void activated ();
@@ -53,7 +53,7 @@
z(input(1, 0), 0.1 .. 0.2)
z(input(2, 0), height: 250.nm, color: 0xffbc80)
zz(like: 7/0, name: "Metal") do
zz(like: "7/0", name: "Metal") do
z(input(7, 0), height: 100.nm)
z(input(8, 0), height: 150.nm)
end
@@ -29,6 +29,8 @@
#include "layLayoutView.h"
#include "layUtils.h"
#include <QPointer>
namespace lay
{
@@ -36,20 +38,19 @@ class XORPlugin
: public lay::Plugin
{
public:
XORPlugin (Plugin *parent, lay::LayoutViewBase *view)
: lay::Plugin (parent), mp_view (view)
XORPlugin (lay::LayoutViewBase *view)
: lay::Plugin (view), mp_view (view)
{
if (lay::has_gui ()) {
mp_dialog = new lay::XORToolDialog (0);
} else {
mp_dialog = 0;
}
}
~XORPlugin ()
{
delete mp_dialog;
mp_dialog = 0;
if (mp_dialog) {
delete mp_dialog.data ();
}
}
void menu_activated (const std::string &symbol)
@@ -67,7 +68,7 @@ public:
private:
lay::LayoutViewBase *mp_view;
lay::XORToolDialog *mp_dialog;
QPointer<lay::XORToolDialog> mp_dialog;
};
class XORPluginDeclaration
@@ -116,9 +117,9 @@ public:
// .. nothing yet ..
}
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *root, lay::LayoutViewBase *view) const
lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutViewBase *view) const
{
return new XORPlugin (root, view);
return new XORPlugin (view);
}
};