patches
No OneTemporary

File Metadata

Created
Thu, Jul 9, 2:36 AM
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1303b01..720418a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,8 @@
project (juffed)
cmake_minimum_required (VERSION 2.8.11)
+set (CMAKE_CXX_FLAGS "--std=c++11 ${CMAKE_CXX_FLAGS}")
+
# build options
option(USE_QT5 "Use Qt5. Defaults to Qt4" $ENV{USE_QT5})
option(USE_SYSTEM_QTSINGLEAPPLICATION "Try to find system-wide QtSingleApplication library" $ENV{USE_SYSTEM_SINGLETON})
@@ -301,9 +303,13 @@ target_link_libraries ( ${JUFFED}
)
if ( UNIX )
- set(CMAKE_CXX_FLAGS "-Wall -Wextra")
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS}")
endif ( UNIX )
+#add custom sub projects
+#add_subdirectory(src/3rd_party/RemarkupParser)
+add_subdirectory(src/3rd_party/conduit-client)
+
#
# plugins
message(STATUS "Plugins: all externally linked cmake-ready plugs will be built")
diff --git a/cmake/FileSets.cmake b/cmake/FileSets.cmake
index 256b0fd..6f1a62e 100644
--- a/cmake/FileSets.cmake
+++ b/cmake/FileSets.cmake
@@ -90,6 +90,9 @@ SET ( juffed_qsci_SRCS
src/app/qsci/lexers/qscilexerlisp.cpp
src/app/qsci/lexers/qscilexernsis.cpp
src/app/qsci/lexers/my/QsciLexerMatlab.cpp
+
+ #custom lexers
+ src/app/qsci/lexers/custom/qscilexerremarkup.cpp
)
SET ( juffed_qsci_UIS
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index d161ec9..7d7cb4f 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -120,3 +120,7 @@ endif (BUILD_AUTOSAVE)
if (BUILD_COLORPICKER)
add_subdirectory(colorpicker)
endif (BUILD_COLORPICKER)
+
+#add custom plugins
+add_subdirectory(phapublisher)
+#add_subdirectory(remarkupplugin
diff --git a/src/app/qsci/LexerStorage.cpp b/src/app/qsci/LexerStorage.cpp
index b836047..53ad1cd 100644
--- a/src/app/qsci/LexerStorage.cpp
+++ b/src/app/qsci/LexerStorage.cpp
@@ -3,7 +3,7 @@ JuffEd - An advanced text editor
Copyright 2007-2010 Mikhail Murzin
This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
+modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
@@ -78,6 +78,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "QSciSettings.h"
#include "Log.h"
+#include "lexers/custom/qscilexerremarkup.h"
#include <stdio.h>
namespace Juff {
@@ -92,6 +93,10 @@ namespace Juff {
bool bold;
bool italic;
+ bool capitalization;
+ bool monospace;
+ bool underline;
+ bool strikeout;
QColor color;
QColor bgColor;
};
@@ -101,7 +106,7 @@ namespace Juff {
style = st;
hlElements = elements;
}
-
+
QList<int> hlElements;
Style style;
};
@@ -120,11 +125,11 @@ public:
}
~LSInterior() {
}
-
+
QsciLexer* lexer(const QString& name/*, const QFont&*/);
void readCustomStyle(const QString& name);
void applyCustomStyle(const QString& name, const QFont& font);
-
+
QMap<QString, QsciLexer*> lexers_;
SchemeMap schemes_;
QMap<QString, QColor> curLineColors_;
@@ -147,8 +152,8 @@ void parseScheme(const QDomElement& schEl, StyleMap& styles) {
QString defBgColorStr = schEl.attribute("defaultBgColor", "");
QString defBoldStr = schEl.attribute("defaultBold", "false");
QString defItalicStr = schEl.attribute("defaultItalic", "false");
-
- Style defaultStyle(stringToColor(defColorStr), stringToColor(defBgColorStr),
+
+ Style defaultStyle(stringToColor(defColorStr), stringToColor(defBgColorStr),
stringToBool(defBoldStr), stringToBool(defItalicStr));
styles["default"] = defaultStyle;
@@ -162,6 +167,10 @@ void parseScheme(const QDomElement& schEl, StyleMap& styles) {
style.bgColor = stringToColor(styleEl.attribute("bgColor", defBgColorStr));
style.bold = stringToBool(styleEl.attribute("bold", defBoldStr));
style.italic = stringToBool(styleEl.attribute("italic", defItalicStr));
+ style.monospace = stringToBool(styleEl.attribute("monospace", ""));
+ style.underline = stringToBool(styleEl.attribute("underline", ""));
+ style.capitalization = stringToBool(styleEl.attribute("capitalization", ""));
+ style.strikeout = stringToBool(styleEl.attribute("strikeout", ""));
styles[name] = style;
}
}
@@ -172,7 +181,7 @@ void parseScheme(const QDomElement& schEl, StyleMap& styles) {
void LSInterior::readCustomStyle(const QString& name) {
// LOGGER;
-
+
QDomDocument doc("JuffScheme");
QString nm = name;
nm = nm.replace(QString("+"), "plus").replace(QString("#"), "sharp").toLower();
@@ -187,7 +196,7 @@ void LSInterior::readCustomStyle(const QString& name) {
return;
}
else {
-// Log::debug(QString("File '%1' opened successfully").arg(fileName), true);
+ Log::debug(QString("File '%1' opened successfully").arg(fileName), true);
}
QString err;
@@ -201,7 +210,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else {
// Log::debug(QString("File '%1' was parsed successfully").arg(fileName), true);
}
-
+
file.close();
QDomElement docElem = doc.documentElement();
@@ -232,7 +241,7 @@ void LSInterior::readCustomStyle(const QString& name) {
// Log::debug(QString("Preparing to create a lexer '%1'").arg(name));
Scheme* scheme = NULL;
-
+
if ( name.compare("C++") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
@@ -352,7 +361,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("HTML") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["tag"], QList<int>() << QsciLexerHTML::Tag)
<< Rule(styles["attribute"], QList<int>() << QsciLexerHTML::Attribute)
<< Rule(styles["comment"], QList<int>() << QsciLexerHTML::HTMLComment)
@@ -371,7 +380,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("PHP") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["phpKeyword"], QList<int>() << QsciLexerHTML::PHPKeyword)
<< Rule(styles["phpOperator"], QList<int>() << QsciLexerHTML::PHPOperator)
<< Rule(styles["phpVariable"], QList<int>() << QsciLexerHTML::PHPVariable)
@@ -410,9 +419,9 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("CSS") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["tag"], QList<int>() << QsciLexerCSS::Tag)
-#ifdef CSS3_FOUND
+#ifdef CSS3_FOUND
<< Rule(styles["property"], QList<int>() << QsciLexerCSS::CSS1Property << QsciLexerCSS::CSS2Property << QsciLexerCSS::CSS3Property)
#else
<< Rule(styles["property"], QList<int>() << QsciLexerCSS::CSS1Property << QsciLexerCSS::CSS2Property)
@@ -500,7 +509,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("TCL") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["number"], QList<int>() << QsciLexerTCL::Number)
<< Rule(styles["keyword"], QList<int>() << QsciLexerTCL::QuotedKeyword << QsciLexerTCL::ExpandKeyword << QsciLexerTCL::KeywordSet6 << QsciLexerTCL::KeywordSet7 << QsciLexerTCL::KeywordSet8 << QsciLexerTCL::KeywordSet9)
<< Rule(styles["string"], QList<int>() << QsciLexerTCL::QuotedString)
@@ -522,7 +531,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("Pascal") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["comment"], QList<int>() << QsciLexerPascal::Comment << QsciLexerPascal::CommentLine << QsciLexerPascal::CommentParenthesis)
<< Rule(styles["number"], QList<int>() << QsciLexerPascal::Number)
<< Rule(styles["keyword"], QList<int>() << QsciLexerPascal::Keyword)
@@ -539,7 +548,7 @@ void LSInterior::readCustomStyle(const QString& name) {
else if ( name.compare("Fortran") == 0 ) {
scheme = new Scheme();
scheme->defaultStyle = styles["default"];
- scheme->rules
+ scheme->rules
<< Rule(styles["comment"], QList<int>() << QsciLexerFortran77::Comment)
<< Rule(styles["number"], QList<int>() << QsciLexerFortran77::Number)
<< Rule(styles["keyword"], QList<int>() << QsciLexerFortran77::Keyword)
@@ -570,17 +579,29 @@ void LSInterior::readCustomStyle(const QString& name) {
}
#endif // JUFF_PROPERTIES_LEXER
+ else if ( name.compare("Remarkup") == 0 ) {
+ scheme = new Scheme();
+ scheme->defaultStyle = styles["default"];
+ scheme->rules
+ << Rule(styles["Bold"], QList<int>() << (int) QsciLexerRemarkupStyles::Bold)
+ << Rule(styles["Italic"], QList<int>() <<(int) QsciLexerRemarkupStyles::Italic)
+ << Rule(styles["Hidden"], QList<int>() <<(int) QsciLexerRemarkupStyles::Hidden)
+ << Rule(styles["Highlight"], QList<int>() <<(int) QsciLexerRemarkupStyles::Highlight)
+ << Rule(styles["Underline"], QList<int>() <<(int) QsciLexerRemarkupStyles::Underline)
+ << Rule(styles["Monospace"], QList<int>() <<(int) QsciLexerRemarkupStyles::Monospace);
+ schemes_[name] = scheme;
+ }
// Log::debug("Exiting readCustomStyle()");
}
void LSInterior::applyCustomStyle(const QString& name, const QFont& font) {
// LOGGER;
-
+
QsciLexer* lex = lexers_.value(name, 0);
if ( lex != 0 ) {
// Log::debug("Have a lexer");
-
+
lex->setFont(font, -1);
if ( name.compare("none") == 0 ) {
@@ -591,11 +612,11 @@ void LSInterior::applyCustomStyle(const QString& name, const QFont& font) {
}
else {
// Log::debug(QString("Lexer is not 'none'"));
-
+
if ( schemes_.contains(name) ) {
// Log::debug(QString("Found scheme %1").arg(name));
Scheme* scheme = schemes_[name];
-
+
QFont f(font);
f.setStyle(scheme->defaultStyle.italic ? QFont::StyleItalic : QFont::StyleNormal);
f.setWeight(scheme->defaultStyle.bold ? QFont::Bold : QFont::Normal);
@@ -622,6 +643,15 @@ void LSInterior::applyCustomStyle(const QString& name, const QFont& font) {
QFont f(font);
f.setStyle(rule.style.italic ? QFont::StyleItalic : QFont::StyleNormal);
f.setWeight(rule.style.bold ? QFont::Bold : QFont::Normal);
+ if (rule.style.capitalization) {
+ f.setCapitalization(QFont::AllUppercase);
+ }
+ f.setUnderline(rule.style.underline);
+ f.setStrikeOut(rule.style.strikeout);
+ if (rule.style.monospace) {
+ f.setStyleHint(QFont::Monospace);
+ }
+
if ( rule.style.color.isValid() )
lex->setColor(rule.style.color, element);
if ( rule.style.bgColor.isValid() )
@@ -643,7 +673,7 @@ void LSInterior::applyCustomStyle(const QString& name, const QFont& font) {
QsciLexer* LSInterior::lexer(const QString& name) {
if ( lexers_.contains(name) ) {
- // return lexer with this name
+ // return lexer with this name
// if it already exists
return lexers_[name];
}
@@ -774,7 +804,11 @@ QsciLexer* LSInterior::lexer(const QString& name) {
// TODO/FIXME: special lexer. Qorus has to inherit Qore
newLexer = new QsciLexerPerl();
}
-
+
+ else if ( name.compare("Remarkup") == 0 ) {
+ newLexer = new QsciLexerRemarkup();
+ }
+
if ( newLexer != 0 ) {
lexers_[name] = newLexer;
if ( !name.isEmpty() && name.compare("none") != 0 ) {
@@ -811,7 +845,7 @@ QString LexerStorage::lexerName(const QString& fName) {
// try to guess lexer using file name
QStringList types = lexersList();
types.removeAll("none");
-
+
foreach(QString type, types ) {
QStringList patterns = FileTypeSettings::getFileNamePatterns(type);
foreach (QString pattern, patterns) {
@@ -824,7 +858,7 @@ QString LexerStorage::lexerName(const QString& fName) {
}
}
- // file name didn't match to any pattern - try to
+ // file name didn't match to any pattern - try to
// analize file's 1st line
QFile file(fName);
@@ -866,14 +900,14 @@ QsciLexer* LexerStorage::lexerByFileName(const QString& fileName) {
QStringList LexerStorage::lexersList() const {
QStringList list;
- list << "none" << "Ada" << "Asm" << "Bash" << "Batch" << "C++" << "C#"
- << "CMake" << "CSS" << "D" << "Diff"
-
+ list << "none" << "Ada" << "Asm" << "Bash" << "Batch" << "C++" << "C#"
+ << "CMake" << "CSS" << "D" << "Diff"
+
#ifdef JUFF_FORTRAN_LEXER
<< "Fortran"
#endif // JUFF_FORTRAN_LEXER
- << "Haskell" << "HTML" << "IDL" << "Java" << "JavaScript" << "Lisp"
+ << "Haskell" << "HTML" << "IDL" << "Java" << "JavaScript" << "Lisp"
<< "Lua" << "Makefile" << "Matlab" << "NBC" << "NSIS" << "NXC"
#ifdef JUFF_PASCAL_LEXER
@@ -886,7 +920,7 @@ QStringList LexerStorage::lexersList() const {
<< "Properties"
#endif // JUFF_PROPERTIES_LEXER
- << "Python" << "PHP" << "Ruby" << "SQL"
+ << "Python" << "PHP" << "Ruby" << "Remarkup" <<"SQL"
#ifdef JUFF_TCL_LEXER
<< "TCL"
@@ -901,7 +935,7 @@ QStringList LexerStorage::lexersList() const {
void LexerStorage::updateLexers(const QFont& font) {
// if ( font == lsInt_->curFont_ )
// return;
-
+
QMap<QString, QsciLexer*>::iterator it = lsInt_->lexers_.begin();
while (it != lsInt_->lexers_.end()) {
lsInt_->applyCustomStyle(it.key(), font);
diff --git a/src/app/qsci/SciDoc.cpp b/src/app/qsci/SciDoc.cpp
index 284ac5d..93596e6 100644
--- a/src/app/qsci/SciDoc.cpp
+++ b/src/app/qsci/SciDoc.cpp
@@ -88,39 +88,39 @@ SciDoc::Eol guessEol(const QString& fileName) {
std::pair<bool,int> guessIndentation(const QString& fileName) {
bool use_tabs = EditorSettings::get(EditorSettings::UseTabs); // Stores final result whether document uses tabs for indentation (start with default)
int indentation_width = EditorSettings::get(EditorSettings::TabWidth); // Stores final result what indentation width the document uses (start with default)
-
+
if ( !Juff::Document::isNoname(fileName) && EditorSettings::get(EditorSettings::AutoDetectIndentation) ) {
QFile file(fileName);
if ( file.open(QIODevice::ReadOnly) ) {
int tab_block_count = 0; // Counter of how many text blocks start with tabs
int space_block_count = 0; // Counter of how many text blocks start with spaces
-
+
QString prev_indent(""); // Stores prior line's indentation string
int prev_spaces; // Stores the prior line's leading spaces
-
+
std::map<int, int> space_counts; // Stores the number of indentation increases of various sizes in spaces
- space_counts[1] = space_counts[2] = space_counts[3] = space_counts[4] = space_counts[5] = space_counts[6] = space_counts[7] = space_counts[8] = 0;
-
+ space_counts[1] = space_counts[2] = space_counts[3] = space_counts[4] = space_counts[5] = space_counts[6] = space_counts[7] = space_counts[8] = 0;
+
QRegExp blank_re("[\t ]*\r?\n?"); // Checks if line is blank
QRegExp indent_re("^[\t ]*"); // Finds all leading whitespace
QRegExp tabs_re("^\t*"); // Finds leading tabs
QRegExp spaces_re("^ *"); // Finds leading spaces
-
+
// Collect indentation statistics
for ( int i = 0; !file.atEnd() && i < 1000; ++i ) { // Stop at end of document or 1000 lines, whichever comes first
QString line = QString::fromLocal8Bit(file.readLine().constData());
-
+
// Skip blank lines, as they are likely to have malformed indentation
if (blank_re.exactMatch(line))
continue;
-
+
// Skip subsequent lines with identical indentation.
// In other words, we're counting blocks of indented text, not lines
indent_re.exactMatch(line);
if (prev_indent == indent_re.cap(0))
continue;
prev_indent = indent_re.cap(0);
-
+
// Check for a leading tab
tabs_re.exactMatch(line);
if (tabs_re.matchedLength() > 0) {
@@ -128,7 +128,7 @@ std::pair<bool,int> guessIndentation(const QString& fileName) {
prev_spaces = 0;
continue;
}
-
+
// Check for a leading space
spaces_re.exactMatch(line);
if ( spaces_re.matchedLength() > 0 ) {
@@ -139,7 +139,7 @@ std::pair<bool,int> guessIndentation(const QString& fileName) {
prev_spaces = spaces_re.matchedLength();
}
}
-
+
// Guess indentation style based on the collected statistics
if (tab_block_count > 0 || space_block_count > 0) { // If we don't have any statistics to work with, stick with defaults
if ( (tab_block_count * 2) > space_block_count ) { // Heuristic: even smaller numbers of leading tabs typically still indicate that tabs are the indentation character
@@ -148,14 +148,14 @@ std::pair<bool,int> guessIndentation(const QString& fileName) {
else {
// If document uses spaces...
use_tabs = false;
-
+
// Guess indentation width in spaces
int width = 1;
for ( int i = 2; i <= 8; ++i ) {
if ( space_counts[width] <= space_counts[i] ) // Barely favor larger widths (<= instead of <)
width = i;
}
-
+
// Heuristic: if there's only one example of an indent, skip and stick with the default
if ( space_counts[width] > 1)
indentation_width = width;
@@ -164,7 +164,7 @@ std::pair<bool,int> guessIndentation(const QString& fileName) {
}
file.close();
}
-
+
return std::make_pair(use_tabs, indentation_width);
}
@@ -236,7 +236,7 @@ public:
edit1_->setDocument(edit2_->document());
w->setFocusProxy(spl_);
spl_->setSizes(QList<int>() << 0 << spl_->height());
-
+
hlTimer_ = new QTimer( w );
hlTimer_->setSingleShot( true );
connect(hlTimer_, SIGNAL(timeout()), w, SLOT(highlightWord()));
@@ -323,10 +323,10 @@ SciDoc::SciDoc(const QString& fileName) : Juff::Document(fileName) {
setIndentationsUseTabs(indentation.first);
setTabWidth(indentation.second);
}
-
-
-
-
+
+
+
+
setLexer(lexName);
applySettings();
@@ -1379,8 +1379,8 @@ void SciDoc::applySettings() {
QsciScintilla* edit = edits[i];
// indents
- //edit->setTabWidth(EditorSettings::get(EditorSettings::TabWidth));
- //edit->setIndentationsUseTabs(EditorSettings::get(EditorSettings::UseTabs));
+ edit->setTabWidth(EditorSettings::get(EditorSettings::TabWidth));
+ edit->setIndentationsUseTabs(EditorSettings::get(EditorSettings::UseTabs));
edit->setBackspaceUnindents(EditorSettings::get(EditorSettings::BackspaceUnindents));
// colors
@@ -1562,4 +1562,9 @@ Juff::SessionParams SciDoc::sessionParams() const {
return params;
}
+JuffScintilla*
+SciDoc::getCurrentEditor() const{
+ return int_->curEdit_;
+}
+
}
diff --git a/src/app/qsci/SciDoc.h b/src/app/qsci/SciDoc.h
index 58edad1..69a7547 100644
--- a/src/app/qsci/SciDoc.h
+++ b/src/app/qsci/SciDoc.h
@@ -155,6 +155,9 @@ private:
class Interior;
Interior* int_;
+
+public:
+ JuffScintilla* getCurrentEditor() const;
};
}

Event Timeline