12 changed files with 287 additions and 42 deletions
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
/* *********************************************************************** *
|
||||
* XINX * |
||||
* Copyright (C) 2009 by Ulrich Van Den Hekke * |
||||
* ulrich.vdh@shadoware.org * |
||||
* * |
||||
* 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 <http://www.gnu.org/licenses/>. *
|
||||
* *********************************************************************** */ |
||||
|
||||
// Xinx header
|
||||
#include "xinxformatscheme.h" |
||||
#include "xinxconfig.h" |
||||
|
||||
// QCodeEdit header
|
||||
#include "qformat.h" |
||||
|
||||
/* XinxFormatScheme */ |
||||
|
||||
XinxFormatScheme::XinxFormatScheme( XINXConfig * parent ) : QFormatScheme( parent ), m_config( parent ) { |
||||
createStandardFormat(); |
||||
} |
||||
|
||||
XinxFormatScheme::~XinxFormatScheme() { |
||||
|
||||
} |
||||
|
||||
void XinxFormatScheme::createStandardFormat() { |
||||
QFormat searchFormat, matchFormat; |
||||
|
||||
// Init search format
|
||||
searchFormat.background = m_config->config().editor.highlightWord; |
||||
setFormat( "search", searchFormat ); |
||||
|
||||
// Init match format
|
||||
matchFormat.weight = QFont::Bold; |
||||
matchFormat.foreground = Qt::red; |
||||
matchFormat.foreground = Qt::yellow; |
||||
setFormat( "match", matchFormat ); |
||||
} |
||||
|
||||
void XinxFormatScheme::updateFormatsFromConfig() { |
||||
// Reload from config file ;)
|
||||
createStandardFormat(); |
||||
|
||||
foreach( QString format, m_config->config().formats.keys() ) { |
||||
|
||||
} |
||||
} |
||||
|
||||
void XinxFormatScheme::putFormatsToConfig() { |
||||
|
||||
} |
||||
|
||||
void XinxFormatScheme::setNameSpace( const QString & value ) { |
||||
m_nameSpace = value; |
||||
} |
||||
|
||||
const QString & XinxFormatScheme::nameSpace() const { |
||||
return m_nameSpace; |
||||
} |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* *********************************************************************** *
|
||||
* XINX * |
||||
* Copyright (C) 2009 by Ulrich Van Den Hekke * |
||||
* ulrich.vdh@shadoware.org * |
||||
* * |
||||
* 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 <http://www.gnu.org/licenses/>. *
|
||||
* *********************************************************************** */ |
||||
|
||||
#ifndef XINXFORMATSCHEME_H_ |
||||
#define XINXFORMATSCHEME_H_ |
||||
|
||||
// QCodeEdit header
|
||||
#include <qformatscheme.h> |
||||
|
||||
class XINXConfig; |
||||
|
||||
/*!
|
||||
* This object base create standard format. |
||||
*/ |
||||
class XinxFormatScheme : public QFormatScheme { |
||||
Q_OBJECT |
||||
public: |
||||
/*!
|
||||
* Create a XinxFormatFactory. |
||||
*/ |
||||
XinxFormatScheme( XINXConfig * parent ); |
||||
|
||||
//! Destroy the format factory
|
||||
virtual ~XinxFormatScheme(); |
||||
|
||||
//! Update the list of format (can't delete existing format)
|
||||
void updateFormatsFromConfig(); |
||||
void putFormatsToConfig(); |
||||
protected: |
||||
//! Create standards formats
|
||||
void createStandardFormat(); |
||||
|
||||
void setNameSpace( const QString & value ); |
||||
const QString & nameSpace() const; |
||||
private: |
||||
XINXConfig * m_config; |
||||
QString m_nameSpace; |
||||
}; |
||||
|
||||
#endif /* XINXFORMATSCHEME_H_ */ |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
/* *********************************************************************** *
|
||||
* XINX * |
||||
* Copyright (C) 2009 by Ulrich Van Den Hekke * |
||||
* ulrich.vdh@shadoware.org * |
||||
* * |
||||
* 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 <http://www.gnu.org/licenses/>. *
|
||||
* *********************************************************************** */ |
||||
|
||||
// Xinx header
|
||||
#include "xmlformatscheme.h" |
||||
|
||||
// QCodeEdit header
|
||||
#include <QFormat> |
||||
|
||||
XmlFormatScheme::XmlFormatScheme( XINXConfig * config ) : XinxFormatScheme( config ) { |
||||
createDefaultScheme(); |
||||
} |
||||
|
||||
void XmlFormatScheme::createDefaultScheme() { |
||||
QFormat comment, cdata, preprocessor, doctype, entity, elementname, attributename, attributevalue, xpath; |
||||
|
||||
// Comment format
|
||||
comment.foreground = Qt::darkGreen; |
||||
setFormat( "comment", comment ); |
||||
|
||||
// CDATA format
|
||||
cdata.foreground = Qt::gray; |
||||
setFormat( "comment", cdata ); |
||||
|
||||
// Preprocessor format
|
||||
preprocessor.foreground = Qt::gray; |
||||
setFormat( "comment", preprocessor ); |
||||
|
||||
// doctype format
|
||||
doctype.foreground = Qt::gray; |
||||
setFormat( "comment", doctype ); |
||||
|
||||
// entity format
|
||||
entity.foreground = Qt::gray; |
||||
setFormat( "comment", entity ); |
||||
|
||||
// Element Name format
|
||||
elementname.foreground = Qt::darkRed; |
||||
setFormat( "comment", elementname ); |
||||
|
||||
// Attribute Name format
|
||||
attributename.foreground = Qt::red; |
||||
setFormat( "comment", attributename ); |
||||
|
||||
// Attribute Value format
|
||||
attributevalue.foreground = Qt::blue; |
||||
setFormat( "comment", attributevalue ); |
||||
|
||||
// X Path format
|
||||
xpath.foreground = Qt::darkMagenta; |
||||
setFormat( "comment", xpath ); |
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
/* *********************************************************************** *
|
||||
* XINX * |
||||
* Copyright (C) 2009 by Ulrich Van Den Hekke * |
||||
* ulrich.vdh@shadoware.org * |
||||
* * |
||||
* 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 <http://www.gnu.org/licenses/>. *
|
||||
* *********************************************************************** */ |
||||
|
||||
#ifndef XMLFORMATSCHEME_H_ |
||||
#define XMLFORMATSCHEME_H_ |
||||
|
||||
// Xinx header
|
||||
#include <xinxformatscheme.h> |
||||
|
||||
|
||||
class XmlFormatScheme : public XinxFormatScheme { |
||||
Q_OBJECT |
||||
public: |
||||
XmlFormatScheme( XINXConfig * config ); |
||||
protected: |
||||
void createDefaultScheme(); |
||||
private: |
||||
}; |
||||
|
||||
|
||||
#endif /* XMLFORMATSCHEME_H_ */ |
Loading…
Reference in new issue