Browse Source

Start of a new hope

v0.8.0
Ulrich Van Den Hekke 14 years ago
parent
commit
0a4d14ae38
  1. 3
      WARNING
  2. 2
      libxinx/libxinx.pro
  3. 35
      libxinx/plugininterfaces.h
  4. 2
      libxinx/textfileeditor.cpp
  5. 5
      libxinx/xinxcodeedit.cpp
  6. 70
      libxinx/xinxformatscheme.cpp
  7. 56
      libxinx/xinxformatscheme.h
  8. 11
      plugins/webplugin/filetypeplugin.h
  9. 24
      plugins/webplugin/qcodeedit/xml.qnfa
  10. 16
      plugins/webplugin/webplugin.pro
  11. 68
      plugins/webplugin/xsl/xmlformatscheme.cpp
  12. 37
      plugins/webplugin/xsl/xmlformatscheme.h

3
WARNING

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
- Paste (Ctrl+V) doesn't work
* From word
* Rechercher/Remplacer : ne remplace pas
* Can't paste when i'm from XDME
* I have a crash in use (QVector index out of bound)
* Bookmark bar doesn't work
@ -12,7 +13,7 @@ @@ -12,7 +13,7 @@
- Le surligner automatique/non automatique ne fonctionne pas. ==> le fichier de config est charge apres le plugins
* Le surligner ne marche pas quand recherche espace.
- Probleme lors d'ouverture de fichier qui n'existe plus ?
- Ctrl+D pour dupliquer ne fonctionne pas : plantage
* Ctrl+D pour dupliquer ne fonctionne pas : plantage
* Si ajout de // sur une ligne de l'editeur ....
* Ctrl+Enter ne fonctionne plus

2
libxinx/libxinx.pro

@ -17,6 +17,7 @@ win32 : QMAKE_LFLAGS_SHLIB *= -no-undefined \ @@ -17,6 +17,7 @@ win32 : QMAKE_LFLAGS_SHLIB *= -no-undefined \
-enable-runtime-pseudo-reloc
win32 : RC_FILE += rc/libxinx.rc
HEADERS = xinxformatfactory.h \
xinxformatscheme.h \
textfileeditor.h \
filewatcher.h \
p_filewatcher.h \
@ -39,6 +40,7 @@ HEADERS = xinxformatfactory.h \ @@ -39,6 +40,7 @@ HEADERS = xinxformatfactory.h \
xinxcodeedit_p.h \
xinxlanguagefactory.h
SOURCES = xinxformatfactory.cpp \
xinxformatscheme.cpp \
textfileeditor.cpp \
filewatcher.cpp \
filecontentitemmodel.cpp \

35
libxinx/plugininterfaces.h

