diff --git a/bba/main.cc b/bba/main.cc index d236dd01..dd0caf1a 100644 --- a/bba/main.cc +++ b/bba/main.cc @@ -183,7 +183,7 @@ int main(int argc, char **argv) const char *value = skipWhitespace(strtok(nullptr, "\r\n")); char terminator[2] = {*value, 0}; assert(terminator[0] != 0); - value = strtok((char*)value+1, terminator); + value = strtok((char *)value + 1, terminator); const char *comment = skipWhitespace(strtok(nullptr, "\r\n")); std::string label = std::string("str:") + value; Stream &s = streams.at(streamStack.back()); @@ -401,7 +401,7 @@ int main(int argc, char **argv) cursor = 1; } if (d < 32 || d >= 127) { - if (i+1 < int(data.size()) && (data[i+1] < '0' || '9' < data[i+1])) + if (i + 1 < int(data.size()) && (data[i + 1] < '0' || '9' < data[i + 1])) cursor += fprintf(fileOut, "\\%o", int(d)); else cursor += fprintf(fileOut, "\\%03o", int(d)); diff --git a/common/nextpnr.h b/common/nextpnr.h index 1cce21c0..e9e491f4 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -155,10 +155,10 @@ struct GraphicElement enum style_t { - G_FRAME, - G_HIDDEN, - G_INACTIVE, - G_ACTIVE, + G_FRAME, // Static "frame". Contrast between G_INACTIVE and G_ACTIVE + G_HIDDEN, // Only display when object is selected or highlighted + G_INACTIVE, // Render using low-contrast color + G_ACTIVE, // Render using high-contast color } style = G_FRAME; float x1 = 0, y1 = 0, x2 = 0, y2 = 0, z = 0; diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 4086fd63..2bba8532 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -777,18 +777,16 @@ std::vector DesignWidget::getDecals(ElementType type, IdString value) return decals; } -void DesignWidget::updateHighlightGroup(QList items, int group) +void DesignWidget::updateHighlightGroup(QList items, int group) { const bool shouldClear = items.size() == 1; for (auto item : items) { if (highlightSelected.contains(item)) { if (shouldClear && highlightSelected[item] == group) { highlightSelected.remove(item); - } - else + } else highlightSelected[item] = group; - } - else + } else highlightSelected.insert(item, group); } std::vector decals[8]; @@ -799,14 +797,14 @@ void DesignWidget::updateHighlightGroup(QList items, int group std::vector d = getDecals(type, value); std::move(d.begin(), d.end(), std::back_inserter(decals[it.second])); } - for (int i=0;i<8;i++) + for (int i = 0; i < 8; i++) Q_EMIT highlight(decals[i], i); } void DesignWidget::prepareMenuProperty(const QPoint &pos) { QTreeWidget *tree = propertyEditor->treeWidget(); - QList items; + QList items; for (auto itemContextMenu : tree->selectedItems()) { QtBrowserItem *browserItem = propertyEditor->itemToBrowserItem(itemContextMenu); if (!browserItem) @@ -848,7 +846,7 @@ void DesignWidget::prepareMenuTree(const QPoint &pos) if (treeWidget->selectedItems().size() == 0) return; int selectedIndex = -1; - QList items = treeWidget->selectedItems(); + QList items = treeWidget->selectedItems(); if (treeWidget->selectedItems().size() == 1) { QTreeWidgetItem *item = treeWidget->selectedItems().at(0); if (highlightSelected.contains(item)) diff --git a/gui/designwidget.h b/gui/designwidget.h index fe340237..6d4b7fe1 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -60,7 +60,7 @@ class DesignWidget : public QWidget void updateButtons(); void addToHistory(QTreeWidgetItem *item); std::vector getDecals(ElementType type, IdString value); - void updateHighlightGroup(QList item, int group); + void updateHighlightGroup(QList item, int group); Q_SIGNALS: void info(std::string text); void selected(std::vector decal); diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 636d5672..36d4a3f2 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -296,6 +296,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions void zoom_out(); void zoom_selected(); void zoom_outbound(); + private: void renderLines(void); void zoom(int level); diff --git a/ice40/arch.cc b/ice40/arch.cc index 55252f2c..d08463d2 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -745,9 +745,9 @@ std::vector Arch::getDecalGraphics(DecalId decal) const el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1; el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2; el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + - (4*chip_info->bel_data[bel.index].z) * logic_cell_pitch; + (4 * chip_info->bel_data[bel.index].z) * logic_cell_pitch; el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + - (4*chip_info->bel_data[bel.index].z + 3) * logic_cell_pitch; + (4 * chip_info->bel_data[bel.index].z + 3) * logic_cell_pitch; ret.push_back(el); }