Restore compilation of loggraph, extract code layout of kernel's message dialog into...
[vlp.git] / src / graph / loggraph.h
diff --git a/src/graph/loggraph.h b/src/graph/loggraph.h
new file mode 100644 (file)
index 0000000..45703bb
--- /dev/null
@@ -0,0 +1,147 @@
+#ifndef _VLP_GRAPH_H
+#define _VLP_GRAPH_H
+
+#include <QtGui/QPainter>
+#include <QtGui/QPrinter>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
+#include <QtGui/QFrame>
+#include <math.h>
+#include <QtGui/QPixmap>
+#include <QtGui/QScrollBar>
+#include <QtGui/QColor>
+#include <stdio.h>
+#include <QtGui/QFont>
+#include <QtGui/QFontMetrics>
+#include <QtCore/QList>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include "genint1.h"
+#include "comm.h"
+#include "socu.h"
+#include <unistd.h>
+#include <QtCore/QSocketNotifier>
+#include <QtCore/QObject>
+#include <errno.h>
+#include <QtCore/QQueue>
+#include <QtGui/QMessageBox>
+#include <QtGui/QMenuBar>
+#include <QtGui/QMouseEvent>
+// #include <qpopmenu.h>
+#include <QtCore/qnamespace.h>
+
+#define MAXWIDTH       640
+#define MAXHEIGHT      480
+#define TEXT_LINES     50
+#define TEXT_COLS      100
+#define REQUEST_NAME   "gr.req"
+#define PERM           0666
+
+class VGRMap {
+public:
+       QPixmap *map;
+       int number;
+
+       VGRMap(int n, QPixmap *m) {
+               number = n;
+               map = m;
+       };
+};
+
+class VGR : public QMainWindow {
+       Q_OBJECT
+public:
+       VGR(int argc, char ** argv);
+       ~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;
+};
+
+#endif /* _VLP_GRAPH_H */