@ -1,22 +1,21 @@ @@ -1,22 +1,21 @@
/***************************************************************************
* Copyright (C) 2007 by Ulrich Van Den Hekke *
* ulrich.vdh@free.fr *
/* *********************************************************************** *
* 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 2 of the License, or *
* (at your option) any later version. *
* 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. *
* 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, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
* 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 INTERFACES_H_
#define INTERFACES_H_
@ -41,6 +40,7 @@ class AbstractFileContainer; @@ -41,6 +40,7 @@ class AbstractFileContainer;
class AbstractEditor;
class QWizardPage;
class XSLProject;
class XinxFormatScheme;
/*!
* This intereface is used to create a plugin used by XINX.
@ -188,6 +188,9 @@ public: @@ -188,6 +188,9 @@ public:
//! Identifier used to find the correct file type
virtual QString highlighterId() const = 0;
//! Return the format scheme used to draw the text.
virtual XinxFormatScheme * createFormatScheme( XINXConfig * config ) const = 0;
//! Return an example of highlighter.
virtual QString fileExample() const = 0;
};

2
libxinx/textfileeditor.cpp

@ -260,6 +260,7 @@ void TextFileEditor::replace( const QString & from, const QString & to, SearchOp @@ -260,6 +260,7 @@ void TextFileEditor::replace( const QString & from, const QString & to, SearchOp
Q_ASSERT( ! m_cursorStart.isNull() );
if( ! options.testFlag( REGULAR_EXPRESSION ) ) {
m_cursorStart.removeSelectedText();
m_cursorStart.insertText( to );
return;
}
@ -276,6 +277,7 @@ void TextFileEditor::replace( const QString & from, const QString & to, SearchOp @@ -276,6 +277,7 @@ void TextFileEditor::replace( const QString & from, const QString & to, SearchOp
it++; index++;
}
m_cursorStart.removeSelectedText();
m_cursorStart.insertText( result );
}

5
libxinx/xinxcodeedit.cpp

@ -426,12 +426,15 @@ void XinxCodeEdit::duplicateLines() { @@ -426,12 +426,15 @@ void XinxCodeEdit::duplicateLines() {
text += "\n";
QDocumentCursor selStart = cursor.selectionStart();
cursor.beginEditBlock();
cursor.moveTo( cursor.selectionStart() );
cursor.moveTo( selStart );
if( text.contains( '\n' ) )
cursor.movePosition( 0, QDocumentCursor::StartOfLine );
cursor.insertText( text );
cursor.movePosition( text.length(), QDocumentCursor::Right, QDocumentCursor::KeepAnchor );
cursor.endEditBlock();
setTextCursor( cursor );
}
void XinxCodeEdit::moveLineUp() {

70
libxinx/xinxformatscheme.cpp

@ -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;
}

56
libxinx/xinxformatscheme.h

@ -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_ */

