clangformat and GraphicElement::style comments

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-07-26 17:14:56 +02:00
parent db7edbf0b3
commit 03f92948d1
6 changed files with 16 additions and 17 deletions

View File

@ -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));

View File

@ -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;

View File

@ -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))

View File

@ -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);

View File

@ -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);

View File

@ -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);
}