author | ar <ar> | 2004-05-03 21:35:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-03 21:35:18 (UTC) |
commit | 412619441fab46fc79c695a23ccf9e38135bdfad (patch) (unidiff) | |
tree | 19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/tinykate/libkate/document | |
parent | d1095d71394779557f446e2a67ba55bc62eec859 (diff) | |
download | opie-412619441fab46fc79c695a23ccf9e38135bdfad.zip opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/tinykate/libkate/document') (more/less context) (ignore whitespace changes)
4 files changed, 184 insertions, 173 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp index 22a4917..4c15fd0 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp +++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp | |||
@@ -19,30 +19,31 @@ | |||
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "katebuffer.h" | 24 | #include "katebuffer.h" |
25 | #include "kdebug.h" | ||
25 | 26 | ||
26 | // Includes for reading file | 27 | /* OPIE */ |
27 | #include <sys/types.h> | 28 | #include <opie2/odebug.h> |
28 | #include <sys/stat.h> | ||
29 | #include <fcntl.h> | ||
30 | #include <errno.h> | ||
31 | #include <unistd.h> | ||
32 | 29 | ||
30 | /* QT */ | ||
33 | #include <qfile.h> | 31 | #include <qfile.h> |
34 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
35 | |||
36 | #include <qtimer.h> | 33 | #include <qtimer.h> |
37 | #include <qtextcodec.h> | 34 | #include <qtextcodec.h> |
38 | 35 | ||
39 | // | 36 | /* STD */ |
40 | 37 | // Includes for reading file | |
38 | #include <sys/types.h> | ||
39 | #include <sys/stat.h> | ||
40 | #include <fcntl.h> | ||
41 | #include <errno.h> | ||
42 | #include <unistd.h> | ||
41 | #include <assert.h> | 43 | #include <assert.h> |
42 | #include <kdebug.h> | ||
43 | 44 | ||
44 | /** | 45 | /** |
45 | * Create an empty buffer. | 46 | * Create an empty buffer. |
46 | */ | 47 | */ |
47 | KWBuffer::KWBuffer() | 48 | KWBuffer::KWBuffer() |
48 | { | 49 | { |
@@ -62,41 +63,41 @@ KWBuffer::clear() | |||
62 | /** | 63 | /** |
63 | * Insert a file at line @p line in the buffer. | 64 | * Insert a file at line @p line in the buffer. |
64 | */ | 65 | */ |
65 | void | 66 | void |
66 | KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) | 67 | KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) |
67 | { | 68 | { |
68 | if (line) { | 69 | if (line) { |
69 | qDebug("insert File only supports insertion at line 0 == file opening"); | 70 | odebug << "insert File only supports insertion at line 0 == file opening" << oendl; |
70 | return; | 71 | return; |
71 | } | 72 | } |
72 | clear(); | 73 | clear(); |
73 | QFile iofile(file); | 74 | QFile iofile(file); |
74 | iofile.open(IO_ReadOnly); | 75 | iofile.open(IO_ReadOnly); |
75 | QTextStream stream(&iofile); | 76 | QTextStream stream(&iofile); |
76 | stream.setCodec(codec); | 77 | stream.setCodec(codec); |
77 | QString qsl; | 78 | QString qsl; |
78 | int count=0; | 79 | int count=0; |
79 | for (count=0;((qsl=stream.readLine())!=QString::null);count++) | 80 | for (count=0;((qsl=stream.readLine())!=QString::null); count++) |
80 | { | 81 | { |
81 | if (count==0) | 82 | if (count==0) |
82 | { | 83 | { |
83 | (*m_stringListIt)->append(qsl.unicode(),qsl.length()); | 84 | (*m_stringListIt)->append(qsl.unicode(),qsl.length()); |
84 | } | 85 | } |
85 | else | 86 | else |
86 | { | 87 | { |
87 | TextLine::Ptr tl=new TextLine(); | 88 | TextLine::Ptr tl=new TextLine(); |
88 | tl ->append(qsl.unicode(),qsl.length()); | 89 | tl ->append(qsl.unicode(),qsl.length()); |
89 | m_stringListIt=m_stringList.append(tl); | 90 | m_stringListIt=m_stringList.append(tl); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | if (count!=0) | 93 | if (count!=0) |
93 | { | 94 | { |
94 | m_stringListCurrent=count-1; | 95 | m_stringListCurrent=count-1; |
95 | m_lineCount=count; | 96 | m_lineCount=count; |
96 | } | 97 | } |
97 | } | 98 | } |
98 | 99 | ||
99 | void | 100 | void |
100 | KWBuffer::loadFilePart() | 101 | KWBuffer::loadFilePart() |
101 | { | 102 | { |
102 | } | 103 | } |
@@ -118,15 +119,15 @@ KWBuffer::slotLoadFile() | |||
118 | /** | 119 | /** |
119 | * Return the total number of lines in the buffer. | 120 | * Return the total number of lines in the buffer. |
120 | */ | 121 | */ |
121 | int | 122 | int |
122 | KWBuffer::count() | 123 | KWBuffer::count() |
123 | { | 124 | { |
124 | qDebug("m_stringList.count %d",m_stringList.count()); | 125 | odebug << "m_stringList.count " << m_stringList.count() << "" << oendl; |
125 | return m_lineCount; | 126 | return m_lineCount; |
126 | //return m_stringList.count(); | 127 | // return m_stringList.count(); |
127 | // return m_totalLines; | 128 | // return m_totalLines; |
128 | } | 129 | } |
129 | 130 | ||
130 | 131 | ||
131 | void KWBuffer::seek(int i) | 132 | void KWBuffer::seek(int i) |
132 | { | 133 | { |
@@ -145,15 +146,15 @@ void KWBuffer::seek(int i) | |||
145 | } | 146 | } |
146 | 147 | ||
147 | 148 | ||
148 | TextLine::Ptr | 149 | TextLine::Ptr |
149 | KWBuffer::line(int i) | 150 | KWBuffer::line(int i) |
150 | { | 151 | { |
151 | if (i>=m_stringList.count()) return 0; | 152 | if (i>=m_stringList.count()) return 0; |
152 | seek(i); | 153 | seek(i); |
153 | return *m_stringListIt; | 154 | return *m_stringListIt; |
154 | } | 155 | } |
155 | 156 | ||
156 | void | 157 | void |
157 | KWBuffer::insertLine(int i, TextLine::Ptr line) | 158 | KWBuffer::insertLine(int i, TextLine::Ptr line) |
158 | { | 159 | { |
159 | seek(i); | 160 | seek(i); |
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 0c742d7..6dc4fd2 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp | |||
@@ -3,13 +3,13 @@ | |||
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Jan 15 2001 | 4 | begin : Mon Jan 15 2001 |
5 | copyright : (C) 2001 by Christoph "Crossfire" Cullmann | 5 | copyright : (C) 2001 by Christoph "Crossfire" Cullmann |
6 | (C) 2002 by Joseph Wenninger | 6 | (C) 2002 by Joseph Wenninger |
7 | email : crossfire@babylon2k.de | 7 | email : crossfire@babylon2k.de |
8 | jowenn@kde.org | 8 | jowenn@kde.org |
9 | 9 | ||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * * | 13 | * * |
14 | * This program is free software; you can redistribute it and/or modify * | 14 | * This program is free software; you can redistribute it and/or modify * |
15 | * it under the terms of the GNU General Public License as published by * | 15 | * it under the terms of the GNU General Public License as published by * |
@@ -36,50 +36,51 @@ | |||
36 | along with this library; see the file COPYING.LIB. If not, write to | 36 | along with this library; see the file COPYING.LIB. If not, write to |
37 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 37 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
38 | Boston, MA 02111-1307, USA. | 38 | Boston, MA 02111-1307, USA. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "katedocument.h" | 41 | #include "katedocument.h" |
42 | #include "kmessagebox.h" | ||
43 | #include "kglobal.h" | ||
42 | 44 | ||
45 | //#include "kcharsets.h" | ||
46 | #include "kdebug.h" | ||
47 | //#include "kinstance.h" | ||
43 | 48 | ||
44 | #include <qfileinfo.h> | 49 | #include "kglobalsettings.h" |
45 | #include <qdatetime.h> | 50 | //#include "kaction.h" |
51 | //#include "kstdaction.h" | ||
46 | 52 | ||
47 | #include <kmessagebox.h> | 53 | #include "../view/kateview.h" |
48 | #include <qpe/config.h> | 54 | #include "katebuffer.h" |
49 | #include <qstring.h> | 55 | #include "katetextline.h" |
50 | 56 | ||
51 | #include <sys/time.h> | 57 | #include "katecmd.h" |
52 | #include <unistd.h> | ||
53 | 58 | ||
54 | #include <stdio.h> | 59 | /* OPIE */ |
60 | #include <opie2/odebug.h> | ||
61 | #include <qpe/config.h> | ||
55 | 62 | ||
63 | /* QT */ | ||
64 | #include <qfileinfo.h> | ||
65 | #include <qdatetime.h> | ||
66 | #include <qstring.h> | ||
56 | #include <qtimer.h> | 67 | #include <qtimer.h> |
57 | #include <qobject.h> | 68 | #include <qobject.h> |
58 | #include <qapplication.h> | 69 | #include <qapplication.h> |
59 | #include <qclipboard.h> | 70 | #include <qclipboard.h> |
60 | #include <qfont.h> | 71 | #include <qfont.h> |
61 | #include <qpainter.h> | 72 | #include <qpainter.h> |
62 | #include <qfile.h> | 73 | #include <qfile.h> |
63 | #include <qtextstream.h> | 74 | #include <qtextstream.h> |
64 | #include <qtextcodec.h> | 75 | #include <qtextcodec.h> |
65 | #include <kglobal.h> | ||
66 | 76 | ||
67 | //#include <kcharsets.h> | 77 | /* STD */ |
68 | #include <kdebug.h> | 78 | #include <sys/time.h> |
69 | //#include <kinstance.h> | 79 | #include <unistd.h> |
70 | 80 | #include <stdio.h> | |
71 | #include <kglobalsettings.h> | ||
72 | //#include <kaction.h> | ||
73 | //#include <kstdaction.h> | ||
74 | |||
75 | #include "../view/kateview.h" | ||
76 | #include "katebuffer.h" | ||
77 | #include "katetextline.h" | ||
78 | |||
79 | #include "katecmd.h" | ||
80 | 81 | ||
81 | KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) | 82 | KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) |
82 | : action(a), cursor(cursor), len(len), text(text) { | 83 | : action(a), cursor(cursor), len(len), text(text) { |
83 | } | 84 | } |
84 | 85 | ||
85 | KateActionGroup::KateActionGroup(PointStruc &aStart, int type) | 86 | KateActionGroup::KateActionGroup(PointStruc &aStart, int type) |
@@ -127,35 +128,35 @@ const int KateDocument::maxAttribs = 32; | |||
127 | 128 | ||
128 | QStringList KateDocument::searchForList = QStringList(); | 129 | QStringList KateDocument::searchForList = QStringList(); |
129 | QStringList KateDocument::replaceWithList = QStringList(); | 130 | QStringList KateDocument::replaceWithList = QStringList(); |
130 | 131 | ||
131 | uint KateDocument::uniqueID = 0; | 132 | uint KateDocument::uniqueID = 0; |
132 | 133 | ||
133 | QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; | 134 | QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; |
134 | 135 | ||
135 | 136 | ||
136 | KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, | 137 | KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, |
137 | QWidget *parentWidget, const char *widgetName, | 138 | QWidget *parentWidget, const char *widgetName, |
138 | QObject *, const char *) | 139 | QObject *, const char *) |
139 | : Kate::Document (), | 140 | : Kate::Document (), |
140 | myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()), | 141 | myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()), |
141 | myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), | 142 | myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), |
142 | hlManager(HlManager::self ()) | 143 | hlManager(HlManager::self ()) |
143 | { | 144 | { |
144 | 145 | ||
145 | d(this)->hlSetByUser = false; | 146 | d(this)->hlSetByUser = false; |
146 | PreHighlightedTill=0; | 147 | PreHighlightedTill=0; |
147 | RequestPreHighlightTill=0; | 148 | RequestPreHighlightTill=0; |
148 | 149 | ||
149 | m_bSingleViewMode=bSingleViewMode; | 150 | m_bSingleViewMode=bSingleViewMode; |
150 | m_bBrowserView = bBrowserView; | 151 | m_bBrowserView = bBrowserView; |
151 | 152 | ||
152 | m_url = QString::null; | 153 | m_url = QString::null; |
153 | 154 | ||
154 | // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports | 155 | // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports |
155 | // (esp. it doesn't distinguish between UTF-8 and iso10646-1) | 156 | // (esp. it doesn't distinguish between UTF-8 and iso10646-1) |
156 | 157 | ||
157 | myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); | 158 | myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); |
158 | 159 | ||
159 | maxLength = -1; | 160 | maxLength = -1; |
160 | 161 | ||
161 | setFont (KGlobalSettings::generalFont()); | 162 | setFont (KGlobalSettings::generalFont()); |
@@ -289,26 +290,26 @@ KateDocument::~KateDocument() | |||
289 | delete_d(this); | 290 | delete_d(this); |
290 | } | 291 | } |
291 | 292 | ||
292 | void KateDocument::openURL(const QString &filename) | 293 | void KateDocument::openURL(const QString &filename) |
293 | { | 294 | { |
294 | 295 | ||
295 | m_file=filename; | 296 | m_file=filename; |
296 | fileInfo->setFile (m_file); | 297 | fileInfo->setFile (m_file); |
297 | setMTime(); | 298 | setMTime(); |
298 | 299 | ||
299 | if (!fileInfo->exists() || !fileInfo->isReadable()) | 300 | if (!fileInfo->exists() || !fileInfo->isReadable()) |
300 | { | 301 | { |
301 | qDebug("File doesn't exit or couldn't be read"); | 302 | odebug << "File doesn't exit or couldn't be read" << oendl; |
302 | return ; | 303 | return ; |
303 | } | 304 | } |
304 | 305 | ||
305 | buffer->clear(); | 306 | buffer->clear(); |
306 | #warning fixme | 307 | #warning fixme |
307 | // buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); | 308 | // buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); |
308 | qDebug("Telling buffer to open file"); | 309 | odebug << "Telling buffer to open file" << oendl; |
309 | buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); | 310 | buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); |
310 | 311 | ||
311 | setMTime(); | 312 | setMTime(); |
312 | 313 | ||
313 | if (myWordWrap) | 314 | if (myWordWrap) |
314 | wrapText (myWordWrapAt); | 315 | wrapText (myWordWrapAt); |
@@ -318,19 +319,19 @@ void KateDocument::openURL(const QString &filename) | |||
318 | setHighlight(hl); | 319 | setHighlight(hl); |
319 | 320 | ||
320 | updateLines(); | 321 | updateLines(); |
321 | updateViews(); | 322 | updateViews(); |
322 | 323 | ||
323 | emit fileNameChanged(); | 324 | emit fileNameChanged(); |
324 | 325 | ||
325 | return ; | 326 | return ; |
326 | } | 327 | } |
327 | 328 | ||
328 | bool KateDocument::saveFile() | 329 | bool KateDocument::saveFile() |
329 | { | 330 | { |
330 | 331 | ||
331 | QFile f( m_file ); | 332 | QFile f( m_file ); |
332 | if ( !f.open( IO_WriteOnly ) ) | 333 | if ( !f.open( IO_WriteOnly ) ) |
333 | return false; // Error | 334 | return false; // Error |
334 | 335 | ||
335 | QTextStream stream(&f); | 336 | QTextStream stream(&f); |
336 | 337 | ||
@@ -608,13 +609,13 @@ void KateDocument::readConfig() | |||
608 | m_singleSelection = config->readBoolEntry("SingleSelection", false); | 609 | m_singleSelection = config->readBoolEntry("SingleSelection", false); |
609 | myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name())); | 610 | myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name())); |
610 | setFont (config->readFontEntry("Font", myFont)); | 611 | setFont (config->readFontEntry("Font", myFont)); |
611 | 612 | ||
612 | colors[0] = config->readColorEntry("Color Background", colors[0]); | 613 | colors[0] = config->readColorEntry("Color Background", colors[0]); |
613 | colors[1] = config->readColorEntry("Color Selected", colors[1]); | 614 | colors[1] = config->readColorEntry("Color Selected", colors[1]); |
614 | 615 | ||
615 | // config->sync(); | 616 | // config->sync(); |
616 | } | 617 | } |
617 | 618 | ||
618 | void KateDocument::writeConfig() | 619 | void KateDocument::writeConfig() |
619 | { | 620 | { |
620 | KateConfig *config = KGlobal::config(); | 621 | KateConfig *config = KGlobal::config(); |
@@ -680,13 +681,13 @@ void KateDocument::setHighlight(int n) { | |||
680 | PreHighlightedTill=0; | 681 | PreHighlightedTill=0; |
681 | RequestPreHighlightTill=0; | 682 | RequestPreHighlightTill=0; |
682 | emit(highlightChanged()); | 683 | emit(highlightChanged()); |
683 | } | 684 | } |
684 | 685 | ||
685 | void KateDocument::makeAttribs() { | 686 | void KateDocument::makeAttribs() { |
686 | qDebug("KateDocument::makeAttribs()"); | 687 | odebug << "KateDocument::makeAttribs()" << oendl; |
687 | m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs); | 688 | m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs); |
688 | updateFontData(); | 689 | updateFontData(); |
689 | updateLines(); | 690 | updateLines(); |
690 | } | 691 | } |
691 | 692 | ||
692 | void KateDocument::updateFontData() { | 693 | void KateDocument::updateFontData() { |
@@ -1920,14 +1921,14 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor | |||
1920 | if (textLine==0) kdDebug(13020)<<"****updateLines()>> error textLine==0"<<endl; | 1921 | if (textLine==0) kdDebug(13020)<<"****updateLines()>> error textLine==0"<<endl; |
1921 | if (line <= endLine && line != cursorY) { | 1922 | if (line <= endLine && line != cursorY) { |
1922 | if (flags & KateView::cfRemoveSpaces) textLine->removeSpaces(); | 1923 | if (flags & KateView::cfRemoveSpaces) textLine->removeSpaces(); |
1923 | updateMaxLength(textLine); | 1924 | updateMaxLength(textLine); |
1924 | } | 1925 | } |
1925 | endCtx = textLine->getContext(); | 1926 | endCtx = textLine->getContext(); |
1926 | // qDebug("DOHIGHLIGHT"); | 1927 | // odebug << "DOHIGHLIGHT" << oendl; |
1927 | 1928 | ||
1928 | ctxNum = m_highlight->doHighlight(ctxNum,textLine); | 1929 | ctxNum = m_highlight->doHighlight(ctxNum,textLine); |
1929 | textLine->setContext(ctxNum); | 1930 | textLine->setContext(ctxNum); |
1930 | line++; | 1931 | line++; |
1931 | } while ((buffer->line(line)!=0) && (line <= endLine || endCtx != ctxNum)); | 1932 | } while ((buffer->line(line)!=0) && (line <= endLine || endCtx != ctxNum)); |
1932 | // kdDebug(13020)<<"updateLines :: while loop left"<<endl; | 1933 | // kdDebug(13020)<<"updateLines :: while loop left"<<endl; |
1933 | tagLines(startLine, line - 1); | 1934 | tagLines(startLine, line - 1); |
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,11 +1,11 @@ | |||
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, |
@@ -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; |
@@ -117,14 +121,14 @@ HlStringDetect::~HlStringDetect() { | |||
117 | } | 121 | } |
118 | 122 | ||
119 | const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { | 123 | const 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 | ||
130 | HlRangeDetect::HlRangeDetect(int attribute, int context, QChar ch1, QChar ch2) | 134 | HlRangeDetect::HlRangeDetect(int attribute, int context, QChar ch1, QChar ch2) |
@@ -210,16 +214,16 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) { | |||
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 | } |
@@ -245,20 +249,20 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { | |||
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; |
@@ -342,13 +346,13 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { | |||
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++; |
@@ -397,26 +401,26 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) | |||
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 | ||
407 | HlLineContinue::HlLineContinue(int attribute, int context) | 411 | HlLineContinue::HlLineContinue(int attribute, int context) |
408 | : HlItem(attribute,context) { | 412 | : HlItem(attribute,context) { |
409 | } | 413 | } |
410 | 414 | ||
411 | const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { | 415 | const 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 | ||
421 | HlCStringChar::HlCStringChar(int attribute, int context) | 425 | HlCStringChar::HlCStringChar(int attribute, int context) |
422 | : HlItem(attribute,context) { | 426 | : HlItem(attribute,context) { |
@@ -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 |
@@ -930,18 +934,18 @@ void Highlight::createItemData(ItemDataList &list) | |||
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 | ||
934 | int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) | 938 | int 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 |
@@ -1074,17 +1078,17 @@ void Highlight::readCommentConfig() | |||
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 | } |
@@ -1109,16 +1113,16 @@ void Highlight::readGlobalKeywordConfig() | |||
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++) |
@@ -1130,13 +1134,13 @@ void Highlight::readGlobalKeywordConfig() | |||
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(""); |
@@ -1201,31 +1205,31 @@ void Highlight::makeContextList() | |||
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); |
@@ -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; |
@@ -1412,13 +1416,13 @@ void HlManager::getDefaults(ItemStyleList &list) { | |||
1412 | void HlManager::setDefaults(ItemStyleList &list) { | 1416 | void 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); |
diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index 6059e9b..9fa4452 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp | |||
@@ -13,21 +13,26 @@ | |||
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "katesyntaxdocument.h" | 18 | #include "katesyntaxdocument.h" |
19 | #include <kateconfig.h> | 19 | #include "kateconfig.h" |
20 | #include "kdebug.h" | ||
21 | #include "kstddirs.h" | ||
22 | #include "klocale.h" | ||
23 | #include "kmessagebox.h" | ||
24 | #include "kglobal.h" | ||
25 | |||
26 | /* OPIE */ | ||
27 | #include <opie2/odebug.h> | ||
28 | #include <qpe/qpeapplication.h> | ||
29 | |||
30 | /* QT */ | ||
20 | #include <qfile.h> | 31 | #include <qfile.h> |
21 | #include <kdebug.h> | ||
22 | #include <kstddirs.h> | ||
23 | #include <klocale.h> | ||
24 | #include <kmessagebox.h> | ||
25 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
26 | #include <kglobal.h> | ||
27 | #include <qpe/qpeapplication.h> | ||
28 | #include <qdir.h> | 33 | #include <qdir.h> |
29 | 34 | ||
30 | SyntaxDocument::SyntaxDocument() | 35 | SyntaxDocument::SyntaxDocument() |
31 | { | 36 | { |
32 | m_root=0; | 37 | m_root=0; |
33 | currentFile=""; | 38 | currentFile=""; |
@@ -36,13 +41,13 @@ SyntaxDocument::SyntaxDocument() | |||
36 | 41 | ||
37 | void SyntaxDocument::setIdentifier(const QString& identifier) | 42 | void SyntaxDocument::setIdentifier(const QString& identifier) |
38 | { | 43 | { |
39 | #warning FIXME delete m_root; | 44 | #warning FIXME delete m_root; |
40 | m_root=Opie::Core::XMLElement::load(identifier); | 45 | m_root=Opie::Core::XMLElement::load(identifier); |
41 | if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); | 46 | if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); |
42 | 47 | ||
43 | } | 48 | } |
44 | 49 | ||
45 | SyntaxDocument::~SyntaxDocument() | 50 | SyntaxDocument::~SyntaxDocument() |
46 | { | 51 | { |
47 | } | 52 | } |
48 | 53 | ||
@@ -73,27 +78,27 @@ void SyntaxDocument::setupModeList(bool force) | |||
73 | mli->extension = config->readEntry("extension",""); | 78 | mli->extension = config->readEntry("extension",""); |
74 | mli->identifier = path+*it; | 79 | mli->identifier = path+*it; |
75 | myModeList.append(mli); | 80 | myModeList.append(mli); |
76 | } | 81 | } |
77 | else | 82 | else |
78 | { | 83 | { |
79 | qDebug("Found a description file:"+path+(*it)); | 84 | odebug << "Found a description file:"+path+(*it) << oendl; |
80 | setIdentifier(path+(*it)); | 85 | setIdentifier(path+(*it)); |
81 | Opie::Core::XMLElement *e=m_root; | 86 | Opie::Core::XMLElement *e=m_root; |
82 | if (e) | 87 | if (e) |
83 | { | 88 | { |
84 | e=e->firstChild(); | 89 | e=e->firstChild(); |
85 | qDebug(e->tagName()); | 90 | odebug << e->tagName() << oendl; |
86 | if (e->tagName()=="language") | 91 | if (e->tagName()=="language") |
87 | { | 92 | { |
88 | syntaxModeListItem *mli=new syntaxModeListItem; | 93 | syntaxModeListItem *mli=new syntaxModeListItem; |
89 | mli->name = e->attribute("name"); | 94 | mli->name = e->attribute("name"); |
90 | mli->section = e->attribute("section"); | 95 | mli->section = e->attribute("section"); |
91 | mli->mimetype = e->attribute("mimetype"); | 96 | mli->mimetype = e->attribute("mimetype"); |
92 | mli->extension = e->attribute("extensions"); | 97 | mli->extension = e->attribute("extensions"); |
93 | qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); | 98 | odebug << QString("valid description for: %1/%2").arg(mli->section).arg(mli->name) << oendl; |
94 | if (mli->section.isEmpty()) | 99 | if (mli->section.isEmpty()) |
95 | mli->section=i18n("Other"); | 100 | mli->section=i18n("Other"); |
96 | 101 | ||
97 | mli->identifier = path+(*it); | 102 | mli->identifier = path+(*it); |
98 | config->setGroup(Group); | 103 | config->setGroup(Group); |
99 | config->writeEntry("name",mli->name); | 104 | config->writeEntry("name",mli->name); |
@@ -177,15 +182,15 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data) | |||
177 | delete data; | 182 | delete data; |
178 | } | 183 | } |
179 | 184 | ||
180 | syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data) | 185 | syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data) |
181 | { | 186 | { |
182 | syntaxContextData *retval=new syntaxContextData; | 187 | syntaxContextData *retval=new syntaxContextData; |
183 | retval->parent=0; | 188 | retval->parent=0; |
184 | retval->currentGroup=0; | 189 | retval->currentGroup=0; |
185 | retval->item=0; | 190 | retval->item=0; |
186 | if (data != 0) | 191 | if (data != 0) |
187 | { | 192 | { |
188 | retval->parent=data->currentGroup; | 193 | retval->parent=data->currentGroup; |
189 | retval->currentGroup=data->item; | 194 | retval->currentGroup=data->item; |
190 | retval->item=0; | 195 | retval->item=0; |
191 | } | 196 | } |
@@ -209,14 +214,14 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const | |||
209 | { | 214 | { |
210 | kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; | 215 | kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; |
211 | 216 | ||
212 | if (e1->tagName()==Config) | 217 | if (e1->tagName()==Config) |
213 | { | 218 | { |
214 | syntaxContextData *data=new ( syntaxContextData); | 219 | syntaxContextData *data=new ( syntaxContextData); |
215 | data->currentGroup=0; | 220 | data->currentGroup=0; |
216 | data->parent=0; | 221 | data->parent=0; |
217 | data->item=e1; | 222 | data->item=e1; |
218 | return data; | 223 | return data; |
219 | } | 224 | } |
220 | 225 | ||
221 | e1=e1->nextChild(); | 226 | e1=e1->nextChild(); |
222 | } | 227 | } |
@@ -251,14 +256,14 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co | |||
251 | { | 256 | { |
252 | kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; | 257 | kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; |
253 | if (e1->tagName()==group+"s") | 258 | if (e1->tagName()==group+"s") |
254 | { | 259 | { |
255 | syntaxContextData *data=new ( syntaxContextData); | 260 | syntaxContextData *data=new ( syntaxContextData); |
256 | data->parent=e1; | 261 | data->parent=e1; |
257 | data->currentGroup=0; | 262 | data->currentGroup=0; |
258 | data->item=0; | 263 | data->item=0; |
259 | return data; | 264 | return data; |
260 | } | 265 | } |
261 | 266 | ||
262 | e1=e1->nextChild(); | 267 | e1=e1->nextChild(); |
263 | } | 268 | } |
264 | 269 | ||
@@ -281,25 +286,25 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty | |||
281 | m_data.clear(); | 286 | m_data.clear(); |
282 | 287 | ||
283 | for(e=e->firstChild(); e; e=e->nextChild()) | 288 | for(e=e->firstChild(); e; e=e->nextChild()) |
284 | { | 289 | { |
285 | if (e->tagName()==mainGroup) | 290 | if (e->tagName()==mainGroup) |
286 | { | 291 | { |
287 | for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) | 292 | for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) |
288 | { | 293 | { |
289 | if (e1->tagName()!="list") continue; | 294 | if (e1->tagName()!="list") continue; |
290 | 295 | ||
291 | if (e1->attribute("name")==type) | 296 | if (e1->attribute("name")==type) |
292 | { | 297 | { |
293 | for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) | 298 | for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) |
294 | { | 299 | { |
295 | qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value()); | 300 | odebug << "FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value() << oendl; |
296 | m_data+=e2->firstChild()->value().stripWhiteSpace(); | 301 | m_data+=e2->firstChild()->value().stripWhiteSpace(); |
297 | } | 302 | } |
298 | break; | 303 | break; |
299 | } | 304 | } |
300 | } | 305 | } |
301 | break; | 306 | break; |
302 | } | 307 | } |
303 | } | 308 | } |
304 | 309 | ||
305 | return m_data; | 310 | return m_data; |