11
plugins/webplugin/filetypeplugin.h

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#define _FILETYPEPLUGIN_H_
// Xinx header
#include "xsl/xmlformatscheme.h"
#include "xsl/xsllistview.h"
#include "xsl/stylesheeteditor.h"
#include "xsl/xmlfileeditor.h"
@ -71,11 +72,7 @@ static const QColor DEFAULT_STRING = Qt::red; @@ -71,11 +72,7 @@ static const QColor DEFAULT_STRING = Qt::red;
class XMLFileType : public QObject, public IFileTextPlugin {
Q_OBJECT
public:
XMLFileType() {
QHash<QString,QTextCharFormat> formats = defaultsFormat();
foreach( QString key, formats.keys() )
XINXConfig::self()->config().formats[ key ] = formats[ key ];
}
XMLFileType() : m_formats(0) {};
virtual QString description() { return tr( "XML File" ); };
virtual QString match() { return "*.xml"; };
@ -107,6 +104,10 @@ public: @@ -107,6 +104,10 @@ public:
return "XML";
}
virtual XinxFormatScheme * createFormatScheme( XINXConfig * config ) const {
return new XmlFormatScheme( config );
}
virtual QHash<QString,QTextCharFormat> defaultsFormat() const {
QHash<QString,QTextCharFormat> formats;
formats[ "xml_comment" ].setForeground( DEFAULT_COMMENT );

24
plugins/webplugin/qcodeedit/xml.qnfa

@ -1,35 +1,35 @@ @@ -1,35 +1,35 @@
<!DOCTYPE QNFA>
<QNFA language="XML" extensions="xml" defaultLineMark="bookmark" >
<context id="comment" format="xml_comment" >
<context id="comment" format="comment" >
<start parenthesis="xmlcomment:open" indent="1" fold="1">&lt;!--</start>
<stop parenthesis="xmlcomment:close" indent="1" fold="1">--&gt;</stop>
</context>
<context id="cdata" format="xml_cdata" >
<context id="cdata" format="cdata" >
<start parenthesis="xmlcdata:open" indent="1" fold="1">&lt;!\[CDATA\[</start>
<stop parenthesis="xmlcdata:close" indent="1" fold="1">\]\]&gt;</stop>
</context>
<context id="preprocessor" format="xml_preprocessor" >
<context id="preprocessor" format="preprocessor" >
<start parenthesis="xmlpreproc:open" indent="1" fold="1">&lt;\?xml</start>
<stop parenthesis="xmlpreproc:close" indent="1" fold="1">\?&gt;</stop>
</context>
<context id="doctype" format="xml_doctype" >
<context id="doctype" format="doctype" >
<start>&lt;!DOCTYPE</start>
<stop>&gt;</stop>
</context>
<sequence id="entity" format="xml_entity">&amp;$w+;</sequence>
<sequence id="entity" format="entity">&amp;$w+;</sequence>
<context id="tag/start" >
<start format="xml_elementname" >&lt;[0-9$w:\-]+</start>
<stop format="xml_elementname" parenthesis="xmltag:open@nomatch" indent="0" fold="1" >&gt;</stop>
<stop format="xml_elementname" >/&gt;</stop>
<start format="elementname" >&lt;[0-9$w:\-]+</start>
<stop format="elementname" parenthesis="xmltag:open@nomatch" indent="0" fold="1" >&gt;</stop>
<stop format="elementname" >/&gt;</stop>
<word format="xml_attributename">[0-9$w:]+=</word>
<word format="attributename">[0-9$w:]+=</word>
<context id="data/string" format="xml_attributevalue" stayOnLine="true" >
<context id="data/string" format="attributevalue" stayOnLine="true" >
<start>&quot;</start>
<stop>&quot;</stop>
<escape>\\</escape>
@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
<sequence parenthesis="round:open">(</sequence>
<sequence parenthesis="round:close">)</sequence>
<context id="xpath" format="xml_xpath" >
<context id="xpath" format="xpath" >
<start parenthesis="xpath:open">{</start>
<stop parenthesis="xpath:close">}</stop>
<stop exclusive="false">&quot;</stop>
@ -47,5 +47,5 @@ @@ -47,5 +47,5 @@
</context>
</context>
<sequence id="tag/stop" parenthesis="xmltag:close@nomatch" indent="0" fold="1" format="xml_elementname" >&lt;/[0-9$w:\-]+&gt;</sequence>
<sequence id="tag/stop" parenthesis="xmltag:close@nomatch" indent="0" fold="1" format="elementname" >&lt;/[0-9$w:\-]+&gt;</sequence>
</QNFA>

16
plugins/webplugin/webplugin.pro

@ -8,12 +8,13 @@ TARGET = webplugin @@ -8,12 +8,13 @@ TARGET = webplugin
INCLUDEPATH += ./ \
../../libxinx \
../../components \
../../ext/qcodeedit/lib \
../../ext/qcodeedit/lib/document \
../../ext/qcodeedit/lib/language \
../../ext/qcodeedit/lib/qnfa \
../../ext/qcodeedit/lib/widgets
HEADERS = xq/xquery_keyword.h \
../../ext/qcodeedit/lib \
../../ext/qcodeedit/lib/document \
../../ext/qcodeedit/lib/language \
../../ext/qcodeedit/lib/qnfa \
../../ext/qcodeedit/lib/widgets
HEADERS = xsl/xmlformatscheme.h \
xq/xquery_keyword.h \
xsl/xsltexteditor.h \
config/webpluginsettings.h \
xsl/xmlprettyprinter.h \
@ -38,7 +39,8 @@ HEADERS = xq/xquery_keyword.h \ @@ -38,7 +39,8 @@ HEADERS = xq/xquery_keyword.h \
xq/xqfileeditor.h \
xq/xqmodelcompleter.h \
filetypeplugin.h
SOURCES = xq/xquery_keyword.cpp \
SOURCES = xsl/xmlformatscheme.cpp \
xq/xquery_keyword.cpp \
xsl/xsltexteditor.cpp \
config/selfwebpluginsettings.cpp \
config/webpluginsettings.cpp \

68
plugins/webplugin/xsl/xmlformatscheme.cpp

@ -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 );
}

37
plugins/webplugin/xsl/xmlformatscheme.h

@ -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…
Cancel
Save