summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp18
-rw-r--r--noncore/apps/opie-reader/Bkmks.h7
-rw-r--r--noncore/apps/opie-reader/StyleConsts.cpp7
-rw-r--r--noncore/apps/opie-reader/StyleConsts.h8
4 files changed, 29 insertions, 11 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
11const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE); 11const unsigned long BkmkFile::magic = ((unsigned long)'q' << 24) | ((unsigned long)'t' << 16) | ((unsigned long)'r' << 8) | ((unsigned long)BKMKTYPE);
12 12
13Bkmk::Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p) 13Bkmk::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
18Bkmk::Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short annolen, unsigned int _p) : m_position(_p) 23Bkmk::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
28Bkmk::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
23Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p) 39Bkmk::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
36Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p, unsigned int _p2) : m_position(_p) 52Bkmk::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
8template<class T> 8template<class T>
9class CList; 9class CList;
10 10
11class Bkmk 11class 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
5GraphicLink::~GraphicLink() { delete graphic; } 5GraphicLink::~GraphicLink() { delete graphic; }
6 6
7pmstore::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
7pmstore::~pmstore() 14pmstore::~pmstore()
8{ 15{
9//// qDebug("Deleting image"); 16//// qDebug("Deleting image");
10 delete graphic; 17 delete graphic;
11} 18}
12 19
13CStyle::~CStyle() 20CStyle::~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
24CStyle::CStyle(const CStyle& rhs) : graphic(NULL) 31CStyle::CStyle(const CStyle& rhs) : graphic(NULL)
25{ 32{
26 *this = rhs; 33 *this = rhs;
27} 34}
28 35
29CStyle& CStyle::operator=(const CStyle& rhs) 36CStyle& 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
4typedef unsigned short StyleType; 4typedef 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>
12class QImage; 12class QImage;
13 13
14struct GraphicLink 14struct 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
24struct pmstore 24class 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
36enum EalignmentType 34enum 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
45class CBasicStyle 43class 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;