Changes to cover issues from code review
This commit is contained in:
parent
3758029227
commit
02edd66ae9
@ -289,7 +289,7 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
std::lock_guard<std::mutex> lock(ctx->mutex);
|
std::lock_guard<std::mutex> lock(ctx->mutex);
|
||||||
|
|
||||||
{
|
{
|
||||||
std::map<std::pair<int, int>, std::vector<BelId>> belMap;
|
TreeModel::ElementXYRoot<BelId>::ElementMap belMap;
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto loc = ctx->getBelLocation(bel);
|
auto loc = ctx->getBelLocation(bel);
|
||||||
belMap[std::pair<int, int>(loc.x, loc.y)].push_back(bel);
|
belMap[std::pair<int, int>(loc.x, loc.y)].push_back(bel);
|
||||||
@ -303,7 +303,7 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
|
|
||||||
#ifdef ARCH_ICE40
|
#ifdef ARCH_ICE40
|
||||||
{
|
{
|
||||||
std::map<std::pair<int, int>, std::vector<WireId>> wireMap;
|
TreeModel::ElementXYRoot<WireId>::ElementMap wireMap;
|
||||||
for (int i = 0; i < ctx->chip_info->num_wires; i++) {
|
for (int i = 0; i < ctx->chip_info->num_wires; i++) {
|
||||||
const auto wire = &ctx->chip_info->wire_data[i];
|
const auto wire = &ctx->chip_info->wire_data[i];
|
||||||
WireId wireid;
|
WireId wireid;
|
||||||
@ -317,7 +317,7 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::map<std::pair<int, int>, std::vector<PipId>> pipMap;
|
TreeModel::ElementXYRoot<PipId>::ElementMap pipMap;
|
||||||
for (int i = 0; i < ctx->chip_info->num_pips; i++) {
|
for (int i = 0; i < ctx->chip_info->num_pips; i++) {
|
||||||
const auto pip = &ctx->chip_info->pip_data[i];
|
const auto pip = &ctx->chip_info->pip_data[i];
|
||||||
PipId pipid;
|
PipId pipid;
|
||||||
@ -453,6 +453,8 @@ int DesignWidget::getIndexByElementType(ElementType type)
|
|||||||
return 3;
|
return 3;
|
||||||
if (type == ElementType::CELL)
|
if (type == ElementType::CELL)
|
||||||
return 4;
|
return 4;
|
||||||
|
if (type == ElementType::GROUP)
|
||||||
|
return 5;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
void DesignWidget::addProperty(QtProperty *topItem, int propertyType, const QString &name, QVariant value,
|
void DesignWidget::addProperty(QtProperty *topItem, int propertyType, const QString &name, QVariant value,
|
||||||
@ -473,6 +475,12 @@ QtProperty *DesignWidget::addSubGroup(QtProperty *topItem, const QString &name)
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesignWidget::clearAllSelectionModels()
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= getIndexByElementType(ElementType::GROUP); i++)
|
||||||
|
selectionModel[i]->clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
void DesignWidget::onClickedBel(BelId bel, bool keep)
|
void DesignWidget::onClickedBel(BelId bel, bool keep)
|
||||||
{
|
{
|
||||||
boost::optional<TreeModel::Item *> item;
|
boost::optional<TreeModel::Item *> item;
|
||||||
@ -488,10 +496,7 @@ void DesignWidget::onClickedBel(BelId bel, bool keep)
|
|||||||
}
|
}
|
||||||
int index = getIndexByElementType(ElementType::BEL);
|
int index = getIndexByElementType(ElementType::BEL);
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{
|
clearAllSelectionModels();
|
||||||
for(int i=0;i<6;i++)
|
|
||||||
selectionModel[i]->clearSelection();
|
|
||||||
}
|
|
||||||
if (tabWidget->currentIndex() != index) {
|
if (tabWidget->currentIndex() != index) {
|
||||||
tabWidget->setCurrentIndex(index);
|
tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
@ -514,10 +519,7 @@ void DesignWidget::onClickedWire(WireId wire, bool keep)
|
|||||||
}
|
}
|
||||||
int index = getIndexByElementType(ElementType::WIRE);
|
int index = getIndexByElementType(ElementType::WIRE);
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{
|
clearAllSelectionModels();
|
||||||
for(int i=0;i<6;i++)
|
|
||||||
selectionModel[i]->clearSelection();
|
|
||||||
}
|
|
||||||
if (tabWidget->currentIndex() != index)
|
if (tabWidget->currentIndex() != index)
|
||||||
tabWidget->setCurrentIndex(index);
|
tabWidget->setCurrentIndex(index);
|
||||||
selectionModel[index]->setCurrentIndex(getTreeByElementType(ElementType::WIRE)->indexFromNode(*item),
|
selectionModel[index]->setCurrentIndex(getTreeByElementType(ElementType::WIRE)->indexFromNode(*item),
|
||||||
@ -540,10 +542,7 @@ void DesignWidget::onClickedPip(PipId pip, bool keep)
|
|||||||
|
|
||||||
int index = getIndexByElementType(ElementType::PIP);
|
int index = getIndexByElementType(ElementType::PIP);
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{
|
clearAllSelectionModels();
|
||||||
for(int i=0;i<6;i++)
|
|
||||||
selectionModel[i]->clearSelection();
|
|
||||||
}
|
|
||||||
if (tabWidget->currentIndex() != index)
|
if (tabWidget->currentIndex() != index)
|
||||||
tabWidget->setCurrentIndex(index);
|
tabWidget->setCurrentIndex(index);
|
||||||
selectionModel[index]->setCurrentIndex(getTreeByElementType(ElementType::PIP)->indexFromNode(*item),
|
selectionModel[index]->setCurrentIndex(getTreeByElementType(ElementType::PIP)->indexFromNode(*item),
|
||||||
@ -554,7 +553,7 @@ void DesignWidget::onSelectionChanged(int num, const QItemSelection &, const QIt
|
|||||||
{
|
{
|
||||||
int num_selected = 0;
|
int num_selected = 0;
|
||||||
std::vector<DecalXY> decals;
|
std::vector<DecalXY> decals;
|
||||||
for(int i=0;i<6;i++) {
|
for (int i = 0; i <= getIndexByElementType(ElementType::GROUP); i++) {
|
||||||
num_selected += selectionModel[i]->selectedIndexes().size();
|
num_selected += selectionModel[i]->selectedIndexes().size();
|
||||||
for (auto index : selectionModel[i]->selectedIndexes()) {
|
for (auto index : selectionModel[i]->selectedIndexes()) {
|
||||||
TreeModel::Item *item = treeModel[i]->nodeFromIndex(index);
|
TreeModel::Item *item = treeModel[i]->nodeFromIndex(index);
|
||||||
@ -931,7 +930,7 @@ void DesignWidget::prepareMenuTree(int num, const QPoint &pos)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QList<TreeModel::Item *> items;
|
QList<TreeModel::Item *> items;
|
||||||
for(int i=0;i<6;i++) {
|
for (int i = 0; i <= getIndexByElementType(ElementType::GROUP); i++) {
|
||||||
for (auto index : selectionModel[i]->selectedIndexes()) {
|
for (auto index : selectionModel[i]->selectedIndexes()) {
|
||||||
TreeModel::Item *item = treeModel[i]->nodeFromIndex(index);
|
TreeModel::Item *item = treeModel[i]->nodeFromIndex(index);
|
||||||
items.append(item);
|
items.append(item);
|
||||||
@ -969,8 +968,7 @@ void DesignWidget::onItemDoubleClicked(QTreeWidgetItem *item, int column)
|
|||||||
auto it = getTreeByElementType(type)->nodeForId(ctx->id(selectedProperty->valueText().toStdString()));
|
auto it = getTreeByElementType(type)->nodeForId(ctx->id(selectedProperty->valueText().toStdString()));
|
||||||
if (it) {
|
if (it) {
|
||||||
int num = getIndexByElementType(type);
|
int num = getIndexByElementType(type);
|
||||||
for(int i=0;i<6;i++)
|
clearAllSelectionModels();
|
||||||
selectionModel[i]->clearSelection();
|
|
||||||
if (tabWidget->currentIndex() != num)
|
if (tabWidget->currentIndex() != num)
|
||||||
tabWidget->setCurrentIndex(num);
|
tabWidget->setCurrentIndex(num);
|
||||||
selectionModel[num]->setCurrentIndex(getTreeByElementType(type)->indexFromNode(*it),
|
selectionModel[num]->setCurrentIndex(getTreeByElementType(type)->indexFromNode(*it),
|
||||||
|
@ -73,6 +73,7 @@ class DesignWidget : public QWidget
|
|||||||
void addToHistory(int tab, QModelIndex item);
|
void addToHistory(int tab, QModelIndex item);
|
||||||
std::vector<DecalXY> getDecals(ElementType type, IdString value);
|
std::vector<DecalXY> getDecals(ElementType type, IdString value);
|
||||||
void updateHighlightGroup(QList<TreeModel::Item *> item, int group);
|
void updateHighlightGroup(QList<TreeModel::Item *> item, int group);
|
||||||
|
void clearAllSelectionModels();
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void selected(std::vector<DecalXY> decal, bool keep);
|
void selected(std::vector<DecalXY> decal, bool keep);
|
||||||
void highlight(std::vector<DecalXY> decal, int group);
|
void highlight(std::vector<DecalXY> decal, int group);
|
||||||
|
Loading…
Reference in New Issue
Block a user