2 #include <QtGui/QPainter>
3 #include <QtGui/QPrinter>
4 #include <QtGui/QPushButton>
5 #include <QtGui/QRadioButton>
6 #include <QtGui/QButtonGroup>
7 #include <QtGui/QApplication>
8 #include <QtGui/QMainWindow>
9 #include <QtGui/QFrame>
11 #include <QtGui/QPixmap>
12 #include <QtGui/QScrollBar>
13 #include <QtGui/QColor>
15 #include <QtGui/QFont>
16 #include <QtGui/QFontMetrics>
17 #include <QtCore/QList>
20 #include <netinet/in.h>
25 #include <QtCore/QSocketNotifier>
26 #include <QtCore/QObject>
28 #include <QtCore/QQueue>
29 #include <QtGui/QMessageBox>
30 #include <QtGui/QMenuBar>
31 #include <QtGui/QMouseEvent>
32 // #include <qpopmenu.h>
33 #include <QtCore/qnamespace.h>
39 #define REQUEST_NAME "gr.req"
45 * Construct the DrawView with buttons.
47 VGR::VGR(int argc, char **argv)
50 char *sockname = argv[1];
52 fprintf(stderr, "loggraph: inited with sockname = %s\n", sockname);
55 struct sockaddr_un svr;
56 int len, i, optval, on;
58 normal_font = new QFont("lucidatypewriter", 10, QFont::Normal);
59 normal_font->setFixedPitch(TRUE);
60 bold_font = new QFont("lucidatypewriter", 10, QFont::Bold);
61 bold_font->setFixedPitch(TRUE);
62 italic_font = new QFont("lucidatypewriter", 10, QFont::Normal,TRUE);
63 italic_font->setFixedPitch(TRUE);
65 prv_font = normal_font;
68 setCaption("graphic resource");
69 // setBackgroundColor(white);
70 canvas = new QPixmap(640, 480);
71 canvas->fill(backgroundColor());
78 // maps.setAutoDelete(TRUE);
84 hscroll = new QScrollBar(0, MAXWIDTH, lstep, pstep, 0, Qt::Orientation::Horizontal, this);
85 vscroll = new QScrollBar(0, MAXHEIGHT, lstep, pstep, 0, Qt::Orientation::Vertical, this);
86 hscroll->setTracking(TRUE);
87 vscroll->setTracking(TRUE);
90 hscroll->setGeometry(0, height() - 16, width() - 16, 16);
91 vscroll->setGeometry(width() - 16, 0, 16, height() - 16);
93 connect(hscroll, SIGNAL(valueChanged(int)), this, SLOT(hscrolled(int)));
94 connect(vscroll, SIGNAL(valueChanged(int)), this, SLOT(vscrolled(int)));
96 close_btn = new QPushButton(this, "close");
98 if (mp.load("pics/close.bmp"))
99 close_btn->setPixmap(mp);
101 close_btn->setText("C");
103 close_btn->setGeometry(width()-16,height()-16,16,16);
104 close_btn->setEnabled(FALSE);
105 connect(close_btn, SIGNAL(clicked()), this, SLOT(CloseMe()));
110 resp_sock = socket(AF_UNIX, SOCK_STREAM, 0);
111 bzero(&svr, sizeof(svr));
112 svr.sun_family = AF_UNIX;
113 strcpy(svr.sun_path, sockname);
114 len = strlen(svr.sun_path) + sizeof(svr.sun_family);
115 i = ::connect(resp_sock, (struct sockaddr*)&svr, len);
117 fcntl(resp_sock, F_SETFL, O_NONBLOCK |
118 fcntl(resp_sock , F_GETFL, 0));
120 setsockopt(resp_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof(on));
121 request = new QSocketNotifier(resp_sock, QSocketNotifier::Read);
122 connect(request, SIGNAL(activated(int)), this, SLOT(RequestMessage()));
123 optval=TCP_BUFFER_SIZE;
125 setsockopt(resp_sock,SOL_SOCKET,SO_SNDBUF,&optval,sizeof(optval));
126 setsockopt(resp_sock,SOL_SOCKET,SO_RCVBUF,&optval,sizeof(optval));
129 inkey_wait = string_wait = FALSE;
130 char_wait = line_wait = mouse_wait = FALSE;
133 // CharBuffer.setAutoDelete(TRUE);
135 setFocusPolicy(Qt::StrongFocus);
136 hscroll->setRange(0, MAXWIDTH - width() + 20);
137 vscroll->setRange(0, MAXHEIGHT - height() + 20);
138 hscroll->setSteps((int)(hscroll->width() / hscroll->maxValue()),
139 (int)((hscroll->width() / hscroll->maxValue()) * 4));
140 vscroll->setSteps((int)(vscroll->height() / vscroll->maxValue()),
141 (int)((vscroll->height() / vscroll->maxValue()) * 4));
143 setMaximumSize(MAXWIDTH + 16, MAXHEIGHT + 16);
144 setUpdatesEnabled(FALSE);
153 void VGR::paintEvent(QPaintEvent *p)
155 /*if (isUpdatesEnabled()) {*/
156 bitBlt(this, 0, 0, canvas, ox, oy, width() - 16, height() - 16);
161 void VGR::focusInEvent(QFocusEvent *)
163 setUpdatesEnabled(TRUE);
165 setUpdatesEnabled(FALSE);
169 void VGR::resizeEvent( QResizeEvent *ev )
171 hscroll->setGeometry(0, height() - 16, width() - 16, 16);
172 vscroll->setGeometry(width() - 16, 0, 16, height() - 16);
173 close_btn->setGeometry(width() - 16, height() - 16, 16, 16);
174 hscroll->setRange(0, MAXWIDTH - width() + 20);
175 vscroll->setRange(0, MAXHEIGHT - height() + 20);
176 pstep = height() - 32;
177 hscroll->setSteps(lstep, pstep);
178 vscroll->setSteps(lstep, pstep);
181 void VGR::closeEvent(QCloseEvent *ev)
185 // QFrame::closeEvent(ev);
188 void VGR::mousePressEvent(QMouseEvent *ev)
193 msg.msg_type = MSG_GRAPH;
194 msg.param.pword[0] = GRAPH_MGETPRESS_RESPONSE;
195 msg.param.pword[2] = ev->pos().x() - ox;
196 msg.param.pword[3] = ev->pos().y() - oy;
197 switch(ev->button()) {
199 msg.param.pword[7] = 1;
201 case Qt::RightButton:
202 msg.param.pword[7] = 3;
205 msg.param.pword[7] = 2;
208 msg.param.pword[7] = 0;
211 write(resp_sock, &msg, sizeof(G_MESSAGE));
217 // QFrame::mousePressEvent(ev);
221 bool VGR::GetInput(int t)
225 if (!CharBuffer.isEmpty()) {
228 msg.msg_type = MSG_GRAPH;
229 msg.param.pword[0] = GRAPH_INKEY_RESPONSE;
230 msg.param.pword[3] = *(CharBuffer.dequeue());
231 write(resp_sock,&msg,sizeof(G_MESSAGE));
239 msg.msg_type = MSG_GRAPH;
240 msg.param.pword[0] = GRAPH_MAGIC_RESPONSE;
241 msg.param.pword[1] = 0;
243 (char)(*(CharBuffer.dequeue()));
244 WriteChar(msg.param.pchar);
247 msg.msg_type = MSG_GRAPH;
248 msg.param.pword[0] = GRAPH_READCHAR_RESPONSE;
250 (char)(*(CharBuffer.dequeue()));
253 write(resp_sock,&msg,sizeof(G_MESSAGE));
258 while ( ((!CharBuffer.isEmpty()) &&
259 (!(*(CharBuffer.dequeue()) = 13))));
261 if (!CharBuffer.isEmpty()) {
262 msg.msg_type = MSG_GRAPH;
263 msg.param.pword[0] = GRAPH_READLN_RESPONSE;
264 write(resp_sock, &msg, sizeof(G_MESSAGE));
273 if (CharBuffer.isEmpty() && (t == 2)) {
274 msg.msg_type = MSG_GRAPH;
275 msg.param.pword[0] = GRAPH_INKEY_RESPONSE;
276 msg.param.pword[3] = 0;
277 write(resp_sock, &msg, sizeof(G_MESSAGE));
285 void VGR::keyPressEvent(QKeyEvent *ev)
336 case Qt::Key_PageDown:
353 if ((!string_wait) && (!inkey_wait) && (!char_wait) && (!line_wait))
354 CharBuffer.enqueue(pom);
358 msg.msg_type = MSG_GRAPH;
359 msg.param.pword[0] = GRAPH_INKEY_RESPONSE;
360 msg.param.pword[3] = *pom;
361 write(resp_sock, &msg, sizeof(G_MESSAGE));
367 msg.msg_type = MSG_GRAPH;
368 msg.param.pword[0] = GRAPH_MAGIC_RESPONSE;
369 msg.param.pword[1] = 0;
370 WriteChar((char)ev->ascii());
373 msg.msg_type = MSG_GRAPH;
374 msg.param.pword[0] = GRAPH_READCHAR_RESPONSE;
376 msg.param.pchar = (char)ev->ascii();
377 write(resp_sock, &msg, sizeof(G_MESSAGE));
381 if ((line_wait) && (ev->ascii() == 13)) {
382 msg.msg_type = MSG_GRAPH;
383 msg.param.pword[0] = GRAPH_READLN_RESPONSE;
384 write(resp_sock, &msg, sizeof(G_MESSAGE));
389 if (ev->ascii() == 13) {
390 internal_buffer[strcnt] = '\0';
394 msg.msg_type = MSG_GRAPH;
395 msg.param.pword[0] = GRAPH_MAGIC_RESPONSE;
396 msg.param.pword[1] = 0;
398 msg.msg_type = MSG_GRAPH;
399 msg.param.pword[0] = GRAPH_READSTR_RESPONSE;
401 strcpy(msg.param.pstr, internal_buffer);
402 write(resp_sock, &msg, sizeof(G_MESSAGE));
407 else if (ev->ascii() == 8) {
413 internal_buffer[strcnt] = (char)ev->ascii();
416 WriteChar((char)ev->ascii());
430 void VGR::hscrolled(int val)
433 setUpdatesEnabled(TRUE);
435 setUpdatesEnabled(FALSE);
438 void VGR::vscrolled(int val)
441 setUpdatesEnabled(TRUE);
443 setUpdatesEnabled(FALSE);
446 void VGR::MakeColors()
448 lcolors[0] = new QColor(0, 0, 0 ); /* black */
449 lcolors[1] = new QColor(0, 0, 139); /* blue dark */
450 lcolors[2] = new QColor(0, 100, 0 ); /* green dark */
451 lcolors[3] = new QColor(0, 197, 205 ); /* turquoise dark */
452 lcolors[4] = new QColor(205,0 , 0 ); /* red dark */
453 lcolors[5] = new QColor(238, 130,238); /* violet */
454 lcolors[6] = new QColor(139,35,35 ); /* brown */
455 lcolors[7] = new QColor(190,190,190 ); /* grey light */
456 lcolors[8] = new QColor(97, 97, 97 ); /* grey dark */
457 lcolors[9] = new QColor(0, 0, 255 ); /* blue */
458 lcolors[10] = new QColor(0, 255, 0 ); /* green */
459 lcolors[11] = new QColor(0, 229,238 ); /* turquoise */
460 lcolors[12] = new QColor(255, 0, 0 ); /* red light */
461 lcolors[13] = new QColor(255, 110,180 ); /* rose */
462 lcolors[14] = new QColor(255,255, 0 ); /* yellow */
463 lcolors[15] = new QColor(255, 255, 255 ); /* white */
466 /****************************************/
468 void VGR::SetForeground(int col)
473 void VGR::SetBackground(int col)
478 void VGR::Line(int x1, int y1, int x2, int y2)
482 p.setPen(*lcolors[fcol]);
483 p.drawLine(x1, y1, x2, y2);
487 p.setPen(*lcolors[fcol]);
488 p.drawLine(x1 - ox, y1 - oy, x2 - ox, y2 - oy);
492 void VGR::Ellipse(int x, int y, int a, int b, int alfa, int beta, int fill)
497 p.setPen(*lcolors[fcol]);
498 p.setBrush(*lcolors[fcol]);
500 p.drawPie(x, y, a, b, alfa * 16, (beta - alfa) * 16);
502 p.drawArc(x, y, a, b, alfa * 16, (beta - alfa) * 16);
507 p.setPen(*lcolors[fcol]);
508 p.setBrush(*lcolors[fcol]);
510 p.drawPie(x - ox, y - oy, a, b, alfa * 16, (beta - alfa) * 16);
512 p.drawArc(x - ox, y - oy, a, b, alfa * 16, (beta - alfa) * 16);
517 void VGR::Rect(int x1, int y1, int x2, int y2,int col, int fill)
520 QBrush b(*lcolors[col]);
522 p.setPen(*lcolors[col]);
524 p.fillRect(x1 , y1 , x2 - x1, y2 - y1, b);
526 p.drawRect(x1,y1,x2-x1,y2-y1);
531 p.setPen(*lcolors[col]);
533 p.fillRect(x1 - ox, y1 - oy, x2 - x1, y2 - y1, b);
535 p.drawRect(x1 - ox, y1 - oy, x2 - x1, y2 - y1);
539 void VGR::TextXY(int x, int y, char *s)
542 QFontMetrics fm(*prv_font);
545 p.setPen(*lcolors[fcol]);
546 p.setBackgroundColor(*lcolors[bcol]);
547 p.setBackgroundMode(Qt::OpaqueMode);
548 p.setFont(*prv_font);
549 p.drawText(x, y + fm.height(), s, strlen(s));
554 p.setPen(*lcolors[fcol]);
555 p.setBackgroundColor(*lcolors[bcol]);
556 p.setBackgroundMode(Qt::OpaqueMode);
557 p.setFont(*prv_font);
558 p.drawText(x - ox, y - oy + fm.height(), s, strlen(s));
563 void VGR::CharXY(int x, int y, char a)
567 QFontMetrics fm(*prv_font);
572 p.setPen(*lcolors[fcol]);
573 p.setBackgroundColor(*lcolors[bcol]);
574 p.setBackgroundMode(Qt::OpaqueMode);
575 p.setFont(*prv_font);
576 p.drawText(x , y + fm.height(), s, strlen(s));
580 p.setPen(*lcolors[fcol]);
581 p.setBackgroundColor(*lcolors[bcol]);
582 p.setBackgroundMode(Qt::OpaqueMode);
583 p.setFont(*prv_font);
584 p.drawText(x - ox, y - oy + fm.height(), s, strlen(s));
589 void VGR::IntXY(int x, int y, int val)
593 QFontMetrics fm(*prv_font);
595 sprintf(s, "%d", val);
597 p.setPen(*lcolors[fcol]);
598 p.setBackgroundColor(*lcolors[bcol]);
599 p.setBackgroundMode(Qt::OpaqueMode);
600 p.setFont(*prv_font);
601 p.drawText(x, y + fm.height(), s, strlen(s));
605 p.setPen(*lcolors[fcol]);
606 p.setBackgroundColor(*lcolors[bcol]);
607 p.setBackgroundMode(Qt::OpaqueMode);
608 p.setFont(*prv_font);
609 p.drawText(x - ox, y - oy + fm.height(), s, strlen(s));
613 void VGR::WriteText(char *s)
616 QFontMetrics fm(*prv_font);
619 p.setPen(*lcolors[fcol]);
620 p.setBackgroundColor(*lcolors[bcol]);
621 p.setBackgroundMode(Qt::OpaqueMode);
622 p.setFont(*prv_font);
623 p.drawText(tx * fm.maxWidth(), (ty + 1) * fm.height(), s, strlen(s));
627 p.setPen(*lcolors[fcol]);
628 p.setBackgroundColor(*lcolors[bcol]);
629 p.setBackgroundMode(Qt::OpaqueMode);
630 p.setFont(*prv_font);
631 p.drawText(tx * fm.maxWidth() - ox, (ty + 1) * fm.height() - oy, s,
636 if (tx > TEXT_COLS) {
640 if (ty > TEXT_LINES) {
645 void VGR::WriteChar(char a)
648 QFontMetrics fm(*prv_font);
656 p.setPen(*lcolors[gfcol]);
657 p.setBackgroundColor(*lcolors[gbcol]);
658 p.setBackgroundMode(Qt::OpaqueMode);
659 p.setFont(*prv_font);
660 p.drawText(gx, gy + fm.height(), s, strlen(s));
664 p.setPen(*lcolors[gfcol]);
665 p.setBackgroundColor(*lcolors[gbcol]);
666 p.setBackgroundMode(Qt::OpaqueMode);
667 p.setFont(*prv_font);
668 p.drawText(gx - ox, gy - oy + fm.height(), s, strlen(s));
671 gx = gx + strlen(s) * fm.maxWidth();
673 gy = gy + fm.height();
676 if (gy > MAXHEIGHT) {
681 p.setPen(*lcolors[fcol]);
682 p.setBackgroundColor(*lcolors[bcol]);
683 p.setBackgroundMode(Qt::OpaqueMode);
684 p.setFont(*prv_font);
685 p.drawText(tx * fm.maxWidth(), (ty + 1) * fm.height(), s,
690 p.setPen(*lcolors[fcol]);
691 p.setBackgroundColor(*lcolors[bcol]);
692 p.setBackgroundMode(Qt::OpaqueMode);
693 p.setFont(*prv_font);
694 p.drawText(tx * fm.maxWidth() - ox, (ty + 1) * fm.height() - oy,
699 if (tx > TEXT_COLS) {
703 if (ty > TEXT_LINES) {
712 QFontMetrics fm(*prv_font);
716 p.setPen(*lcolors[fcol]);
717 p.fillRect(gx - fm.maxWidth(), gy, fm.maxWidth(),
718 fm.height() + fm.descent() + 1, *lcolors[bcol]);
722 p.setPen(*lcolors[fcol]);
724 p.fillRect(gx - ox - fm.maxWidth(), gy - oy, fm.maxWidth(),
725 fm.height() + fm.descent() + 1, *lcolors[bcol]);
727 gx = gx - fm.maxWidth();
731 p.setPen(*lcolors[fcol]);
732 p.fillRect((tx - 1) * fm.maxWidth(), (ty) * fm.height(),
734 (ty + 1) * fm.height() + fm.descent() + 1,
739 p.setPen(*lcolors[fcol]);
740 p.fillRect((tx - 1) * fm.maxWidth() - ox, (ty) * fm.height() - oy,
742 (ty + 1) * fm.height() + fm.descent() + 1,
752 void VGR::PutChar(char a)
755 QFontMetrics fm(*prv_font);
761 p.setPen(*lcolors[fcol]);
762 p.setBackgroundColor(*lcolors[bcol]);
763 p.setBackgroundMode(Qt::OpaqueMode);
764 p.setFont(*prv_font);
765 p.drawText(tx * fm.maxWidth(), (ty + 1) * fm.height(), s, strlen(s));
769 p.setPen(*lcolors[fcol]);
770 p.setBackgroundColor(*lcolors[bcol]);
771 p.setBackgroundMode(Qt::OpaqueMode);
772 p.setFont(*prv_font);
773 p.drawText(tx * fm.maxWidth() - ox, (ty + 1) * fm.height() - oy, s,
778 void VGR::WriteLine()
782 if (ty > TEXT_LINES) {
788 void VGR::Point(int x, int y)
793 p.setPen(*lcolors[fcol]);
798 p.setPen(*lcolors[fcol]);
799 p.drawPoint(x - ox, y - oy);
803 void VGR::ClearArea(int x, int y, int w, int h)
807 p.eraseRect(x, y, w, h);
811 p.eraseRect(x - ox, y - oy, w, h);
818 QBrush b(QColor(white));
822 canvas->fill(backgroundColor());
825 p.fillRect(0, 0, width() - 16, height() - 16, backgroundColor());
829 int VGR::Getmap(int w, int h)
833 m = new QPixmap(w, h);
834 bitBlt(m, 0, 0, canvas, curx, cury, w, h);
835 maps.append(new VGRMap(firstfreemap, m));
837 return(firstfreemap - 1);
841 void VGR::Putmap(int map)
844 QListIterator<VGRMap *> mapsIterator(maps);
846 while (mapsIterator.hasNext()) {
847 m = mapsIterator.next();
848 if (m->number == map) {
849 bitBlt(canvas, curx, cury, m->map, 0, 0,
850 m->map->width(), m->map->height());
851 bitBlt(this, curx - ox, cury - oy, m->map, 0, 0,
852 m->map->width(), m->map->height());
858 void VGR::Outstring(int x, int y, char *s, int b, int f)
861 QFontMetrics fm(*prv_font);
864 p.setPen(*lcolors[f]);
865 p.setBackgroundColor(*lcolors[b]);
866 p.setBackgroundMode(Qt::OpaqueMode);
867 p.setFont(*prv_font);
868 p.drawText(x, y + fm.height(), s, strlen(s));
872 p.setPen(*lcolors[f]);
873 p.setFont(*prv_font);
874 p.setBackgroundColor(*lcolors[b]);
875 p.setBackgroundMode(Qt::OpaqueMode);
876 p.drawText(x - ox, y - oy + fm.height(), s, strlen(s));
881 void VGR::writeintxy(int x, int y, int val,int c)
885 QFontMetrics fm(*prv_font);
887 sprintf(s, "%d", val);
889 p.setPen(*lcolors[c]);
890 p.setFont(*prv_font);
891 p.drawText(x, y, s, strlen(s));
895 p.setPen(*lcolors[c]);
896 p.setFont(*prv_font);
897 p.drawText(x - ox, y - oy + fm.height(), s, strlen(s));
905 msg.msg_type = MSG_GRAPH;
906 msg.param.pword[0] = GRAPH_CURPOS_RESPONSE;
907 msg.param.pword[3] = curx;
908 msg.param.pword[4] = cury;
909 write(resp_sock, &msg, sizeof(G_MESSAGE));
913 void VGR::RequestMessage()
918 bzero(&m, sizeof(G_MESSAGE));
919 stat = read(resp_sock, &m, sizeof(G_MESSAGE));
921 if (m.msg_type == MSG_GRAPH) {
922 switch(m.param.pword[0]) {
924 close_btn->setEnabled(TRUE);
928 case GRAPH_SET_TITLE:
929 setCaption(m.param.pstr);
932 if (strcmp(m.param.pstr,"\n") == 0)
935 WriteText(m.param.pstr);
951 strcpy(internal_buffer, "");
958 m.msg_type = MSG_GRAPH;
959 m.param.pword[0] = GRAPH_READLN_RESPONSE;
960 write(resp_sock, &m, sizeof(G_MESSAGE));
962 } else if (!GetInput(1))
966 WriteChar(m.param.pchar);
996 case GRAPH_FOREGROUND:
997 SetForeground(m.param.pword[3]);
999 case GRAPH_BACKGROUND:
1000 SetBackground(m.param.pword[3]);
1003 Point(m.param.pword[3], m.param.pword[4]);
1016 case GRAPH_OUTSTRING:
1025 case GRAPH_WRITEINTXY:
1026 writeintxy(m.param.pword[2], m.param.pword[3],
1027 m.param.pword[4], m.param.pword[5]);
1030 bzero(&mm, sizeof(G_MESSAGE));
1031 mm.msg_type = MSG_GRAPH;
1032 mm.param.pword[0] = GRAPH_GETMAP_RESPONSE;
1033 mm.param.pword[2] = Getmap(m.param.pword[2] - curx, m.param.pword[3] - cury);
1034 mm.param.pword[3] = m.param.pword[2] - curx;
1035 mm.param.pword[4] = m.param.pword[3] - cury;
1036 write(resp_sock, &mm, sizeof(G_MESSAGE));
1039 Putmap(m.param.pword[2]);
1042 curx = m.param.pword[2];
1043 cury = m.param.pword[3];
1045 case GRAPH_MGETPRESS:
1052 if (m.param.pword[1] != 0)
1053 CharXY(curx, cury, (char)m.param.pword[1]);
1055 CharXY(curx, cury, ' ');
1065 void VGR::MagicGraph(G_MESSAGE *msg)
1072 switch(msg->param.pword[1]) {
1075 tx = msg->param.pword[2];
1076 ty = msg->param.pword[3];
1080 fcol = msg->param.pword[2];
1084 bcol = msg->param.pword[2];
1087 prv_font = bold_font;
1090 prv_font = italic_font;
1093 prv_font = normal_font;
1098 /* Draw array_of char (x,y,fcol,bcol) */
1102 fcol = msg->param.pword[4];
1103 bcol = msg->param.pword[5];
1105 msg->param.pword[2],
1106 msg->param.pword[3],
1112 /* Draw int (x,y,int,fcol,bcol) */
1116 fcol = msg->param.pword[5];
1117 bcol = msg->param.pword[6];
1119 msg->param.pword[2],
1120 msg->param.pword[3],
1126 /* Draw char (x,y,char,fcol,bcol) */
1130 fcol = msg->param.pword[5];
1131 bcol = msg->param.pword[6];
1132 CharXY(msg->param.pword[2], msg->param.pword[3],
1133 (char)(msg->param.pword[4]));
1137 /* Draw real (x,y,int,frac,fcol,bcol) */
1141 fcol = msg->param.pword[6];
1142 bcol = msg->param.pword[7];
1143 sprintf(ss, "%d.%d", msg->param.pword[4], msg->param.pword[5]);
1144 TextXY(msg->param.pword[2], msg->param.pword[3], ss);
1148 /* ReadText (x,y,fcol,bcol) */
1152 gfcol = msg->param.pword[4];
1153 gbcol = msg->param.pword[5];
1154 strcpy(internal_buffer, "");
1157 gx = msg->param.pword[2];
1158 gy = msg->param.pword[3];
1164 gfcol = msg->param.pword[4];
1165 gbcol = msg->param.pword[5];
1166 strcpy(internal_buffer, "");
1169 gx = msg->param.pword[2];
1170 gy = msg->param.pword[3];
1174 /* Put image from file (x,y,fname) */
1176 if (p.load(msg->param.pstr)) {
1177 bitBlt(canvas, msg->param.pword[2],
1178 msg->param.pword[3], &p,
1179 0, 0, p.width(), p.height());
1180 bitBlt(this, msg->param.pword[2] - ox,
1181 msg->param.pword[3] - oy, &p,
1182 0, 0, p.width(), p.height());
1187 QListIterator<VGRMap *> mapsIterator(maps);
1189 while (mapsIterator.hasNext()) {
1190 pmap = mapsIterator.next();
1191 if (msg->param.pword[2] == pmap->number) {
1198 /* Line (x1,y1,x2,y2,col) */
1201 fcol = msg->param.pword[6];
1203 msg->param.pword[2], msg->param.pword[3],
1204 msg->param.pword[4], msg->param.pword[5]
1208 /* Rectangle(x1,y1,x2,y2,fcol,icol) */
1211 msg->param.pword[2], msg->param.pword[3],
1212 msg->param.pword[4], msg->param.pword[5],
1213 msg->param.pword[7],
1216 Rect(msg->param.pword[2], msg->param.pword[3],
1217 msg->param.pword[4],msg->param.pword[5],
1218 msg->param.pword[6], 0);
1220 /* ClearArea(x1,y1,w,h) */
1222 ClearArea(msg->param.pword[2],msg->param.pword[3],
1223 msg->param.pword[4], msg->param.pword[5]);
1228 int main(int argc, char **argv)
1230 QApplication app(argc, argv);