-class VGRMap {
-public:
- QPixmap *map;
- int number;
-
- VGRMap(int n, QPixmap *m) {
- number = n;
- map = m;
- };
-};
-
-class VGR : public QMainWindow {
- Q_OBJECT
-public:
- VGR(char*);
- ~VGR();
-
- int resp_sock;
- int fcol;
- int bcol;
- int gfcol;
- int gbcol;
- int curx;
- int cury;
- int tx;
- int ty;
- QQueue<int> CharBuffer;
-
- bool string_wait;
- bool char_wait;
- bool line_wait;
- bool mouse_wait;
- bool inkey_wait;
- bool was_line;
- QColor *lcolors[256];
- QFont *prv_font;
- QFont *italic_font;
- QFont *bold_font;
- QFont *normal_font;
-
- void MakeColors();
-
- void SetForeground(int);
- void SetBackground(int);
- void ClearAll();
- void ClearArea(int, int, int, int);
-
- void Line(int, int, int, int);
- void Ellipse(int x, int y, int a, int b, int alfa, int beta, int fill);
- void Rect(int x1, int y1, int x2, int y2, int col, int fill);
- void Point(int x, int y);
- void TextXY(int x, int y, char *s);
- void CharXY(int x, int y, char a);
- void IntXY(int x, int y, int val);
-
- void WriteText(char *s);
- void WriteChar(char a);
- void WriteLine();
-
- /* Write Char w/o changing position */
- void PutChar(char a);
- void DelChar();
-
- void Outstring(int x, int y, char *s, int b, int f);
- void writeintxy(int x, int y, int val, int c);
- void CurPos();
-
- int Getmap(int w, int h);
- void Putmap(int map);
-
- void MagicGraph(G_MESSAGE*);
- bool GetInput(int);
-
-public slots:
- void vscrolled(int);
- void hscrolled(int);
- void CloseMe();
- void RequestMessage();
-
-protected:
- virtual void resizeEvent(QResizeEvent *);
- virtual void closeEvent(QCloseEvent *);
- virtual void keyPressEvent(QKeyEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void paintEvent(QPaintEvent *);
- virtual void focusInEvent(QFocusEvent *);
-
-private:
- QPixmap *canvas;
- QScrollBar *hscroll;
- QScrollBar *vscroll;
- QPushButton *close_btn;
- int ox,oy,lstep,pstep,gx,gy;
- QList<VGRMap> maps;
- int firstfreemap;
- bool Closed;
- bool MustRepaint;
- bool GraphRead;
- QSocketNotifier *request;
- char internal_buffer[256];
- int strcnt;
-};
-
-void VGR::MakeColors()
-{
- /* black */
- lcolors[0] = new QColor(0, 0, 0);
- /* blue dark */
- lcolors[1] = new QColor(0, 0, 139);
- /* green dark */
- lcolors[2] = new QColor(0, 100, 0);
- /* turquoise dark */
- lcolors[3] = new QColor(0, 197, 205);
- /* red dark */
- lcolors[4] = new QColor(205, 0, 0);
- /* violet */
- lcolors[5] = new QColor(238, 130, 238);
- /* brown */
- lcolors[6] = new QColor(139,35, 35);
- /* grey light */
- lcolors[7] = new QColor(190, 190, 190);
- /* grey dark */
- lcolors[8] = new QColor(97, 97, 97);
- /* blue */
- lcolors[9] = new QColor(0, 0, 255);
- /* green */
- lcolors[10] = new QColor(0, 255, 0);
- /* turquoise */
- lcolors[11] = new QColor(0, 229, 238);
- /* red light */
- lcolors[12] = new QColor(255, 0, 0);
- /* rose */
- lcolors[13] = new QColor(255, 110, 180);
- /* yellow */
- lcolors[14] = new QColor(255, 255, 0);
- /* white */
- lcolors[15] = new QColor(255, 255, 255);
-}