Merge pull request #1019 from KLayout/25d-with-booleans

25d with booleans
This commit is contained in:
Matthias Köfferlein
2022-03-10 19:15:16 +01:00
committed by GitHub
50 changed files with 2326 additions and 1307 deletions
@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>D25TechnologyComponentEditor</class>
<widget class="QFrame" name="D25TechnologyComponentEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>549</width>
<height>434</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;2.5d Vertical stack information (see &lt;a href=&quot;int:/about/25d_view.xml&quot;&gt;here&lt;/a&gt; for details)&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lnum_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Line</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTextEdit" name="src_te">
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
@@ -1,115 +0,0 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2022 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "laybasicConfig.h"
#include "dbD25TechnologyComponent.h"
#include "layD25TechnologyComponent.h"
#include "layQtTools.h"
#include <QResource>
#include <QBuffer>
namespace lay
{
D25TechnologyComponentEditor::D25TechnologyComponentEditor (QWidget *parent)
: TechnologyComponentEditor (parent)
{
setupUi (this);
src_te->setFont (monospace_font ());
activate_help_links (label);
QResource res (tl::to_qstring (":/syntax/d25_text.xml"));
QByteArray data ((const char *) res.data (), int (res.size ()));
#if QT_VERSION >= 0x60000
if (res.compressionAlgorithm () == QResource::ZlibCompression) {
#else
if (res.isCompressed ()) {
#endif
data = qUncompress (data);
}
QBuffer input (&data);
input.open (QIODevice::ReadOnly);
mp_hl_basic_attributes.reset (new GenericSyntaxHighlighterAttributes ());
mp_hl_attributes.reset (new GenericSyntaxHighlighterAttributes (mp_hl_basic_attributes.get ()));
lay::GenericSyntaxHighlighter *hl = new GenericSyntaxHighlighter (src_te, input, mp_hl_attributes.get ());
input.close ();
hl->setDocument (src_te->document ());
connect (src_te, SIGNAL (cursorPositionChanged ()), this, SLOT (cursor_position_changed ()));
}
void
D25TechnologyComponentEditor::cursor_position_changed ()
{
int line = src_te->textCursor ().block ().firstLineNumber () + 1;
lnum_label->setText (tl::to_qstring (tl::sprintf (tl::to_string (tr ("Line %d")), line)));
}
void
D25TechnologyComponentEditor::commit ()
{
db::D25TechnologyComponent *data = dynamic_cast <db::D25TechnologyComponent *> (tech_component ());
if (! data) {
return;
}
std::string src = tl::to_string (src_te->toPlainText ());
// test-compile before setting it
db::D25TechnologyComponent tc;
tc.set_src (src);
tc.compile_from_source ();
data->set_src (src);
}
void
D25TechnologyComponentEditor::setup ()
{
db::D25TechnologyComponent *data = dynamic_cast <db::D25TechnologyComponent *> (tech_component ());
if (! data) {
return;
}
src_te->setPlainText (tl::to_qstring (data->src ()));
}
class D25TechnologyComponentEditorProvider
: public lay::TechnologyEditorProvider
{
public:
virtual lay::TechnologyComponentEditor *create_editor (QWidget *parent) const
{
return new D25TechnologyComponentEditor (parent);
}
};
static tl::RegisteredClass<lay::TechnologyEditorProvider> editor_decl (new D25TechnologyComponentEditorProvider (), 3100, "d25");
} // namespace lay
@@ -1,57 +0,0 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2022 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef HDR_layD25TechnologyComponent
#define HDR_layD25TechnologyComponent
#include "ui_D25TechnologyComponentEditor.h"
#include "layTechnology.h"
#include "layGenericSyntaxHighlighter.h"
#include <memory>
namespace lay {
class D25TechnologyComponentEditor
: public lay::TechnologyComponentEditor,
public Ui::D25TechnologyComponentEditor
{
Q_OBJECT
public:
D25TechnologyComponentEditor (QWidget *parent);
void commit ();
void setup ();
private slots:
void cursor_position_changed ();
private:
std::unique_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
};
}
#endif
+1 -1
View File
@@ -35,8 +35,8 @@
namespace db
{
struct LayerProperties;
class Layout;
struct LayerProperties;
}
namespace lay
+1 -4
View File
@@ -74,8 +74,7 @@ FORMS = \
NetInfoDialog.ui \
NetExportDialog.ui \
SelectCellViewForm.ui \
LayoutStatistics.ui \
D25TechnologyComponentEditor.ui
LayoutStatistics.ui
RESOURCES = \
laybasicResources.qrc \
@@ -192,7 +191,6 @@ SOURCES = \
laySelectCellViewForm.cc \
layLayoutStatisticsForm.cc \
gsiDeclLayNetlistBrowserDialog.cc \
layD25TechnologyComponent.cc \
layLayoutViewFunctions.cc
HEADERS = \
@@ -300,7 +298,6 @@ HEADERS = \
layDispatcher.h \
laySelectCellViewForm.h \
layLayoutStatisticsForm.h \
layD25TechnologyComponent.h \
layLayoutViewFunctions.h
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC