summaryrefslogtreecommitdiff
path: root/src/gui/styleeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styleeditor.cpp')
-rw-r--r--src/gui/styleeditor.cpp62
1 files changed, 28 insertions, 34 deletions
diff --git a/src/gui/styleeditor.cpp b/src/gui/styleeditor.cpp
index 29192d6..e2ade45 100644
--- a/src/gui/styleeditor.cpp
+++ b/src/gui/styleeditor.cpp
@@ -1,10 +1,30 @@
+/*
+ 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 <QColorDialog>
#include <QDebug>
#include <QMessageBox>
#include "tikzit.h"
#include "styleeditor.h"
+#include "delimitedstringvalidator.h"
#include "ui_styleeditor.h"
+#include "delimitedstringitemdelegate.h"
StyleEditor::StyleEditor(QWidget *parent) :
QMainWindow(parent),
@@ -18,6 +38,14 @@ StyleEditor::StyleEditor(QWidget *parent) :
ui->leftArrow << ui->rightArrow <<
ui->properties;
+ DelimitedStringValidator *v = new DelimitedStringValidator(this);
+ ui->name->setValidator(v);
+ ui->category->lineEdit()->setValidator(v);
+ ui->shape->lineEdit()->setValidator(v);
+
+ DelimitedStringItemDelegate *delegate = new DelimitedStringItemDelegate(ui->properties);
+ ui->properties->setItemDelegate(delegate);
+
setWindowIcon(QIcon(":/images/tikzit.png"));
_styles = nullptr;
_activeStyle = nullptr;
@@ -44,40 +72,6 @@ StyleEditor::StyleEditor(QWidget *parent) :
SIGNAL(currentIndexChanged(int)),
this, SLOT(shapeChanged()));
- // 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, tikzit->colorByIndex(i));
- pos += 1;
- }
-
- // rainbow in column 2
- pos = 6;
- for (int i=5; i < 11; ++i) {
- QColorDialog::setStandardColor(pos, tikzit->colorByIndex(i));
- pos += 1;
- }
-
- // brown/green/teal spectrum in column 3
- pos = 12;
- for (int i=11; i < 16; ++i) {
- QColorDialog::setStandardColor(pos, tikzit->colorByIndex(i));
- pos += 1;
- }
-
- // pinks in column 4
- pos = 18;
- for (int i=16; i < 19; ++i) {
- QColorDialog::setStandardColor(pos, tikzit->colorByIndex(i));
- pos += 1;
- }
-
refreshDisplay();
}