mirror of https://github.com/KLayout/klayout.git
Fixed issue #1430 (Add option to filter out geometric primitives from Marker Database Browser Info widget)
This commit is contained in:
parent
abf2970438
commit
8051e43583
|
|
@ -62,7 +62,7 @@
|
|||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../../icons/icons.qrc">
|
||||
<normaloff>:/run_16px.png</normaloff>:/run_16px.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
|
|
@ -480,27 +480,6 @@
|
|||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QToolButton" name="photo_pb">
|
||||
<property name="toolTip">
|
||||
<string>Add snapshot</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Photo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../icons/icons.qrc">
|
||||
<normaloff>:/photo_16px.png</normaloff>:/photo_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QToolButton" name="waive_pb">
|
||||
<property name="toolTip">
|
||||
|
|
@ -515,40 +494,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="info_label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="flags_pb">
|
||||
<property name="toolTip">
|
||||
<string>Set or reset flag</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flag</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QToolButton" name="important_pb">
|
||||
<property name="toolTip">
|
||||
<string>Important</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Imp</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../icons/icons.qrc">
|
||||
<normaloff>:/important_16px.png</normaloff>:/important_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QToolButton" name="nophoto_pb">
|
||||
<property name="toolTip">
|
||||
|
|
@ -566,6 +511,54 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="flags_pb">
|
||||
<property name="toolTip">
|
||||
<string>Set or reset flag</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flag</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QToolButton" name="photo_pb">
|
||||
<property name="toolTip">
|
||||
<string>Add snapshot</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Photo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../icons/icons.qrc">
|
||||
<normaloff>:/photo_16px.png</normaloff>:/photo_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QToolButton" name="important_pb">
|
||||
<property name="toolTip">
|
||||
<string>Important</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Imp</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../icons/icons.qrc">
|
||||
<normaloff>:/important_16px.png</normaloff>:/important_16px.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="info_label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="7">
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -612,6 +605,63 @@ p, li { white-space: pre-wrap; }
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="7">
|
||||
<widget class="QFrame" name="frame_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="list_shapes_cb">
|
||||
<property name="text">
|
||||
<string>list shapes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ namespace rdb
|
|||
|
||||
std::string cfg_rdb_context_mode ("rdb-context-mode");
|
||||
std::string cfg_rdb_show_all ("rdb-show-all");
|
||||
std::string cfg_rdb_list_shapes ("rdb-list-shapes");
|
||||
std::string cfg_rdb_window_state ("rdb-window-state-v2"); // v2: 0.24++
|
||||
std::string cfg_rdb_window_mode ("rdb-window-mode");
|
||||
std::string cfg_rdb_window_dim ("rdb-window-dim");
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ namespace rdb
|
|||
|
||||
extern std::string cfg_rdb_context_mode;
|
||||
extern std::string cfg_rdb_show_all;
|
||||
extern std::string cfg_rdb_list_shapes;
|
||||
extern std::string cfg_rdb_window_state;
|
||||
extern std::string cfg_rdb_window_mode;
|
||||
extern std::string cfg_rdb_window_dim;
|
||||
|
|
@ -445,6 +446,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu
|
|||
bool need_update = false;
|
||||
bool taken = true;
|
||||
bool show_all = mp_ui->browser_frame->show_all ();
|
||||
bool list_shapes = mp_ui->browser_frame->list_shapes ();
|
||||
|
||||
if (name == cfg_rdb_context_mode) {
|
||||
|
||||
|
|
@ -452,6 +454,10 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu
|
|||
MarkerBrowserContextModeConverter ().from_string (value, context);
|
||||
need_update = lay::test_and_set (m_context, context);
|
||||
|
||||
} else if (name == cfg_rdb_list_shapes) {
|
||||
|
||||
tl::from_string (value, list_shapes);
|
||||
|
||||
} else if (name == cfg_rdb_show_all) {
|
||||
|
||||
tl::from_string (value, show_all);
|
||||
|
|
@ -540,6 +546,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu
|
|||
}
|
||||
|
||||
mp_ui->browser_frame->show_all (show_all);
|
||||
mp_ui->browser_frame->list_shapes (list_shapes);
|
||||
|
||||
return taken;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ namespace rdb
|
|||
{
|
||||
|
||||
extern std::string cfg_rdb_show_all;
|
||||
extern std::string cfg_rdb_list_shapes;
|
||||
|
||||
struct FlagDescriptor
|
||||
{
|
||||
|
|
@ -1447,6 +1448,7 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/)
|
|||
m_update_needed (false),
|
||||
mp_database (0),
|
||||
m_show_all (true),
|
||||
m_list_shapes (true),
|
||||
mp_view (0),
|
||||
m_cv_index (0),
|
||||
m_num_items (0),
|
||||
|
|
@ -1504,6 +1506,8 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/)
|
|||
markers_list->header ()->setSortIndicatorShown (true);
|
||||
markers_list->header ()->setMinimumSectionSize (24);
|
||||
|
||||
list_shapes_cb->setChecked (m_list_shapes);
|
||||
|
||||
connect (markers_list, SIGNAL (doubleClicked (const QModelIndex &)), this, SLOT (marker_double_clicked (const QModelIndex &)));
|
||||
|
||||
connect (dir_up_pb, SIGNAL (clicked ()), this, SLOT (dir_up_clicked ()));
|
||||
|
|
@ -1519,6 +1523,7 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/)
|
|||
connect (cat_filter, SIGNAL (textEdited (const QString &)), this, SLOT (filter_changed ()));
|
||||
connect (cell_filter, SIGNAL (textEdited (const QString &)), this, SLOT (filter_changed ()));
|
||||
connect (rerun_button, SIGNAL (pressed ()), this, SLOT (rerun_button_pressed ()));
|
||||
connect (list_shapes_cb, SIGNAL (clicked ()), this, SLOT (list_shapes_clicked ()));
|
||||
|
||||
m_show_all_action = new QAction (QObject::tr ("Show All"), this);
|
||||
m_show_all_action->setCheckable (true);
|
||||
|
|
@ -1674,7 +1679,20 @@ MarkerBrowserPage::show_all (bool f)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
MarkerBrowserPage::list_shapes (bool f)
|
||||
{
|
||||
if (f != m_list_shapes) {
|
||||
|
||||
m_list_shapes = f;
|
||||
list_shapes_cb->setChecked (f);
|
||||
|
||||
update_info_text ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MarkerBrowserPage::set_rdb (rdb::Database *database)
|
||||
{
|
||||
if (database != mp_database) {
|
||||
|
|
@ -1975,7 +1993,7 @@ MarkerBrowserPage::update_info_text ()
|
|||
|
||||
for (rdb::Values::const_iterator v = item->values ().begin (); v != item->values ().end (); ++v) {
|
||||
|
||||
if (v->get () != 0) {
|
||||
if (v->get () != 0 && (m_list_shapes || ! v->get ()->is_shape ())) {
|
||||
|
||||
if (v->tag_id () != 0) {
|
||||
const rdb::Tag &tag = mp_database->tags ().tag (v->tag_id ());
|
||||
|
|
@ -2851,7 +2869,15 @@ MarkerBrowserPage::show_all_clicked ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
MarkerBrowserPage::list_shapes_clicked ()
|
||||
{
|
||||
if (mp_plugin_root) {
|
||||
mp_plugin_root->config_set (cfg_rdb_list_shapes, tl::to_string (list_shapes_cb->isChecked ()));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MarkerBrowserPage::unwaive_all ()
|
||||
{
|
||||
if (! mp_database) {
|
||||
|
|
|
|||
|
|
@ -103,6 +103,21 @@ public:
|
|||
*/
|
||||
void show_all (bool f);
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether to list the shapes in the info panel
|
||||
*/
|
||||
bool list_shapes () const
|
||||
{
|
||||
return m_list_shapes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a value indicating whether to list the shapes in the info panel
|
||||
*
|
||||
* If this property is set to false, shapes will not be listed in the info panel.
|
||||
*/
|
||||
void list_shapes (bool f);
|
||||
|
||||
/**
|
||||
* @brief Update the contents
|
||||
*
|
||||
|
|
@ -176,6 +191,7 @@ public slots:
|
|||
void waive ();
|
||||
void unwaive ();
|
||||
void show_all_clicked ();
|
||||
void list_shapes_clicked ();
|
||||
void info_anchor_clicked (const QUrl &link);
|
||||
void filter_changed ();
|
||||
|
||||
|
|
@ -184,6 +200,7 @@ private:
|
|||
bool m_update_needed;
|
||||
rdb::Database *mp_database;
|
||||
bool m_show_all;
|
||||
bool m_list_shapes;
|
||||
QAction *m_show_all_action;
|
||||
lay::LayoutViewBase *mp_view;
|
||||
unsigned int m_cv_index;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,49 @@ template <> RDB_PUBLIC std::string Value<db::DText>::to_display_string () const
|
|||
return to_string ();
|
||||
}
|
||||
|
||||
// is_shape implementations
|
||||
|
||||
template <> RDB_PUBLIC bool Value<double>::is_shape () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<std::string>::is_shape () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DPolygon>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DEdge>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DEdgePair>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DBox>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DPath>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <> RDB_PUBLIC bool Value<db::DText>::is_shape () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ValueBase::compare (const ValueBase *a, const ValueBase *b)
|
||||
{
|
||||
// compare is the intrinsic compare of equal type and type index for different types.
|
||||
|
|
|
|||
|
|
@ -438,6 +438,8 @@ public:
|
|||
|
||||
virtual std::string to_display_string () const = 0;
|
||||
|
||||
virtual bool is_shape () const = 0;
|
||||
|
||||
virtual ValueBase *clone () const = 0;
|
||||
|
||||
virtual int type_index () const = 0;
|
||||
|
|
@ -508,6 +510,8 @@ public:
|
|||
return m_value < static_cast<const Value<C> *> (other)->m_value;
|
||||
}
|
||||
|
||||
bool is_shape () const;
|
||||
|
||||
std::string to_string () const;
|
||||
|
||||
std::string to_display_string () const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue