| 1 | /* Copyright 2003 Kjetil S. Matheussen |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or |
| 4 | modify it under the terms of the GNU General Public License |
| 5 | as published by the Free Software Foundation; either version 2 |
| 6 | of the License, or (at your option) any later version. |
| 7 | |
| 8 | This program is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 16 | |
| 17 | #ifndef EDITOR_WIDGET_H |
| 18 | #define EDITOR_WIDGET_Hcxx . . $ `Qt/EditorWidget.h:18:9`! |
| 19 | |
| 20 | #ifdef USE_QT3 |
| 21 | #include <qmenubar.h> |
| 22 | #include <qmainwindow.h> |
| 23 | #include <qslider.h> |
| 24 | #include <qtimer.h> |
| 25 | |
| 26 | # if USE_GTK_VISUAL |
| 27 | # include "qtxembed-1.3-free/src/qtxembed.h" |
| 28 | # endif |
| 29 | |
| 30 | #include <qapplication.h> |
| 31 | #include <qpixmap.h> |
| 32 | #include <qimage.h> |
| 33 | #include <qpointarray.h> |
| 34 | #include <qlabel.h> |
| 35 | #endif // USE_QT3 |
| 36 | |
| 37 | #ifdef USE_QT4cxx . . $ `<built-in>:483:9`! |
| 38 | //Added by qt3to4: |
| 39 | #include <QWidget> |
| 40 | #include <QLabel> |
| 41 | //#include <Q3PointArray> |
| 42 | #include <QPainter> |
| 43 | #endif |
| 44 | |
| 45 | #ifdef USE_QT3 |
| 46 | # define Q3PointArray QPointArray |
| 47 | # define Q3PopupMenu QPopupMenu |
| 48 | #endif |
| 49 | |
| 50 | #define GFX_DONTSHRINKcxx . . $ `Qt/EditorWidget.h:50:9`! |
| 51 | #include "../common/nsmtracker.h"cxx . . $ `<file>/common/nsmtracker.h`/ |
| 52 | #include "../common/windows_proc.h"cxx . . $ `<file>/common/windows_proc.h`/ |
| 53 | |
| 54 | #include "../common/visual_proc.h"cxx . . $ `<file>/common/visual_proc.h`/ |
| 55 | #include "../common/visual_op_queue_proc.h"cxx . . $ `<file>/common/visual_op_queue_proc.h`/ |
| 56 | |
| 57 | |
| 58 | // Don't paint on the frame. |
| 59 | //#define XOFFSET 5 |
| 60 | //#define YOFFSET 2 |
| 61 | |
| 62 | |
| 63 | class QMainWindowcxx . . $ QMainWindow#; |
| 64 | class QSplittercxx . . $ QSplitter#; |
| 65 | |
| 66 | #if USE_QIMAGE_BUFFER |
| 67 | typedef QImage PaintBuffer; |
| 68 | #else |
| 69 | typedef QPixmapcxx . . $ QPixmap# PaintBuffercxx . . $ PaintBuffer#; |
| 70 | #endif |
| 71 | |
| 72 | class EditorWidgetcxx . . $ EditorWidget# : public QWidgetcxx . . $ QWidget# //QFrame |
| 73 | //class EditorWidget : public QtXEmbedContainer //QWidget //QFrame |
| 74 | { |
| 75 | |
| 76 | public: |
| 77 | EditorWidgetcxx . . $ EditorWidget#EditorWidget(d4d784ff5f449b0d).(QWidgetcxx . . $ QWidget# *parent=0, const char *name="no name" ); |
| 78 | ~cxx . . $ EditorWidget#`~EditorWidget`(ced63f7c635d850d).EditorWidgetcxx . . $ EditorWidget#(); |
| 79 | |
| 80 | #if USE_QT_VISUAL && USE_QT4cxx . . $ `<built-in>:483:9`! |
| 81 | //const QPaintEngine* paintEngine(); |
| 82 | #endif |
| 83 | |
| 84 | QColorcxx . . $ QColor# colorscxx . . $ EditorWidget#colors.[16]; // color array |
| 85 | |
| 86 | #if USE_QT_VISUAL |
| 87 | PaintBuffer *paintbuffer; |
| 88 | |
| 89 | PaintBuffer *cursorbuffer; |
| 90 | #endif |
| 91 | |
| 92 | //void timerEvent(QTimerEvent *); |
| 93 | |
| 94 | struct Tracker_Windowscxx . . $ Tracker_Windows# *windowcxx . . $ EditorWidget#window.; // Not sure if this one is used. |
| 95 | |
| 96 | QMainWindowcxx . . $ QMainWindow# *main_windowcxx . . $ EditorWidget#main_window.; |
| 97 | |
| 98 | #if USE_QT_VISUAL |
| 99 | QPainter *painter; // Set in paintEvent |
| 100 | QPainter *paintbuffer_painter; // Set in paintEvent |
| 101 | QPainter *cursorbuffer_painter; // Set in paintEvent |
| 102 | |
| 103 | QFont font; |
| 104 | #endif |
| 105 | |
| 106 | //QFrame *status_frame; |
| 107 | QLabelcxx . . $ QLabel# *status_labelcxx . . $ EditorWidget#status_label.; |
| 108 | |
| 109 | QSplittercxx . . $ QSplitter# *xsplittercxx . . $ EditorWidget#xsplitter.; |
| 110 | QSplittercxx . . $ QSplitter# *ysplittercxx . . $ EditorWidget#ysplitter.; |
| 111 | |
| 112 | int get_editor_widthcxx . . $ EditorWidget#get_editor_width(b126dc7c1de90089).(){ |
| 113 | //return this->width()-XOFFSET-2; // Fine tuned. No logical reason behind it. (2 is probably just the frame border width) |
| 114 | return this->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(); |
| 115 | } |
| 116 | |
| 117 | int get_editor_heightcxx . . $ EditorWidget#get_editor_height(b126dc7c1de90089).(){ |
| 118 | //return this->height()-YOFFSET-2; // Fine tuned. No logical reason behind it. (2 is probably just the frame border width) |
| 119 | return this->heightcxx . . $ QWidget#height(455f465bc33b4cdf).(); |
| 120 | } |
| 121 | |
| 122 | //Q3PointArray qpa; |
| 123 | |
| 124 | void updateEditorcxx . . $ EditorWidget#updateEditor(49f6e7a06ebc5aa8).(); |
| 125 | |
| 126 | void callCustomEventcxx . . $ EditorWidget#callCustomEvent(49f6e7a06ebc5aa8).(){ |
| 127 | customEventcxx . . $ EditorWidget#customEvent(c2473e2e70986fd7).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 128 | } |
| 129 | |
| 130 | #if USE_QT_VISUAL && USE_QIMAGE_BUFFER |
| 131 | void init_buffers(){ |
| 132 | const QImage::Format image_format = QImage::Format_RGB32; |
| 133 | |
| 134 | if(this->paintbuffer==NULL || this->cursorbuffer==NULL || this->paintbuffer->width()<this->width() || this->paintbuffer->height()<this->height()){ |
| 135 | delete this->paintbuffer_painter; |
| 136 | delete this->cursorbuffer_painter; |
| 137 | |
| 138 | delete this->paintbuffer; |
| 139 | delete this->cursorbuffer; |
| 140 | this->paintbuffer = new QImage(this->width(), this->height(), image_format); |
| 141 | this->cursorbuffer = new QImage(this->width(), this->height(), image_format); |
| 142 | |
| 143 | this->paintbuffer_painter = new QPainter(this->paintbuffer); |
| 144 | this->cursorbuffer_painter = new QPainter(this->cursorbuffer); |
| 145 | |
| 146 | this->paintbuffer_painter->setFont(this->font); |
| 147 | } |
| 148 | |
| 149 | #if 1 |
| 150 | { |
| 151 | this->cursorbuffer_painter->fillRect(0,0,this->width(),this->height(),this->colors[15]); |
| 152 | } |
| 153 | #if 0 |
| 154 | { |
| 155 | this->paintbuffer_painter->fillRect(0,0,this->width(),this->height(),this->colors[0]); |
| 156 | } |
| 157 | #endif |
| 158 | #endif |
| 159 | } |
| 160 | |
| 161 | #else |
| 162 | void init_bufferscxx . . $ EditorWidget#init_buffers(49f6e7a06ebc5aa8).(){ |
| 163 | #if USE_QT_VISUAL |
| 164 | if(this->paintbuffer==NULL || this->cursorbuffer==NULL){ |
| 165 | this->paintbuffer=new QPixmap(editor->width(),editor->height()); |
| 166 | this->cursorbuffer=new QPixmap(editor->width(),editor->height()); |
| 167 | #ifdef USE_QT3 |
| 168 | this->paintbuffer->setOptimization(QPixmap::BestOptim); |
| 169 | this->cursorbuffer->setOptimization(QPixmap::BestOptim); |
| 170 | #endif |
| 171 | }else{ |
| 172 | this->paintbuffer->resize(this->width(), this->height()); |
| 173 | this->cursorbuffer->resize(this->width(), this->height()); |
| 174 | } |
| 175 | #endif |
| 176 | } |
| 177 | #endif |
| 178 | |
| 179 | protected: |
| 180 | // bool event(QEvent *); |
| 181 | #if 1 //USE_QT_VISUAL |
| 182 | void paintEventcxx . . $ EditorWidget#paintEvent(f239c9e85d61a220).( QPaintEventcxx . . $ QPaintEvent# * ); |
| 183 | #endif |
| 184 | |
| 185 | #if 0 // Using X11filter for keys |
| 186 | void keyPressEvent(QKeyEvent *); |
| 187 | void keyReleaseEvent(QKeyEvent *qkeyevent); |
| 188 | #endif |
| 189 | |
| 190 | #if USE_QT_VISUAL |
| 191 | void mousePressEvent( QMouseEvent *); |
| 192 | void mouseReleaseEvent( QMouseEvent *); |
| 193 | void mouseMoveEvent( QMouseEvent *); |
| 194 | #endif |
| 195 | void resizeEventcxx . . $ EditorWidget#resizeEvent(eeeec21cf8dc0387).( QResizeEventcxx . . $ QResizeEvent# *); |
| 196 | void closeEventcxx . . $ EditorWidget#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent# *); |
| 197 | void customEventcxx . . $ EditorWidget#customEvent(c2473e2e70986fd7).(QEventcxx . . $ QEvent# *); |
| 198 | }; |
| 199 | |
| 200 | #endif |
| 201 |