mirror of https://github.com/KLayout/klayout.git
Merge pull request #390 from KLayout/issue-382
Implemented #382: text editor view for user props
This commit is contained in:
commit
9fffd03ad3
|
|
@ -102,5 +102,6 @@ plugins.depends += lib rdb db
|
||||||
unit_tests.depends += plugins $$MAIN_DEPENDS
|
unit_tests.depends += plugins $$MAIN_DEPENDS
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
plugins/tools/import/lay_plugin/layResources.qrc
|
plugins/tools/import/lay_plugin/layResources.qrc \
|
||||||
|
laybasic/laybasic/layResources.qrc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ SOURCES = \
|
||||||
layClipDialog.cc \
|
layClipDialog.cc \
|
||||||
layCrashMessage.cc \
|
layCrashMessage.cc \
|
||||||
layFillDialog.cc \
|
layFillDialog.cc \
|
||||||
layGenericSyntaxHighlighter.cc \
|
|
||||||
layGSIHelpProvider.cc \
|
layGSIHelpProvider.cc \
|
||||||
layHelpDialog.cc \
|
layHelpDialog.cc \
|
||||||
layHelpProvider.cc \
|
layHelpProvider.cc \
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,14 @@ MacroEditorHighlighters::highlighter_for_scheme (QObject *parent, const std::str
|
||||||
if (! scheme.empty ()) {
|
if (! scheme.empty ()) {
|
||||||
|
|
||||||
QResource res (tl::to_qstring (":/syntax/" + scheme + ".xml"));
|
QResource res (tl::to_qstring (":/syntax/" + scheme + ".xml"));
|
||||||
QByteArray data = qUncompress (QByteArray ((const char *) res.data (), int (res.size ())));
|
|
||||||
|
QByteArray data;
|
||||||
|
if (res.isCompressed ()) {
|
||||||
|
data = qUncompress ((const unsigned char *)res.data (), (int)res.size ());
|
||||||
|
} else {
|
||||||
|
data = QByteArray ((const char *)res.data (), (int)res.size ());
|
||||||
|
}
|
||||||
|
|
||||||
QBuffer input (&data);
|
QBuffer input (&data);
|
||||||
input.open (QIODevice::ReadOnly);
|
input.open (QIODevice::ReadOnly);
|
||||||
lay::GenericSyntaxHighlighter *hl = new GenericSyntaxHighlighter (parent, input, attributes);
|
lay::GenericSyntaxHighlighter *hl = new GenericSyntaxHighlighter (parent, input, attributes);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<author></author>
|
<ui version="4.0">
|
||||||
<comment></comment>
|
|
||||||
<exportmacro></exportmacro>
|
|
||||||
<class>SelectStippleForm</class>
|
<class>SelectStippleForm</class>
|
||||||
<widget class="QDialog" name="SelectStippleForm" >
|
<widget class="QDialog" name="SelectStippleForm">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
|
@ -12,86 +10,102 @@
|
||||||
<height>374</height>
|
<height>374</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Select Stipple Pattern</string>
|
<string>Select Stipple Pattern</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="stipple_items" >
|
<widget class="QListWidget" name="stipple_items">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy>
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<hsizetype>5</hsizetype>
|
|
||||||
<vsizetype>7</vsizetype>
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops" >
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="showDropIndicator" stdset="0" >
|
<property name="showDropIndicator" stdset="0">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled" >
|
<property name="dragEnabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors" >
|
<property name="alternatingRowColors">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode" >
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize" >
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>34</width>
|
<width>34</width>
|
||||||
<height>36</height>
|
<height>36</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="movement" >
|
<property name="movement">
|
||||||
<enum>QListView::Static</enum>
|
<enum>QListView::Static</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="viewMode" >
|
<property name="viewMode">
|
||||||
<enum>QListView::ListMode</enum>
|
<enum>QListView::ListMode</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line" >
|
<widget class="Line" name="line">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame5" >
|
<widget class="QFrame" name="frame5">
|
||||||
<property name="frameShape" >
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="topMargin">
|
||||||
<number>6</number>
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>81</width>
|
<width>81</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
|
|
@ -100,21 +114,21 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ok_button" >
|
<widget class="QPushButton" name="ok_button">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>OK</string>
|
<string>OK</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="default" >
|
<property name="default">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cancel_button" >
|
<widget class="QPushButton" name="cancel_button">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Cancel</string>
|
<string>Cancel</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="default" >
|
<property name="default">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -124,11 +138,8 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<pixmapfunction></pixmapfunction>
|
<resources/>
|
||||||
<resources>
|
|
||||||
<include location="layResources.qrc" />
|
|
||||||
</resources>
|
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>ok_button</sender>
|
<sender>ok_button</sender>
|
||||||
|
|
@ -136,11 +147,11 @@
|
||||||
<receiver>SelectStippleForm</receiver>
|
<receiver>SelectStippleForm</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>182</x>
|
<x>182</x>
|
||||||
<y>334</y>
|
<y>334</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>163</x>
|
<x>163</x>
|
||||||
<y>178</y>
|
<y>178</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|
@ -152,11 +163,11 @@
|
||||||
<receiver>SelectStippleForm</receiver>
|
<receiver>SelectStippleForm</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>275</x>
|
<x>275</x>
|
||||||
<y>334</y>
|
<y>334</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>163</x>
|
<x>163</x>
|
||||||
<y>178</y>
|
<y>178</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|
|
||||||
|
|
@ -1,179 +1,198 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>UserPropertiesForm</class>
|
<class>UserPropertiesForm</class>
|
||||||
<widget class="QDialog" name="UserPropertiesForm" >
|
<widget class="QDialog" name="UserPropertiesForm">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>424</width>
|
<width>424</width>
|
||||||
<height>305</height>
|
<height>428</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>User Properties</string>
|
<string>User Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0" colspan="2" >
|
<property name="rightMargin">
|
||||||
<spacer>
|
<number>9</number>
|
||||||
<property name="orientation" >
|
</property>
|
||||||
<enum>Qt::Vertical</enum>
|
<property name="bottomMargin">
|
||||||
</property>
|
<number>9</number>
|
||||||
<property name="sizeType" >
|
</property>
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<property name="spacing">
|
||||||
</property>
|
<number>6</number>
|
||||||
<property name="sizeHint" >
|
</property>
|
||||||
<size>
|
<item row="0" column="0" colspan="2">
|
||||||
<width>332</width>
|
<widget class="QLabel" name="title_lbl">
|
||||||
<height>16</height>
|
<property name="text">
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2" >
|
|
||||||
<widget class="QLabel" name="title_lbl" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>User properties</string>
|
<string>User properties</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2" >
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="3" column="1">
|
||||||
<widget class="QTreeWidget" name="prop_list" >
|
<widget class="QFrame" name="edit_frame">
|
||||||
<property name="rootIsDecorated" >
|
<property name="frameShape">
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="allColumnsShowFocus" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Key</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Value</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" >
|
|
||||||
<widget class="QFrame" name="edit_frame" >
|
|
||||||
<property name="frameShape" >
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="3" column="2" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>61</width>
|
|
||||||
<height>114</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item rowspan="4" row="0" column="0" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType" >
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>6</width>
|
|
||||||
<height>201</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2" >
|
|
||||||
<widget class="QPushButton" name="edit_pb" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Edit</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" colspan="2" >
|
|
||||||
<widget class="QPushButton" name="add_pb" >
|
|
||||||
<property name="text" >
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon" >
|
|
||||||
<iconset resource="layResources.qrc" >:/add.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2" >
|
|
||||||
<widget class="QPushButton" name="remove_pb" >
|
|
||||||
<property name="text" >
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon" >
|
|
||||||
<iconset resource="layResources.qrc" >:/del.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2" >
|
<item row="1" column="0">
|
||||||
<spacer>
|
<widget class="QTabWidget" name="mode_tab">
|
||||||
<property name="orientation" >
|
<property name="currentIndex">
|
||||||
<enum>Qt::Vertical</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<widget class="QWidget" name="tab">
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<attribute name="title">
|
||||||
</property>
|
<string>Table</string>
|
||||||
<property name="sizeHint" >
|
</attribute>
|
||||||
<size>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<width>332</width>
|
<item row="0" column="1" rowspan="4">
|
||||||
<height>16</height>
|
<spacer name="spacer_2">
|
||||||
</size>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Horizontal</enum>
|
||||||
</spacer>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>6</width>
|
||||||
|
<height>201</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="add_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../lay/lay/layResources.qrc">
|
||||||
|
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="remove_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../lay/lay/layResources.qrc">
|
||||||
|
<normaloff>:/del.png</normaloff>:/del.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="edit_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<spacer name="spacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>61</width>
|
||||||
|
<height>211</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="4">
|
||||||
|
<widget class="QTreeWidget" name="prop_list">
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Key</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Text Editor</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="text_edit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="help_label">
|
||||||
|
<property name="text">
|
||||||
|
<string><html>Use the Variant Notation for key and value (<a href="int:/about/variant_notation.xml">See here for details</a>)</html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>prop_list</tabstop>
|
|
||||||
<tabstop>add_pb</tabstop>
|
|
||||||
<tabstop>remove_pb</tabstop>
|
|
||||||
<tabstop>edit_pb</tabstop>
|
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="layResources.qrc" />
|
<include location="../../lay/lay/layResources.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
@ -182,11 +201,11 @@
|
||||||
<receiver>UserPropertiesForm</receiver>
|
<receiver>UserPropertiesForm</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>211</x>
|
<x>211</x>
|
||||||
<y>282</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>211</x>
|
<x>211</x>
|
||||||
<y>152</y>
|
<y>152</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|
@ -198,11 +217,11 @@
|
||||||
<receiver>UserPropertiesForm</receiver>
|
<receiver>UserPropertiesForm</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>211</x>
|
<x>211</x>
|
||||||
<y>282</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>211</x>
|
<x>211</x>
|
||||||
<y>152</y>
|
<y>152</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include "layLayoutView.h"
|
#include "layLayoutView.h"
|
||||||
#include "layCellTreeModel.h"
|
#include "layCellTreeModel.h"
|
||||||
#include "layQtTools.h"
|
#include "layQtTools.h"
|
||||||
|
#include "layGenericSyntaxHighlighter.h"
|
||||||
|
|
||||||
#include "ui_LayerSourceDialog.h"
|
#include "ui_LayerSourceDialog.h"
|
||||||
#include "ui_NewLayoutPropertiesDialog.h"
|
#include "ui_NewLayoutPropertiesDialog.h"
|
||||||
|
|
@ -55,6 +56,9 @@
|
||||||
#include "ui_UserPropertiesForm.h"
|
#include "ui_UserPropertiesForm.h"
|
||||||
#include "ui_UserPropertiesEditForm.h"
|
#include "ui_UserPropertiesEditForm.h"
|
||||||
|
|
||||||
|
#include <QResource>
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
namespace lay
|
namespace lay
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1012,17 +1016,38 @@ FlattenInstOptionsDialog::exec_dialog (int &levels, bool &prune)
|
||||||
// UserPropertiesForm implementation
|
// UserPropertiesForm implementation
|
||||||
|
|
||||||
UserPropertiesForm::UserPropertiesForm (QWidget *parent)
|
UserPropertiesForm::UserPropertiesForm (QWidget *parent)
|
||||||
: QDialog (parent), m_editable (false)
|
: QDialog (parent), m_editable (false), mp_prep (0)
|
||||||
{
|
{
|
||||||
setObjectName (QString::fromUtf8 ("user_properties_form"));
|
setObjectName (QString::fromUtf8 ("user_properties_form"));
|
||||||
|
|
||||||
mp_ui = new Ui::UserPropertiesForm ();
|
mp_ui = new Ui::UserPropertiesForm ();
|
||||||
mp_ui->setupUi (this);
|
mp_ui->setupUi (this);
|
||||||
|
|
||||||
|
mp_ui->text_edit->setFont (QFont ("Monospace"));
|
||||||
|
mp_ui->text_edit->setAcceptRichText (false);
|
||||||
|
|
||||||
connect (mp_ui->add_pb, SIGNAL (clicked ()), this, SLOT (add ()));
|
connect (mp_ui->add_pb, SIGNAL (clicked ()), this, SLOT (add ()));
|
||||||
connect (mp_ui->remove_pb, SIGNAL (clicked ()), this, SLOT (remove ()));
|
connect (mp_ui->remove_pb, SIGNAL (clicked ()), this, SLOT (remove ()));
|
||||||
connect (mp_ui->edit_pb, SIGNAL (clicked ()), this, SLOT (edit ()));
|
connect (mp_ui->edit_pb, SIGNAL (clicked ()), this, SLOT (edit ()));
|
||||||
connect (mp_ui->prop_list, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), this, SLOT (dbl_clicked (QTreeWidgetItem *, int)));
|
connect (mp_ui->prop_list, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), this, SLOT (dbl_clicked (QTreeWidgetItem *, int)));
|
||||||
|
connect (mp_ui->mode_tab, SIGNAL (currentChanged (int)), this, SLOT (tab_changed (int)));
|
||||||
|
|
||||||
|
activate_help_links (mp_ui->help_label);
|
||||||
|
|
||||||
|
QResource res (tl::to_qstring (":/syntax/ur_text.xml"));
|
||||||
|
QByteArray data ((const char *) res.data (), int (res.size ()));
|
||||||
|
if (res.isCompressed ()) {
|
||||||
|
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 (mp_ui->text_edit, input, mp_hl_attributes.get ());
|
||||||
|
input.close ();
|
||||||
|
|
||||||
|
hl->setDocument (mp_ui->text_edit->document ());
|
||||||
}
|
}
|
||||||
|
|
||||||
UserPropertiesForm::~UserPropertiesForm ()
|
UserPropertiesForm::~UserPropertiesForm ()
|
||||||
|
|
@ -1031,35 +1056,12 @@ UserPropertiesForm::~UserPropertiesForm ()
|
||||||
mp_ui = 0;
|
mp_ui = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
db::PropertiesRepository::properties_set
|
||||||
UserPropertiesForm::show (lay::LayoutView *view, unsigned int cv_index, db::properties_id_type &prop_id)
|
UserPropertiesForm::get_properties (int tab)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
db::PropertiesRepository::properties_set props;
|
||||||
|
|
||||||
BEGIN_PROTECTED
|
if (tab == 0) {
|
||||||
|
|
||||||
const lay::CellView &cv = view->cellview (cv_index);
|
|
||||||
db::PropertiesRepository &prep = cv->layout ().properties_repository ();
|
|
||||||
|
|
||||||
m_editable = cv->layout ().is_editable ();
|
|
||||||
if (m_editable) {
|
|
||||||
mp_ui->edit_frame->show ();
|
|
||||||
} else {
|
|
||||||
mp_ui->edit_frame->hide ();
|
|
||||||
}
|
|
||||||
|
|
||||||
mp_ui->prop_list->clear ();
|
|
||||||
|
|
||||||
const db::PropertiesRepository::properties_set &props = prep.properties (prop_id);
|
|
||||||
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
|
||||||
QTreeWidgetItem *entry = new QTreeWidgetItem (mp_ui->prop_list);
|
|
||||||
entry->setText (0, tl::to_qstring (prep.prop_name (p->first).to_parsable_string ()));
|
|
||||||
entry->setText (1, tl::to_qstring (p->second.to_parsable_string ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exec ()) {
|
|
||||||
|
|
||||||
db::PropertiesRepository::properties_set props;
|
|
||||||
|
|
||||||
QTreeWidgetItemIterator it (mp_ui->prop_list);
|
QTreeWidgetItemIterator it (mp_ui->prop_list);
|
||||||
while (*it) {
|
while (*it) {
|
||||||
|
|
@ -1076,13 +1078,92 @@ BEGIN_PROTECTED
|
||||||
kex.read (k);
|
kex.read (k);
|
||||||
kex.expect_end ();
|
kex.expect_end ();
|
||||||
|
|
||||||
props.insert (std::make_pair (prep.prop_name_id (k), v));
|
props.insert (std::make_pair (mp_prep->prop_name_id (k), v));
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prop_id = prep.properties_id (props);
|
} else {
|
||||||
|
|
||||||
|
std::string text = tl::to_string (mp_ui->text_edit->toPlainText ());
|
||||||
|
std::vector<std::string> lines = tl::split (text, "\n");
|
||||||
|
|
||||||
|
for (std::vector<std::string>::const_iterator l = lines.begin (); l != lines.end (); ++l) {
|
||||||
|
|
||||||
|
tl::Extractor ex (l->c_str ());
|
||||||
|
if (ex.at_end ()) {
|
||||||
|
// empty line
|
||||||
|
} else {
|
||||||
|
|
||||||
|
tl::Variant v, k;
|
||||||
|
ex.read (k);
|
||||||
|
ex.test (":");
|
||||||
|
ex.read (v);
|
||||||
|
ex.expect_end ();
|
||||||
|
|
||||||
|
props.insert (std::make_pair (mp_prep->prop_name_id (k), v));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserPropertiesForm::set_properties (const db::PropertiesRepository::properties_set &props)
|
||||||
|
{
|
||||||
|
mp_ui->prop_list->clear ();
|
||||||
|
|
||||||
|
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||||
|
QTreeWidgetItem *entry = new QTreeWidgetItem (mp_ui->prop_list);
|
||||||
|
entry->setText (0, tl::to_qstring (mp_prep->prop_name (p->first).to_parsable_string ()));
|
||||||
|
entry->setText (1, tl::to_qstring (p->second.to_parsable_string ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text;
|
||||||
|
for (db::PropertiesRepository::properties_set::const_iterator p = props.begin (); p != props.end (); ++p) {
|
||||||
|
text += mp_prep->prop_name (p->first).to_parsable_string ();
|
||||||
|
text += ": ";
|
||||||
|
text += p->second.to_parsable_string ();
|
||||||
|
text += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_ui->text_edit->setPlainText (tl::to_qstring (text));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
UserPropertiesForm::show (lay::LayoutView *view, unsigned int cv_index, db::properties_id_type &prop_id)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
BEGIN_PROTECTED
|
||||||
|
|
||||||
|
const lay::CellView &cv = view->cellview (cv_index);
|
||||||
|
mp_prep = &cv->layout ().properties_repository ();
|
||||||
|
|
||||||
|
m_editable = cv->layout ().is_editable ();
|
||||||
|
if (m_editable) {
|
||||||
|
mp_ui->edit_frame->show ();
|
||||||
|
} else {
|
||||||
|
mp_ui->edit_frame->hide ();
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_ui->text_edit->setReadOnly (! m_editable);
|
||||||
|
mp_ui->prop_list->clear ();
|
||||||
|
|
||||||
|
const db::PropertiesRepository::properties_set &props = mp_prep->properties (prop_id);
|
||||||
|
set_properties (props);
|
||||||
|
|
||||||
|
if (exec ()) {
|
||||||
|
|
||||||
|
if (m_editable) {
|
||||||
|
db::PropertiesRepository::properties_set props = get_properties (mp_ui->mode_tab->currentIndex ());
|
||||||
|
prop_id = mp_prep->properties_id (props);
|
||||||
|
}
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
|
|
@ -1090,6 +1171,8 @@ BEGIN_PROTECTED
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mp_prep = 0;
|
||||||
|
|
||||||
END_PROTECTED
|
END_PROTECTED
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -1144,6 +1227,50 @@ UserPropertiesForm::dbl_clicked (QTreeWidgetItem *, int)
|
||||||
edit ();
|
edit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserPropertiesForm::tab_changed (int tab_index)
|
||||||
|
{
|
||||||
|
if (! m_editable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_PROTECTED
|
||||||
|
|
||||||
|
int prev_tab = tab_index == 0 ? 1 : 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// sync content
|
||||||
|
set_properties (get_properties (prev_tab));
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
mp_ui->mode_tab->blockSignals (true);
|
||||||
|
mp_ui->mode_tab->setCurrentIndex (prev_tab);
|
||||||
|
mp_ui->mode_tab->blockSignals (false);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
END_PROTECTED
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserPropertiesForm::accept ()
|
||||||
|
{
|
||||||
|
BEGIN_PROTECTED
|
||||||
|
|
||||||
|
// Test for errors
|
||||||
|
if (m_editable) {
|
||||||
|
get_properties (mp_ui->mode_tab->currentIndex ());
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog::accept ();
|
||||||
|
|
||||||
|
END_PROTECTED
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserPropertiesForm::edit ()
|
UserPropertiesForm::edit ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,11 @@
|
||||||
#include "dbPoint.h"
|
#include "dbPoint.h"
|
||||||
#include "dbVector.h"
|
#include "dbVector.h"
|
||||||
#include "dbTypes.h"
|
#include "dbTypes.h"
|
||||||
|
#include "dbPropertiesRepository.h"
|
||||||
#include "laybasicCommon.h"
|
#include "laybasicCommon.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
|
|
@ -39,6 +41,11 @@ namespace db
|
||||||
struct LayerProperties;
|
struct LayerProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
class GenericSyntaxHighlighterAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class LayerSourceDialog;
|
class LayerSourceDialog;
|
||||||
|
|
@ -412,11 +419,17 @@ public slots:
|
||||||
void remove ();
|
void remove ();
|
||||||
void edit ();
|
void edit ();
|
||||||
void dbl_clicked (QTreeWidgetItem *, int);
|
void dbl_clicked (QTreeWidgetItem *, int);
|
||||||
|
void tab_changed (int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_editable;
|
db::PropertiesRepository::properties_set get_properties (int tab);
|
||||||
|
void set_properties (const db::PropertiesRepository::properties_set &props);
|
||||||
|
void accept ();
|
||||||
|
|
||||||
|
bool m_editable;
|
||||||
|
db::PropertiesRepository *mp_prep;
|
||||||
Ui::UserPropertiesForm *mp_ui;
|
Ui::UserPropertiesForm *mp_ui;
|
||||||
|
std::auto_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -432,7 +445,6 @@ public:
|
||||||
bool show (QString &key, QString &value);
|
bool show (QString &key, QString &value);
|
||||||
virtual void accept ();
|
virtual void accept ();
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::UserPropertiesEditForm *mp_ui;
|
Ui::UserPropertiesEditForm *mp_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#define HDR_layGenericSyntaxHighlighter
|
#define HDR_layGenericSyntaxHighlighter
|
||||||
|
|
||||||
#include "tlString.h"
|
#include "tlString.h"
|
||||||
|
#include "laybasicCommon.h"
|
||||||
|
|
||||||
#include <QSyntaxHighlighter>
|
#include <QSyntaxHighlighter>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
@ -40,7 +41,7 @@ namespace lay
|
||||||
/**
|
/**
|
||||||
* @brief Specifies one element in the text block's user data
|
* @brief Specifies one element in the text block's user data
|
||||||
*/
|
*/
|
||||||
struct SyntaxHighlighterElement
|
struct LAYBASIC_PUBLIC SyntaxHighlighterElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,7 +62,7 @@ public:
|
||||||
*
|
*
|
||||||
* The user data will contain useful data for bracket detection and other things
|
* The user data will contain useful data for bracket detection and other things
|
||||||
*/
|
*/
|
||||||
class SyntaxHighlighterUserData
|
class LAYBASIC_PUBLIC SyntaxHighlighterUserData
|
||||||
: public QTextBlockUserData
|
: public QTextBlockUserData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -92,7 +93,7 @@ public:
|
||||||
* Rule implementations must implement this base class in order to plug into the
|
* Rule implementations must implement this base class in order to plug into the
|
||||||
* generic syntax highlighter framework.
|
* generic syntax highlighter framework.
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterRuleBase
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterRuleBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
@ -131,7 +132,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief A specialization of GenericSyntaxHighlighterRuleBase which looks for a choice of strings
|
* @brief A specialization of GenericSyntaxHighlighterRuleBase which looks for a choice of strings
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterRuleStringList
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterRuleStringList
|
||||||
: public GenericSyntaxHighlighterRuleBase
|
: public GenericSyntaxHighlighterRuleBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -152,7 +153,7 @@ private:
|
||||||
*
|
*
|
||||||
* This object will forward the match request to the actual implementation.
|
* This object will forward the match request to the actual implementation.
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterRule
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
@ -319,7 +320,7 @@ private:
|
||||||
* Special context ID's are 0 (#stay), -n (#pop n times).
|
* Special context ID's are 0 (#stay), -n (#pop n times).
|
||||||
* A context is associated with an attribute, which is given by an integer ID.
|
* A context is associated with an attribute, which is given by an integer ID.
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterContext
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -478,7 +479,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief A collection of (named) contexts
|
* @brief A collection of (named) contexts
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterContexts
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterContexts
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericSyntaxHighlighterContexts ();
|
GenericSyntaxHighlighterContexts ();
|
||||||
|
|
@ -579,7 +580,7 @@ enum def_style {
|
||||||
/**
|
/**
|
||||||
* @brief A collection of attributes
|
* @brief A collection of attributes
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterAttributes
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterAttributes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::map<QString, int>::const_iterator const_iterator;
|
typedef std::map<QString, int>::const_iterator const_iterator;
|
||||||
|
|
@ -672,7 +673,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief The parser's state
|
* @brief The parser's state
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighterState
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighterState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericSyntaxHighlighterState (const GenericSyntaxHighlighterContexts *contexts);
|
GenericSyntaxHighlighterState (const GenericSyntaxHighlighterContexts *contexts);
|
||||||
|
|
@ -710,7 +711,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief A generic syntax highlighter using "Kate"'s syntax highlight scripts
|
* @brief A generic syntax highlighter using "Kate"'s syntax highlight scripts
|
||||||
*/
|
*/
|
||||||
class GenericSyntaxHighlighter
|
class LAYBASIC_PUBLIC GenericSyntaxHighlighter
|
||||||
: public QSyntaxHighlighter
|
: public QSyntaxHighlighter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -177,7 +177,8 @@ SOURCES = \
|
||||||
layNetlistCrossReferenceModel.cc \
|
layNetlistCrossReferenceModel.cc \
|
||||||
layNetlistBrowserTreeModel.cc \
|
layNetlistBrowserTreeModel.cc \
|
||||||
layLibrariesView.cc \
|
layLibrariesView.cc \
|
||||||
layBookmarksView.cc
|
layBookmarksView.cc \
|
||||||
|
layGenericSyntaxHighlighter.cc
|
||||||
|
|
||||||
HEADERS = \
|
HEADERS = \
|
||||||
gtf.h \
|
gtf.h \
|
||||||
|
|
@ -275,7 +276,8 @@ HEADERS = \
|
||||||
layNetlistCrossReferenceModel.h \
|
layNetlistCrossReferenceModel.h \
|
||||||
layNetlistBrowserTreeModel.h \
|
layNetlistBrowserTreeModel.h \
|
||||||
layLibrariesView.h \
|
layLibrariesView.h \
|
||||||
layBookmarksView.h
|
layBookmarksView.h \
|
||||||
|
layGenericSyntaxHighlighter.h
|
||||||
|
|
||||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||||
|
|
|
||||||
|
|
@ -44,5 +44,6 @@
|
||||||
<file>images/icon_device_bjt_32.png</file>
|
<file>images/icon_device_bjt_32.png</file>
|
||||||
<file>images/icon_device_bjt_24.png</file>
|
<file>images/icon_device_bjt_24.png</file>
|
||||||
<file>images/icon_device_bjt_16.png</file>
|
<file>images/icon_device_bjt_16.png</file>
|
||||||
|
<file>syntax/ur_text.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE language SYSTEM "language.dtd">
|
||||||
|
|
||||||
|
<language name="UserPropertiesTextFormat">
|
||||||
|
|
||||||
|
<highlighting>
|
||||||
|
|
||||||
|
<contexts>
|
||||||
|
|
||||||
|
<context name="Normal" attribute="Normal Text">
|
||||||
|
|
||||||
|
<DetectChar attribute="String" char=""" context="Quoted Key String"/>
|
||||||
|
<DetectChar attribute="Raw String" char="'" context="Apostrophed Key String"/>
|
||||||
|
|
||||||
|
<RegExpr attribute="Float" String="##\s*\-?[0-9]([0-9]|_[0-9])*(\.[0-9]([0-9]|_[0-9])*)?([eE]\-?[1-9]([0-9]|_[0-9])*(\.[0-9]*)?)?" context="After Key"/>
|
||||||
|
<RegExpr attribute="Dec" String="#\s*\-?[1-9]([0-9]|_[0-9])*" context="After Key"/>
|
||||||
|
<RegExpr attribute="Symbol" String="[_A-Za-z0-9]+\b" context="After Key"/>
|
||||||
|
|
||||||
|
<RegExpr attribute="Error" String="[^\s]" context="Error"/>
|
||||||
|
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="After Key" attribute="Normal Text" fallthrough="true" fallthroughContext="Value" lineEndContext="Error">
|
||||||
|
<DetectChar attribute="Normal" char=":" context="Value"/>
|
||||||
|
<RegExpr attribute="Normal" String="\s+" context="#stay"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Value" attribute="Normal Text" fallthrough="true" fallthroughContext="Error" lineEndContext="Error">
|
||||||
|
|
||||||
|
<DetectChar attribute="String" char=""" context="Quoted Value String"/>
|
||||||
|
<DetectChar attribute="Raw String" char="'" context="Apostrophed Value String"/>
|
||||||
|
|
||||||
|
<RegExpr attribute="Float" String="##\s*\-?[0-9]([0-9]|_[0-9])*(\.[0-9]([0-9]|_[0-9])*)?([eE]\-?[1-9]([0-9]|_[0-9])*(\.[0-9]*)?)?" context="After Value"/>
|
||||||
|
<RegExpr attribute="Dec" String="#\s*\-?[1-9]([0-9]|_[0-9])*" context="After Value"/>
|
||||||
|
<RegExpr attribute="Symbol" String="[_A-Za-z0-9]+\b" context="After Value"/>
|
||||||
|
|
||||||
|
<RegExpr attribute="Normal" String="\s+" context="Value"/>
|
||||||
|
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="After Value" attribute="Normal Text" fallthrough="true" fallthroughContext="Error" lineEndContext="Normal">
|
||||||
|
<RegExpr attribute="Normal" String="\s+" context="#stay"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Error" attribute="Error" lineEndContext="Normal">
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Quoted Key String" attribute="String" lineEndContext="Error">
|
||||||
|
<StringDetect attribute="String" String="\\" context="#stay"/>
|
||||||
|
<RegExpr attribute="String" String="\\\"" context="#stay"/>
|
||||||
|
<DetectChar char=""" attribute="String" context="After Key"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Apostrophed Key String" attribute="Raw String" lineEndContext="Error">
|
||||||
|
<StringDetect attribute="String" String="\\" context="#stay"/>
|
||||||
|
<RegExpr attribute="String" String="\\\'" context="#stay"/>
|
||||||
|
<DetectChar char="'" attribute="Raw String" context="After Key"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Quoted Value String" attribute="String" lineEndContext="Error">
|
||||||
|
<StringDetect attribute="String" String="\\" context="#stay"/>
|
||||||
|
<RegExpr attribute="String" String="\\\"" context="#stay"/>
|
||||||
|
<DetectChar char=""" attribute="String" context="After Value"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Apostrophed Value String" attribute="Raw String" lineEndContext="Error">
|
||||||
|
<StringDetect attribute="String" String="\\" context="#stay"/>
|
||||||
|
<RegExpr attribute="String" String="\\\'" context="#stay"/>
|
||||||
|
<DetectChar char="'" attribute="Raw String" context="After Value"/>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
</contexts>
|
||||||
|
|
||||||
|
<itemDatas>
|
||||||
|
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
||||||
|
|
||||||
|
<itemData name="Dec" defStyleNum="dsDecVal"/>
|
||||||
|
<itemData name="Float" defStyleNum="dsFloat"/>
|
||||||
|
<itemData name="Symbol" defStyleNum="dsString" color="#D40000"/>
|
||||||
|
<itemData name="String" defStyleNum="dsString"/>
|
||||||
|
<itemData name="Raw String" defStyleNum="dsString" color="#DD4A4A" selColor="#DD4A4A"/>
|
||||||
|
|
||||||
|
<!-- use these to mark errors and alerts things -->
|
||||||
|
<itemData name="Error" defStyleNum="dsAlert"/>
|
||||||
|
|
||||||
|
</itemDatas>
|
||||||
|
|
||||||
|
</highlighting>
|
||||||
|
</language>
|
||||||
Loading…
Reference in New Issue