Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katehighlight.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 0d2c283..539d356 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp | |||
@@ -16,32 +16,36 @@ | |||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <string.h> | ||
23 | |||
24 | #include <qtextstream.h> | ||
25 | #include <qpe/config.h> | ||
26 | #include <kglobal.h> | ||
27 | //#include <kinstance.h> | ||
28 | //#include <kmimemagic.h> | ||
29 | #include <klocale.h> | ||
30 | //#include <kregexp.h> | ||
31 | #include <kglobalsettings.h> | ||
32 | #include <kdebug.h> | ||
33 | #include <kstddirs.h> | ||
34 | |||
35 | #include "katehighlight.h" | 22 | #include "katehighlight.h" |
36 | |||
37 | |||
38 | #include "katetextline.h" | 23 | #include "katetextline.h" |
39 | #include "katedocument.h" | 24 | #include "katedocument.h" |
40 | #include "katesyntaxdocument.h" | 25 | #include "katesyntaxdocument.h" |
41 | 26 | ||
27 | #include "kglobal.h" | ||
28 | //#include "kinstance.h" | ||
29 | //#include "kmimemagic.h" | ||
30 | #include "klocale.h" | ||
31 | //#include "kregexp.h" | ||
32 | #include "kglobalsettings.h" | ||
33 | #include "kdebug.h" | ||
34 | #include "kstddirs.h" | ||
35 | |||
36 | /* OPIE */ | ||
37 | #include <opie2/odebug.h> | ||
38 | #include <qpe/config.h> | ||
39 | |||
40 | /* QT */ | ||
41 | #include <qtextstream.h> | ||
42 | |||
43 | /* STD */ | ||
44 | #include <string.h> | ||
45 | |||
42 | 46 | ||
43 | HlManager *HlManager::s_pSelf = 0; | 47 | HlManager *HlManager::s_pSelf = 0; |
44 | 48 | ||
45 | enum Item_styles { dsNormal,dsKeyword,dsDataType,dsDecVal,dsBaseN,dsFloat,dsChar,dsString,dsComment,dsOthers}; | 49 | enum Item_styles { dsNormal,dsKeyword,dsDataType,dsDecVal,dsBaseN,dsFloat,dsChar,dsString,dsComment,dsOthers}; |
46 | 50 | ||
47 | static bool trueBool = true; | 51 | static bool trueBool = true; |
@@ -618,13 +622,13 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) | |||
618 | { | 622 | { |
619 | if (item->startEnable(lastChar)) | 623 | if (item->startEnable(lastChar)) |
620 | { | 624 | { |
621 | s2 = item->checkHgl(s1, len-z, z==0); | 625 | s2 = item->checkHgl(s1, len-z, z==0); |
622 | if (s2 > s1) | 626 | if (s2 > s1) |
623 | { | 627 | { |
624 | qDebug("An item has been detected"); | 628 | odebug << "An item has been detected" << oendl; |
625 | textLine->setAttribs(item->attr,s1 - str,s2 - str); | 629 | textLine->setAttribs(item->attr,s1 - str,s2 - str); |
626 | ctxNum = item->ctx; | 630 | ctxNum = item->ctx; |
627 | context = contextList[ctxNum]; | 631 | context = contextList[ctxNum]; |
628 | z = z + s2 - s1 - 1; | 632 | z = z + s2 - s1 - 1; |
629 | s1 = s2 - 1; | 633 | s1 = s2 - 1; |
630 | found = true; | 634 | found = true; |
@@ -850,13 +854,13 @@ void Highlight::done() | |||
850 | ************* | 854 | ************* |
851 | * return value: none | 855 | * return value: none |
852 | *******************************************************************************************/ | 856 | *******************************************************************************************/ |
853 | 857 | ||
854 | void Highlight::createItemData(ItemDataList &list) | 858 | void Highlight::createItemData(ItemDataList &list) |
855 | { | 859 | { |
856 | qDebug("Highlight::createItemData"); | 860 | odebug << "Highlight::createItemData" << oendl; |
857 | 861 | ||
858 | // If no highlighting is selected we need only one default. | 862 | // If no highlighting is selected we need only one default. |
859 | if (noHl) | 863 | if (noHl) |
860 | { | 864 | { |
861 | list.append(new ItemData(I18N_NOOP("Normal Text"), dsNormal)); | 865 | list.append(new ItemData(I18N_NOOP("Normal Text"), dsNormal)); |
862 | return; | 866 | return; |
@@ -871,21 +875,21 @@ void Highlight::createItemData(ItemDataList &list) | |||
871 | if (internalIDList.count()==0) | 875 | if (internalIDList.count()==0) |
872 | { | 876 | { |
873 | //if all references to the list are destried the contents will also be deleted | 877 | //if all references to the list are destried the contents will also be deleted |
874 | internalIDList.setAutoDelete(true); | 878 | internalIDList.setAutoDelete(true); |
875 | syntaxContextData *data; | 879 | syntaxContextData *data; |
876 | 880 | ||
877 | qDebug("Trying to read itemData section"); | 881 | odebug << "Trying to read itemData section" << oendl; |
878 | 882 | ||
879 | //Tell the syntax document class which file we want to parse and which data group | 883 | //Tell the syntax document class which file we want to parse and which data group |
880 | HlManager::self()->syntax->setIdentifier(identifier); | 884 | HlManager::self()->syntax->setIdentifier(identifier); |
881 | data=HlManager::self()->syntax->getGroupInfo("highlighting","itemData"); | 885 | data=HlManager::self()->syntax->getGroupInfo("highlighting","itemData"); |
882 | //begin with the real parsing | 886 | //begin with the real parsing |
883 | while (HlManager::self()->syntax->nextGroup(data)) | 887 | while (HlManager::self()->syntax->nextGroup(data)) |
884 | { | 888 | { |
885 | qDebug("Setting up one itemData element"); | 889 | odebug << "Setting up one itemData element" << oendl; |
886 | // read all attributes | 890 | // read all attributes |
887 | color=HlManager::self()->syntax->groupData(data,QString("color")); | 891 | color=HlManager::self()->syntax->groupData(data,QString("color")); |
888 | selColor=HlManager::self()->syntax->groupData(data,QString("selColor")); | 892 | selColor=HlManager::self()->syntax->groupData(data,QString("selColor")); |
889 | bold=HlManager::self()->syntax->groupData(data,QString("bold")); | 893 | bold=HlManager::self()->syntax->groupData(data,QString("bold")); |
890 | italic=HlManager::self()->syntax->groupData(data,QString("italic")); | 894 | italic=HlManager::self()->syntax->groupData(data,QString("italic")); |
891 | //check if the user overrides something | 895 | //check if the user overrides something |
@@ -1309,22 +1313,22 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { | |||
1309 | ItemStyleList defaultStyleList; | 1313 | ItemStyleList defaultStyleList; |
1310 | ItemStyle *defaultStyle; | 1314 | ItemStyle *defaultStyle; |
1311 | ItemDataList itemDataList; | 1315 | ItemDataList itemDataList; |
1312 | ItemData *itemData; | 1316 | ItemData *itemData; |
1313 | int nAttribs, z; | 1317 | int nAttribs, z; |
1314 | 1318 | ||
1315 | qDebug("HlManager::makeAttribs"); | 1319 | odebug << "HlManager::makeAttribs" << oendl; |
1316 | 1320 | ||
1317 | defaultStyleList.setAutoDelete(true); | 1321 | defaultStyleList.setAutoDelete(true); |
1318 | getDefaults(defaultStyleList); | 1322 | getDefaults(defaultStyleList); |
1319 | 1323 | ||
1320 | // itemDataList.setAutoDelete(true); | 1324 | // itemDataList.setAutoDelete(true); |
1321 | highlight->getItemDataList(itemDataList); | 1325 | highlight->getItemDataList(itemDataList); |
1322 | nAttribs = itemDataList.count(); | 1326 | nAttribs = itemDataList.count(); |
1323 | for (z = 0; z < nAttribs; z++) { | 1327 | for (z = 0; z < nAttribs; z++) { |
1324 | qDebug("HlManager::makeAttribs: createing one attribute definition"); | 1328 | odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; |
1325 | itemData = itemDataList.at(z); | 1329 | itemData = itemDataList.at(z); |
1326 | if (itemData->defStyle) { | 1330 | if (itemData->defStyle) { |
1327 | // default style | 1331 | // default style |
1328 | defaultStyle = defaultStyleList.at(itemData->defStyleNum); | 1332 | defaultStyle = defaultStyleList.at(itemData->defStyleNum); |
1329 | a[z].col = defaultStyle->col; | 1333 | a[z].col = defaultStyle->col; |
1330 | a[z].selCol = defaultStyle->selCol; | 1334 | a[z].selCol = defaultStyle->selCol; |