-rw-r--r-- | noncore/apps/opie-reader/Bkmks.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.h | 7 | ||||
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-write/qrichtext.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.h | 2 |
7 files changed, 38 insertions, 16 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp index 440d8be..28f6318 100644 --- a/noncore/apps/opie-reader/Bkmks.cpp +++ b/noncore/apps/opie-reader/Bkmks.cpp | |||
@@ -1,46 +1,62 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | 2 | ||
3 | #include "Bkmks.h" | 3 | #include "Bkmks.h" |
4 | 4 | ||
5 | #include "StyleConsts.h" | 5 | #include "StyleConsts.h" |
6 | #include "Markups.h" | 6 | #include "Markups.h" |
7 | #include "my_list.h" | 7 | #include "my_list.h" |
8 | #include "version.h" | 8 | #include "version.h" |
9 | #include "names.h" | 9 | #include "names.h" |
10 | 10 | ||
11 | const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE); | 11 | const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE); |
12 | 12 | ||
13 | Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) | 13 | Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) : |
14 | m_name(0), | ||
15 | m_namelen(0), | ||
16 | m_anno(0), | ||
17 | m_annolen(0), | ||
18 | m_position(0) | ||
14 | { | 19 | { |
15 | init(_nm, _nmlen, _anno, _annolen, _p); | 20 | init(_nm, _nmlen, _anno, _annolen, _p); |
16 | } | 21 | } |
17 | 22 | ||
18 | Bkmk::Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short annolen, unsigned int _p) : m_position(_p) | 23 | Bkmk::Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short annolen, unsigned int _p) : m_position(_p) |
19 | { | 24 | { |
20 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, annolen, _p); | 25 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, annolen, _p); |
21 | } | 26 | } |
22 | 27 | ||
28 | Bkmk::Bkmk(const Bkmk& rhs) : | ||
29 | m_name(0), | ||
30 | m_namelen(0), | ||
31 | m_anno(0), | ||
32 | m_annolen(0), | ||
33 | m_position(0) | ||
34 | { | ||
35 | init(rhs.name(), sizeof(tchar)*(ustrlen(rhs.name())+1), rhs.anno(), | ||
36 | sizeof(tchar)*(ustrlen(rhs.anno())+1), rhs.value()); | ||
37 | } | ||
38 | |||
23 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p) | 39 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p) |
24 | { | 40 | { |
25 | if (_anno == NULL) | 41 | if (_anno == NULL) |
26 | { | 42 | { |
27 | tchar t = 0; | 43 | tchar t = 0; |
28 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); | 44 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); |
29 | } | 45 | } |
30 | else | 46 | else |
31 | { | 47 | { |
32 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); | 48 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); |
33 | } | 49 | } |
34 | } | 50 | } |
35 | 51 | ||
36 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2) : m_position(_p) | 52 | Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2) : m_position(_p) |
37 | { | 53 | { |
38 | if (_anno == NULL) | 54 | if (_anno == NULL) |
39 | { | 55 | { |
40 | tchar t = 0; | 56 | tchar t = 0; |
41 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); | 57 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), &t, sizeof(t), _p); |
42 | } | 58 | } |
43 | else | 59 | else |
44 | { | 60 | { |
45 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); | 61 | init(_nm, sizeof(tchar)*(ustrlen(_nm)+1), _anno, sizeof(tchar)*(ustrlen(_anno)+1), _p); |
46 | } | 62 | } |
diff --git a/noncore/apps/opie-reader/Bkmks.h b/noncore/apps/opie-reader/Bkmks.h index c2275e2..985e158 100644 --- a/noncore/apps/opie-reader/Bkmks.h +++ b/noncore/apps/opie-reader/Bkmks.h | |||
@@ -1,55 +1,52 @@ | |||
1 | #ifndef __Bkmks_h | 1 | #ifndef __Bkmks_h |
2 | #define __Bkmks_h | 2 | #define __Bkmks_h |
3 | 3 | ||
4 | #include "config.h" | 4 | #include "config.h" |
5 | #include "Filedata.h" | 5 | #include "Filedata.h" |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | 7 | ||
8 | template<class T> | 8 | template<class T> |
9 | class CList; | 9 | class CList; |
10 | 10 | ||
11 | class Bkmk | 11 | class Bkmk |
12 | { | 12 | { |
13 | friend class BkmkFile; | 13 | friend class BkmkFile; |
14 | unsigned char* m_name; | 14 | unsigned char* m_name; |
15 | unsigned short m_namelen; | 15 | unsigned short m_namelen; |
16 | unsigned char* m_anno; | 16 | unsigned char* m_anno; |
17 | unsigned short m_annolen; | 17 | unsigned short m_annolen; |
18 | unsigned int m_position; | 18 | unsigned int m_position; |
19 | unsigned int m_position2; | 19 | unsigned int m_position2; |
20 | unsigned char m_red,m_green,m_blue, m_level; | 20 | unsigned char m_red,m_green,m_blue, m_level; |
21 | void init(const void*, unsigned short, const void*, unsigned short, unsigned int); | 21 | void init(const void*, unsigned short, const void*, unsigned short, unsigned int); |
22 | public: | 22 | public: |
23 | Bkmk() : m_name(NULL), m_namelen(0), m_anno(NULL), m_annolen(0), m_position(0) {}; | 23 | Bkmk() : m_name(0), m_namelen(0), m_anno(0), m_annolen(0), m_position(0) {}; |
24 | Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | 24 | Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); |
25 | Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | 25 | Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); |
26 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); | 26 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); |
27 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2); | 27 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2); |
28 | Bkmk(const Bkmk& rhs) : m_name(NULL), m_anno(NULL) | 28 | Bkmk(const Bkmk& rhs); |
29 | { | ||
30 | *this = rhs; | ||
31 | } | ||
32 | ~Bkmk(); | 29 | ~Bkmk(); |
33 | unsigned int value() const { return m_position; } | 30 | unsigned int value() const { return m_position; } |
34 | void value(unsigned int _v) { m_position = _v; } | 31 | void value(unsigned int _v) { m_position = _v; } |
35 | unsigned int value2() const { return m_position2; } | 32 | unsigned int value2() const { return m_position2; } |
36 | void value2(unsigned int _v) { m_position2 = _v; } | 33 | void value2(unsigned int _v) { m_position2 = _v; } |
37 | unsigned char red() { return m_red; } | 34 | unsigned char red() { return m_red; } |
38 | unsigned char green() { return m_green; } | 35 | unsigned char green() { return m_green; } |
39 | unsigned char blue() { return m_blue; } | 36 | unsigned char blue() { return m_blue; } |
40 | void red(unsigned char _v) { m_red = _v; } | 37 | void red(unsigned char _v) { m_red = _v; } |
41 | void green(unsigned char _v) { m_green = _v; } | 38 | void green(unsigned char _v) { m_green = _v; } |
42 | void blue(unsigned char _v) { m_blue = _v; } | 39 | void blue(unsigned char _v) { m_blue = _v; } |
43 | unsigned char level() { return m_level; } | 40 | unsigned char level() { return m_level; } |
44 | void level(unsigned char _v) { m_level = _v; } | 41 | void level(unsigned char _v) { m_level = _v; } |
45 | tchar *name() const { return (tchar*)m_name; } | 42 | tchar *name() const { return (tchar*)m_name; } |
46 | tchar *anno() const { return (tchar*)m_anno; } | 43 | tchar *anno() const { return (tchar*)m_anno; } |
47 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } | 44 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } |
48 | Bkmk& operator=(const Bkmk& rhs); | 45 | Bkmk& operator=(const Bkmk& rhs); |
49 | bool operator==(const Bkmk& rhs); | 46 | bool operator==(const Bkmk& rhs); |
50 | void setAnno(tchar* t); | 47 | void setAnno(tchar* t); |
51 | void setAnno(unsigned char* t, unsigned short len); | 48 | void setAnno(unsigned char* t, unsigned short len); |
52 | unsigned char* filedata() | 49 | unsigned char* filedata() |
53 | { | 50 | { |
54 | CFiledata fd(anno()); | 51 | CFiledata fd(anno()); |
55 | return m_anno+fd.length(); | 52 | return m_anno+fd.length(); |
diff --git a/noncore/apps/opie-reader/StyleConsts.cpp b/noncore/apps/opie-reader/StyleConsts.cpp index 77c9d3b..c19fa3d 100644 --- a/noncore/apps/opie-reader/StyleConsts.cpp +++ b/noncore/apps/opie-reader/StyleConsts.cpp | |||
@@ -1,30 +1,37 @@ | |||
1 | 1 | ||
2 | #include <qimage.h> | 2 | #include <qimage.h> |
3 | #include "StyleConsts.h" | 3 | #include "StyleConsts.h" |
4 | 4 | ||
5 | GraphicLink::~GraphicLink() { delete graphic; } | 5 | GraphicLink::~GraphicLink() { delete graphic; } |
6 | 6 | ||
7 | pmstore::pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : | ||
8 | count(1), | ||
9 | m_isScaleable(_canScale) | ||
10 | { | ||
11 | graphic = new GraphicLink(p, isLnk, tgt); | ||
12 | } | ||
13 | |||
7 | pmstore::~pmstore() | 14 | pmstore::~pmstore() |
8 | { | 15 | { |
9 | //// qDebug("Deleting image"); | 16 | //// qDebug("Deleting image"); |
10 | delete graphic; | 17 | delete graphic; |
11 | } | 18 | } |
12 | 19 | ||
13 | CStyle::~CStyle() | 20 | CStyle::~CStyle() |
14 | { | 21 | { |
15 | if (graphic != NULL) | 22 | if (graphic != NULL) |
16 | { | 23 | { |
17 | if (--(graphic->count) == 0) | 24 | if (--(graphic->count) == 0) |
18 | { | 25 | { |
19 | delete graphic; | 26 | delete graphic; |
20 | } | 27 | } |
21 | } | 28 | } |
22 | } | 29 | } |
23 | 30 | ||
24 | CStyle::CStyle(const CStyle& rhs) : graphic(NULL) | 31 | CStyle::CStyle(const CStyle& rhs) : graphic(NULL) |
25 | { | 32 | { |
26 | *this = rhs; | 33 | *this = rhs; |
27 | } | 34 | } |
28 | 35 | ||
29 | CStyle& CStyle::operator=(const CStyle& rhs) | 36 | CStyle& CStyle::operator=(const CStyle& rhs) |
30 | { | 37 | { |
diff --git a/noncore/apps/opie-reader/StyleConsts.h b/noncore/apps/opie-reader/StyleConsts.h index 4b7ff4b..5fd9669 100644 --- a/noncore/apps/opie-reader/StyleConsts.h +++ b/noncore/apps/opie-reader/StyleConsts.h | |||
@@ -1,56 +1,54 @@ | |||
1 | #ifndef __STYLECONSTS_H | 1 | #ifndef __STYLECONSTS_H |
2 | #define __STYLECONSTS_H | 2 | #define __STYLECONSTS_H |
3 | 3 | ||
4 | typedef unsigned short StyleType; | 4 | typedef unsigned short StyleType; |
5 | 5 | ||
6 | #ifdef _WINDOWS | 6 | #ifdef _WINDOWS |
7 | #include <string.h> | 7 | #include <string.h> |
8 | #endif | 8 | #endif |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <qglobal.h> | 11 | #include <qglobal.h> |
12 | class QImage; | 12 | class QImage; |
13 | 13 | ||
14 | struct GraphicLink | 14 | struct GraphicLink |
15 | { | 15 | { |
16 | QImage* graphic; | 16 | QImage* graphic; |
17 | bool isLink; | 17 | bool isLink; |
18 | unsigned long link; | 18 | unsigned long link; |
19 | GraphicLink(QImage* p, bool isLnk, unsigned long tgt) : | 19 | GraphicLink(QImage* p, bool isLnk, unsigned long tgt) : |
20 | graphic(p), isLink(isLnk), link(tgt) {} | 20 | graphic(p), isLink(isLnk), link(tgt) {} |
21 | ~GraphicLink(); | 21 | ~GraphicLink(); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | struct pmstore | 24 | class pmstore |
25 | { | 25 | { |
26 | public: | ||
26 | unsigned int count; | 27 | unsigned int count; |
27 | bool m_isScaleable; | 28 | bool m_isScaleable; |
28 | GraphicLink* graphic; | 29 | GraphicLink* graphic; |
29 | pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt) : count(1), m_isScaleable(_canScale) | 30 | pmstore(bool _canScale, QImage* p, bool isLnk, unsigned long tgt); |
30 | { | ||
31 | graphic = new GraphicLink(p, isLnk, tgt); | ||
32 | } | ||
33 | ~pmstore(); | 31 | ~pmstore(); |
34 | }; | 32 | }; |
35 | 33 | ||
36 | enum EalignmentType | 34 | enum EalignmentType |
37 | { | 35 | { |
38 | m_AlignLeft, | 36 | m_AlignLeft, |
39 | m_AlignRight, | 37 | m_AlignRight, |
40 | m_AlignCentre, | 38 | m_AlignCentre, |
41 | m_AlignJustify, | 39 | m_AlignJustify, |
42 | m_AlignNone | 40 | m_AlignNone |
43 | }; | 41 | }; |
44 | 42 | ||
45 | class CBasicStyle | 43 | class CBasicStyle |
46 | { | 44 | { |
47 | friend class CStyle; | 45 | friend class CStyle; |
48 | bool m_bold, | 46 | bool m_bold, |
49 | m_italic; | 47 | m_italic; |
50 | unsigned long m_table; | 48 | unsigned long m_table; |
51 | int m_fontsize; | 49 | int m_fontsize; |
52 | EalignmentType m_align; | 50 | EalignmentType m_align; |
53 | unsigned char red, green, blue; | 51 | unsigned char red, green, blue; |
54 | unsigned char bred, bgreen, bblue; | 52 | unsigned char bred, bgreen, bblue; |
55 | unsigned char pred, pgreen, pblue; | 53 | unsigned char pred, pgreen, pblue; |
56 | unsigned long data; | 54 | unsigned long data; |
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index c27eb1e..f040f1e 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp | |||
@@ -6039,57 +6039,56 @@ QTextFormat QTextFormat::makeTextFormat( const QStyleSheetItem *style, const QMa | |||
6039 | else | 6039 | else |
6040 | format.setVAlign( QTextFormat::AlignNormal ); | 6040 | format.setVAlign( QTextFormat::AlignNormal ); |
6041 | } else if ( style.startsWith("color:" ) ) { | 6041 | } else if ( style.startsWith("color:" ) ) { |
6042 | format.col.setNamedColor( style.mid(6) ); | 6042 | format.col.setNamedColor( style.mid(6) ); |
6043 | format.linkColor = FALSE; | 6043 | format.linkColor = FALSE; |
6044 | } | 6044 | } |
6045 | } | 6045 | } |
6046 | } | 6046 | } |
6047 | 6047 | ||
6048 | format.update(); | 6048 | format.update(); |
6049 | return format; | 6049 | return format; |
6050 | } | 6050 | } |
6051 | 6051 | ||
6052 | struct QPixmapInt | 6052 | struct QPixmapInt |
6053 | { | 6053 | { |
6054 | QPixmapInt() : ref( 0 ) {} | 6054 | QPixmapInt() : ref( 0 ) {} |
6055 | QPixmap pm; | 6055 | QPixmap pm; |
6056 | int ref; | 6056 | int ref; |
6057 | }; | 6057 | }; |
6058 | 6058 | ||
6059 | static QMap<QString, QPixmapInt> *pixmap_map = 0; | 6059 | static QMap<QString, QPixmapInt> *pixmap_map = 0; |
6060 | 6060 | ||
6061 | QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, | 6061 | QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, |
6062 | QMimeSourceFactory &factory ) | 6062 | QMimeSourceFactory &factory ) |
6063 | : QTextCustomItem( p ) | 6063 | : QTextCustomItem( p ), reg( 0 ) |
6064 | { | 6064 | { |
6065 | width = height = 0; | 6065 | width = height = 0; |
6066 | if ( attr.contains("width") ) | 6066 | if ( attr.contains("width") ) |
6067 | width = attr["width"].toInt(); | 6067 | width = attr["width"].toInt(); |
6068 | if ( attr.contains("height") ) | 6068 | if ( attr.contains("height") ) |
6069 | height = attr["height"].toInt(); | 6069 | height = attr["height"].toInt(); |
6070 | 6070 | ||
6071 | reg = 0; | ||
6072 | QString imageName = attr["src"]; | 6071 | QString imageName = attr["src"]; |
6073 | 6072 | ||
6074 | if (!imageName) | 6073 | if (!imageName) |
6075 | imageName = attr["source"]; | 6074 | imageName = attr["source"]; |
6076 | 6075 | ||
6077 | if ( !imageName.isEmpty() ) { | 6076 | if ( !imageName.isEmpty() ) { |
6078 | imgId = QString( "%1,%2,%3,%4" ).arg( imageName ).arg( width ).arg( height ).arg( (ulong)&factory ); | 6077 | imgId = QString( "%1,%2,%3,%4" ).arg( imageName ).arg( width ).arg( height ).arg( (ulong)&factory ); |
6079 | if ( !pixmap_map ) | 6078 | if ( !pixmap_map ) |
6080 | pixmap_map = new QMap<QString, QPixmapInt>; | 6079 | pixmap_map = new QMap<QString, QPixmapInt>; |
6081 | if ( pixmap_map->contains( imgId ) ) { | 6080 | if ( pixmap_map->contains( imgId ) ) { |
6082 | QPixmapInt& pmi = pixmap_map->operator[](imgId); | 6081 | QPixmapInt& pmi = pixmap_map->operator[](imgId); |
6083 | pm = pmi.pm; | 6082 | pm = pmi.pm; |
6084 | pmi.ref++; | 6083 | pmi.ref++; |
6085 | width = pm.width(); | 6084 | width = pm.width(); |
6086 | height = pm.height(); | 6085 | height = pm.height(); |
6087 | } else { | 6086 | } else { |
6088 | QImage img; | 6087 | QImage img; |
6089 | const QMimeSource* m = | 6088 | const QMimeSource* m = |
6090 | factory.data( imageName, context ); | 6089 | factory.data( imageName, context ); |
6091 | if ( !m ) { | 6090 | if ( !m ) { |
6092 | owarn << "QTextImage: no mimesource for " << imageName.latin1() << "" << oendl; | 6091 | owarn << "QTextImage: no mimesource for " << imageName.latin1() << "" << oendl; |
6093 | } | 6092 | } |
6094 | else { | 6093 | else { |
6095 | if ( !QImageDrag::decode( m, img ) ) { | 6094 | if ( !QImageDrag::decode( m, img ) ) { |
@@ -6128,60 +6127,60 @@ QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, co | |||
6128 | if ( pm.mask() ) { | 6127 | if ( pm.mask() ) { |
6129 | QRegion mask( *pm.mask() ); | 6128 | QRegion mask( *pm.mask() ); |
6130 | QRegion all( 0, 0, pm.width(), pm.height() ); | 6129 | QRegion all( 0, 0, pm.width(), pm.height() ); |
6131 | reg = new QRegion( all.subtract( mask ) ); | 6130 | reg = new QRegion( all.subtract( mask ) ); |
6132 | } | 6131 | } |
6133 | } | 6132 | } |
6134 | 6133 | ||
6135 | if ( pm.isNull() && (width*height)==0 ) | 6134 | if ( pm.isNull() && (width*height)==0 ) |
6136 | width = height = 50; | 6135 | width = height = 50; |
6137 | 6136 | ||
6138 | place = PlaceInline; | 6137 | place = PlaceInline; |
6139 | if ( attr["align"] == "left" ) | 6138 | if ( attr["align"] == "left" ) |
6140 | place = PlaceLeft; | 6139 | place = PlaceLeft; |
6141 | else if ( attr["align"] == "right" ) | 6140 | else if ( attr["align"] == "right" ) |
6142 | place = PlaceRight; | 6141 | place = PlaceRight; |
6143 | 6142 | ||
6144 | tmpwidth = width; | 6143 | tmpwidth = width; |
6145 | tmpheight = height; | 6144 | tmpheight = height; |
6146 | 6145 | ||
6147 | attributes = attr; | 6146 | attributes = attr; |
6148 | } | 6147 | } |
6149 | 6148 | ||
6150 | QTextImage::~QTextImage() | 6149 | QTextImage::~QTextImage() |
6151 | { | 6150 | { |
6151 | delete reg; | ||
6152 | if ( pixmap_map && pixmap_map->contains( imgId ) ) { | 6152 | if ( pixmap_map && pixmap_map->contains( imgId ) ) { |
6153 | QPixmapInt& pmi = pixmap_map->operator[](imgId); | 6153 | QPixmapInt& pmi = pixmap_map->operator[](imgId); |
6154 | pmi.ref--; | 6154 | pmi.ref--; |
6155 | if ( !pmi.ref ) { | 6155 | if ( !pmi.ref ) { |
6156 | pixmap_map->remove( imgId ); | 6156 | pixmap_map->remove( imgId ); |
6157 | if ( pixmap_map->isEmpty() ) { | 6157 | if ( pixmap_map->isEmpty() ) { |
6158 | delete pixmap_map; | 6158 | delete pixmap_map; |
6159 | pixmap_map = 0; | 6159 | pixmap_map = 0; |
6160 | } | 6160 | } |
6161 | } | 6161 | } |
6162 | } | 6162 | } |
6163 | delete reg; | ||
6164 | } | 6163 | } |
6165 | 6164 | ||
6166 | QString QTextImage::richText() const | 6165 | QString QTextImage::richText() const |
6167 | { | 6166 | { |
6168 | QString s; | 6167 | QString s; |
6169 | s += "<img "; | 6168 | s += "<img "; |
6170 | QMap<QString, QString>::ConstIterator it = attributes.begin(); | 6169 | QMap<QString, QString>::ConstIterator it = attributes.begin(); |
6171 | for ( ; it != attributes.end(); ++it ) | 6170 | for ( ; it != attributes.end(); ++it ) |
6172 | s += it.key() + "=" + *it + " "; | 6171 | s += it.key() + "=" + *it + " "; |
6173 | s += ">"; | 6172 | s += ">"; |
6174 | return s; | 6173 | return s; |
6175 | } | 6174 | } |
6176 | 6175 | ||
6177 | void QTextImage::adjustToPainter( QPainter* p ) | 6176 | void QTextImage::adjustToPainter( QPainter* p ) |
6178 | { | 6177 | { |
6179 | width = scale( tmpwidth, p ); | 6178 | width = scale( tmpwidth, p ); |
6180 | height = scale( tmpheight, p ); | 6179 | height = scale( tmpheight, p ); |
6181 | } | 6180 | } |
6182 | 6181 | ||
6183 | #if !defined(Q_WS_X11) | 6182 | #if !defined(Q_WS_X11) |
6184 | #include <qbitmap.h> | 6183 | #include <qbitmap.h> |
6185 | #include "qcleanuphandler.h" | 6184 | #include "qcleanuphandler.h" |
6186 | static QPixmap *qrt_selection = 0; | 6185 | static QPixmap *qrt_selection = 0; |
6187 | static QSingleCleanupHandler<QPixmap> qrt_cleanup_pixmap; | 6186 | static QSingleCleanupHandler<QPixmap> qrt_cleanup_pixmap; |
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 539d356..89024f7 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp | |||
@@ -368,55 +368,60 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { | |||
368 | HlCFloat::HlCFloat(int attribute, int context) | 368 | HlCFloat::HlCFloat(int attribute, int context) |
369 | : HlFloat(attribute,context) { | 369 | : HlFloat(attribute,context) { |
370 | } | 370 | } |
371 | 371 | ||
372 | const QChar *HlCFloat::checkHgl(const QChar *s, int len, bool lineStart) { | 372 | const QChar *HlCFloat::checkHgl(const QChar *s, int len, bool lineStart) { |
373 | 373 | ||
374 | s = HlFloat::checkHgl(s, len, lineStart); | 374 | s = HlFloat::checkHgl(s, len, lineStart); |
375 | if (s && ((*s&0xdf) == 'F' )) s++; | 375 | if (s && ((*s&0xdf) == 'F' )) s++; |
376 | return s; | 376 | return s; |
377 | } | 377 | } |
378 | 378 | ||
379 | HlAnyChar::HlAnyChar(int attribute, int context, const QChar* charList, uint len) | 379 | HlAnyChar::HlAnyChar(int attribute, int context, const QChar* charList, uint len) |
380 | : HlItem(attribute, context) { | 380 | : HlItem(attribute, context) { |
381 | _charList=charList; | 381 | _charList=charList; |
382 | _charListLen=len; | 382 | _charListLen=len; |
383 | } | 383 | } |
384 | 384 | ||
385 | const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool) | 385 | const QChar *HlAnyChar::checkHgl(const QChar *s, int len, bool) |
386 | { | 386 | { |
387 | if (ustrchr(_charList, _charListLen, *s)) return s +1; | 387 | if (ustrchr(_charList, _charListLen, *s)) return s +1; |
388 | return 0L; | 388 | return 0L; |
389 | } | 389 | } |
390 | 390 | ||
391 | HlRegExpr::HlRegExpr(int attribute, int context,QString regexp) | 391 | HlRegExpr::HlRegExpr(int attribute, int context,QString regexp) |
392 | : HlItem(attribute, context) { | 392 | : HlItem(attribute, context), Expr(0) { |
393 | 393 | ||
394 | handlesLinestart=regexp.startsWith("^"); | 394 | handlesLinestart=regexp.startsWith("^"); |
395 | if(!handlesLinestart) regexp.prepend("^"); | 395 | if(!handlesLinestart) regexp.prepend("^"); |
396 | Expr=new QRegExp3(regexp); | 396 | Expr=new QRegExp3(regexp); |
397 | } | 397 | } |
398 | 398 | ||
399 | HlRegExpr::~HlRegExpr() | ||
400 | { | ||
401 | delete Expr; | ||
402 | } | ||
403 | |||
399 | const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) | 404 | const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) |
400 | { | 405 | { |
401 | if ((!lineStart) && handlesLinestart) return 0; | 406 | if ((!lineStart) && handlesLinestart) return 0; |
402 | 407 | ||
403 | QString line(s,len); | 408 | QString line(s,len); |
404 | int pos = Expr->search( line, 0 ); | 409 | int pos = Expr->search( line, 0 ); |
405 | if (pos==-1) return 0L; | 410 | if (pos==-1) return 0L; |
406 | else | 411 | else |
407 | return (s+Expr->matchedLength()); | 412 | return (s+Expr->matchedLength()); |
408 | }; | 413 | }; |
409 | 414 | ||
410 | 415 | ||
411 | HlLineContinue::HlLineContinue(int attribute, int context) | 416 | HlLineContinue::HlLineContinue(int attribute, int context) |
412 | : HlItem(attribute,context) { | 417 | : HlItem(attribute,context) { |
413 | } | 418 | } |
414 | 419 | ||
415 | const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { | 420 | const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { |
416 | 421 | ||
417 | if ((s[0].latin1() == '\\') && (len == 1)) | 422 | if ((s[0].latin1() == '\\') && (len == 1)) |
418 | { | 423 | { |
419 | return s + 1; | 424 | return s + 1; |
420 | } | 425 | } |
421 | return 0L; | 426 | return 0L; |
422 | } | 427 | } |
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.h b/noncore/apps/tinykate/libkate/document/katehighlight.h index fddf585..f0be27b 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.h +++ b/noncore/apps/tinykate/libkate/document/katehighlight.h | |||
@@ -163,49 +163,49 @@ class HlLineContinue : public HlItem { | |||
163 | 163 | ||
164 | class HlCStringChar : public HlItem { | 164 | class HlCStringChar : public HlItem { |
165 | public: | 165 | public: |
166 | HlCStringChar(int attribute, int context); | 166 | HlCStringChar(int attribute, int context); |
167 | virtual const QChar *checkHgl(const QChar *, int len, bool); | 167 | virtual const QChar *checkHgl(const QChar *, int len, bool); |
168 | }; | 168 | }; |
169 | 169 | ||
170 | class HlCChar : public HlItem { | 170 | class HlCChar : public HlItem { |
171 | public: | 171 | public: |
172 | HlCChar(int attribute, int context); | 172 | HlCChar(int attribute, int context); |
173 | virtual const QChar *checkHgl(const QChar *, int len, bool); | 173 | virtual const QChar *checkHgl(const QChar *, int len, bool); |
174 | }; | 174 | }; |
175 | 175 | ||
176 | class HlAnyChar : public HlItem { | 176 | class HlAnyChar : public HlItem { |
177 | public: | 177 | public: |
178 | HlAnyChar(int attribute, int context, const QChar* charList, uint len); | 178 | HlAnyChar(int attribute, int context, const QChar* charList, uint len); |
179 | virtual const QChar *checkHgl(const QChar *, int len, bool); | 179 | virtual const QChar *checkHgl(const QChar *, int len, bool); |
180 | const QChar* _charList; | 180 | const QChar* _charList; |
181 | uint _charListLen; | 181 | uint _charListLen; |
182 | }; | 182 | }; |
183 | 183 | ||
184 | class HlRegExpr : public HlItem { | 184 | class HlRegExpr : public HlItem { |
185 | public: | 185 | public: |
186 | HlRegExpr(int attribute, int context,QString expr); | 186 | HlRegExpr(int attribute, int context,QString expr); |
187 | ~HlRegExpr(){delete Expr;}; | 187 | ~HlRegExpr(); |
188 | virtual const QChar *checkHgl(const QChar *, int len, bool); | 188 | virtual const QChar *checkHgl(const QChar *, int len, bool); |
189 | QRegExp3 *Expr; | 189 | QRegExp3 *Expr; |
190 | bool handlesLinestart; | 190 | bool handlesLinestart; |
191 | }; | 191 | }; |
192 | 192 | ||
193 | //-------- | 193 | //-------- |
194 | 194 | ||
195 | 195 | ||
196 | //Item Style: color, selected color, bold, italic | 196 | //Item Style: color, selected color, bold, italic |
197 | class ItemStyle { | 197 | class ItemStyle { |
198 | public: | 198 | public: |
199 | ItemStyle(); | 199 | ItemStyle(); |
200 | // ItemStyle(const ItemStyle &); | 200 | // ItemStyle(const ItemStyle &); |
201 | ItemStyle(const QColor &, const QColor &, bool bold, bool italic); | 201 | ItemStyle(const QColor &, const QColor &, bool bold, bool italic); |
202 | ItemStyle(ItemStyle *its){col=its->col;selCol=its->selCol; bold=its->bold; italic=its->italic;} | 202 | ItemStyle(ItemStyle *its){col=its->col;selCol=its->selCol; bold=its->bold; italic=its->italic;} |
203 | // void setData(const ItemStyle &); | 203 | // void setData(const ItemStyle &); |
204 | QColor col; | 204 | QColor col; |
205 | QColor selCol; | 205 | QColor selCol; |
206 | int bold; //boolean value | 206 | int bold; //boolean value |
207 | int italic; //boolean value | 207 | int italic; //boolean value |
208 | }; | 208 | }; |
209 | 209 | ||
210 | typedef QList<ItemStyle> ItemStyleList; | 210 | typedef QList<ItemStyle> ItemStyleList; |
211 | 211 | ||