summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/codeeditor.cpp2
-rw-r--r--utils/themeeditor/codeeditor.h2
-rw-r--r--utils/themeeditor/parsetreenode.cpp6
-rw-r--r--utils/themeeditor/skin_parser.c14
-rw-r--r--utils/themeeditor/skindocument.cpp21
-rw-r--r--utils/themeeditor/skindocument.h2
6 files changed, 34 insertions, 13 deletions
diff --git a/utils/themeeditor/codeeditor.cpp b/utils/themeeditor/codeeditor.cpp
index d4b46ac..49f4410 100644
--- a/utils/themeeditor/codeeditor.cpp
+++ b/utils/themeeditor/codeeditor.cpp
@@ -132,7 +132,7 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
if(errors.contains(blockNumber + 1))
{
painter.fillRect(QRect(0, top, lineNumberArea->width(),
- fontMetrics().height()), Qt::red);
+ fontMetrics().height()), errorColor);
}
painter.setPen(Qt::black);
painter.drawText(0, top, lineNumberArea->width(),
diff --git a/utils/themeeditor/codeeditor.h b/utils/themeeditor/codeeditor.h
index ec36d50..5df5b42 100644
--- a/utils/themeeditor/codeeditor.h
+++ b/utils/themeeditor/codeeditor.h
@@ -61,6 +61,7 @@ public:
int lineNumberAreaWidth();
void addError(int line){ errors.append(line); }
void clearErrors(){ errors.clear(); }
+ void setErrorColor(QColor color){ errorColor = color; }
protected:
void resizeEvent(QResizeEvent *event);
@@ -72,6 +73,7 @@ private slots:
private:
QWidget *lineNumberArea;
QList<int> errors;
+ QColor errorColor;
};
//![codeeditordefinition]
diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp
index df4e770..d3a1a71 100644
--- a/utils/themeeditor/parsetreenode.cpp
+++ b/utils/themeeditor/parsetreenode.cpp
@@ -56,7 +56,6 @@ ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent)
}
break;
- case VIEWPORT:
case CONDITIONAL:
for(int i = 0; i < element->params_count; i++)
children.append(new ParseTreeNode(&data->params[i], this));
@@ -71,6 +70,11 @@ ParseTreeNode::ParseTreeNode(struct skin_element* data, ParseTreeNode* parent)
}
break;
+case VIEWPORT:
+ for(int i = 0; i < element->params_count; i++)
+ children.append(new ParseTreeNode(&data->params[i], this));
+ /* Deliberate fall-through here */
+
case LINE:
for(int i = 0; i < data->children_count; i++)
{
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index e6a6350..bf7ca8d 100644
--- a/utils/themeeditor/skin_parser.c
+++ b/utils/themeeditor/skin_parser.c
@@ -249,9 +249,19 @@ static struct skin_element* skin_parse_line_optional(char** document,
retval = skin_alloc_element();
retval->type = LINE;
retval->line = skin_line;
- if(*cursor != '\0')
+ if(*cursor != '\0' && *cursor != '\n'
+ && !(conditional && (*cursor == ARGLISTSEPERATESYM
+ || *cursor == ARGLISTCLOSESYM
+ || *cursor == ENUMLISTSEPERATESYM
+ || *cursor == ENUMLISTCLOSESYM)))
+ {
retval->children_count = 1;
- else retval->children_count = 0;
+ }
+ else
+ {
+ retval->children_count = 0;
+ }
+
if(retval->children_count > 0)
retval->children = skin_alloc_children(1);
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index b67c70d..8547aaf 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -146,10 +146,8 @@ void SkinDocument::settingsChanged()
palette.setColor(QPalette::All, QPalette::Text, fg);
editor->setPalette(palette);
- errorColor = QTextCharFormat();
QColor highlight = settings.value("errorColor", Qt::red).value<QColor>();
- errorColor.setBackground(highlight);
- errorColor.setProperty(QTextFormat::FullWidthSelection, true);
+ editor->setErrorColor(highlight);
/* Setting the font */
QFont def("Monospace");
@@ -175,10 +173,19 @@ void SkinDocument::codeChanged()
if(skin_error_line() > 0)
{
editor->addError(skin_error_line());
- }
- else
- {
- editor->setExtraSelections(QList<QTextEdit::ExtraSelection>());
+
+ /* Now we're going to attempt parsing again at each line, until we find
+ one that won't error out
+ QTextDocument doc(editor->document()->toPlainText());
+ if(skin_error_line() > 0)
+ {
+ QTextCursor rest(&doc);
+
+ for(int i = 0; i < skin_error_line(); i++)
+ rest.movePosition(QTextCursor::NextBlock,
+ QTextCursor::KeepAnchor);
+ rest.clearSelection();
+ }*/
}
if(editor->document()->toPlainText() != saved)
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index e8bd270..741359b 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -79,8 +79,6 @@ private:
QString saved;
QString parseStatus;
- QTextCharFormat errorColor;
-
QLayout* layout;
CodeEditor* editor;