aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-07-26 17:14:56 +0200
committerClifford Wolf <clifford@clifford.at>2018-07-26 17:14:56 +0200
commit03f92948d1504c32049da065c0e73e01f96d8033 (patch)
treee519616846f5e8079ba8d75aeadc3f516817311b
parentdb7edbf0b3bbbf96d46dc082d5c82dd5ebbf460f (diff)
downloadnextpnr-03f92948d1504c32049da065c0e73e01f96d8033.tar.gz
nextpnr-03f92948d1504c32049da065c0e73e01f96d8033.tar.bz2
nextpnr-03f92948d1504c32049da065c0e73e01f96d8033.zip
clangformat and GraphicElement::style comments
Signed-off-by: Clifford Wolf <clifford@clifford.at>
-rw-r--r--bba/main.cc4
-rw-r--r--common/nextpnr.h8
-rw-r--r--gui/designwidget.cc14
-rw-r--r--gui/designwidget.h2
-rw-r--r--gui/fpgaviewwidget.h1
-rw-r--r--ice40/arch.cc4
6 files changed, 16 insertions, 17 deletions
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<DecalXY> DesignWidget::getDecals(ElementType type, IdString value)
return decals;
}
-void DesignWidget::updateHighlightGroup(QList<QTreeWidgetItem*> items, int group)
+void DesignWidget::updateHighlightGroup(QList<QTreeWidgetItem *> 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<DecalXY> decals[8];
@@ -799,14 +797,14 @@ void DesignWidget::updateHighlightGroup(QList<QTreeWidgetItem*> items, int group
std::vector<DecalXY> 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<QTreeWidgetItem*> items;
+ QList<QTreeWidgetItem *> 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<QTreeWidgetItem*> items = treeWidget->selectedItems();
+ QList<QTreeWidgetItem *> 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<DecalXY> getDecals(ElementType type, IdString value);
- void updateHighlightGroup(QList<QTreeWidgetItem*> item, int group);
+ void updateHighlightGroup(QList<QTreeWidgetItem *> item, int group);
Q_SIGNALS:
void info(std::string text);
void selected(std::vector<DecalXY> 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<GraphicElement> 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);
}