Skip to content

Commit 1132b06

Browse files
committed
Merge branch 'master' of github.com:The-OpenROAD-Project-private/OpenROAD into grt-incr-res-aware
2 parents 2f691a3 + 4a6119c commit 1132b06

File tree

19 files changed

+542
-168
lines changed

19 files changed

+542
-168
lines changed

src/OpenRoad.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ void OpenRoad::read3Dbx(const std::string& filename)
495495
{
496496
odb::ThreeDBlox parser(logger_, db_, sta_);
497497
parser.readDbx(filename);
498+
parser.check();
498499
}
499500

500501
void OpenRoad::read3DBloxBMap(const std::string& filename)

src/gui/include/gui/gui.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,58 @@ class Descriptor
397397
int digits = 3);
398398
};
399399

400+
class PropertyTable
401+
{
402+
public:
403+
PropertyTable(int rows, int columns)
404+
{
405+
row_header_.resize(rows);
406+
column_header_.resize(columns);
407+
data_.resize(rows);
408+
for (auto& row : data_) {
409+
row.resize(columns);
410+
}
411+
};
412+
413+
void setRowHeader(int row, const std::string& header)
414+
{
415+
row_header_.at(row) = header;
416+
}
417+
const std::vector<std::string>& getRowHeaders() const { return row_header_; }
418+
419+
void setColumnHeader(int column, const std::string& header)
420+
{
421+
column_header_.at(column) = header;
422+
}
423+
const std::vector<std::string>& getColumnHeaders() const
424+
{
425+
return column_header_;
426+
}
427+
428+
void setData(int row, int column, const std::string& value)
429+
{
430+
data_.at(row).at(column) = value;
431+
}
432+
const std::vector<std::vector<std::string>>& getData() const { return data_; }
433+
434+
bool empty() const
435+
{
436+
for (const auto& row : data_) {
437+
for (const auto& item : row) {
438+
if (!item.empty()) {
439+
return false;
440+
}
441+
}
442+
}
443+
return true;
444+
}
445+
446+
private:
447+
std::vector<std::string> column_header_;
448+
std::vector<std::string> row_header_;
449+
std::vector<std::vector<std::string>> data_;
450+
};
451+
400452
// An object selected in the gui. The object is stored as a
401453
// std::any to allow any client objects to be stored. The descriptor
402454
// is the API for the object as described above. This doesn't

