"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2bREHighlighter.cpp" between
cb2bib-1.9.9.tar.gz and cb2bib-2.0.0.tar.gz

About: cb2Bib is a multiplatform application for rapidly extracting unformatted, or unstandardized bibliographic references from email alerts, journal Web pages, and PDF files.

c2bREHighlighter.cpp  (cb2bib-1.9.9):c2bREHighlighter.cpp  (cb2bib-2.0.0)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans * Copyright (C) 2004-2019 by Pere Constans
* constans@molspaces.com * constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3. * cb2Bib version 2.0.0. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution. * See the LICENSE file that comes with this distribution.
***************************************************************************/ ***************************************************************************/
#include "c2bREHighlighter.h" #include "c2bREHighlighter.h"
#include "c2bSettings.h" #include "c2bSettings.h"
#include <QPalette> #include <QPalette>
#include <QTextDocument> #include <QTextDocument>
c2bREHighlighter::c2bREHighlighter(QTextDocument* doc) : QSyntaxHighlighter(doc) c2bREHighlighter::c2bREHighlighter(QTextDocument* doc) : QSyntaxHighlighter(doc)
{ {
skipping to change at line 35 skipping to change at line 35
rx0.setMinimal(true); rx0.setMinimal(true);
rx1 = QRegExp("\\b(?:article|book|booklet|conference|inbook|incollection|" rx1 = QRegExp("\\b(?:article|book|booklet|conference|inbook|incollection|"
"inproceedings|manual|mastersthesis|misc|periodical|phdthesis| " "inproceedings|manual|mastersthesis|misc|periodical|phdthesis| "
"proceedings|techreport|unpublished)\\b"); "proceedings|techreport|unpublished)\\b");
rx2 = QRegExp("^[a-z_]+=\\S.+$"); rx2 = QRegExp("^[a-z_]+=\\S.+$");
rx3 = QRegExp("^[a-z_]+="); rx3 = QRegExp("^[a-z_]+=");
rx4 = QRegExp("<<[a-z]+>>"); rx4 = QRegExp("<<[a-z]+>>");
rx5 = QRegExp("^#.*$"); rx5 = QRegExp("^#.*$");
} }
c2bREHighlighter::~c2bREHighlighter() c2bREHighlighter::~c2bREHighlighter() {}
{}
void c2bREHighlighter::highlightBlock(const QString& text) void c2bREHighlighter::highlightBlock(const QString& text)
{ {
const int len(text.length()); const int len(text.length());
setFormat(0, len - 1, text_color); setFormat(0, len - 1, text_color);
int pos(0); int pos(0);
while (pos >= 0) while (pos >= 0)
{ {
pos = rx0.indexIn(text, pos); pos = rx0.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx0.matchedLength(), c->bib_reference_field_color); setFormat(pos, rx0.matchedLength(), c->bib_reference_field_color);
pos += rx0.matchedLength(); pos += rx0.matchedLength();
} }
} }
pos = 0; pos = 0;
while (pos >= 0) while (pos >= 0)
{ {
pos = rx1.indexIn(text, pos); pos = rx1.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx1.matchedLength(), c->bib_reference_type_color); setFormat(pos, rx1.matchedLength(), c->bib_reference_type_color);
pos += rx1.matchedLength(); pos += rx1.matchedLength();
} }
} }
pos = 0; pos = 0;
while (pos >= 0) while (pos >= 0)
{ {
pos = rx2.indexIn(text, pos); pos = rx2.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx2.matchedLength(), c->netqinf_command_content_color ); setFormat(pos, rx2.matchedLength(), c->netqinf_command_content_color );
pos += rx2.matchedLength(); pos += rx2.matchedLength();
} }
} }
pos = 0; pos = 0;
while (pos >= 0) while (pos >= 0)
{ {
pos = rx3.indexIn(text, pos); pos = rx3.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx3.matchedLength(), c->netqinf_command_key_color); setFormat(pos, rx3.matchedLength(), c->netqinf_command_key_color);
pos += rx3.matchedLength(); pos += rx3.matchedLength();
} }
} }
pos = 0; pos = 0;
while (pos >= 0) while (pos >= 0)
{ {
pos = rx4.indexIn(text, pos); pos = rx4.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx4.matchedLength(), c->cb2bib_tag_color); setFormat(pos, rx4.matchedLength(), c->cb2bib_tag_color);
pos += rx4.matchedLength(); pos += rx4.matchedLength();
} }
} }
pos = 0; pos = 0;
while (pos >= 0) while (pos >= 0)
{ {
pos = rx5.indexIn(text, pos); pos = rx5.indexIn(text, pos);
if (pos > -1) if (pos > -1)
{ {
setFormat(pos, rx5.matchedLength(), c->comment_color); setFormat(pos, rx5.matchedLength(), c->comment_color);
pos += rx5.matchedLength(); pos += rx5.matchedLength();
} }
} }
} }
 End of changes. 9 change blocks. 
10 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)