-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 32 | ||||
-rw-r--r-- | inputmethods/dasher/PPMLanguageModel.cpp | 3 | ||||
-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 |
9 files changed, 57 insertions, 32 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index 1db34d2..30ff49d 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp | |||
@@ -56,47 +56,47 @@ | |||
56 | 56 | ||
57 | #define HERE printf("%s(%d): here\n",__FILE__,__LINE__) | 57 | #define HERE printf("%s(%d): here\n",__FILE__,__LINE__) |
58 | 58 | ||
59 | //FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI. | 59 | //FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI. |
60 | //FIXME: see if we can get this from terminfo. | 60 | //FIXME: see if we can get this from terminfo. |
61 | #define BS_CLEARS FALSE | 61 | #define BS_CLEARS FALSE |
62 | 62 | ||
63 | #define loc(X,Y) ((Y) * columns + (X)) | 63 | #define loc(X,Y) ((Y) * columns + (X)) |
64 | 64 | ||
65 | /*! creates a `TEScreen' of `lines' lines and `columns' columns. | 65 | /*! creates a `TEScreen' of `lines' lines and `columns' columns. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | TEScreen::TEScreen(int lines, int columns) | 68 | TEScreen::TEScreen(int _lines, int _columns) : |
69 | lines(_lines), | ||
70 | columns(_columns), | ||
71 | tabstops(0), | ||
72 | histCursor(0), | ||
73 | horzCursor(0) | ||
69 | { | 74 | { |
70 | this->lines = lines; | ||
71 | this->columns = columns; | ||
72 | // odebug << "Columns " << columns << "" << oendl; | 75 | // odebug << "Columns " << columns << "" << oendl; |
73 | 76 | ||
74 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 77 | image = new ca[lines*columns]; |
75 | tabstops = NULL; initTabStops(); | 78 | initTabStops(); |
76 | |||
77 | histCursor = 0; | ||
78 | horzCursor = 0; | ||
79 | 79 | ||
80 | clearSelection(); | 80 | clearSelection(); |
81 | reset(); | 81 | reset(); |
82 | } | 82 | } |
83 | 83 | ||
84 | /*! Destructor | 84 | /*! Destructor |
85 | */ | 85 | */ |
86 | 86 | ||
87 | TEScreen::~TEScreen() | 87 | TEScreen::~TEScreen() |
88 | { | 88 | { |
89 | free(image); | 89 | delete [] image; |
90 | if (tabstops) free(tabstops); | 90 | delete [] tabstops; |
91 | } | 91 | } |
92 | 92 | ||
93 | /* ------------------------------------------------------------------------- */ | 93 | /* ------------------------------------------------------------------------- */ |
94 | /* */ | 94 | /* */ |
95 | /* Normalized Screen Operations */ | 95 | /* Normalized Screen Operations */ |
96 | /* */ | 96 | /* */ |
97 | /* ------------------------------------------------------------------------- */ | 97 | /* ------------------------------------------------------------------------- */ |
98 | 98 | ||
99 | // Cursor Setting -------------------------------------------------------------- | 99 | // Cursor Setting -------------------------------------------------------------- |
100 | 100 | ||
101 | /*! \section Cursor | 101 | /*! \section Cursor |
102 | 102 | ||
@@ -387,47 +387,47 @@ void TEScreen::restoreCursor() | |||
387 | 387 | ||
388 | void TEScreen::resizeImage(int new_lines, int new_columns) | 388 | void TEScreen::resizeImage(int new_lines, int new_columns) |
389 | { | 389 | { |
390 | if (cuY > new_lines-1) { | 390 | if (cuY > new_lines-1) { |
391 | // attempt to preserve focus and lines | 391 | // attempt to preserve focus and lines |
392 | bmargin = lines-1; //FIXME: margin lost | 392 | bmargin = lines-1; //FIXME: margin lost |
393 | for (int i = 0; i < cuY-(new_lines-1); i++) { | 393 | for (int i = 0; i < cuY-(new_lines-1); i++) { |
394 | addHistLine(); scrollUp(horzCursor,1); | 394 | addHistLine(); scrollUp(horzCursor,1); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | // make new image | 398 | // make new image |
399 | ca* newimg = (ca*)malloc( new_lines * new_columns * sizeof( ca)); | 399 | ca* newimg = new ca[new_lines * new_columns]; |
400 | 400 | ||
401 | clearSelection(); | 401 | clearSelection(); |
402 | 402 | ||
403 | // clear new image | 403 | // clear new image |
404 | for (int y = 0; y < new_lines; y++) | 404 | for (int y = 0; y < new_lines; y++) |
405 | for (int x = 0; x < new_columns; x++) { | 405 | for (int x = 0; x < new_columns; x++) { |
406 | newimg[y*new_columns+x].c = ' '; | 406 | newimg[y*new_columns+x].c = ' '; |
407 | newimg[y*new_columns+x].f = DEFAULT_FORE_COLOR; | 407 | newimg[y*new_columns+x].f = DEFAULT_FORE_COLOR; |
408 | newimg[y*new_columns+x].b = DEFAULT_BACK_COLOR; | 408 | newimg[y*new_columns+x].b = DEFAULT_BACK_COLOR; |
409 | newimg[y*new_columns+x].r = DEFAULT_RENDITION; | 409 | newimg[y*new_columns+x].r = DEFAULT_RENDITION; |
410 | } | 410 | } |
411 | int cpy_lines = QMIN(new_lines, lines); | 411 | int cpy_lines = QMIN(new_lines, lines); |
412 | int cpy_columns = QMIN(new_columns,columns); | 412 | int cpy_columns = QMIN(new_columns,columns); |
413 | // copy to new image | 413 | // copy to new image |
414 | for (int y = 0; y < cpy_lines; y++) | 414 | for (int y = 0; y < cpy_lines; y++) |
415 | for (int x = 0; x < cpy_columns; x++) { | 415 | for (int x = 0; x < cpy_columns; x++) { |
416 | newimg[y*new_columns+x].c = image[loc(x,y)].c; | 416 | newimg[y*new_columns+x].c = image[loc(x,y)].c; |
417 | newimg[y*new_columns+x].f = image[loc(x,y)].f; | 417 | newimg[y*new_columns+x].f = image[loc(x,y)].f; |
418 | newimg[y*new_columns+x].b = image[loc(x,y)].b; | 418 | newimg[y*new_columns+x].b = image[loc(x,y)].b; |
419 | newimg[y*new_columns+x].r = image[loc(x,y)].r; | 419 | newimg[y*new_columns+x].r = image[loc(x,y)].r; |
420 | } | 420 | } |
421 | free(image); | 421 | delete [] image; |
422 | image = newimg; | 422 | image = newimg; |
423 | lines = new_lines; | 423 | lines = new_lines; |
424 | columns = new_columns; | 424 | columns = new_columns; |
425 | cuX = QMIN(cuX,columns-1); | 425 | cuX = QMIN(cuX,columns-1); |
426 | cuY = QMIN(cuY,lines-1); | 426 | cuY = QMIN(cuY,lines-1); |
427 | 427 | ||
428 | // FIXME: try to keep values, evtl. | 428 | // FIXME: try to keep values, evtl. |
429 | tmargin=0; | 429 | tmargin=0; |
430 | bmargin=lines-1; | 430 | bmargin=lines-1; |
431 | initTabStops(); | 431 | initTabStops(); |
432 | clearSelection(); | 432 | clearSelection(); |
433 | } | 433 | } |
@@ -498,25 +498,25 @@ void TEScreen::effectiveRendition() | |||
498 | returns the image. | 498 | returns the image. |
499 | 499 | ||
500 | Get the size of the image by \sa getLines and \sa getColumns. | 500 | Get the size of the image by \sa getLines and \sa getColumns. |
501 | 501 | ||
502 | NOTE that the image returned by this function must later be | 502 | NOTE that the image returned by this function must later be |
503 | freed. | 503 | freed. |
504 | 504 | ||
505 | */ | 505 | */ |
506 | 506 | ||
507 | ca* TEScreen::getCookedImage() | 507 | ca* TEScreen::getCookedImage() |
508 | { | 508 | { |
509 | int x,y; | 509 | int x,y; |
510 | ca* merged = (ca*)malloc(lines*columns*sizeof(ca)); | 510 | ca* merged = new ca[lines*columns]; |
511 | ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); | 511 | ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); |
512 | 512 | ||
513 | if (histCursor > hist.getLines()) { | 513 | if (histCursor > hist.getLines()) { |
514 | histCursor = hist.getLines(); | 514 | histCursor = hist.getLines(); |
515 | } | 515 | } |
516 | 516 | ||
517 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) | 517 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) |
518 | { | 518 | { |
519 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); | 519 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); |
520 | int yp = y*columns; | 520 | int yp = y*columns; |
521 | int yq = (y+histCursor)*columns; | 521 | int yq = (y+histCursor)*columns; |
522 | 522 | ||
@@ -614,26 +614,28 @@ void TEScreen::clearTabStops() | |||
614 | { | 614 | { |
615 | for (int i = 0; i < columns; i++) tabstops[i-1] = FALSE; | 615 | for (int i = 0; i < columns; i++) tabstops[i-1] = FALSE; |
616 | } | 616 | } |
617 | 617 | ||
618 | void TEScreen::changeTabStop(bool set) | 618 | void TEScreen::changeTabStop(bool set) |
619 | { | 619 | { |
620 | if (cuX >= columns) return; | 620 | if (cuX >= columns) return; |
621 | tabstops[cuX] = set; | 621 | tabstops[cuX] = set; |
622 | } | 622 | } |
623 | 623 | ||
624 | void TEScreen::initTabStops() | 624 | void TEScreen::initTabStops() |
625 | { | 625 | { |
626 | if (tabstops) free(tabstops); | 626 | if (tabstops) |
627 | tabstops = (bool*)malloc(columns*sizeof(bool)); | 627 | delete [] tabstops; |
628 | |||
629 | tabstops = new bool[columns]; | ||
628 | // Arrg! The 1st tabstop has to be one longer than the other. | 630 | // Arrg! The 1st tabstop has to be one longer than the other. |
629 | // i.e. the kids start counting from 0 instead of 1. | 631 | // i.e. the kids start counting from 0 instead of 1. |
630 | // Other programs might behave correctly. Be aware. | 632 | // Other programs might behave correctly. Be aware. |
631 | for (int i = 0; i < columns; i++) tabstops[i] = (i%8 == 0 && i != 0); | 633 | for (int i = 0; i < columns; i++) tabstops[i] = (i%8 == 0 && i != 0); |
632 | } | 634 | } |
633 | 635 | ||
634 | /*! | 636 | /*! |
635 | This behaves either as IND (Screen::Index) or as NEL (Screen::NextLine) | 637 | This behaves either as IND (Screen::Index) or as NEL (Screen::NextLine) |
636 | depending on the NewLine Mode (LNM). This mode also | 638 | depending on the NewLine Mode (LNM). This mode also |
637 | affects the key sequence returned for newline ([CR]LF). | 639 | affects the key sequence returned for newline ([CR]LF). |
638 | */ | 640 | */ |
639 | 641 | ||
diff --git a/inputmethods/dasher/PPMLanguageModel.cpp b/inputmethods/dasher/PPMLanguageModel.cpp index 137b07f..d767d16 100644 --- a/inputmethods/dasher/PPMLanguageModel.cpp +++ b/inputmethods/dasher/PPMLanguageModel.cpp | |||
@@ -50,33 +50,34 @@ CPPMLanguageModel::CPPMnode * CPPMLanguageModel::CPPMnode::add_symbol_to_node(in | |||
50 | } | 50 | } |
51 | return search; | 51 | return search; |
52 | } | 52 | } |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | ///////////////////////////////////////////////////////////////////// | 57 | ///////////////////////////////////////////////////////////////////// |
58 | // CPPMLanguageModel defs | 58 | // CPPMLanguageModel defs |
59 | ///////////////////////////////////////////////////////////////////// | 59 | ///////////////////////////////////////////////////////////////////// |
60 | 60 | ||
61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) | 61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) |
62 | : CLanguageModel(_alphabet,_normalization) | 62 | : CLanguageModel(_alphabet,_normalization), root(0), m_rootcontext(0) |
63 | { | 63 | { |
64 | root=new CPPMnode(-1); | 64 | root=new CPPMnode(-1); |
65 | m_rootcontext=new CPPMContext(root,0); | 65 | m_rootcontext=new CPPMContext(root,0); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | CPPMLanguageModel::~CPPMLanguageModel() | 69 | CPPMLanguageModel::~CPPMLanguageModel() |
70 | { | 70 | { |
71 | delete m_rootcontext; | ||
71 | delete root; | 72 | delete root; |
72 | } | 73 | } |
73 | 74 | ||
74 | 75 | ||
75 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) | 76 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) |
76 | // get the probability distribution at the context | 77 | // get the probability distribution at the context |
77 | { | 78 | { |
78 | // seems like we have to have this hack for VC++ | 79 | // seems like we have to have this hack for VC++ |
79 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); | 80 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); |
80 | 81 | ||
81 | 82 | ||
82 | int modelchars=GetNumberModelChars(); | 83 | int modelchars=GetNumberModelChars(); |
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,34 +1,50 @@ | |||
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 | } |
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 | |||
@@ -11,33 +11,30 @@ class CList; | |||
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; } |
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,18 +1,25 @@ | |||
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 | { |
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 | |||
@@ -12,33 +12,31 @@ typedef unsigned short StyleType; | |||
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 | ||
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 | |||
@@ -6051,33 +6051,32 @@ QTextFormat QTextFormat::makeTextFormat( const QStyleSheetItem *style, const QMa | |||
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; |
@@ -6140,36 +6139,36 @@ QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, co | |||
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 | } |
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 | |||
@@ -380,31 +380,36 @@ 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 | ||
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 | |||
@@ -175,25 +175,25 @@ class HlCChar : public HlItem { | |||
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(); |