author | mjg59 <mjg59> | 2003-12-10 03:57:04 (UTC) |
---|---|---|
committer | mjg59 <mjg59> | 2003-12-10 03:57:04 (UTC) |
commit | becbcfae3bf3b5a714e7d3e39b924e08761739c2 (patch) (unidiff) | |
tree | 7ec5f6f90a9d529858da340150b415d87e7936ba /inputmethods/dasher/QtDasherScreen.h | |
parent | 1f0b92e554b76852af210ceb277b3e9ecb09a43d (diff) | |
download | opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.zip opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.tar.gz opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.tar.bz2 |
Fix the search directory for the training file, remove the (non-working anyway) font size calculation code - with luck, this'll fix the failure to start under Opie
Diffstat (limited to 'inputmethods/dasher/QtDasherScreen.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/dasher/QtDasherScreen.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/inputmethods/dasher/QtDasherScreen.h b/inputmethods/dasher/QtDasherScreen.h index c4d3b59..c029a60 100644 --- a/inputmethods/dasher/QtDasherScreen.h +++ b/inputmethods/dasher/QtDasherScreen.h | |||
@@ -1,98 +1,101 @@ | |||
1 | // QtDasherScreen.h | 1 | // QtDasherScreen.h |
2 | // (c) 2003 Yann Dirson | 2 | // (c) 2003 Yann Dirson |
3 | // Derived from GtkDasherCanvas.h | 3 | // Derived from GtkDasherCanvas.h |
4 | // (c) 2002 Philip Cowans | 4 | // (c) 2002 Philip Cowans |
5 | 5 | ||
6 | #ifndef QT_DASHER_SCREEN_H | 6 | #ifndef QT_DASHER_SCREEN_H |
7 | #define QT_DASHER_SCREEN_H | 7 | #define QT_DASHER_SCREEN_H |
8 | 8 | ||
9 | #include <string> | 9 | #include <string> |
10 | #include <sys/time.h> | 10 | #include <sys/time.h> |
11 | 11 | ||
12 | #include <qwidget.h> | 12 | #include <qwidget.h> |
13 | #include <qpainter.h> | 13 | #include <qpainter.h> |
14 | #include <qfont.h> | 14 | #include <qfont.h> |
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qpixmap.h> | 16 | #include <qpixmap.h> |
17 | #include <qtimer.h> | 17 | #include <qtimer.h> |
18 | #include <qcursor.h> | 18 | #include <qcursor.h> |
19 | 19 | ||
20 | #include "DasherScreen.h" | 20 | #include "DasherScreen.h" |
21 | #include "DashEdit.h" | 21 | #include "DashEdit.h" |
22 | #include "DasherInterface.h" | 22 | #include "DasherInterface.h" |
23 | 23 | ||
24 | #include <iconv.h> | ||
25 | |||
24 | using namespace Dasher; | 26 | using namespace Dasher; |
25 | 27 | ||
26 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen | 28 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen |
27 | 29 | ||
28 | { | 30 | { |
29 | Q_OBJECT | 31 | Q_OBJECT |
30 | public: | 32 | public: |
31 | QtDasherScreen (int _width, int _height, | 33 | QtDasherScreen (int _width, int _height, |
32 | CDasherInterface *_interface, | 34 | CDasherInterface *_interface, |
33 | QWidget * _parent=0, Dasher::CDashEditbox* edit=0); | 35 | QWidget * _parent=0, Dasher::CDashEditbox* edit=0); |
34 | QtDasherScreen::~QtDasherScreen(); | 36 | QtDasherScreen::~QtDasherScreen(); |
35 | 37 | ||
36 | void SetFont(std::string Name) | 38 | void SetFont(std::string Name) |
37 | { fontname = Name; /* set_the_font(); */ } | 39 | { fontname = Name; /* set_the_font(); */ } |
38 | 40 | ||
39 | void SetFontSize(Dasher::Opts::FontSize fontsize) | 41 | void SetFontSize(Dasher::Opts::FontSize fontsize) |
40 | { | 42 | { |
41 | #warning QtDasherScreen::SetFontSize() not implemented | 43 | #warning QtDasherScreen::SetFontSize() not implemented |
42 | } | 44 | } |
43 | Dasher::Opts::FontSize GetFontSize() | 45 | Dasher::Opts::FontSize GetFontSize() |
44 | { | 46 | { |
45 | #warning QtDasherScreen::GetFontSize() not implemented | 47 | #warning QtDasherScreen::GetFontSize() not implemented |
46 | return (Dasher::Opts::Normal); | 48 | return (Dasher::Opts::Normal); |
47 | } | 49 | } |
48 | 50 | ||
49 | void TextSize(symbol Character, int* Width, int* Height, int Size) const | 51 | void TextSize(symbol Character, int* Width, int* Height, int Size) const |
50 | { | 52 | { |
51 | // should probably use QPainter::boundingRect() | 53 | // should probably use QPainter::boundingRect() |
52 | *Width = *Height = Fonts[Size].pixelSize(); | 54 | *Width = *Height = font.pixelSize(); |
53 | 55 | ||
54 | } | 56 | } |
55 | void DrawText(symbol Character, int x1, int y1, int Size) const | 57 | void DrawText(symbol Character, int x1, int y1, int Size) const |
56 | { | 58 | { |
57 | // QFont font = QFont (fontname.c_str(), Size); | 59 | // QFont font = QFont (fontname.c_str(), Size); |
58 | // font.setPixelSize(Size); | 60 | // font.setPixelSize(Size); |
59 | QPoint point = QPoint(x1, y1+Size/2); | 61 | QPoint point = QPoint(x1, y1+Size/2); |
60 | 62 | ||
61 | painter->setFont (Fonts[Size]); | 63 | painter->setFont (font); |
62 | painter->drawText (point, | 64 | painter->drawText (point, |
63 | QString(interface->GetDisplayText(Character).c_str())); | 65 | QString(interface->GetDisplayText(Character).c_str())); |
64 | } | 66 | } |
65 | 67 | ||
66 | void DrawRectangle(int x1, int y1, int x2, int y2, | 68 | void DrawRectangle(int x1, int y1, int x2, int y2, |
67 | int Color, Opts::ColorSchemes ColorScheme) const; | 69 | int Color, Opts::ColorSchemes ColorScheme) const; |
68 | void Polyline(point* Points, int Number) const; | 70 | void Polyline(point* Points, int Number) const; |
69 | void DrawPolygon(point* Points, int Number, int Color, | 71 | void DrawPolygon(point* Points, int Number, int Color, |
70 | Opts::ColorSchemes ColorScheme) const; | 72 | Opts::ColorSchemes ColorScheme) const; |
71 | 73 | ||
72 | std::vector<int> FontSizes; | 74 | std::vector<int> FontSizes; |
73 | std::vector<QFont> Fonts; | 75 | std::vector<QFont> Fonts; |
74 | 76 | QFont font; | |
77 | int fontsize; | ||
75 | void Blank() const { | 78 | void Blank() const { |
76 | painter->begin(pixmap); | 79 | painter->begin(pixmap); |
77 | painter->setPen (NoPen); | 80 | painter->setPen (NoPen); |
78 | painter->fillRect(0, 0, m_iWidth, m_iHeight, | 81 | painter->fillRect(0, 0, m_iWidth, m_iHeight, |
79 | QColor(255,255,255)); | 82 | QColor(255,255,255)); |
80 | } | 83 | } |
81 | void Display() { | 84 | void Display() { |
82 | painter->end(); | 85 | painter->end(); |
83 | repaint(); | 86 | repaint(); |
84 | } | 87 | } |
85 | 88 | ||
86 | void paintEvent( QPaintEvent * ) | 89 | void paintEvent( QPaintEvent * ) |
87 | { | 90 | { |
88 | bitBlt(this, 0, 0, pixmap); | 91 | bitBlt(this, 0, 0, pixmap); |
89 | } | 92 | } |
90 | 93 | ||
91 | void mousePressEvent (QMouseEvent *e); | 94 | void mousePressEvent (QMouseEvent *e); |
92 | void mouseReleaseEvent (QMouseEvent *e); | 95 | void mouseReleaseEvent (QMouseEvent *e); |
93 | 96 | ||
94 | protected: | 97 | protected: |
95 | QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const; | 98 | QColor getColor(int Color, const Opts::ColorSchemes ColorScheme) const; |
96 | 99 | ||
97 | long QtDasherScreen::get_time(); | 100 | long QtDasherScreen::get_time(); |
98 | 101 | ||