src/gui/src/dbDescriptors.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,32 +2951,28 @@ Descriptor::Properties DbTechLayerDescriptor::getDBProperties(
29512951
if (layer->hasTwoWidthsSpacingRules()) {
29522952
const int widths = layer->getTwoWidthsSpacingTableNumWidths();
29532953

2954-
PropertyList spacing_rules;
2954+
PropertyTable table(widths, widths);
29552955
for (int i = 0; i < widths; i++) {
29562956
const std::string prefix_title = Property::convert_dbu(
29572957
layer->getTwoWidthsSpacingTableWidth(i), true);
29582958
const std::string prl_title
29592959
= layer->getTwoWidthsSpacingTableHasPRL(i)
2960-
? " - PRL "
2960+
? "\nPRL "
29612961
+ Property::convert_dbu(
29622962
layer->getTwoWidthsSpacingTablePRL(i), true)
29632963
: "";
2964-
2964+
table.setRowHeader(i, prefix_title + prl_title);
2965+
table.setColumnHeader(i, prefix_title + prl_title);
29652966
for (int j = 0; j < widths; j++) {
2966-
std::string title = prefix_title;
2967-
title += " - ";
2968-
title += Property::convert_dbu(layer->getTwoWidthsSpacingTableWidth(j),
2969-
true);
2970-
title += prl_title;
2971-
spacing_rules.emplace_back(
2972-
title,
2973-
Property::convert_dbu(layer->getTwoWidthsSpacingTableEntry(i, j),
2974-
true));
2967+
table.setData(i,
2968+
j,
2969+
Property::convert_dbu(
2970+
layer->getTwoWidthsSpacingTableEntry(i, j), true));
29752971
}
29762972
}
29772973

2978-
if (!spacing_rules.empty()) {
2979-
props.push_back({"Two width spacing rules", spacing_rules});
2974+
if (!table.empty()) {
2975+
props.push_back({"Two width spacing rules", table});
29802976
}
29812977
}
29822978

src/gui/src/inspector.cpp

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
#include <QLineEdit>
1212
#include <QMenu>
1313
#include <QMessageBox>
14+
#include <QPainter>
1415
#include <QPushButton>
1516
#include <QString>
17+
#include <QStyleOptionViewItem>
18+
#include <QTextDocument>
1619
#include <QVariant>
1720
#include <QWidget>
1821
#include <algorithm>
@@ -134,6 +137,8 @@ void SelectedItemModel::makePropertyItem(const Descriptor::Property& property,
134137
// as children rows
135138
if (auto sel_set = std::any_cast<Descriptor::PropertyList>(&value)) {
136139
value_item = makePropertyList(name_item, sel_set->begin(), sel_set->end());
140+
} else if (auto sel_set = std::any_cast<PropertyTable>(&value)) {
141+
value_item = makePropertyTable(name_item, *sel_set);
137142
} else if (auto sel_set = std::any_cast<SelectionSet>(&value)) {
138143
value_item = makeList(name_item, sel_set->begin(), sel_set->end());
139144
} else if (auto v_list = std::any_cast<std::vector<std::any>>(&value)) {
@@ -189,9 +194,7 @@ QStandardItem* SelectedItemModel::makeList(QStandardItem* name_item,
189194
name_item->appendRow({index_item, selected_item});
190195
}
191196

192-
QString items = QString::number(index) + " items";
193-
194-
return makeItem(items);
197+
return makeItem(QString::number(index) + " items");
195198
}
196199

197200
template <typename Iterator>
@@ -204,9 +207,50 @@ QStandardItem* SelectedItemModel::makePropertyList(QStandardItem* name_item,
204207
name_item->appendRow({makeItem(name, true), makeItem(value)});
205208
}
206209

207-
QString items = QString::number(name_item->rowCount()) + " items";
210+
return makeItem(QString::number(name_item->rowCount()) + " items");
211+
}
212+
213+
QStandardItem* SelectedItemModel::makePropertyTable(QStandardItem* name_item,
214+
const PropertyTable& table)
215+
{
216+
const int rows = table.getData().size();
217+
const int columns = table.getColumnHeaders().size();
218+
219+
QStandardItem* table_item = makeItem(QString());
220+
221+
QString html;
222+
html += "<style>th, td {padding: 2px; border: 1px solid black; text-align: center; vertical-align: middle;}</style>";
223+
html += "<table>";
224+
// setup column headers
225+
html += "<tr><th />";
226+
for (int col = 0; col < columns; col++) {
227+
html += "<th>";
228+
html += QString::fromStdString(table.getColumnHeaders().at(col))
229+
.replace("\n", "<br>");
230+
html += "</th>";
231+
}
232+
html += "</tr>";
233+
// add rows
234+
for (int row = 0; row < rows; row++) {
235+
html += "<tr>";
236+
html += "<th>";
237+
html += QString::fromStdString(table.getRowHeaders().at(row))
238+
.replace("\n", "<br>");
239+
html += "</th>";
240+
for (int col = 0; col < columns; col++) {
241+
html += "<td>";
242+
html += QString::fromStdString(table.getData().at(row).at(col))
243+
.replace("\n", "<br>");
244+
html += "</td>";
245+
}
246+
html += "</tr>";
247+
}
248+
html += "</table>";
249+
table_item->setData(html, EditorItemDelegate::kHtml);
250+
251+
name_item->appendRow({nullptr, table_item});
208252

209-
return makeItem(items);
253+
return makeItem(QString::number(rows * columns) + " items");
210254
}
211255

212256
void SelectedItemModel::makeItemEditor(const std::string& name,
@@ -240,7 +284,7 @@ void SelectedItemModel::makeItemEditor(const std::string& name,
240284

241285
EditorItemDelegate::EditorItemDelegate(SelectedItemModel* model,
242286
QObject* parent)
243-
: QItemDelegate(parent),
287+
: QStyledItemDelegate(parent),
244288
model_(model),
245289
background_(model->getEditableColor())
246290
{
@@ -383,6 +427,51 @@ EditorItemDelegate::EditType EditorItemDelegate::getEditorType(
383427
return EditorItemDelegate::kString;
384428
}
385429

430+
void EditorItemDelegate::paint(QPainter* painter,
431+
const QStyleOptionViewItem& option,
432+
const QModelIndex& index) const
433+
{
434+
if (index.model()->data(index, kHtml).toString().isEmpty()) {
435+
QStyledItemDelegate::paint(painter, option, index);
436+
return;
437+
}
438+
439+
QStyleOptionViewItem options(option);
440+
initStyleOption(&options, index);
441+
442+
painter->save();
443+
444+
QTextDocument doc;
445+
doc.setHtml(index.model()->data(index, kHtml).toString());
446+
447+
/* Call this to get the focus rect and selection background. */
448+
options.text = "";
449+
options.widget->style()->drawControl(
450+
QStyle::CE_ItemViewItem, &options, painter);
451+
452+
/* Draw using text document. */
453+
painter->translate(options.rect.left(), options.rect.top());
454+
const QRectF clip(0, 0, options.rect.width(), options.rect.height());
455+
doc.drawContents(painter, clip);
456+
457+
painter->restore();
458+
}
459+
460+
QSize EditorItemDelegate::sizeHint(const QStyleOptionViewItem& option,
461+
const QModelIndex& index) const
462+
{
463+
if (index.model()->data(index, kHtml).toString().isEmpty()) {
464+
return QStyledItemDelegate::sizeHint(option, index);
465+
}
466+
QStyleOptionViewItem options(option);
467+
initStyleOption(&options, index);
468+
469+
QTextDocument doc;
470+
doc.setHtml(index.model()->data(index, kHtml).toString());
471+
doc.setTextWidth(options.rect.width());
472+
return QSize(doc.idealWidth(), doc.size().height());
473+
}
474+
386475
////////
387476

388477
ActionLayout::ActionLayout(QWidget* parent) : QLayout(parent)

src/gui/src/inspector.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
#include <QColor>
77
#include <QDockWidget>
8-
#include <QItemDelegate>
98
#include <QLabel>
109
#include <QMenu>
1110
#include <QPushButton>
1211
#include <QStandardItemModel>
1312
#include <QString>
13+
#include <QStyledItemDelegate>
1414
#include <QTimer>
1515
#include <QTreeView>
1616
#include <QVBoxLayout>
@@ -27,7 +27,7 @@
2727
namespace gui {
2828
class SelectedItemModel;
2929

30-
class EditorItemDelegate : public QItemDelegate
30+
class EditorItemDelegate : public QStyledItemDelegate
3131
{
3232
Q_OBJECT
3333

@@ -38,6 +38,7 @@ class EditorItemDelegate : public QItemDelegate
3838
static const int kEditorType = Qt::UserRole + 2;
3939
static const int kEditorSelect = Qt::UserRole + 3;
4040
static const int kSelected = Qt::UserRole + 4;
41+
static const int kHtml = Qt::UserRole + 5;
4142

4243
enum EditType
4344
{
@@ -60,6 +61,13 @@ class EditorItemDelegate : public QItemDelegate
6061

6162
static EditType getEditorType(const std::any& value);
6263

64+
protected:
65+
void paint(QPainter* painter,
66+
const QStyleOptionViewItem& option,
67+
const QModelIndex& index) const override;
68+
QSize sizeHint(const QStyleOptionViewItem& option,
69+
const QModelIndex& index) const override;
70+
6371
private:
6472
SelectedItemModel* model_;
6573
const QColor background_;
@@ -102,6 +110,8 @@ class SelectedItemModel : public QStandardItemModel
102110
QStandardItem* makePropertyList(QStandardItem* name_item,
103111
const Iterator& begin,
104112
const Iterator& end);
113+
QStandardItem* makePropertyTable(QStandardItem* name_item,
114+
const PropertyTable& table);
105115

106116
void makeItemEditor(const std::string& name,
107117
QStandardItem* item,

src/odb/include/odb/db.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7247,12 +7247,6 @@ class dbChipInst : public dbObject
72477247
public:
72487248
std::string getName() const;
72497249

7250-
void setLoc(const Point3D& loc);
7251-
7252-
Point3D getLoc() const;
7253-
7254-
void setOrient(dbOrientType3D orient);
7255-
72567250
dbOrientType3D getOrient() const;
72577251

72587252
dbChip* getMasterChip() const;
@@ -7263,6 +7257,12 @@ class dbChipInst : public dbObject
72637257

72647258
dbTransform getTransform() const;
72657259

7260+
void setOrient(dbOrientType3D orient);
7261+
7262+
void setLoc(const Point3D& loc);
7263+
7264+
Point3D getLoc() const;
7265+
72667266
Rect getBBox() const;
72677267

72687268
Cuboid getCuboid() const;

0 commit comments

Comments
 (0)