From ca564287ee3f48945d45c7d92be7a83452f53745 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Thu, 17 Jun 2010 05:37:01 +0000 Subject: Theme Editor: Moved source files into subdirectories git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26876 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/skinhighlighter.cpp | 172 ---------------------------------- 1 file changed, 172 deletions(-) delete mode 100644 utils/themeeditor/skinhighlighter.cpp (limited to 'utils/themeeditor/skinhighlighter.cpp') diff --git a/utils/themeeditor/skinhighlighter.cpp b/utils/themeeditor/skinhighlighter.cpp deleted file mode 100644 index 25a479f..0000000 --- a/utils/themeeditor/skinhighlighter.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2010 Robert Bieber - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "skinhighlighter.h" - -#include - -SkinHighlighter::SkinHighlighter(QTextDocument* doc) - :QSyntaxHighlighter(doc) -{ - loadSettings(); -} - -SkinHighlighter::~SkinHighlighter() -{ - -} - -void SkinHighlighter::highlightBlock(const QString& text) -{ - for(int i = 0; i < text.length(); i++) - { - QChar c = text[i]; - - /* Checking for delimiters */ - if(c == ARGLISTOPENSYM - || c == ARGLISTCLOSESYM - || c == ARGLISTSEPERATESYM) - setFormat(i, 1, tag); - - if(c == ENUMLISTOPENSYM - || c == ENUMLISTCLOSESYM - || c == ENUMLISTSEPERATESYM) - setFormat(i, 1, conditional); - - /* Checking for comments */ - if(c == COMMENTSYM) - { - setFormat(i, text.length() - i, comment); - return; - } - - if(c == TAGSYM) - { - if(text.length() - i < 2) - return; - - if(find_escape_character(text[i + 1].toAscii())) - { - /* Checking for escaped characters */ - - setFormat(i, 2, escaped); - i++; - } - else if(text[i + 1] != CONDITIONSYM) - { - /* Checking for normal tags */ - - char lookup[3]; - struct tag_info* found = 0; - - /* First checking for a two-character tag name */ - lookup[2] = '\0'; - - if(text.length() - i >= 3) - { - lookup[0] = text[i + 1].toAscii(); - lookup[1] = text[i + 2].toAscii(); - - found = find_tag(lookup); - } - - if(found) - { - setFormat(i, 3, tag); - i += 2; - } - else - { - lookup[1] = '\0'; - lookup[0] = text[i + 1].toAscii(); - found = find_tag(lookup); - - if(found) - { - setFormat(i, 2, tag); - i++; - } - } - - } - else if(text[i + 1] == CONDITIONSYM) - { - /* Checking for conditional tags */ - - if(text.length() - i < 3) - return; - - char lookup[3]; - struct tag_info* found = 0; - - lookup[2] = '\0'; - - if(text.length() - i >= 4) - { - lookup[0] = text[i + 2].toAscii(); - lookup[1] = text[i + 3].toAscii(); - - found = find_tag(lookup); - } - - if(found) - { - setFormat(i, 4, conditional); - i += 3; - } - else - { - lookup[1] = '\0'; - lookup[0] = text[i + 2].toAscii(); - - found = find_tag(lookup); - - if(found) - { - setFormat(i, 3, conditional); - i += 2; - } - } - - } - } - } -} - -void SkinHighlighter::loadSettings() -{ - QSettings settings; - - settings.beginGroup("SkinHighlighter"); - - /* Loading the highlighting colors */ - tag = settings.value("tagColor", QColor(180,0,0)).value(); - conditional = settings.value("conditionalColor", - QColor(0, 0, 180)).value(); - escaped = settings.value("escapedColor", - QColor(120,120,120)).value(); - comment = settings.value("commentColor", - QColor(0, 180, 0)).value(); - - settings.endGroup(); - - rehighlight(); -} -- cgit v1.1