From 31a78ae551b781eccc47546a2f6d4bf121af24cf Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Thu, 2 Aug 2018 17:44:37 +0200 Subject: started style editor --- src/data/nodestyle.cpp | 8 +- src/data/nodestyle.h | 4 +- src/data/style.cpp | 15 +- src/data/style.h | 4 +- src/data/tikzstyles.cpp | 83 ++++++ src/data/tikzstyles.h | 10 + src/gui/mainwindow.ui | 6 + src/gui/styleeditor.cpp | 230 +++++++++++++++ src/gui/styleeditor.h | 41 +++ src/gui/styleeditor.ui | 752 +++++++++++++++++++++++++++++++++++++++++++++++ src/gui/stylepalette.cpp | 33 +-- src/gui/stylepalette.h | 1 + src/gui/stylepalette.ui | 18 +- src/main.cpp | 6 + src/tikzit.cpp | 7 + src/tikzit.h | 4 +- src/util.cpp | 1 + src/util.h | 1 + 18 files changed, 1181 insertions(+), 43 deletions(-) create mode 100644 src/gui/styleeditor.cpp create mode 100644 src/gui/styleeditor.h create mode 100644 src/gui/styleeditor.ui (limited to 'src') diff --git a/src/data/nodestyle.cpp b/src/data/nodestyle.cpp index ae9f0f7..928712d 100644 --- a/src/data/nodestyle.cpp +++ b/src/data/nodestyle.cpp @@ -30,11 +30,11 @@ NodeStyle::NodeStyle(QString name, GraphElementData *data): Style(name, data) { } -QColor NodeStyle::fillColor() const +QColor NodeStyle::fillColor(bool tikzitOverride) const { if (_data == 0) return Qt::white; - QString col = propertyWithDefault("fill", "white"); + QString col = propertyWithDefault("fill", "white", tikzitOverride); QColor namedColor(col); if (namedColor.isValid()) { @@ -50,11 +50,11 @@ QBrush NodeStyle::brush() const return QBrush(fillColor()); } -NodeStyle::Shape NodeStyle::shape() const +NodeStyle::Shape NodeStyle::shape(bool tikzitOverride) const { if (_data == 0) return NodeStyle::Circle; - QString sh = propertyWithDefault("shape", "circle"); + QString sh = propertyWithDefault("shape", "circle", tikzitOverride); if (sh == "circle") return NodeStyle::Circle; else if (sh == "rectangle") return NodeStyle::Rectangle; else return NodeStyle::Circle; diff --git a/src/data/nodestyle.h b/src/data/nodestyle.h index c6fc0f6..ce36006 100644 --- a/src/data/nodestyle.h +++ b/src/data/nodestyle.h @@ -37,10 +37,10 @@ public: NodeStyle(); NodeStyle(QString name, GraphElementData *data); - QColor fillColor() const; + QColor fillColor(bool tikzitOverride=true) const; QBrush brush() const; QPainterPath path() const override; - Shape shape() const; + Shape shape(bool tikzitOverride=true) const; QPainterPath palettePath() const override; QIcon icon() const override; diff --git a/src/data/style.cpp b/src/data/style.cpp index 41013c0..61c86d6 100644 --- a/src/data/style.cpp +++ b/src/data/style.cpp @@ -41,11 +41,11 @@ QString Style::name() const return _name; } -QColor Style::strokeColor() const +QColor Style::strokeColor(bool tikzitOverride) const { if (_data == 0) return Qt::black; - QString col = propertyWithDefault("draw", "black"); + QString col = propertyWithDefault("draw", "black", tikzitOverride); QColor namedColor(col); if (namedColor.isValid()) { @@ -69,10 +69,15 @@ QPen Style::pen() const return p; } -QString Style::propertyWithDefault(QString prop, QString def) const +QString Style::propertyWithDefault(QString prop, QString def, bool tikzitOverride) const { - QString val = _data->property("tikzit " + prop); - if (val.isNull()) val = _data->property(prop); + QString val; + if (tikzitOverride) { + val = _data->property("tikzit " + prop); + if (val.isNull()) val = _data->property(prop); + } else { + val = _data->property(prop); + } if (val.isNull()) val = def; return val; } diff --git a/src/data/style.h b/src/data/style.h index 8315e5a..0be8b87 100644 --- a/src/data/style.h +++ b/src/data/style.h @@ -38,7 +38,7 @@ public: // properties that both edges and nodes have GraphElementData *data() const; QString name() const; - QColor strokeColor() const; + QColor strokeColor(bool tikzitOverride=true) const; int strokeThickness() const; // methods that are implemented differently for edges and nodes @@ -47,7 +47,7 @@ public: virtual QPainterPath palettePath() const = 0; virtual QIcon icon() const = 0; protected: - QString propertyWithDefault(QString prop, QString def) const; + QString propertyWithDefault(QString prop, QString def, bool tikzitOverride=true) const; QString _name; GraphElementData *_data; }; diff --git a/src/data/tikzstyles.cpp b/src/data/tikzstyles.cpp index addd464..c96c55b 100644 --- a/src/data/tikzstyles.cpp +++ b/src/data/tikzstyles.cpp @@ -20,10 +20,38 @@ #include "nodestyle.h" #include +#include TikzStyles::TikzStyles(QObject *parent) : QObject(parent) { + // 19 standard xcolor colours + _colNames << + "black" << + "gray" << + "darkgray" << + "lightgray" << + "white" << + "red" << + "orange" << + "yellow" << + "lime" << + "blue" << + "purple" << + + "brown" << + "olive" << + "green" << + "teal" << + "cyan" << + + "magenta" << + "violet" << + "pink"; + + for (int i = 0; i < _colNames.length(); ++i) { + _cols << QColor(_colNames[i]); + } } NodeStyle *TikzStyles::nodeStyle(QString name) const @@ -51,6 +79,61 @@ void TikzStyles::clear() _edgeStyles.clear(); } +QColor TikzStyles::colorByIndex(int i) +{ + return _cols[i]; +} + +QColor TikzStyles::colorByName(QString name) +{ + for (int i = 0; i < _colNames.length(); ++i) { + if (_colNames[i] == name) return _cols[i]; + } + return QColor(); +} + +QString TikzStyles::nameForColor(QColor col) +{ + for (int i = 0; i < _colNames.length(); ++i) { + if (_cols[i] == col) return _colNames[i]; + } + return QString(); +} + +void TikzStyles::refreshModels(QStandardItemModel *nodeModel, QStandardItemModel *edgeModel) +{ + nodeModel->clear(); + edgeModel->clear(); + //QString f = tikzit->styleFile(); + //ui->styleFile->setText(f); + + QStandardItem *it; + + it = new QStandardItem(noneStyle->icon(), noneStyle->name()); + it->setEditable(false); + it->setData(noneStyle->name()); + nodeModel->appendRow(it); + + foreach(NodeStyle *ns, _nodeStyles) { + it = new QStandardItem(ns->icon(), ns->name()); + it->setEditable(false); + it->setData(ns->name()); + nodeModel->appendRow(it); + } + + it = new QStandardItem(noneEdgeStyle->icon(), noneEdgeStyle->name()); + it->setEditable(false); + it->setData(noneEdgeStyle->name()); + edgeModel->appendRow(it); + + foreach(EdgeStyle *es, _edgeStyles) { + it = new QStandardItem(es->icon(), es->name()); + it->setEditable(false); + it->setData(es->name()); + edgeModel->appendRow(it); + } +} + QVector TikzStyles::edgeStyles() const { return _edgeStyles; diff --git a/src/data/tikzstyles.h b/src/data/tikzstyles.h index da9a05f..51392b2 100644 --- a/src/data/tikzstyles.h +++ b/src/data/tikzstyles.h @@ -25,6 +25,8 @@ #include #include +#include +#include class TikzStyles : public QObject { @@ -39,6 +41,12 @@ public: QVector edgeStyles() const; void clear(); + // convenience functions for named colors + QColor colorByIndex(int i); + QColor colorByName(QString name); + QString nameForColor(QColor col); + void refreshModels(QStandardItemModel *nodeModel, QStandardItemModel *edgeModel); + signals: public slots: @@ -46,6 +54,8 @@ public slots: private: QVector _nodeStyles; QVector _edgeStyles; + QStringList _colNames; + QVector _cols; }; #endif // PROJECT_H diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 137d6cf..cae5735 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -10,6 +10,12 @@ 580 + + + 0 + 0 + + TikZiT - untitled diff --git a/src/gui/styleeditor.cpp b/src/gui/styleeditor.cpp new file mode 100644 index 0000000..fae5e1a --- /dev/null +++ b/src/gui/styleeditor.cpp @@ -0,0 +1,230 @@ +#include +#include + +#include "tikzit.h" +#include "styleeditor.h" +#include "ui_styleeditor.h" + +StyleEditor::StyleEditor(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::StyleEditor) +{ + ui->setupUi(this); + + setColor(ui->fillColor, QColor(Qt::white)); + setColor(ui->drawColor, QColor(Qt::black)); + setColor(ui->tikzitFillColor, QColor(Qt::white)); + setColor(ui->tikzitDrawColor, QColor(Qt::black)); + + TikzStyles *styles = tikzit->styles(); + + _nodeModel = new QStandardItemModel(this); + _edgeModel = new QStandardItemModel(this); + + ui->styleListView->setModel(_nodeModel); + ui->styleListView->setViewMode(QListView::IconMode); + ui->styleListView->setMovement(QListView::Static); + ui->styleListView->setGridSize(QSize(48,48)); + + + ui->edgeStyleListView->setModel(_edgeModel); + ui->edgeStyleListView->setViewMode(QListView::IconMode); + ui->edgeStyleListView->setMovement(QListView::Static); + ui->edgeStyleListView->setGridSize(QSize(48,48)); + + // setup the color dialog to display only the named colors that tikzit/xcolor knows + // about as "standard colors". + for (int i = 0; i < 48; ++i) { + QColorDialog::setStandardColor(i, QColor(Qt::white)); + } + + // grayscale in column 1 + int pos = 0; + for (int i=0; i < 5; ++i) { + QColorDialog::setStandardColor(pos, styles->colorByIndex(i)); + pos += 1; + } + + // rainbow in column 2 + pos = 6; + for (int i=5; i < 11; ++i) { + QColorDialog::setStandardColor(pos, styles->colorByIndex(i)); + pos += 1; + } + + // brown/green/teal spectrum in column 3 + pos = 12; + for (int i=11; i < 16; ++i) { + QColorDialog::setStandardColor(pos, styles->colorByIndex(i)); + pos += 1; + } + + // pinks in column 4 + pos = 18; + for (int i=16; i < 19; ++i) { + QColorDialog::setStandardColor(pos, styles->colorByIndex(i)); + pos += 1; + } + + _activeNodeStyle = 0; + _activeEdgeStyle = 0; + updateFields(); +} + +StyleEditor::~StyleEditor() +{ + delete ui; +} + +void StyleEditor::showEvent(QShowEvent *) +{ + tikzit->styles()->refreshModels(_nodeModel, _edgeModel); +} + +void StyleEditor::updateFields() +{ + ui->name->setEnabled(false); + ui->category->setEnabled(false); + ui->fillColor->setEnabled(false); + ui->drawColor->setEnabled(false); + ui->tikzitFillColor->setEnabled(false); + ui->tikzitDrawColor->setEnabled(false); + ui->hasTikzitFillColor->setEnabled(false); + ui->hasTikzitDrawColor->setEnabled(false); + ui->shape->setEnabled(false); + ui->hasTikzitShape->setEnabled(false); + ui->tikzitShape->setEnabled(false); + ui->leftArrow->setEnabled(false); + ui->rightArrow->setEnabled(false); + ui->properties->setEnabled(false); + + if (_activeNodeStyle != 0) { + ui->name->setEnabled(true); + ui->name->setText(_activeNodeStyle->name()); + + ui->category->setEnabled(true); + // TODO + + // passing 'false' to these methods prevents 'tikzit foo' from overriding property 'foo' + QColor realFill = _activeNodeStyle->fillColor(false); + QColor fill = _activeNodeStyle->fillColor(); + bool fillOverride = realFill != fill; + QColor realDraw = _activeNodeStyle->strokeColor(false); + QColor draw = _activeNodeStyle->strokeColor(); + bool drawOverride = realDraw != draw; + + ui->fillColor->setEnabled(true); + setColor(ui->fillColor, realFill); + + ui->drawColor->setEnabled(true); + setColor(ui->drawColor, realDraw); + + + ui->hasTikzitFillColor->setEnabled(true); + ui->hasTikzitFillColor->setChecked(fillOverride); + + ui->tikzitFillColor->setEnabled(fillOverride); + setColor(ui->tikzitFillColor, fill); + + ui->hasTikzitDrawColor->setEnabled(true); + ui->hasTikzitDrawColor->setChecked(drawOverride); + + ui->tikzitDrawColor->setEnabled(drawOverride); + setColor(ui->tikzitDrawColor, draw); + + // TODO + ui->shape->setEnabled(true); + ui->hasTikzitShape->setEnabled(true); + ui->tikzitShape->setEnabled(true); + ui->properties->setEnabled(true); + } else if (_activeEdgeStyle != 0) { + ui->name->setEnabled(true); + ui->name->setText(_activeEdgeStyle->name()); + + ui->category->setEnabled(true); + // TODO + + + setColor(ui->fillColor, QColor(Qt::gray)); + setColor(ui->tikzitFillColor, QColor(Qt::gray)); + ui->hasTikzitFillColor->setChecked(false); + + + // passing 'false' to these methods prevents 'tikzit foo' from overriding property 'foo' + QColor realDraw = _activeEdgeStyle->strokeColor(false); + QColor draw = _activeEdgeStyle->strokeColor(); + bool drawOverride = realDraw != draw; + + ui->drawColor->setEnabled(true); + setColor(ui->drawColor, realDraw); + + ui->hasTikzitDrawColor->setEnabled(true); + ui->hasTikzitDrawColor->setChecked(drawOverride); + + ui->tikzitDrawColor->setEnabled(drawOverride); + setColor(ui->tikzitDrawColor, draw); + + // TODO + ui->leftArrow->setEnabled(true); + ui->rightArrow->setEnabled(true); + ui->properties->setEnabled(true); + } else { + setColor(ui->fillColor, QColor(Qt::gray)); + setColor(ui->drawColor, QColor(Qt::gray)); + setColor(ui->tikzitDrawColor, QColor(Qt::gray)); + setColor(ui->tikzitFillColor, QColor(Qt::gray)); + } +} + + +void StyleEditor::on_fillColor_clicked() +{ + QColor col = QColorDialog::getColor( + color(ui->fillColor), + this, + "Fill Color", + QColorDialog::DontUseNativeDialog); + if (col.isValid()) setColor(ui->fillColor, col); +} + +void StyleEditor::on_styleListView_clicked() +{ + _activeNodeStyle = 0; + _activeEdgeStyle = 0; + const QModelIndexList i = ui->styleListView->selectionModel()->selectedIndexes(); + QString sty; + if (!i.isEmpty()) { + sty = i[0].data().toString(); + if (sty != "none") + _activeNodeStyle = tikzit->styles()->nodeStyle(sty); + } + updateFields(); +} + +void StyleEditor::on_edgeStyleListView_clicked() +{ + _activeNodeStyle = 0; + _activeEdgeStyle = 0; + const QModelIndexList i = ui->edgeStyleListView->selectionModel()->selectedIndexes(); + QString sty; + if (!i.isEmpty()) { + sty = i[0].data().toString(); + if (sty != "none") + _activeEdgeStyle = tikzit->styles()->edgeStyle(sty); + } + updateFields(); +} + +void StyleEditor::setColor(QPushButton *btn, QColor col) +{ + QPalette pal = btn->palette(); + pal.setColor(QPalette::Button, col); + btn->setPalette(pal); + btn->update(); +} + +QColor StyleEditor::color(QPushButton *btn) +{ + QPalette pal = btn->palette(); + return pal.color(QPalette::Button); +} diff --git a/src/gui/styleeditor.h b/src/gui/styleeditor.h new file mode 100644 index 0000000..3a8dd9d --- /dev/null +++ b/src/gui/styleeditor.h @@ -0,0 +1,41 @@ +#ifndef STYLEEDITOR_H +#define STYLEEDITOR_H + +#include "nodestyle.h" +#include "edgestyle.h" + +#include +#include +#include + +namespace Ui { +class StyleEditor; +} + +class StyleEditor : public QMainWindow +{ + Q_OBJECT + +public: + explicit StyleEditor(QWidget *parent = 0); + ~StyleEditor(); + + void showEvent(QShowEvent *) override; + void updateFields(); + +public slots: + void on_fillColor_clicked(); + void on_styleListView_clicked(); + void on_edgeStyleListView_clicked(); + +private: + Ui::StyleEditor *ui; + void setColor(QPushButton *btn, QColor col); + QColor color(QPushButton *btn); + QStandardItemModel *_nodeModel; + QStandardItemModel *_edgeModel; + NodeStyle *_activeNodeStyle; + EdgeStyle *_activeEdgeStyle; +}; + +#endif // STYLEEDITOR_H diff --git a/src/gui/styleeditor.ui b/src/gui/styleeditor.ui new file mode 100644 index 0000000..9888954 --- /dev/null +++ b/src/gui/styleeditor.ui @@ -0,0 +1,752 @@ + + + StyleEditor + + + + 0 + 0 + 580 + 519 + + + + MainWindow + + + + + + 10 + 10 + 181 + 22 + + + + + + + 200 + 50 + 61 + 20 + + + + + 10 + + + + Name + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 200 + 80 + 61 + 20 + + + + + 10 + + + + Category + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 200 + 110 + 61 + 20 + + + + + 10 + + + + Fill Color + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 200 + 140 + 61 + 20 + + + + + 10 + + + + Draw Color + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 270 + 50 + 301 + 20 + + + + + + + 270 + 80 + 301 + 22 + + + + true + + + + + + 270 + 110 + 31 + 18 + + + + true + + + + + + + + + true + + + + + + 270 + 140 + 31 + 18 + + + + true + + + + + + + + + true + + + + + + 380 + 110 + 71 + 17 + + + + + 10 + false + + + + in TikZiT: + + + + + + 380 + 140 + 71 + 17 + + + + + 10 + false + + + + in TikZiT: + + + + + + 450 + 110 + 31 + 18 + + + + true + + + + + + true + + + + + + 450 + 140 + 31 + 18 + + + + true + + + + + + true + + + + + + 200 + 170 + 61 + 20 + + + + + 10 + + + + Shape + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 270 + 170 + 211 + 22 + + + + true + + + + + + + + + circle + + + + + rectangle + + + + + + + 280 + 200 + 71 + 17 + + + + + 10 + false + + + + in TikZiT: + + + + + + 350 + 200 + 131 + 22 + + + + + + + 200 + 230 + 61 + 20 + + + + + 10 + + + + Arrowhead + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 270 + 230 + 71 + 22 + + + + true + + + + + + + + + < + + + + + > + + + + + | + + + + + stealth + + + + + latex + + + + + [ + + + + + ] + + + + + ( + + + + + ) + + + + + + + 350 + 230 + 16 + 21 + + + + + 16 + + + + - + + + + + + 370 + 230 + 71 + 22 + + + + true + + + + + + + + + > + + + + + < + + + + + | + + + + + stealth + + + + + latex + + + + + ] + + + + + [ + + + + + ) + + + + + ( + + + + + + + 200 + 270 + 61 + 20 + + + + + 10 + + + + Properties + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 270 + 270 + 301 + 211 + + + + + Name + + + + + Value + + + + + + + 270 + 490 + 23 + 18 + + + + + + + + + + + 300 + 490 + 23 + 18 + + + + +a + + + + + + 330 + 490 + 23 + 18 + + + + - + + + + + + 360 + 490 + 23 + 18 + + + + ^ + + + + + + 390 + 490 + 23 + 18 + + + + v + + + + + + 10 + 40 + 181 + 251 + + + + + + + 10 + 330 + 181 + 151 + + + + + + + 10 + 300 + 23 + 18 + + + + + + + + + + + 40 + 300 + 23 + 18 + + + + - + + + + + + 70 + 300 + 23 + 18 + + + + ^ + + + + + + 100 + 300 + 23 + 18 + + + + v + + + + + + 40 + 490 + 23 + 18 + + + + - + + + + + + 10 + 490 + 23 + 18 + + + + + + + + + + + 70 + 490 + 23 + 18 + + + + ^ + + + + + + 100 + 490 + 23 + 18 + + + + v + + + + + + + diff --git a/src/gui/stylepalette.cpp b/src/gui/stylepalette.cpp index b5e1475..500384b 100644 --- a/src/gui/stylepalette.cpp +++ b/src/gui/stylepalette.cpp @@ -67,36 +67,10 @@ StylePalette::~StylePalette() void StylePalette::reloadStyles() { - _nodeModel->clear(); - _edgeModel->clear(); QString f = tikzit->styleFile(); ui->styleFile->setText(f); - QStandardItem *it; - - it = new QStandardItem(noneStyle->icon(), noneStyle->name()); - it->setEditable(false); - it->setData(noneStyle->name()); - _nodeModel->appendRow(it); - - foreach(NodeStyle *ns, tikzit->styles()->nodeStyles()) { - it = new QStandardItem(ns->icon(), ns->name()); - it->setEditable(false); - it->setData(ns->name()); - _nodeModel->appendRow(it); - } - - it = new QStandardItem(noneEdgeStyle->icon(), noneEdgeStyle->name()); - it->setEditable(false); - it->setData(noneEdgeStyle->name()); - _edgeModel->appendRow(it); - - foreach(EdgeStyle *es, tikzit->styles()->edgeStyles()) { - it = new QStandardItem(es->icon(), es->name()); - it->setEditable(false); - it->setData(es->name()); - _edgeModel->appendRow(it); - } + tikzit->styles()->refreshModels(_nodeModel, _edgeModel); } void StylePalette::changeNodeStyle(int increment) @@ -161,6 +135,11 @@ void StylePalette::on_buttonOpenTikzstyles_clicked() tikzit->openTikzStyles(); } +void StylePalette::on_buttonEditTikzstyles_clicked() +{ + tikzit->showStyleEditor(); +} + void StylePalette::on_buttonRefreshTikzstyles_clicked() { QSettings settings("tikzit", "tikzit"); diff --git a/src/gui/stylepalette.h b/src/gui/stylepalette.h index 45dc8da..3c0c721 100644 --- a/src/gui/stylepalette.h +++ b/src/gui/stylepalette.h @@ -44,6 +44,7 @@ public slots: void nodeStyleDoubleClicked(const QModelIndex &index); void edgeStyleDoubleClicked(const QModelIndex &index); void on_buttonOpenTikzstyles_clicked(); + void on_buttonEditTikzstyles_clicked(); void on_buttonRefreshTikzstyles_clicked(); //void on_buttonApplyNodeStyle_clicked(); diff --git a/src/gui/stylepalette.ui b/src/gui/stylepalette.ui index 4f5b58d..10b80fb 100644 --- a/src/gui/stylepalette.ui +++ b/src/gui/stylepalette.ui @@ -7,11 +7,11 @@ 0 0 88 - 518 + 506 - + 0 0 @@ -71,6 +71,20 @@ + + + + New Project + + + + + + + :/images/document-new.svg:/images/document-new.svg + + + diff --git a/src/main.cpp b/src/main.cpp index 412f15f..1fcefc0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,10 +28,16 @@ #include #include +// #ifdef Q_OS_WIN +// #include +// #endif int main(int argc, char *argv[]) { + // #ifdef Q_OS_WIN + // SetProcessDPIAware(); + // #endif QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); diff --git a/src/tikzit.cpp b/src/tikzit.cpp index 9a4e166..1dc8bd9 100644 --- a/src/tikzit.cpp +++ b/src/tikzit.cpp @@ -47,6 +47,8 @@ void Tikzit::init(QApplication *app) //_stylePalette = new StylePalette(dummy); _styles = new TikzStyles(this); + _styleEditor = new StyleEditor(); + //_stylePalette->show(); _windows << new MainWindow(); _windows[0]->show(); @@ -176,6 +178,11 @@ void Tikzit::loadStyles(QString fileName) } } +void Tikzit::showStyleEditor() +{ + _styleEditor->show(); +} + QString Tikzit::styleFile() const { return _styleFile; diff --git a/src/tikzit.h b/src/tikzit.h index 232a4aa..3369962 100644 --- a/src/tikzit.h +++ b/src/tikzit.h @@ -53,6 +53,7 @@ #include "mainmenu.h" #include "ui_mainmenu.h" +#include "styleeditor.h" #include "toolpalette.h" #include "propertypalette.h" #include "stylepalette.h" @@ -116,6 +117,7 @@ public: void openTikzStyles(); void loadStyles(QString fileName); + void showStyleEditor(); TikzStyles *styles() const; QString styleFile() const; //StylePalette *stylePalette() const; @@ -133,7 +135,7 @@ private: MainWindow *_activeWindow; TikzStyles *_styles; QString _styleFile; - + StyleEditor *_styleEditor; }; extern Tikzit *tikzit; diff --git a/src/util.cpp b/src/util.cpp index 9c699f5..d5e2b96 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -18,6 +18,7 @@ #include "util.h" + float bezierInterpolate(float dist, float c0, float c1, float c2, float c3) { float distp = 1 - dist; return (distp*distp*distp) * c0 + diff --git a/src/util.h b/src/util.h index aff0587..89d0c5b 100644 --- a/src/util.h +++ b/src/util.h @@ -25,6 +25,7 @@ #include #include +#include #include #ifndef M_PI -- cgit v1.2.3