summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katehighlight.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katehighlight.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp126
1 files changed, 65 insertions, 61 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
@@ -1,65 +1,69 @@
1/* 1/*
2 Copyright (C) 1998, 1999 Jochen Wilhelmy 2 Copyright (C) 1998, 1999 Jochen Wilhelmy
3 digisnap@cs.tu-berlin.de 3 digisnap@cs.tu-berlin.de
4 (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> 4 (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org>
5 (C) 2002 Joseph Wenninger <jowenn@kde.org> 5 (C) 2002 Joseph Wenninger <jowenn@kde.org>
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
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
43HlManager *HlManager::s_pSelf = 0; 47HlManager *HlManager::s_pSelf = 0;
44 48
45enum Item_styles { dsNormal,dsKeyword,dsDataType,dsDecVal,dsBaseN,dsFloat,dsChar,dsString,dsComment,dsOthers}; 49enum Item_styles { dsNormal,dsKeyword,dsDataType,dsDecVal,dsBaseN,dsFloat,dsChar,dsString,dsComment,dsOthers};
46 50
47static bool trueBool = true; 51static bool trueBool = true;
48static QString stdDeliminator = QString ("!%&()*+,-./:;<=>?[]^{|}~ \t\\"); 52static QString stdDeliminator = QString ("!%&()*+,-./:;<=>?[]^{|}~ \t\\");
49 53
50int getDefStyleNum(QString name) 54int getDefStyleNum(QString name)
51{ 55{
52 if (name=="dsNormal") return dsNormal; 56 if (name=="dsNormal") return dsNormal;
53 if (name=="dsKeyword") return dsKeyword; 57 if (name=="dsKeyword") return dsKeyword;
54 if (name=="dsDataType") return dsDataType; 58 if (name=="dsDataType") return dsDataType;
55 if (name=="dsDecVal") return dsDecVal; 59 if (name=="dsDecVal") return dsDecVal;
56 if (name=="dsBaseN") return dsBaseN; 60 if (name=="dsBaseN") return dsBaseN;
57 if (name=="dsFloat") return dsFloat; 61 if (name=="dsFloat") return dsFloat;
58 if (name=="dsChar") return dsChar; 62 if (name=="dsChar") return dsChar;
59 if (name=="dsString") return dsString; 63 if (name=="dsString") return dsString;
60 if (name=="dsComment") return dsComment; 64 if (name=="dsComment") return dsComment;
61 if (name=="dsOthers") return dsOthers; 65 if (name=="dsOthers") return dsOthers;
62 66
63 return dsNormal; 67 return dsNormal;
64} 68}
65 69
@@ -99,50 +103,50 @@ const QChar *HlCharDetect::checkHgl(const QChar *str, int len, bool) {
99} 103}
100 104
101Hl2CharDetect::Hl2CharDetect(int attribute, int context, QChar ch1, QChar ch2) 105Hl2CharDetect::Hl2CharDetect(int attribute, int context, QChar ch1, QChar ch2)
102 : HlItem(attribute,context) { 106 : HlItem(attribute,context) {
103 sChar1 = ch1; 107 sChar1 = ch1;
104 sChar2 = ch2; 108 sChar2 = ch2;
105} 109}
106 110
107const QChar *Hl2CharDetect::checkHgl(const QChar *str, int len, bool) { 111const QChar *Hl2CharDetect::checkHgl(const QChar *str, int len, bool) {
108 if (str[0] == sChar1 && str[1] == sChar2) return str + 2; 112 if (str[0] == sChar1 && str[1] == sChar2) return str + 2;
109 return 0L; 113 return 0L;
110} 114}
111 115
112HlStringDetect::HlStringDetect(int attribute, int context, const QString &s, bool inSensitive) 116HlStringDetect::HlStringDetect(int attribute, int context, const QString &s, bool inSensitive)
113 : HlItem(attribute, context), str(inSensitive ? s.upper():s), _inSensitive(inSensitive) { 117 : HlItem(attribute, context), str(inSensitive ? s.upper():s), _inSensitive(inSensitive) {
114} 118}
115 119
116HlStringDetect::~HlStringDetect() { 120HlStringDetect::~HlStringDetect() {
117} 121}
118 122
119const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { 123const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) {
120 if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();} 124 if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();}
121 else 125 else
122 { 126 {
123 QString tmp=QString(s,str.length()).upper(); 127 QString tmp=QString(s,str.length()).upper();
124 if (tmp==str) return s+str.length(); 128 if (tmp==str) return s+str.length();
125 } 129 }
126 return 0L; 130 return 0L;
127} 131}
128 132
129 133
130HlRangeDetect::HlRangeDetect(int attribute, int context, QChar ch1, QChar ch2) 134HlRangeDetect::HlRangeDetect(int attribute, int context, QChar ch1, QChar ch2)
131 : HlItem(attribute,context) { 135 : HlItem(attribute,context) {
132 sChar1 = ch1; 136 sChar1 = ch1;
133 sChar2 = ch2; 137 sChar2 = ch2;
134} 138}
135 139
136const QChar *HlRangeDetect::checkHgl(const QChar *s, int len, bool) { 140const QChar *HlRangeDetect::checkHgl(const QChar *s, int len, bool) {
137 if (*s == sChar1) 141 if (*s == sChar1)
138 { 142 {
139 do 143 do
140 { 144 {
141 s++; 145 s++;
142 len--; 146 len--;
143 if (len == 0) return 0L; 147 if (len == 0) return 0L;
144 } 148 }
145 while (*s != sChar2); 149 while (*s != sChar2);
146 150
147 return s + 1; 151 return s + 1;
148 } 152 }
@@ -192,91 +196,91 @@ const QChar *HlKeyword::checkHgl(const QChar *s, int len, bool b)
192 len--; 196 len--;
193 } 197 }
194 198
195 if (s2 == s) return 0L; 199 if (s2 == s) return 0L;
196 200
197 QString lookup = QString(s,s2-s); 201 QString lookup = QString(s,s2-s);
198 202
199 if ( dict.find(lookup) ) return s2; 203 if ( dict.find(lookup) ) return s2;
200 return 0L; 204 return 0L;
201} 205}
202 206
203HlInt::HlInt(int attribute, int context) 207HlInt::HlInt(int attribute, int context)
204 : HlItem(attribute,context) { 208 : HlItem(attribute,context) {
205} 209}
206 210
207const QChar *HlInt::checkHgl(const QChar *str, int len, bool) { 211const QChar *HlInt::checkHgl(const QChar *str, int len, bool) {
208 const QChar *s,*s1; 212 const QChar *s,*s1;
209 213
210 s = str; 214 s = str;
211 while (s->isDigit()) s++; 215 while (s->isDigit()) s++;
212 if (s > str) 216 if (s > str)
213 { 217 {
214 if (subItems) 218 if (subItems)
215 { 219 {
216 for (HlItem *it=subItems->first();it;it=subItems->next()) 220 for (HlItem *it=subItems->first();it;it=subItems->next())
217 { 221 {
218 s1=it->checkHgl(s, len, false); 222 s1=it->checkHgl(s, len, false);
219 if (s1) return s1; 223 if (s1) return s1;
220 } 224 }
221 } 225 }
222 return s; 226 return s;
223 } 227 }
224 return 0L; 228 return 0L;
225} 229}
226 230
227HlFloat::HlFloat(int attribute, int context) 231HlFloat::HlFloat(int attribute, int context)
228 : HlItem(attribute,context) { 232 : HlItem(attribute,context) {
229} 233}
230 234
231const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { 235const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) {
232 bool b, p; 236 bool b, p;
233 const QChar *s1; 237 const QChar *s1;
234 238
235 b = false; 239 b = false;
236 while (s->isDigit()){ 240 while (s->isDigit()){
237 s++; 241 s++;
238 b = true; 242 b = true;
239 } 243 }
240 if (p = (*s == '.')) { 244 if (p = (*s == '.')) {
241 s++; 245 s++;
242 while (s->isDigit()) { 246 while (s->isDigit()) {
243 s++; 247 s++;
244 b = true; 248 b = true;
245 } 249 }
246 } 250 }
247 if (!b) return 0L; 251 if (!b) return 0L;
248 if ((*s&0xdf) == 'E') s++; 252 if ((*s&0xdf) == 'E') s++;
249 else 253 else
250 if (!p) return 0L; 254 if (!p) return 0L;
251 else 255 else
252 { 256 {
253 if (subItems) 257 if (subItems)
254 { 258 {
255 for (HlItem *it=subItems->first();it;it=subItems->next()) 259 for (HlItem *it=subItems->first();it;it=subItems->next())
256 { 260 {
257 s1=it->checkHgl(s, len, false); 261 s1=it->checkHgl(s, len, false);
258 if (s1) return s1; 262 if (s1) return s1;
259 } 263 }
260 } 264 }
261 return s; 265 return s;
262 } 266 }
263 if ((*s == '-')||(*s =='+')) s++; 267 if ((*s == '-')||(*s =='+')) s++;
264 b = false; 268 b = false;
265 while (s->isDigit()) { 269 while (s->isDigit()) {
266 s++; 270 s++;
267 b = true; 271 b = true;
268 } 272 }
269 if (b) 273 if (b)
270 { 274 {
271 if (subItems) 275 if (subItems)
272 { 276 {
273 for (HlItem *it=subItems->first();it;it=subItems->next()) 277 for (HlItem *it=subItems->first();it;it=subItems->next())
274 { 278 {
275 s1=it->checkHgl(s, len, false); 279 s1=it->checkHgl(s, len, false);
276 if (s1) return s1; 280 if (s1) return s1;
277 } 281 }
278 } 282 }
279 return s; 283 return s;
280 } 284 }
281 else return 0L; 285 else return 0L;
282} 286}
@@ -324,49 +328,49 @@ const QChar *HlCOct::checkHgl(const QChar *str, int len, bool) {
324 s = str; 328 s = str;
325 while (*s >= '0' && *s <= '7') s++; 329 while (*s >= '0' && *s <= '7') s++;
326 if (s > str) { 330 if (s > str) {
327 if ((*s&0xdf) == 'L' || (*s&0xdf) == 'U' ) s++; 331 if ((*s&0xdf) == 'L' || (*s&0xdf) == 'U' ) s++;
328 return s; 332 return s;
329 } 333 }
330 } 334 }
331 return 0L; 335 return 0L;
332} 336}
333 337
334HlCHex::HlCHex(int attribute, int context) 338HlCHex::HlCHex(int attribute, int context)
335 : HlItem(attribute,context) { 339 : HlItem(attribute,context) {
336} 340}
337 341
338const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { 342const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) {
339 const QChar *s=str; 343 const QChar *s=str;
340#if 0 344#if 0
341 int i; 345 int i;
342 for (i=0;(*s)!='\0';s++,i++); 346 for (i=0;(*s)!='\0';s++,i++);
343 QString line(str,i); 347 QString line(str,i);
344 QRegExp3 rx("0[xX][a-fA-F\\d]+[UuLl]?"); // this matches but is also matching parenthesis 348 QRegExp3 rx("0[xX][a-fA-F\\d]+[UuLl]?"); // this matches but is also matching parenthesis
345 int pos=rx.search(line,0); 349 int pos=rx.search(line,0);
346 if(pos > -1) return str+rx.matchedLength(); 350 if(pos > -1) return str+rx.matchedLength();
347 else 351 else
348 return 0L; 352 return 0L;
349 353
350#else 354#else
351 if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) { 355 if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) {
352 str += 2; 356 str += 2;
353 s = str; 357 s = str;
354 while (s->isDigit() || ((*s&0xdf) >= 'A' && (*s&0xdf) <= 'F') /*|| (*s >= 'a' && *s <= 'f')*/) s++; 358 while (s->isDigit() || ((*s&0xdf) >= 'A' && (*s&0xdf) <= 'F') /*|| (*s >= 'a' && *s <= 'f')*/) s++;
355 if (s > str) { 359 if (s > str) {
356 if ((*s&0xdf) == 'L' || (*s&0xdf) == 'U' ) s++; 360 if ((*s&0xdf) == 'L' || (*s&0xdf) == 'U' ) s++;
357 return s; 361 return s;
358 } 362 }
359 } 363 }
360 return 0L; 364 return 0L;
361#endif 365#endif
362} 366}
363 367
364HlCFloat::HlCFloat(int attribute, int context) 368HlCFloat::HlCFloat(int attribute, int context)
365 : HlFloat(attribute,context) { 369 : HlFloat(attribute,context) {
366} 370}
367 371
368const QChar *HlCFloat::checkHgl(const QChar *s, int len, bool lineStart) { 372const QChar *HlCFloat::checkHgl(const QChar *s, int len, bool lineStart) {
369 373
370 s = HlFloat::checkHgl(s, len, lineStart); 374 s = HlFloat::checkHgl(s, len, lineStart);
371 if (s && ((*s&0xdf) == 'F' )) s++; 375 if (s && ((*s&0xdf) == 'F' )) s++;
372 return s; 376 return s;
@@ -379,62 +383,62 @@ HlAnyChar::HlAnyChar(int attribute, int context, const QChar* charList, uint len
379} 383}
380 384
381const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool) 385const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool)
382{ 386{
383 if (ustrchr(_charList, _charListLen, *s)) return s +1; 387 if (ustrchr(_charList, _charListLen, *s)) return s +1;
384 return 0L; 388 return 0L;
385} 389}
386 390
387HlRegExpr::HlRegExpr(int attribute, int context,QString regexp) 391HlRegExpr::HlRegExpr(int attribute, int context,QString regexp)
388 : HlItem(attribute, context) { 392 : HlItem(attribute, context) {
389 393
390 handlesLinestart=regexp.startsWith("^"); 394 handlesLinestart=regexp.startsWith("^");
391 if(!handlesLinestart) regexp.prepend("^"); 395 if(!handlesLinestart) regexp.prepend("^");
392 Expr=new QRegExp3(regexp); 396 Expr=new QRegExp3(regexp);
393} 397}
394 398
395const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) 399const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
396{ 400{
397 if ((!lineStart) && handlesLinestart) return 0; 401 if ((!lineStart) && handlesLinestart) return 0;
398 402
399 QString line(s,len); 403 QString line(s,len);
400 int pos = Expr->search( line, 0 ); 404 int pos = Expr->search( line, 0 );
401 if (pos==-1) return 0L; 405 if (pos==-1) return 0L;
402 else 406 else
403 return (s+Expr->matchedLength()); 407 return (s+Expr->matchedLength());
404}; 408};
405 409
406 410
407HlLineContinue::HlLineContinue(int attribute, int context) 411HlLineContinue::HlLineContinue(int attribute, int context)
408 : HlItem(attribute,context) { 412 : HlItem(attribute,context) {
409} 413}
410 414
411const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { 415const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) {
412 416
413 if ((s[0].latin1() == '\\') && (len == 1)) 417 if ((s[0].latin1() == '\\') && (len == 1))
414 { 418 {
415 return s + 1; 419 return s + 1;
416 } 420 }
417 return 0L; 421 return 0L;
418} 422}
419 423
420 424
421HlCStringChar::HlCStringChar(int attribute, int context) 425HlCStringChar::HlCStringChar(int attribute, int context)
422 : HlItem(attribute,context) { 426 : HlItem(attribute,context) {
423} 427}
424 428
425//checks for hex and oct (for example \x1b or \033) 429//checks for hex and oct (for example \x1b or \033)
426const QChar *checkCharHexOct(const QChar *str) { 430const QChar *checkCharHexOct(const QChar *str) {
427 const QChar *s; 431 const QChar *s;
428 s=str; 432 s=str;
429 int n; 433 int n;
430 if (*s == 'x') { 434 if (*s == 'x') {
431 n = 0; 435 n = 0;
432 do { 436 do {
433 s++; 437 s++;
434 n *= 16; 438 n *= 16;
435 if (s->isDigit()) n += *s - '0'; 439 if (s->isDigit()) n += *s - '0';
436 else if ((*s&0xdf) >= 'A' && (*s&0xdf) <= 'F') n += (*s&0xdf) - 'A' + 10; 440 else if ((*s&0xdf) >= 'A' && (*s&0xdf) <= 'F') n += (*s&0xdf) - 'A' + 10;
437// else if (*s >= 'a' && *s <= 'f') n += *s - 'a' + 10; 441// else if (*s >= 'a' && *s <= 'f') n += *s - 'a' + 10;
438 else break; 442 else break;
439 if (n >= 256) return 0L; 443 if (n >= 256) return 0L;
440 } while (true); 444 } while (true);
@@ -600,49 +604,49 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine)
600 QChar lastChar = ' '; 604 QChar lastChar = ' ';
601 605
602 // first char 606 // first char
603 const QChar *str = textLine->getText(); 607 const QChar *str = textLine->getText();
604 608
605 // non space char - index of that char 609 // non space char - index of that char
606 const QChar *s1 = textLine->firstNonSpace(); 610 const QChar *s1 = textLine->firstNonSpace();
607 uint z = textLine->firstChar(); 611 uint z = textLine->firstChar();
608 612
609 // length of textline 613 // length of textline
610 uint len = textLine->length(); 614 uint len = textLine->length();
611 615
612 bool found = false; 616 bool found = false;
613 while (z < len) 617 while (z < len)
614 { 618 {
615 found = false; 619 found = false;
616 620
617 for (item = context->items.first(); item != 0L; item = context->items.next()) 621 for (item = context->items.first(); item != 0L; item = context->items.next())
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;
631 break; 635 break;
632 } 636 }
633 } 637 }
634 } 638 }
635 639
636 // nothing found: set attribute of one char 640 // nothing found: set attribute of one char
637 if (!found) 641 if (!found)
638 textLine->setAttribs(context->attr,s1 - str,s1 - str + 1); 642 textLine->setAttribs(context->attr,s1 - str,s1 - str + 1);
639 643
640 lastChar = *s1; 644 lastChar = *s1;
641 s1++; 645 s1++;
642 z++; 646 z++;
643 } 647 }
644 648
645 //set "end of line"-properties 649 //set "end of line"-properties
646 textLine->setAttr(context->attr); 650 textLine->setAttr(context->attr);
647 651
648 //return new context 652 //return new context
@@ -832,78 +836,78 @@ void Highlight::done()
832{ 836{
833 if (noHl) 837 if (noHl)
834 return; 838 return;
835 839
836 for (int z = 0; z < nContexts; z++) delete contextList[z]; 840 for (int z = 0; z < nContexts; z++) delete contextList[z];
837} 841}
838 842
839 843
840/******************************************************************************************* 844/*******************************************************************************************
841 Highlight - createItemData 845 Highlight - createItemData
842 This function reads the itemData entries from the config file, which specifies the 846 This function reads the itemData entries from the config file, which specifies the
843 default attribute styles for matched items/contexts. 847 default attribute styles for matched items/contexts.
844 848
845 * input: none 849 * input: none
846 ************* 850 *************
847 * output: ItemDataList &list :A reference to the internal 851 * output: ItemDataList &list :A reference to the internal
848 list containing the parsed 852 list containing the parsed
849 default config 853 default config
850 ************* 854 *************
851 * return value: none 855 * return value: none
852*******************************************************************************************/ 856*******************************************************************************************/
853 857
854void Highlight::createItemData(ItemDataList &list) 858void 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;
863 } 867 }
864 868
865 QString color; 869 QString color;
866 QString selColor; 870 QString selColor;
867 QString bold; 871 QString bold;
868 QString italic; 872 QString italic;
869 873
870 // If the internal list isn't already available read the config file 874 // If the internal list isn't already available read the config file
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
892 if ( (!color.isEmpty()) && (!selColor.isEmpty()) && (!bold.isEmpty()) && (!italic.isEmpty())) 896 if ( (!color.isEmpty()) && (!selColor.isEmpty()) && (!bold.isEmpty()) && (!italic.isEmpty()))
893 { 897 {
894 //create a user defined style 898 //create a user defined style
895 internalIDList.append(new ItemData( 899 internalIDList.append(new ItemData(
896 HlManager::self()->syntax->groupData(data,QString("name")).simplifyWhiteSpace(), 900 HlManager::self()->syntax->groupData(data,QString("name")).simplifyWhiteSpace(),
897 getDefStyleNum(HlManager::self()->syntax->groupData(data,QString("defStyleNum"))), 901 getDefStyleNum(HlManager::self()->syntax->groupData(data,QString("defStyleNum"))),
898 QColor(color),QColor(selColor),(bold=="true") || (bold=="1"), (italic=="true") || (italic=="1") 902 QColor(color),QColor(selColor),(bold=="true") || (bold=="1"), (italic=="true") || (italic=="1")
899 )); 903 ));
900 } 904 }
901 else 905 else
902 { 906 {
903 //assign a default style 907 //assign a default style
904 internalIDList.append(new ItemData( 908 internalIDList.append(new ItemData(
905 HlManager::self()->syntax->groupData(data,QString("name")).simplifyWhiteSpace(), 909 HlManager::self()->syntax->groupData(data,QString("name")).simplifyWhiteSpace(),
906 getDefStyleNum(HlManager::self()->syntax->groupData(data,QString("defStyleNum"))))); 910 getDefStyleNum(HlManager::self()->syntax->groupData(data,QString("defStyleNum")))));
907 911
908 } 912 }
909 } 913 }
@@ -912,54 +916,54 @@ void Highlight::createItemData(ItemDataList &list)
912 } 916 }
913 917
914 //set the ouput reference 918 //set the ouput reference
915 list=internalIDList; 919 list=internalIDList;
916} 920}
917 921
918 922
919/******************************************************************************************* 923/*******************************************************************************************
920 Highlight - lookupAttrName 924 Highlight - lookupAttrName
921 This function is a helper for makeContextList and createHlItem. It looks the given 925 This function is a helper for makeContextList and createHlItem. It looks the given
922 attribute name in the itemData list up and returns it's index 926 attribute name in the itemData list up and returns it's index
923 927
924 * input: QString &name :the attribute name to lookup 928 * input: QString &name :the attribute name to lookup
925 * ItemDataList &iDl :the list containing all 929 * ItemDataList &iDl :the list containing all
926 * available attributes 930 * available attributes
927 ************* 931 *************
928 * output: none 932 * output: none
929 ************* 933 *************
930 * return value: int :The index of the attribute 934 * return value: int :The index of the attribute
931 * or 0 935 * or 0
932*******************************************************************************************/ 936*******************************************************************************************/
933 937
934int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) 938int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl)
935{ 939{
936 for (int i=0;i<iDl.count();i++) 940 for (int i=0;i<iDl.count();i++)
937 { 941 {
938 if (iDl.at(i)->name==name) return i; 942 if (iDl.at(i)->name==name) return i;
939 } 943 }
940 kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; 944 kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl;
941 return 0; 945 return 0;
942} 946}
943 947
944 948
945/******************************************************************************************* 949/*******************************************************************************************
946 Highlight - createHlItem 950 Highlight - createHlItem
947 This function is a helper for makeContextList. It parses the xml file for 951 This function is a helper for makeContextList. It parses the xml file for
948 information, how single or multi line comments are marked 952 information, how single or multi line comments are marked
949 953
950 * input: syntaxContextData *data : Data about the item read from 954 * input: syntaxContextData *data : Data about the item read from
951 * the xml file 955 * the xml file
952 * ItemDataList &iDl : List of all available itemData 956 * ItemDataList &iDl : List of all available itemData
953 * entries. Needed for attribute 957 * entries. Needed for attribute
954 * name->index translation 958 * name->index translation
955 ************* 959 *************
956 * output: none 960 * output: none
957 ************* 961 *************
958 * return value: HlItem * : Pointer to the newly created item 962 * return value: HlItem * : Pointer to the newly created item
959 * object 963 * object
960*******************************************************************************************/ 964*******************************************************************************************/
961 965
962HlItem *Highlight::createHlItem(syntaxContextData *data, ItemDataList &iDl) 966HlItem *Highlight::createHlItem(syntaxContextData *data, ItemDataList &iDl)
963{ 967{
964 // No highlighting -> exit 968 // No highlighting -> exit
965 if (noHl) 969 if (noHl)
@@ -1056,105 +1060,105 @@ bool Highlight::isInWord(QChar c)
1056 This function is a helper for makeContextList. It parses the xml file for 1060 This function is a helper for makeContextList. It parses the xml file for
1057 information, how single or multi line comments are marked 1061 information, how single or multi line comments are marked
1058 1062
1059 * input: none 1063 * input: none
1060 ************* 1064 *************
1061 * output: none 1065 * output: none
1062 ************* 1066 *************
1063 * return value: none 1067 * return value: none
1064*******************************************************************************************/ 1068*******************************************************************************************/
1065 1069
1066void Highlight::readCommentConfig() 1070void Highlight::readCommentConfig()
1067{ 1071{
1068 1072
1069 cslStart = ""; 1073 cslStart = "";
1070 HlManager::self()->syntax->setIdentifier(identifier); 1074 HlManager::self()->syntax->setIdentifier(identifier);
1071 1075
1072 syntaxContextData *data=HlManager::self()->syntax->getGroupInfo("general","comment"); 1076 syntaxContextData *data=HlManager::self()->syntax->getGroupInfo("general","comment");
1073 if (data) 1077 if (data)
1074 { 1078 {
1075// kdDebug(13010)<<"COMMENT DATA FOUND"<<endl; 1079// kdDebug(13010)<<"COMMENT DATA FOUND"<<endl;
1076 while (HlManager::self()->syntax->nextGroup(data)) 1080 while (HlManager::self()->syntax->nextGroup(data))
1077 { 1081 {
1078 1082
1079 if (HlManager::self()->syntax->groupData(data,"name")=="singleLine") 1083 if (HlManager::self()->syntax->groupData(data,"name")=="singleLine")
1080 cslStart=HlManager::self()->syntax->groupData(data,"start"); 1084 cslStart=HlManager::self()->syntax->groupData(data,"start");
1081 if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") 1085 if (HlManager::self()->syntax->groupData(data,"name")=="multiLine")
1082 { 1086 {
1083 cmlStart=HlManager::self()->syntax->groupData(data,"start"); 1087 cmlStart=HlManager::self()->syntax->groupData(data,"start");
1084 cmlEnd=HlManager::self()->syntax->groupData(data,"end"); 1088 cmlEnd=HlManager::self()->syntax->groupData(data,"end");
1085 } 1089 }
1086 } 1090 }
1087 HlManager::self()->syntax->freeGroupInfo(data); 1091 HlManager::self()->syntax->freeGroupInfo(data);
1088 } 1092 }
1089 1093
1090} 1094}
1091 1095
1092/******************************************************************************************* 1096/*******************************************************************************************
1093 Highlight - readGlobalKeyWordConfig 1097 Highlight - readGlobalKeyWordConfig
1094 This function is a helper for makeContextList. It parses the xml file for 1098 This function is a helper for makeContextList. It parses the xml file for
1095 information, if keywords should be treated case(in)sensitive and creates the keyword 1099 information, if keywords should be treated case(in)sensitive and creates the keyword
1096 delimiter list. Which is the default list, without any given weak deliminiators 1100 delimiter list. Which is the default list, without any given weak deliminiators
1097 1101
1098 * input: none 1102 * input: none
1099 ************* 1103 *************
1100 * output: none 1104 * output: none
1101 ************* 1105 *************
1102 * return value: none 1106 * return value: none
1103*******************************************************************************************/ 1107*******************************************************************************************/
1104 1108
1105 1109
1106void Highlight::readGlobalKeywordConfig() 1110void Highlight::readGlobalKeywordConfig()
1107{ 1111{
1108 // Tell the syntax document class which file we want to parse 1112 // Tell the syntax document class which file we want to parse
1109 HlManager::self()->syntax->setIdentifier(identifier); 1113 HlManager::self()->syntax->setIdentifier(identifier);
1110 1114
1111 // Get the keywords config entry 1115 // Get the keywords config entry
1112 syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords"); 1116 syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords");
1113 if (data) 1117 if (data)
1114 { 1118 {
1115 kdDebug(13010)<<"Found global keyword config"<<endl; 1119 kdDebug(13010)<<"Found global keyword config"<<endl;
1116 1120
1117 if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0") 1121 if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0")
1118 casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} 1122 casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;}
1119 //get the weak deliminators 1123 //get the weak deliminators
1120 weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator"))); 1124 weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator")));
1121 1125
1122 // remove any weakDelimitars (if any) from the default list and store this list. 1126 // remove any weakDelimitars (if any) from the default list and store this list.
1123 int f; 1127 int f;
1124 for (int s=0; s < weakDeliminator.length(); s++) 1128 for (int s=0; s < weakDeliminator.length(); s++)
1125 { 1129 {
1126 f = 0; 1130 f = 0;
1127 f = deliminator.find (weakDeliminator[s]); 1131 f = deliminator.find (weakDeliminator[s]);
1128 1132
1129 if (f > -1) 1133 if (f > -1)
1130 deliminator.remove (f, 1); 1134 deliminator.remove (f, 1);
1131 } 1135 }
1132 1136
1133 deliminatorChars = deliminator.unicode(); 1137 deliminatorChars = deliminator.unicode();
1134 deliminatorLen = deliminator.length(); 1138 deliminatorLen = deliminator.length();
1135 1139
1136 HlManager::self()->syntax->freeGroupInfo(data); 1140 HlManager::self()->syntax->freeGroupInfo(data);
1137 } 1141 }
1138 else 1142 else
1139 { 1143 {
1140 //Default values 1144 //Default values
1141 casesensitive=true; 1145 casesensitive=true;
1142 weakDeliminator=QString(""); 1146 weakDeliminator=QString("");
1143 } 1147 }
1144 1148
1145} 1149}
1146 1150
1147/******************************************************************************************* 1151/*******************************************************************************************
1148 Highlight - makeContextList 1152 Highlight - makeContextList
1149 That's the most important initialization function for each highlighting. It's called 1153 That's the most important initialization function for each highlighting. It's called
1150 each time a document gets a highlighting style assigned. parses the xml file and 1154 each time a document gets a highlighting style assigned. parses the xml file and
1151 creates a corresponding internal structure 1155 creates a corresponding internal structure
1152 1156
1153 * input: none 1157 * input: none
1154 ************* 1158 *************
1155 * output: none 1159 * output: none
1156 ************* 1160 *************
1157 * return value: none 1161 * return value: none
1158*******************************************************************************************/ 1162*******************************************************************************************/
1159 1163
1160 1164
@@ -1183,67 +1187,67 @@ void Highlight::makeContextList()
1183 if (data) 1187 if (data)
1184 { 1188 {
1185 while (HlManager::self()->syntax->nextGroup(data)) 1189 while (HlManager::self()->syntax->nextGroup(data))
1186 { 1190 {
1187 1191
1188 // BEGIN - Translation of the attribute parameter 1192 // BEGIN - Translation of the attribute parameter
1189 QString tmpAttr=HlManager::self()->syntax->groupData(data,QString("attribute")).simplifyWhiteSpace(); 1193 QString tmpAttr=HlManager::self()->syntax->groupData(data,QString("attribute")).simplifyWhiteSpace();
1190 int attr; 1194 int attr;
1191 if (QString("%1").arg(tmpAttr.toInt())==tmpAttr) 1195 if (QString("%1").arg(tmpAttr.toInt())==tmpAttr)
1192 attr=tmpAttr.toInt(); 1196 attr=tmpAttr.toInt();
1193 else 1197 else
1194 attr=lookupAttrName(tmpAttr,iDl); 1198 attr=lookupAttrName(tmpAttr,iDl);
1195 // END - Translation of the attribute parameter 1199 // END - Translation of the attribute parameter
1196 1200
1197 contextList[i]=new HlContext( 1201 contextList[i]=new HlContext(
1198 attr, 1202 attr,
1199 (HlManager::self()->syntax->groupData(data,QString("lineEndContext"))).toInt(), 1203 (HlManager::self()->syntax->groupData(data,QString("lineEndContext"))).toInt(),
1200 (HlManager::self()->syntax->groupData(data,QString("lineBeginContext"))).isEmpty()?-1: 1204 (HlManager::self()->syntax->groupData(data,QString("lineBeginContext"))).isEmpty()?-1:
1201 (HlManager::self()->syntax->groupData(data,QString("lineBeginContext"))).toInt()); 1205 (HlManager::self()->syntax->groupData(data,QString("lineBeginContext"))).toInt());
1202 1206
1203 1207
1204 //Let's create all items for the context 1208 //Let's create all items for the context
1205 while (HlManager::self()->syntax->nextItem(data)) 1209 while (HlManager::self()->syntax->nextItem(data))
1206 { 1210 {
1207 // kdDebug(13010)<< "In make Contextlist: Item:"<<endl; 1211// kdDebug(13010)<< "In make Contextlist: Item:"<<endl;
1208 c=createHlItem(data,iDl); 1212 c=createHlItem(data,iDl);
1209 if (c) 1213 if (c)
1210 { 1214 {
1211 contextList[i]->items.append(c); 1215 contextList[i]->items.append(c);
1212 1216
1213 // Not supported completely atm and only one level. Subitems.(all have to be matched to at once) 1217 // Not supported completely atm and only one level. Subitems.(all have to be matched to at once)
1214 datasub=HlManager::self()->syntax->getSubItems(data); 1218 datasub=HlManager::self()->syntax->getSubItems(data);
1215 bool tmpbool; 1219 bool tmpbool;
1216 if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) 1220 if (tmpbool=HlManager::self()->syntax->nextItem(datasub))
1217 { 1221 {
1218 c->subItems=new QList<HlItem>; 1222 c->subItems=new QList<HlItem>;
1219 for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) 1223 for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub))
1220 c->subItems->append(createHlItem(datasub,iDl)); 1224 c->subItems->append(createHlItem(datasub,iDl));
1221 } 1225 }
1222 HlManager::self()->syntax->freeGroupInfo(datasub); 1226 HlManager::self()->syntax->freeGroupInfo(datasub);
1223 // end of sublevel 1227 // end of sublevel
1224 } 1228 }
1225 // kdDebug(13010)<<"Last line in loop"<<endl; 1229// kdDebug(13010)<<"Last line in loop"<<endl;
1226 } 1230 }
1227 i++; 1231 i++;
1228 } 1232 }
1229 } 1233 }
1230 1234
1231 HlManager::self()->syntax->freeGroupInfo(data); 1235 HlManager::self()->syntax->freeGroupInfo(data);
1232 1236
1233 1237
1234} 1238}
1235 1239
1236HlManager::HlManager() : QObject(0L) 1240HlManager::HlManager() : QObject(0L)
1237{ 1241{
1238 syntax = new SyntaxDocument(); 1242 syntax = new SyntaxDocument();
1239 SyntaxModeList modeList = syntax->modeList(); 1243 SyntaxModeList modeList = syntax->modeList();
1240 1244
1241 hlList.setAutoDelete(true); 1245 hlList.setAutoDelete(true);
1242 hlList.append(new Highlight(0)); 1246 hlList.append(new Highlight(0));
1243 1247
1244 uint i=0; 1248 uint i=0;
1245 while (i < modeList.count()) 1249 while (i < modeList.count())
1246 { 1250 {
1247 hlList.append(new Highlight(modeList.at(i))); 1251 hlList.append(new Highlight(modeList.at(i)));
1248 i++; 1252 i++;
1249 } 1253 }
@@ -1291,58 +1295,58 @@ int HlManager::wildcardFind(const QString &fileName) {
1291 for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) { 1295 for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) {
1292 p1 = 0; 1296 p1 = 0;
1293 w = highlight->getWildcards(); 1297 w = highlight->getWildcards();
1294 while (p1 < (int) w.length()) { 1298 while (p1 < (int) w.length()) {
1295 p2 = w.find(';',p1); 1299 p2 = w.find(';',p1);
1296 if (p2 == -1) p2 = w.length(); 1300 if (p2 == -1) p2 = w.length();
1297 if (p1 < p2) { 1301 if (p1 < p2) {
1298 QRegExp regExp(w.mid(p1,p2 - p1),true,true); 1302 QRegExp regExp(w.mid(p1,p2 - p1),true,true);
1299 if (regExp.match(fileName) == 0) return hlList.at(); 1303 if (regExp.match(fileName) == 0) return hlList.at();
1300 } 1304 }
1301 p1 = p2 + 1; 1305 p1 = p2 + 1;
1302 } 1306 }
1303 } 1307 }
1304 return -1; 1308 return -1;
1305} 1309}
1306 1310
1307 1311
1308int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { 1312int 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;
1331 a[z].bold = defaultStyle->bold; 1335 a[z].bold = defaultStyle->bold;
1332 a[z].italic = defaultStyle->italic; 1336 a[z].italic = defaultStyle->italic;
1333 } else { 1337 } else {
1334 // custom style 1338 // custom style
1335 a[z].col = itemData->col; 1339 a[z].col = itemData->col;
1336 a[z].selCol = itemData->selCol; 1340 a[z].selCol = itemData->selCol;
1337 a[z].bold = itemData->bold; 1341 a[z].bold = itemData->bold;
1338 a[z].italic = itemData->italic; 1342 a[z].italic = itemData->italic;
1339 } 1343 }
1340 } 1344 }
1341 1345
1342 for (; z < maxAttribs; z++) { 1346 for (; z < maxAttribs; z++) {
1343 a[z].col = black; 1347 a[z].col = black;
1344 a[z].selCol = black; 1348 a[z].selCol = black;
1345 a[z].bold = defaultStyle->bold; 1349 a[z].bold = defaultStyle->bold;
1346 a[z].italic = defaultStyle->italic; 1350 a[z].italic = defaultStyle->italic;
1347 } 1351 }
1348 return nAttribs; 1352 return nAttribs;
@@ -1394,49 +1398,49 @@ void HlManager::getDefaults(ItemStyleList &list) {
1394 list.append(new ItemStyle(darkGreen,green,false,false)); //others 1398 list.append(new ItemStyle(darkGreen,green,false,false)); //others
1395 1399
1396#warning fixme 1400#warning fixme
1397/* 1401/*
1398 config = KateFactory::instance()->config(); 1402 config = KateFactory::instance()->config();
1399 config->setGroup("Default Item Styles"); 1403 config->setGroup("Default Item Styles");
1400 for (z = 0; z < defaultStyles(); z++) { 1404 for (z = 0; z < defaultStyles(); z++) {
1401 i = list.at(z); 1405 i = list.at(z);
1402 s = config->readEntry(defaultStyleName(z)); 1406 s = config->readEntry(defaultStyleName(z));
1403 if (!s.isEmpty()) { 1407 if (!s.isEmpty()) {
1404 sscanf(s.latin1(),"%X,%X,%d,%d",&col,&selCol,&i->bold,&i->italic); 1408 sscanf(s.latin1(),"%X,%X,%d,%d",&col,&selCol,&i->bold,&i->italic);
1405 i->col.setRgb(col); 1409 i->col.setRgb(col);
1406 i->selCol.setRgb(selCol); 1410 i->selCol.setRgb(selCol);
1407 } 1411 }
1408 } 1412 }
1409*/ 1413*/
1410} 1414}
1411 1415
1412void HlManager::setDefaults(ItemStyleList &list) { 1416void HlManager::setDefaults(ItemStyleList &list) {
1413 KateConfig *config; 1417 KateConfig *config;
1414 int z; 1418 int z;
1415 ItemStyle *i; 1419 ItemStyle *i;
1416 char s[64]; 1420 char s[64];
1417#warning fixme 1421#warning fixme
1418/* 1422/*
1419 config = KateFactory::instance()->config(); 1423 config = KateFactory::instance()->config();
1420 config->setGroup("Default Item Styles"); 1424 config->setGroup("Default Item Styles");
1421 for (z = 0; z < defaultStyles(); z++) { 1425 for (z = 0; z < defaultStyles(); z++) {
1422 i = list.at(z); 1426 i = list.at(z);
1423 sprintf(s,"%X,%X,%d,%d",i->col.rgb(),i->selCol.rgb(),i->bold, i->italic); 1427 sprintf(s,"%X,%X,%d,%d",i->col.rgb(),i->selCol.rgb(),i->bold, i->italic);
1424 config->writeEntry(defaultStyleName(z),s); 1428 config->writeEntry(defaultStyleName(z),s);
1425 } 1429 }
1426*/ 1430*/
1427 emit changed(); 1431 emit changed();
1428} 1432}
1429 1433
1430 1434
1431int HlManager::highlights() { 1435int HlManager::highlights() {
1432 return (int) hlList.count(); 1436 return (int) hlList.count();
1433} 1437}
1434 1438
1435QString HlManager::hlName(int n) { 1439QString HlManager::hlName(int n) {
1436 return hlList.at(n)->iName; 1440 return hlList.at(n)->iName;
1437} 1441}
1438 1442
1439QString HlManager::hlSection(int n) { 1443QString HlManager::hlSection(int n) {
1440 return hlList.at(n)->iSection; 1444 return hlList.at(n)->iSection;
1441} 1445}
1442 1446