summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2018-10-06 16:06:06 +0200
committerAleks Kissinger <aleks0@gmail.com>2018-10-06 16:06:06 +0200
commitc0b8dea3d3b93fd4b87e5311b6c6422a7ccdb723 (patch)
tree7bea34c2d86c2d68a6c6d4d9e003c8573dc77449
parent6359b28b155355e0be67961cc21eccdbd2c61cc2 (diff)
removed EdgeStyle and NodeStyle classes
-rw-r--r--src/data/edge.cpp2
-rw-r--r--src/data/edge.h6
-rw-r--r--src/data/edgestyle.cpp137
-rw-r--r--src/data/edgestyle.h56
-rw-r--r--src/data/node.cpp2
-rw-r--r--src/data/node.h6
-rw-r--r--src/data/nodestyle.cpp112
-rw-r--r--src/data/nodestyle.h49
-rw-r--r--src/data/nodestylelist.cpp15
-rw-r--r--src/data/nodestylelist.h12
-rw-r--r--src/data/style.cpp4
-rw-r--r--src/data/style.h5
-rw-r--r--src/data/tikzstyles.cpp26
-rw-r--r--src/data/tikzstyles.h8
-rw-r--r--src/gui/edgeitem.cpp12
-rw-r--r--src/gui/styleeditor.cpp12
-rw-r--r--src/gui/styleeditor.h7
-rw-r--r--src/tikzit.h1
-rw-r--r--tikzit.pro4
19 files changed, 62 insertions, 414 deletions
diff --git a/src/data/edge.cpp b/src/data/edge.cpp
index ca63954..0ae566b 100644
--- a/src/data/edge.cpp
+++ b/src/data/edge.cpp
@@ -401,7 +401,7 @@ void Edge::attachStyle()
else _style = tikzit->styles()->edgeStyle(nm);
}
-EdgeStyle * Edge::style() const
+Style *Edge::style() const
{
return _style;
}
diff --git a/src/data/edge.h b/src/data/edge.h
index 85959bb..ad71364 100644
--- a/src/data/edge.h
+++ b/src/data/edge.h
@@ -21,7 +21,7 @@
#include "graphelementdata.h"
#include "node.h"
-#include "edgestyle.h"
+#include "style.h"
#include <QObject>
#include <QPointF>
@@ -85,7 +85,7 @@ public:
void attachStyle();
QString styleName() const;
void setStyleName(const QString & styleName);
- EdgeStyle *style() const;
+ Style *style() const;
signals:
@@ -105,7 +105,7 @@ private:
Node *_target;
- EdgeStyle *_style;
+ Style *_style;
bool _dirty;
bool _basicBendMode;
diff --git a/src/data/edgestyle.cpp b/src/data/edgestyle.cpp
deleted file mode 100644
index 7897c6f..0000000
--- a/src/data/edgestyle.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- TikZiT - a GUI diagram editor for TikZ
- Copyright (C) 2018 Aleks Kissinger
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include "edgestyle.h"
-
-#include <QPainter>
-#include <QPixmap>
-
-EdgeStyle *noneEdgeStyle = new EdgeStyle("none", new GraphElementData({GraphElementProperty("-")}));
-
-EdgeStyle::EdgeStyle() : Style()
-{
-}
-
-EdgeStyle::EdgeStyle(QString name, GraphElementData *data) : Style(name, data)
-{
-}
-
-//EdgeStyle::ArrowTipStyle EdgeStyle::arrowHead() const
-//{
-// if (_data == 0) return NoTip;
-
-// if (_data->atom("->") || _data->atom("<->") || _data->atom("|->")) return Pointer;
-// if (_data->atom("-|") || _data->atom("<-|") || _data->atom("|-|")) return Flat;
-// return NoTip;
-//}
-
-//EdgeStyle::ArrowTipStyle EdgeStyle::arrowTail() const
-//{
-// if (_data == 0) return NoTip;
-// if (_data->atom("<-") || _data->atom("<->") || _data->atom("<-|")) return Pointer;
-// if (_data->atom("|-") || _data->atom("|->") || _data->atom("|-|")) return Flat;
-// return NoTip;
-//}
-
-//EdgeStyle::DrawStyle EdgeStyle::drawStyle() const
-//{
-// if (_data == 0) return Solid;
-// if (_data->atom("dashed")) return Dashed;
-// if (_data->atom("dotted")) return Dotted;
-// return Solid;
-//}
-
-//QPen EdgeStyle::pen() const
-//{
-// QPen p(strokeColor());
-// p.setWidthF((float)strokeThickness() * 2.0f);
-
-// QVector<qreal> pat;
-// switch (drawStyle()) {
-// case Dashed:
-// pat << 3.0 << 3.0;
-// p.setDashPattern(pat);
-// break;
-// case Dotted:
-// pat << 1.0 << 1.0;
-// p.setDashPattern(pat);
-// break;
-// case Solid:
-// break;
-// }
-
-// return p;
-//}
-
-//QPainterPath EdgeStyle::path() const
-//{
-// return QPainterPath();
-//}
-
-//QPainterPath EdgeStyle::palettePath() const
-//{
-// return QPainterPath();
-//}
-
-//QIcon EdgeStyle::icon() const
-//{
-// // draw an icon matching the style
-// QPixmap px(100,100);
-// px.fill(Qt::transparent);
-// QPainter painter(&px);
-
-// if (_data == 0) {
-// QPen pen(Qt::black);
-// pen.setWidth(3);
-// } else {
-// painter.setPen(pen());
-// }
-
-// painter.drawLine(10, 50, 90, 50);
-
-// QPen pn = pen();
-// pn.setStyle(Qt::SolidLine);
-// painter.setPen(pn);
-
-// switch (arrowHead()) {
-// case Pointer:
-// painter.drawLine(90,50,80,40);
-// painter.drawLine(90,50,80,60);
-// break;
-// case Flat:
-// painter.drawLine(90,40,90,60);
-// break;
-// case NoTip:
-// break;
-// }
-
-// switch (arrowTail()) {
-// case Pointer:
-// painter.drawLine(10,50,20,40);
-// painter.drawLine(10,50,20,60);
-// break;
-// case Flat:
-// painter.drawLine(10,40,10,60);
-// break;
-// case NoTip:
-// break;
-// }
-
-
-// return QIcon(px);
-//}
diff --git a/src/data/edgestyle.h b/src/data/edgestyle.h
deleted file mode 100644
index 0e7b554..0000000
--- a/src/data/edgestyle.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- TikZiT - a GUI diagram editor for TikZ
- Copyright (C) 2018 Aleks Kissinger
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#ifndef EDGESTYLE_H
-#define EDGESTYLE_H
-
-#include "style.h"
-
-#include <QColor>
-#include <QPen>
-#include <QBrush>
-#include <QPainterPath>
-#include <QIcon>
-
-class EdgeStyle : public Style
-{
-public:
- EdgeStyle();
- EdgeStyle(QString name, GraphElementData *data);
-
-// enum ArrowTipStyle {
-// Flat, Pointer, NoTip
-// };
-
-// enum DrawStyle {
-// Solid, Dotted, Dashed
-// };
-
-// ArrowTipStyle arrowHead() const;
-// ArrowTipStyle arrowTail() const;
-// DrawStyle drawStyle() const;
-
-// QPen pen() const override;
-// QPainterPath path() const override;
-// QPainterPath palettePath() const override;
-// QIcon icon() const override;
-};
-
-extern EdgeStyle *noneEdgeStyle;
-
-#endif // EDGESTYLE_H
diff --git a/src/data/node.cpp b/src/data/node.cpp
index a4ee39b..75acd00 100644
--- a/src/data/node.cpp
+++ b/src/data/node.cpp
@@ -102,7 +102,7 @@ void Node::attachStyle()
else _style = tikzit->styles()->nodeStyle(nm);
}
-NodeStyle *Node::style() const
+Style *Node::style() const
{
return _style;
}
diff --git a/src/data/node.h b/src/data/node.h
index 111bf19..490393d 100644
--- a/src/data/node.h
+++ b/src/data/node.h
@@ -20,7 +20,7 @@
#define NODE_H
#include "graphelementdata.h"
-#include "nodestyle.h"
+#include "style.h"
#include <QObject>
#include <QPointF>
@@ -51,7 +51,7 @@ public:
void setStyleName(const QString &styleName);
void attachStyle();
- NodeStyle *style() const;
+ Style *style() const;
bool isBlankNode();
@@ -66,7 +66,7 @@ private:
QPointF _point;
QString _name;
QString _label;
- NodeStyle *_style;
+ Style *_style;
GraphElementData *_data;
int _tikzLine;
};
diff --git a/src/data/nodestyle.cpp b/src/data/nodestyle.cpp
deleted file mode 100644
index b379565..0000000
--- a/src/data/nodestyle.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- TikZiT - a GUI diagram editor for TikZ
- Copyright (C) 2018 Aleks Kissinger
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#include "nodestyle.h"
-#include "tikzit.h"
-
-#include <QPainter>
-#include <QImage>
-
-NodeStyle *noneStyle = new NodeStyle();
-NodeStyle *unknownStyle = new NodeStyle("unknown", new GraphElementData({GraphElementProperty("tikzit fill", "blue")}));
-
-NodeStyle::NodeStyle() : Style()
-{
-}
-
-
-NodeStyle::NodeStyle(QString name, GraphElementData *data): Style(name, data)
-{
-}
-
-//QColor NodeStyle::fillColor(bool tikzitOverride) const
-//{
-// if (_data == 0) return Qt::white;
-
-// QString col = propertyWithDefault("fill", "white", tikzitOverride);
-// return tikzit->colorByName(col);
-//}
-
-//QBrush NodeStyle::brush() const
-//{
-// return QBrush(fillColor());
-//}
-
-//QString NodeStyle::shape(bool tikzitOverride) const
-//{
-// return propertyWithDefault("shape", "circle", tikzitOverride);
-//}
-
-//QPainterPath NodeStyle::path() const
-//{
-// QPainterPath pth;
-// QString sh = shape();
-
-// if (sh == "rectangle") {
-// pth.addRect(-30.0f, -30.0f, 60.0f, 60.0f);
-// } else { // default is 'circle'
-// pth.addEllipse(QPointF(0.0f,0.0f), 30.0f, 30.0f);
-// }
-// return pth;
-//}
-
-//QPainterPath NodeStyle::palettePath() const
-//{
-// return path();
-//}
-
-//QIcon NodeStyle::icon() const
-//{
-// // draw an icon matching the style
-// QImage px(100,100,QImage::Format_ARGB32_Premultiplied);
-// px.fill(Qt::transparent);
-
-
-// QPainter painter(&px);
-// painter.setRenderHint(QPainter::Antialiasing);
-// QPainterPath pth = path();
-// pth.translate(50.0f, 50.0f);
-
-// if (_data == 0) {
-// QColor c(180,180,200);
-// painter.setPen(QPen(c));
-// painter.setBrush(QBrush(c));
-// painter.drawEllipse(QPointF(50.0f,50.0f), 3,3);
-
-// QPen pen(QColor(180,180,220));
-// pen.setWidth(3);
-// QVector<qreal> p;
-// p << 2.0 << 2.0;
-// pen.setDashPattern(p);
-// painter.setPen(pen);
-// painter.setBrush(Qt::NoBrush);
-// painter.drawPath(pth);
-// } else {
-// painter.setPen(pen());
-// painter.setBrush(brush());
-// painter.drawPath(pth);
-// }
-
-// return QIcon(QPixmap::fromImage(px));
-//}
-
-//QString NodeStyle::category()
-//{
-// return propertyWithDefault("tikzit category", "", false);
-//}
-
diff --git a/src/data/nodestyle.h b/src/data/nodestyle.h
deleted file mode 100644
index 36bd5d5..0000000
--- a/src/data/nodestyle.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- TikZiT - a GUI diagram editor for TikZ
- Copyright (C) 2018 Aleks Kissinger
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
-
-#ifndef NODESTYLE_H
-#define NODESTYLE_H
-
-#include "style.h"
-
-#include <QColor>
-#include <QPen>
-#include <QBrush>
-#include <QPainterPath>
-#include <QIcon>
-
-class NodeStyle : public Style
-{
-public:
- NodeStyle();
- NodeStyle(QString name, GraphElementData *data);
-
-// QColor fillColor(bool tikzitOverride=true) const;
-// QBrush brush() const;
-// QPainterPath path() const override;
-// QString shape(bool tikzitOverride=true) const;
-
-// QPainterPath palettePath() const override;
-// QIcon icon() const override;
-
-};
-
-extern NodeStyle *noneStyle;
-extern NodeStyle *unknownStyle;
-
-#endif // NODESTYLE_H
diff --git a/src/data/nodestylelist.cpp b/src/data/nodestylelist.cpp
index 41749db..7f17ff0 100644
--- a/src/data/nodestylelist.cpp
+++ b/src/data/nodestylelist.cpp
@@ -6,14 +6,14 @@ NodeStyleList::NodeStyleList(QObject *parent) : QAbstractListModel(parent)
{
}
-NodeStyle *NodeStyleList::style(QString name)
+Style *NodeStyleList::style(QString name)
{
- foreach (NodeStyle *s, _styles)
+ foreach (Style *s, _styles)
if (s->name() == name) return s;
return nullptr;
}
-NodeStyle *NodeStyleList::style(int i)
+Style *NodeStyleList::style(int i)
{
return _styles[i];
}
@@ -23,8 +23,9 @@ int NodeStyleList::length() const
return _styles.length();
}
-void NodeStyleList::addStyle(NodeStyle *s)
+void NodeStyleList::addStyle(Style *s)
{
+ s->setParent(this);
if (s->category() == _category) {
int n = numInCategory();
beginInsertRows(QModelIndex(), n, n);
@@ -53,7 +54,7 @@ QString NodeStyleList::tikz()
{
QString str;
QTextStream code(&str);
- foreach (NodeStyle *s, _styles) code << s->tikz() << "\n";
+ foreach (Style *s, _styles) code << s->tikz() << "\n";
code.flush();
return str;
}
@@ -61,7 +62,7 @@ QString NodeStyleList::tikz()
int NodeStyleList::numInCategory() const
{
int c = 0;
- foreach (NodeStyle *s, _styles) {
+ foreach (Style *s, _styles) {
if (_category == "" || s->category() == _category) {
++c;
}
@@ -81,7 +82,7 @@ int NodeStyleList::nthInCategory(int n) const
return -1;
}
-NodeStyle *NodeStyleList::styleInCategory(int n) const
+Style *NodeStyleList::styleInCategory(int n) const
{
return _styles[nthInCategory(n)];
}
diff --git a/src/data/nodestylelist.h b/src/data/nodestylelist.h
index 03f7ed5..5a53721 100644
--- a/src/data/nodestylelist.h
+++ b/src/data/nodestylelist.h
@@ -1,7 +1,7 @@
#ifndef NODESTYLELIST_H
#define NODESTYLELIST_H
-#include "nodestyle.h"
+#include "style.h"
#include <QAbstractListModel>
@@ -10,16 +10,16 @@ class NodeStyleList : public QAbstractListModel
Q_OBJECT
public:
explicit NodeStyleList(QObject *parent = nullptr);
- NodeStyle *style(QString name);
- NodeStyle *style(int i);
+ Style *style(QString name);
+ Style *style(int i);
int length() const;
- void addStyle(NodeStyle *s);
+ void addStyle(Style *s);
void clear();
QString tikz();
int numInCategory() const;
int nthInCategory(int n) const;
- NodeStyle *styleInCategory(int n) const;
+ Style *styleInCategory(int n) const;
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &/*parent*/) const override;
@@ -33,7 +33,7 @@ signals:
public slots:
private:
- QVector<NodeStyle*> _styles;
+ QVector<Style*> _styles;
QString _category;
};
diff --git a/src/data/style.cpp b/src/data/style.cpp
index 39314cb..7af95ca 100644
--- a/src/data/style.cpp
+++ b/src/data/style.cpp
@@ -19,6 +19,10 @@
#include "style.h"
#include "tikzit.h"
+Style *noneStyle = new Style("none", new GraphElementData());
+Style *unknownStyle = new Style("unknown", new GraphElementData({GraphElementProperty("tikzit fill", "blue")}));
+Style *noneEdgeStyle = new Style("none", new GraphElementData({GraphElementProperty("-")}));
+
Style::Style() : _name("none")
{
_data = new GraphElementData(this);
diff --git a/src/data/style.h b/src/data/style.h
index ca2e604..476af77 100644
--- a/src/data/style.h
+++ b/src/data/style.h
@@ -73,4 +73,9 @@ protected:
QString _name;
GraphElementData *_data;
};
+
+extern Style *noneStyle;
+extern Style *unknownStyle;
+extern Style *noneEdgeStyle;
+
#endif // STYLE_H
diff --git a/src/data/tikzstyles.cpp b/src/data/tikzstyles.cpp
index e3a735c..0645a72 100644
--- a/src/data/tikzstyles.cpp
+++ b/src/data/tikzstyles.cpp
@@ -17,7 +17,6 @@
*/
#include "tikzstyles.h"
-#include "nodestyle.h"
#include "tikzassembler.h"
#include <QDebug>
@@ -30,16 +29,16 @@ TikzStyles::TikzStyles(QObject *parent) : QObject(parent)
_nodeStyles = new NodeStyleList(this);
}
-NodeStyle *TikzStyles::nodeStyle(QString name) const
+Style *TikzStyles::nodeStyle(QString name) const
{
- NodeStyle *s = _nodeStyles->style(name);
+ Style *s = _nodeStyles->style(name);
return (s == nullptr) ? unknownStyle : s;
}
-EdgeStyle *TikzStyles::edgeStyle(QString name) const
+Style *TikzStyles::edgeStyle(QString name) const
{
- foreach (EdgeStyle *s , _edgeStyles)
+ foreach (Style *s , _edgeStyles)
if (s->name() == name) return s;
return noneEdgeStyle;
}
@@ -99,7 +98,7 @@ void TikzStyles::refreshModels(QStandardItemModel *nodeModel, QStandardItemModel
it->setSizeHint(QSize(48,48));
}
- NodeStyle *ns;
+ Style *ns;
for (int i = 0; i < _nodeStyles->length(); ++i) {
ns = _nodeStyles->style(i);
if (category == "" || category == ns->propertyWithDefault("tikzit category", "", false))
@@ -119,7 +118,7 @@ void TikzStyles::refreshModels(QStandardItemModel *nodeModel, QStandardItemModel
edgeModel->appendRow(it);
}
- foreach(EdgeStyle *es, _edgeStyles) {
+ foreach(Style *es, _edgeStyles) {
//if (category == "" || category == es->propertyWithDefault("tikzit category", "", false))
//{
it = new QStandardItem(es->icon(), es->name());
@@ -134,7 +133,7 @@ QStringList TikzStyles::categories() const
{
QMap<QString,bool> cats; // use a QMap to keep keys sorted
cats.insert("", true);
- NodeStyle *ns;
+ Style *ns;
for (int i = 0; i < _nodeStyles->length(); ++i) {
ns = _nodeStyles->style(i);
cats.insert(ns->propertyWithDefault("tikzit category", "", false), true);
@@ -157,7 +156,7 @@ QString TikzStyles::tikz() const
code << _nodeStyles->tikz();
code << "\n% Edge styles\n";
- foreach (EdgeStyle *s, _edgeStyles) code << s->tikz() << "\n";
+ foreach (Style *s, _edgeStyles) code << s->tikz() << "\n";
code.flush();
return str;
@@ -165,13 +164,12 @@ QString TikzStyles::tikz() const
void TikzStyles::addStyle(QString name, GraphElementData *data)
{
- if (data->atom("-") || data->atom("->") || data->atom("-|") ||
- data->atom("<-") || data->atom("<->") || data->atom("<-|") ||
- data->atom("|-") || data->atom("|->") || data->atom("|-|"))
+ Style *s = new Style(name, data);
+ if (s->isEdgeStyle())
{ // edge style
- _edgeStyles << new EdgeStyle(name, data);
+ _edgeStyles << s;
} else { // node style
- _nodeStyles->addStyle(new NodeStyle(name, data));
+ _nodeStyles->addStyle(new Style(name, data));
}
}
diff --git a/src/data/tikzstyles.h b/src/data/tikzstyles.h
index 68bd9ce..fbb12ff 100644
--- a/src/data/tikzstyles.h
+++ b/src/data/tikzstyles.h
@@ -21,7 +21,7 @@
#include "graphelementdata.h"
#include "nodestylelist.h"
-#include "edgestyle.h"
+#include "style.h"
#include <QObject>
#include <QString>
@@ -35,8 +35,8 @@ public:
explicit TikzStyles(QObject *parent = 0);
void addStyle(QString name, GraphElementData *data);
- NodeStyle *nodeStyle(QString name) const;
- EdgeStyle *edgeStyle(QString name) const;
+ Style *nodeStyle(QString name) const;
+ Style *edgeStyle(QString name) const;
QStringList categories() const;
QString tikz() const;
void clear();
@@ -54,7 +54,7 @@ public slots:
private:
NodeStyleList *_nodeStyles;
- QVector<EdgeStyle*> _edgeStyles;
+ QVector<Style*> _edgeStyles;
QStringList _colNames;
QVector<QColor> _cols;
};
diff --git a/src/gui/edgeitem.cpp b/src/gui/edgeitem.cpp
index 2f5b15c..48f321e 100644
--- a/src/gui/edgeitem.cpp
+++ b/src/gui/edgeitem.cpp
@@ -86,14 +86,14 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
switch (_edge->style()->arrowHead()) {
- case EdgeStyle::Flat:
+ case Style::Flat:
{
painter->drawLine(
toScreen(_edge->head() + hLeft),
toScreen(_edge->head() + hRight));
break;
}
- case EdgeStyle::Pointer:
+ case Style::Pointer:
{
QPainterPath pth;
pth.moveTo(toScreen(_edge->head() + ht + hLeft));
@@ -102,7 +102,7 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
painter->drawPath(pth);
break;
}
- case EdgeStyle::NoTip:
+ case Style::NoTip:
break;
}
@@ -112,14 +112,14 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
//painter->setPen(pen);
switch (_edge->style()->arrowTail()) {
- case EdgeStyle::Flat:
+ case Style::Flat:
{
painter->drawLine(
toScreen(_edge->tail() + tLeft),
toScreen(_edge->tail() + tRight));
break;
}
- case EdgeStyle::Pointer:
+ case Style::Pointer:
{
QPainterPath pth;
pth.moveTo(toScreen(_edge->tail() + tt + tLeft));
@@ -128,7 +128,7 @@ void EdgeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
painter->drawPath(pth);
break;
}
- case EdgeStyle::NoTip:
+ case Style::NoTip:
break;
}
diff --git a/src/gui/styleeditor.cpp b/src/gui/styleeditor.cpp
index f6e3f48..46df095 100644
--- a/src/gui/styleeditor.cpp
+++ b/src/gui/styleeditor.cpp
@@ -368,26 +368,26 @@ void StyleEditor::refreshDisplay()
ui->leftArrow->setEnabled(true);
switch (_activeEdgeStyle->arrowTail()) {
- case EdgeStyle::NoTip:
+ case Style::NoTip:
ui->leftArrow->setCurrentText("");
break;
- case EdgeStyle::Pointer:
+ case Style::Pointer:
ui->leftArrow->setCurrentText("<");
break;
- case EdgeStyle::Flat:
+ case Style::Flat:
ui->leftArrow->setCurrentText("|");
break;
}
ui->rightArrow->setEnabled(true);
switch (_activeEdgeStyle->arrowHead()) {
- case EdgeStyle::NoTip:
+ case Style::NoTip:
ui->rightArrow->setCurrentText("");
break;
- case EdgeStyle::Pointer:
+ case Style::Pointer:
ui->rightArrow->setCurrentText(">");
break;
- case EdgeStyle::Flat:
+ case Style::Flat:
ui->rightArrow->setCurrentText("|");
break;
}
diff --git a/src/gui/styleeditor.h b/src/gui/styleeditor.h
index f5df025..e40facd 100644
--- a/src/gui/styleeditor.h
+++ b/src/gui/styleeditor.h
@@ -1,8 +1,7 @@
#ifndef STYLEEDITOR_H
#define STYLEEDITOR_H
-#include "nodestyle.h"
-#include "edgestyle.h"
+#include "style.h"
#include "tikzstyles.h"
#include <QMainWindow>
@@ -62,8 +61,8 @@ private:
QStandardItemModel *_nodeModel;
QStandardItemModel *_edgeModel;
QStandardItem *_activeItem;
- NodeStyle *_activeNodeStyle;
- EdgeStyle *_activeEdgeStyle;
+ Style *_activeNodeStyle;
+ Style *_activeEdgeStyle;
//QString _activeCategory;
Style *activeStyle();
TikzStyles *_styles;
diff --git a/src/tikzit.h b/src/tikzit.h
index 525696d..6612ff1 100644
--- a/src/tikzit.h
+++ b/src/tikzit.h
@@ -57,7 +57,6 @@
#include "toolpalette.h"
#include "propertypalette.h"
#include "stylepalette.h"
-#include "nodestyle.h"
#include "tikzstyles.h"
#include <QObject>
diff --git a/tikzit.pro b/tikzit.pro
index 79cb6c6..bd25e7d 100644
--- a/tikzit.pro
+++ b/tikzit.pro
@@ -43,7 +43,6 @@ SOURCES += src/gui/mainwindow.cpp \
src/gui/nodeitem.cpp \
src/gui/edgeitem.cpp \
src/tikzit.cpp \
- src/data/nodestyle.cpp \
src/gui/commands.cpp \
src/data/tikzdocument.cpp \
src/gui/undocommands.cpp \
@@ -52,7 +51,6 @@ SOURCES += src/gui/mainwindow.cpp \
src/gui/stylepalette.cpp \
src/data/tikzassembler.cpp \
src/data/tikzstyles.cpp \
- src/data/edgestyle.cpp \
src/data/style.cpp \
src/gui/styleeditor.cpp \
src/data/nodestylelist.cpp
@@ -71,7 +69,6 @@ HEADERS += src/gui/mainwindow.h \
src/gui/nodeitem.h \
src/tikzit.h \
src/gui/edgeitem.h \
- src/data/nodestyle.h \
src/gui/commands.h \
src/data/tikzdocument.h \
src/gui/undocommands.h \
@@ -80,7 +77,6 @@ HEADERS += src/gui/mainwindow.h \
src/gui/stylepalette.h \
src/data/tikzassembler.h \
src/data/tikzstyles.h \
- src/data/edgestyle.h \
src/data/style.h \
src/gui/styleeditor.h \
src/data/nodestylelist.h