mirror of https://github.com/KLayout/klayout.git
Displaying meta info in user properties dialog box for information
Copy of meta info from cell to other layout now preserves names. In addition two bugs have been fixed: * Display of meta info for layout on statistics page did not show description * ghost cell status now is copied on cell copy
This commit is contained in:
parent
9690c5d1bc
commit
7bdc8efc81
|
|
@ -1307,7 +1307,16 @@ cell_index_type
|
|||
Layout::add_cell (const db::Layout &other, db::cell_index_type ci)
|
||||
{
|
||||
cell_index_type ci_new = add_cell (other.cell_name (ci));
|
||||
add_meta_info (ci_new, other.begin_meta (ci), other.end_meta (ci));
|
||||
cell (ci_new).set_ghost_cell (other.cell (ci).is_ghost_cell ());
|
||||
|
||||
if (&other == this) {
|
||||
add_meta_info (ci_new, other.begin_meta (ci), other.end_meta (ci));
|
||||
} else {
|
||||
for (auto m = other.begin_meta (ci); m != other.end_meta (ci); ++m) {
|
||||
add_meta_info (ci_new, meta_info_name_id (other.meta_info_name (m->first)), m->second);
|
||||
}
|
||||
}
|
||||
|
||||
return ci_new;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="mode_tab">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
|
@ -186,6 +186,48 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Meta Info</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Meta Info is additional system data shown here for information. Entries marked with a "*" are persisted in the layout file.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="meta_info_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>Description</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
|
|
@ -1186,8 +1186,32 @@ UserPropertiesForm::set_properties (const db::PropertiesRepository::properties_s
|
|||
mp_ui->text_edit->setPlainText (tl::to_qstring (text));
|
||||
}
|
||||
|
||||
void
|
||||
UserPropertiesForm::set_meta_info (db::Layout::meta_info_iterator begin_meta, db::Layout::meta_info_iterator end_meta, const db::Layout &layout)
|
||||
{
|
||||
m_begin_meta = begin_meta;
|
||||
m_end_meta = end_meta;
|
||||
|
||||
mp_ui->mode_tab->setTabVisible (2, m_begin_meta != m_end_meta);
|
||||
|
||||
mp_ui->meta_info_list->clear ();
|
||||
|
||||
for (auto m = m_begin_meta; m != m_end_meta; ++m) {
|
||||
QTreeWidgetItem *entry = new QTreeWidgetItem (mp_ui->meta_info_list);
|
||||
entry->setText (0, tl::to_qstring ((m->second.persisted ? "*" : "") + layout.meta_info_name (m->first)));
|
||||
entry->setText (1, tl::to_qstring (m->second.description));
|
||||
entry->setText (2, tl::to_qstring (m->second.value.to_parsable_string ()));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
UserPropertiesForm::show (LayoutViewBase *view, unsigned int cv_index, db::properties_id_type &prop_id)
|
||||
{
|
||||
return show (view, cv_index, prop_id, db::Layout::meta_info_iterator (), db::Layout::meta_info_iterator ());
|
||||
}
|
||||
|
||||
bool
|
||||
UserPropertiesForm::show (LayoutViewBase *view, unsigned int cv_index, db::properties_id_type &prop_id, db::Layout::meta_info_iterator begin_meta, db::Layout::meta_info_iterator end_meta)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
|
@ -1209,6 +1233,8 @@ BEGIN_PROTECTED
|
|||
const db::PropertiesRepository::properties_set &props = mp_prep->properties (prop_id);
|
||||
set_properties (props);
|
||||
|
||||
set_meta_info (begin_meta, end_meta, cv->layout ());
|
||||
|
||||
if (exec ()) {
|
||||
|
||||
if (m_editable) {
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@
|
|||
#ifndef HDR_layDialogs
|
||||
#define HDR_layDialogs
|
||||
|
||||
#include "dbPoint.h"
|
||||
#include "dbVector.h"
|
||||
#include "dbTypes.h"
|
||||
#include "dbPropertiesRepository.h"
|
||||
#include "dbLayout.h"
|
||||
#include "layuiCommon.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
|
@ -36,12 +33,6 @@
|
|||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace db
|
||||
{
|
||||
class Layout;
|
||||
struct LayerProperties;
|
||||
}
|
||||
|
||||
namespace lay
|
||||
{
|
||||
class GenericSyntaxHighlighterAttributes;
|
||||
|
|
@ -431,6 +422,7 @@ public:
|
|||
virtual ~UserPropertiesForm ();
|
||||
|
||||
bool show (lay::LayoutViewBase *view, unsigned int cv_index, db::properties_id_type &prop_id);
|
||||
bool show (lay::LayoutViewBase *view, unsigned int cv_index, db::properties_id_type &prop_id, db::Layout::meta_info_iterator begin_meta, db::Layout::meta_info_iterator end_meta);
|
||||
|
||||
public slots:
|
||||
void add ();
|
||||
|
|
@ -442,11 +434,13 @@ public slots:
|
|||
private:
|
||||
db::PropertiesRepository::properties_set get_properties (int tab);
|
||||
void set_properties (const db::PropertiesRepository::properties_set &props);
|
||||
void set_meta_info (db::Layout::meta_info_iterator begin_meta, db::Layout::meta_info_iterator end_meta, const db::Layout &layout);
|
||||
void accept ();
|
||||
|
||||
bool m_editable;
|
||||
db::PropertiesRepository *mp_prep;
|
||||
Ui::UserPropertiesForm *mp_ui;
|
||||
db::Layout::meta_info_iterator m_begin_meta, m_end_meta;
|
||||
std::unique_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ LayoutPropertiesForm::prop_pb_clicked ()
|
|||
db::properties_id_type prop_id = layout.prop_id ();
|
||||
|
||||
lay::UserPropertiesForm props_form (this);
|
||||
if (props_form.show (mp_view, m_index, prop_id)) {
|
||||
if (props_form.show (mp_view, m_index, prop_id, layout.begin_meta (), layout.end_meta ())) {
|
||||
|
||||
mp_view->manager ()->transaction (tl::to_string (QObject::tr ("Edit layout's user properties")));
|
||||
layout.prop_id (prop_id);
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ StatisticsSource::get (const std::string &url)
|
|||
<< "</tr>" << std::endl;
|
||||
for (db::Layout::meta_info_iterator meta = layout.begin_meta (); meta != layout.end_meta (); ++meta) {
|
||||
std::string d = meta->second.description;
|
||||
if (!d.empty ()) {
|
||||
if (d.empty ()) {
|
||||
d = layout.meta_info_name (meta->first);
|
||||
}
|
||||
os << "<tr><td>" << tl::escaped_to_html (d, true) << "</td><td>" << tl::escaped_to_html (meta->second.value.to_string (), true) << "</td></tr>" << std::endl;
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ LayoutViewFunctions::cm_cell_user_properties ()
|
|||
db::properties_id_type prop_id = cell.prop_id ();
|
||||
|
||||
lay::UserPropertiesForm props_form (parent_widget ());
|
||||
if (props_form.show (view (), cv_index, prop_id)) {
|
||||
if (props_form.show (view (), cv_index, prop_id, layout.begin_meta (cell.cell_index ()), layout.end_meta (cell.cell_index ()))) {
|
||||
|
||||
view ()->transaction (tl::to_string (tr ("Edit cell's user properties")));
|
||||
cell.prop_id (prop_id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue