Annotation of OpenXM_contrib2/asir2000/plot/if.c, Revision 1.36
1.2 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.36 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.35 2017/09/01 01:48:40 noro Exp $
1.2 noro 49: */
1.1 noro 50: #include "ca.h"
51: #include "parse.h"
52: #include "ox.h"
53: #include "ifplot.h"
54:
1.22 saito 55: #if defined(INTERVAL)
1.24 saito 56: // Time message and func
1.22 saito 57: #include <sys/types.h>
58: #include <sys/resource.h>
59: #include <sys/time.h>
60:
61: static struct oEGT ltime;
62: static double r0;
63: double get_rtime();
1.30 saito 64: void MSGdraw(char *);
65: char msg[128];
1.22 saito 66: #if defined(ITV_TIME_CHECK)
67: void tstart()
68: {
69: get_eg(<ime);
1.24 saito 70: r0=get_rtime();
1.22 saito 71: }
72:
73: void tstop(struct canvas *can)
74: {
75: struct oEGT egt1;
76: double e, g, r;
77: char ts[100];
78: void popdown_warning();
79: Widget warnshell,warndialog;
80:
81: get_eg(&egt1);
1.24 saito 82: e=egt1.exectime - ltime.exectime;
83: g=egt1.gctime - ltime.gctime;
84: r=get_rtime() - r0;
1.22 saito 85: sprintf(ts,"(%8.6f + gc %8.6f) total %8.6f \n",e,g,r);
86: create_popup(can->shell,"Message",&ts,&warnshell,&warndialog);
87: XawDialogAddButton(warndialog,"OK",popdown_warning,warnshell);
88: XtPopup(warnshell,XtGrabNone);
89: SetWM_Proto(warnshell);
90: }
91: #else
92: #define tstart()
93: #define tstop(a)
94: #endif
95: #endif
96:
1.8 noro 97: extern JMP_BUF ox_env;
1.1 noro 98:
1.24 saito 99: int open_canvas(NODE arg){
1.4 noro 100: int id;
101: struct canvas *can;
102: LIST wsize;
103: STRING wname;
104:
1.24 saito 105: wsize=(LIST)ARG0(arg);
106: wname=(STRING)ARG1(arg);
1.27 saito 107: id=search_canvas();
108: can=canvas[id];
109: can->mode=modeNO(INTERACTIVE);
1.24 saito 110: if(!wsize){
111: can->width=DEFAULTWIDTH;
112: can->height=DEFAULTHEIGHT;
1.4 noro 113: } else {
1.24 saito 114: can->width=QTOS((Q)BDY(BDY(wsize)));
115: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.4 noro 116: }
1.24 saito 117: if(wname)can->wname=BDY(wname);
118: else can->wname="";
1.4 noro 119: create_canvas(can);
120: return id;
121: }
122:
1.30 saito 123: int plot(NODE arg,int fn){
1.1 noro 124: int id;
125: NODE n;
126: struct canvas *can;
127: P formula;
128: LIST xrange,yrange,zrange,wsize;
129: STRING wname;
1.12 noro 130: V v;
1.35 noro 131: Real r;
132: double rr;
1.1 noro 133:
1.24 saito 134: formula=(P)ARG0(arg);
135: xrange=(LIST)ARG1(arg);
136: yrange=(LIST)ARG2(arg);
137: zrange=(LIST)ARG3(arg);
138: wsize=(LIST)ARG4(arg);
139: wname=(STRING)ARG5(arg);
140: can=canvas[id=search_canvas()];
141: if(xrange){
142: n=BDY(xrange);can->vx=VR((P)BDY(n));n=NEXT(n);
143: can->qxmin=(Q)BDY(n);n=NEXT(n);can->qxmax=(Q)BDY(n);
144: can->xmin=ToReal(can->qxmin);can->xmax=ToReal(can->qxmax);
145: }
146: if(yrange){
147: n=BDY(yrange);can->vy=VR((P)BDY(n));n=NEXT(n);
148: can->qymin=(Q)BDY(n);n=NEXT(n);can->qymax=(Q)BDY(n);
149: can->ymin=ToReal(can->qymin);can->ymax=ToReal(can->qymax);
1.35 noro 150: } else if ( !formula || NUM(formula) ) {
151: devalr(CO,(Obj)formula,(Obj *)&r); rr = ToReal(r);
152: can->ymin=rr-1; can->ymax=rr+1;
153: }
1.30 saito 154: can->mode=fn;
1.24 saito 155: if(zrange){
1.30 saito 156: n=NEXT(BDY(zrange));
157: can->zmin=ToReal(BDY(n));
1.24 saito 158: n=NEXT(n);can->zmax=ToReal(BDY(n));
159: n=NEXT(n);
1.30 saito 160: if(can->mode==modeNO(CONPLOT))can->nzstep=n?QTOS((Q)BDY(n)):MAXGC;
1.12 noro 161: else {
1.24 saito 162: can->vx=VR((P)BDY(BDY(zrange)));
1.30 saito 163: can->nzstep=n?QTOS((Q)BDY(n)):DEFAULTPOLARSTEP;
1.12 noro 164: }
165: }
1.24 saito 166: if(!wsize){
167: can->width=DEFAULTWIDTH;
168: can->height=DEFAULTHEIGHT;
1.1 noro 169: } else {
1.24 saito 170: can->width=QTOS((Q)BDY(BDY(wsize)));
171: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.1 noro 172: }
1.30 saito 173: if(wname) can->wname=BDY(wname);
1.24 saito 174: else can->wname="";
175: can->formula=formula;
1.27 saito 176: if(can->mode==modeNO(PLOT)){
1.24 saito 177: //plot
1.36 ! noro 178: can->prec=argc(arg)==7 ? QTOS((Q)ARG6(arg)) : 0;
1.1 noro 179: plotcalc(can);
1.14 noro 180: create_canvas(can);
1.1 noro 181: plot_print(display,can);
1.30 saito 182: } else if(can->mode==modeNO(POLARPLOT)){
183: polarcalc(can);
184: create_canvas(can);
185: plot_print(display,can);
1.14 noro 186: } else {
187: create_canvas(can);
1.30 saito 188: ifplotmain(can);
1.12 noro 189: }
1.1 noro 190: copy_to_canvas(can);
191: return id;
192: }
193:
1.30 saito 194: void ifplotmain(struct canvas *can){
1.24 saito 195: int i,width,height;
196: double ** tabe;
197:
198: width=can->width;height=can->height;
199: tabe=(double **)ALLOCA((width+1)*sizeof(double *));
200: for(i=0;i<width;i++)tabe[i]=(double *)ALLOCA((height+1)*sizeof(double));
201: define_cursor(can->window,runningcur);
202: set_busy(can); set_selection();
203: calc(tabe,can,0);
1.30 saito 204: if_print(display,tabe,can);
1.24 saito 205: reset_selection(); reset_busy(can);
206: define_cursor(can->window,normalcur);
207: }
208:
209: int memory_plot(NODE arg,LIST *bytes){
1.6 noro 210: NODE n;
211: struct canvas tmp_can;
212: struct canvas *can;
213: P formula;
214: LIST xrange,yrange,zrange,wsize;
215: int width,height;
216: double **tabe;
217: int i;
218: BYTEARRAY barray;
1.36 ! noro 219: Q qw,qh,prec;
1.6 noro 220:
1.24 saito 221: formula=(P)ARG0(arg);
222: xrange=(LIST)ARG1(arg);
223: yrange=(LIST)ARG2(arg);
224: zrange=(LIST)ARG3(arg);
225: wsize=(LIST)ARG4(arg);
1.6 noro 226:
1.19 noro 227: bzero((char *)&tmp_can,sizeof(tmp_can));
1.24 saito 228: can=&tmp_can;
229: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
230: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
231: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
232: if( yrange ){
233: n=BDY(yrange); can->vy=VR((P)BDY(n)); n=NEXT(n);
234: can->qymin=(Q)BDY(n); n=NEXT(n); can->qymax=(Q)BDY(n);
235: can->ymin=ToReal(can->qymin); can->ymax=ToReal(can->qymax);
236: if( zrange ){
237: n=NEXT(BDY(zrange));
238: can->zmin=ToReal(BDY(n)); n=NEXT(n); can->zmax=ToReal(BDY(n));
1.27 saito 239: n=NEXT(n);
240: if(n) can->nzstep=QTOS((Q)BDY(n));
1.24 saito 241: else can->nzstep=MAXGC;
1.27 saito 242: can->mode=modeNO(CONPLOT);
1.6 noro 243: } else
1.27 saito 244: can->mode=modeNO(IFPLOT);
1.6 noro 245: } else
1.27 saito 246: can->mode=modeNO(PLOT);
1.24 saito 247: if( !wsize ){
248: can->width=DEFAULTWIDTH; can->height=DEFAULTHEIGHT;
1.6 noro 249: } else {
1.24 saito 250: can->width=QTOS((Q)BDY(BDY(wsize)));
251: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.6 noro 252: }
1.24 saito 253: can->wname="";
254: can->formula=formula;
1.27 saito 255: if( can->mode==modeNO(PLOT)){
1.36 ! noro 256: can->prec = argc(arg)==6 ? QTOS((Q)ARG5(arg)) : 0;
1.6 noro 257: plotcalc(can);
1.19 noro 258: memory_print(can,&barray);
259: STOQ(can->width,qw); STOQ(can->height,qh);
1.24 saito 260: n=mknode(3,qw,qh,barray);
1.19 noro 261: MKLIST(*bytes,n);
262: } else {
1.24 saito 263: width=can->width; height=can->height;
264: tabe=(double **)ALLOCA(width*sizeof(double *));
265: for( i=0; i<width; i++ )
266: tabe[i]=(double *)ALLOCA(height*sizeof(double));
1.6 noro 267: calc(tabe,can,1);
268: memory_if_print(tabe,can,&barray);
269: STOQ(width,qw); STOQ(height,qh);
1.24 saito 270: n=mknode(3,qw,qh,barray);
1.6 noro 271: MKLIST(*bytes,n);
272: }
1.27 saito 273: return 0;
1.6 noro 274: }
275:
1.24 saito 276: int plotover(NODE arg){
1.30 saito 277: int id;
278: unsigned int orgcolor;
1.1 noro 279: P formula;
280: struct canvas *can;
281: VL vl,vl0;
282:
1.24 saito 283: id=QTOS((Q)ARG0(arg));
284: formula=(P)ARG1(arg);
285: can=canvas[id];
286: orgcolor=can->color;
1.27 saito 287: if(argc(arg)==3) can->color=QTOS((Q)ARG2(arg));
288: else can->color=0;
1.7 noro 289: get_vars_recursive((Obj)formula,&vl);
1.24 saito 290: for(vl0=vl;vl0;vl0=NEXT(vl0))
291: if(vl0->v->attr==(pointer)V_IND)
292: if(vl->v!=can->vx && vl->v!=can->vy)return -1;
1.34 fujimoto 293: #if !defined(VISUAL) && !defined(__MINGW32__)
1.17 noro 294: set_drawcolor(can->color);
1.18 noro 295: #endif
1.24 saito 296: current_can=can;
297: can->formula=formula;
1.27 saito 298: if(can->mode==modeNO(PLOT)){
1.36 ! noro 299: can->prec = argc(arg)==3 ? QTOS((Q)ARG2(arg)) : 0;
1.21 saito 300: plotcalc(can);
301: plot_print(display,can);
1.30 saito 302: } else ifplotmain(can);
1.21 saito 303: copy_to_canvas(can);
1.30 saito 304: can->color=orgcolor;
1.34 fujimoto 305: #if !defined(VISUAL) && !defined(__MINGW32__)
1.21 saito 306: set_drawcolor(can->color);
307: #endif
1.26 ohara 308: return id;
1.1 noro 309: }
310:
1.24 saito 311: int drawcircle(NODE arg){
1.34 fujimoto 312: #if !defined(VISUAL) && !defined(__MINGW32__)
1.30 saito 313: int id,index,wx,wy,wr;
314: unsigned int c;
1.1 noro 315: pointer ptr;
316: Q ret;
317: LIST xyr;
318: Obj x,y,r;
319: struct canvas *can;
320:
1.24 saito 321: index=QTOS((Q)ARG0(arg));
322: xyr=(LIST)ARG1(arg);
323: x=(Obj)ARG0(BDY(xyr)); y=(Obj)ARG1(BDY(xyr)); r=(Obj)ARG2(BDY(xyr));
324: c=QTOS((Q)ARG2(arg));
325: can=canvas[index];
326: if(!can->window)return -1;
1.1 noro 327: else {
1.24 saito 328: current_can=can;
1.21 saito 329: set_drawcolor(c);
1.24 saito 330: wx=(ToReal(x)-can->xmin)*can->width/(can->xmax-can->xmin);
331: wy=(can->ymax-ToReal(y))*can->height/(can->ymax-can->ymin);
332: wr=ToReal(r);
1.21 saito 333: XFillArc(display,can->pix,cdrawGC,wx-wr/2,wy-wr/2,wr,wr,0,360*64);
1.1 noro 334: copy_to_canvas(can);
1.21 saito 335: set_drawcolor(can->color);
1.1 noro 336: return index;
337: }
1.4 noro 338: #endif
339: }
340:
1.24 saito 341: int draw_obj(NODE arg){
1.30 saito 342: int index,x,y,u,v,len,r;
343: unsigned int color;
1.4 noro 344: NODE obj,n;
345: RealVect *vect;
346: struct canvas *can;
347:
1.24 saito 348: index=QTOS((Q)ARG0(arg));
349: can=canvas[index];
350: if(!can && closed_canvas[index]){
351: canvas[index]=closed_canvas[index];
352: closed_canvas[index]=0;
353: can=canvas[index];
1.10 noro 354: popup_canvas(index);
1.24 saito 355: current_can=can;
356: } else if(!can||(can && !can->window)){
1.5 noro 357: set_lasterror("draw_obj : canvas does not exist");
1.4 noro 358: return -1;
1.5 noro 359: }
1.4 noro 360:
1.24 saito 361: obj=BDY((LIST)ARG1(arg));
362: if(argc(arg)== 3) color=QTOS((Q)ARG2(arg));
363: else color=0; // black
364: switch(len=length(obj)){
365: case 2: // point
366: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
1.5 noro 367: draw_point(display,can,x,y,color);
1.16 noro 368: MKRVECT3(vect,x,y,color); MKNODE(n,vect,can->history);
1.24 saito 369: can->history=n;
1.5 noro 370: break;
1.24 saito 371: case 3: // circle
372: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
373: r=(int)ToReal((Q)ARG2(obj));
1.16 noro 374: MKRVECT4(vect,x,y,r,color); MKNODE(n,vect,can->history);
1.24 saito 375: can->history=n;
1.4 noro 376: break;
1.24 saito 377: case 4: // line
378: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
379: u=(int)ToReal((Q)ARG2(obj)); v=(int)ToReal((Q)ARG3(obj));
1.5 noro 380: draw_line(display,can,x,y,u,v,color);
1.16 noro 381: MKRVECT5(vect,x,y,u,v,color); MKNODE(n,vect,can->history);
1.24 saito 382: can->history=n;
1.4 noro 383: break;
384: default:
1.5 noro 385: set_lasterror("draw_obj : invalid request");
1.4 noro 386: return -1;
387: }
1.34 fujimoto 388: #if !defined(VISUAL) && !defined(__MINGW32__)
1.21 saito 389: set_drawcolor(can->color);
390: #endif
1.9 noro 391: return 0;
392: }
393:
1.24 saito 394: int draw_string(NODE arg){
1.30 saito 395: int index,x,y;
396: unsigned int color;
1.9 noro 397: char *str;
398: NODE pos;
399: struct canvas *can;
400:
1.24 saito 401: index=QTOS((Q)ARG0(arg));
402: can=canvas[index];
403: if(!can && closed_canvas[index]){
404: canvas[index]=closed_canvas[index];
405: closed_canvas[index]=0;
406: can=canvas[index];
1.11 noro 407: popup_canvas(index);
1.24 saito 408: current_can=can;
409: } else if(!can||(can && !can->window)){
1.11 noro 410: set_lasterror("draw_obj : canvas does not exist");
1.9 noro 411: return -1;
412: }
413:
1.24 saito 414: pos=BDY((LIST)ARG1(arg));
415: str=BDY((STRING)ARG2(arg));
416: if(argc(arg)==4)color=QTOS((Q)ARG3(arg));
417: else color=0; // black
418: x=(int)ToReal((Q)ARG0(pos));
419: y=(int)ToReal((Q)ARG1(pos));
1.9 noro 420: draw_character_string(display,can,x,y,str,color);
1.34 fujimoto 421: #if !defined(VISUAL) && !defined(__MINGW32__)
1.21 saito 422: set_drawcolor(can->color);
423: #endif
1.4 noro 424: return 0;
425: }
426:
1.24 saito 427: int clear_canvas(NODE arg){
1.4 noro 428: int index;
429: struct canvas *can;
430:
1.24 saito 431: index=QTOS((Q)ARG0(arg));
432: can=canvas[index];
433: if(!can||!can->window) return -1;
1.4 noro 434: clear_pixmap(can);
435: copy_to_canvas(can);
1.24 saito 436: // clear the history
437: can->history=0;
1.27 saito 438: return 0;
1.1 noro 439: }
440:
441: #define RealtoDbl(r) ((r)?BDY(r):0.0)
442:
1.24 saito 443: int arrayplot(NODE arg){
1.1 noro 444: int id,ix,w,h;
445: VECT array;
446: LIST xrange,wsize;
447: char *wname;
448: NODE n;
449: double ymax,ymin,dy,xstep;
450: Real *tab;
451: struct canvas *can;
452: POINT *pa;
453:
1.24 saito 454: array=(VECT)ARG0(arg);
455: xrange=(LIST)ARG1(arg);
456: can=canvas[id=search_canvas()];
457: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
458: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
459: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
460: if(!wsize){
461: can->width=DEFAULTWIDTH;
462: can->height=DEFAULTHEIGHT;
1.1 noro 463: } else {
1.24 saito 464: can->width=QTOS((Q)BDY(BDY(wsize)));
465: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.1 noro 466: }
1.27 saito 467: can->wname=wname; can->formula=0; can->mode=modeNO(PLOT);
1.1 noro 468: create_canvas(can);
1.24 saito 469: w=array->len;
470: h=can->height;
471: tab=(Real *)BDY(array);
472: if(can->ymax==can->ymin){
473: for(ymax=ymin=RealtoDbl(tab[0]),ix=1; ix<w; ix++){
474: if(RealtoDbl(tab[ix])>ymax)ymax=RealtoDbl(tab[ix]);
475: if(RealtoDbl(tab[ix])<ymin)ymin=RealtoDbl(tab[ix]);
1.1 noro 476: }
1.24 saito 477: can->ymax=ymax;
478: can->ymin=ymin;
1.1 noro 479: } else {
1.24 saito 480: ymax=can->ymax;
481: ymin=can->ymin;
1.1 noro 482: }
1.24 saito 483: dy=ymax-ymin;
484: can->pa=(struct pa *)MALLOC(sizeof(struct pa));
485: can->pa[0].length=w;
486: can->pa[0].pos=pa=(POINT *)MALLOC(w*sizeof(POINT));
487: xstep=(double)can->width/(double)(w-1);
488: for(ix=0;ix<w;ix++){
1.1 noro 489: #ifndef MAXSHORT
490: #define MAXSHORT ((short)0x7fff)
491: #endif
492: double t;
493:
1.24 saito 494: pa[ix].x=(int)(ix*xstep);
495: t=(h - 1)*(ymax - RealtoDbl(tab[ix]))/dy;
496: if(t>MAXSHORT)pa[ix].y=MAXSHORT;
497: else if(t<-MAXSHORT)pa[ix].y=-MAXSHORT;
498: else pa[ix].y=(long)t;
1.1 noro 499: }
500: plot_print(display,can);
501: copy_to_canvas(can);
502: return id;
503: }
1.30 saito 504: /*
1.24 saito 505: void ifplot_resize(struct canvas *can,POINT spos,POINT epos){
1.1 noro 506: struct canvas *ncan;
507: struct canvas fakecan;
508: Q dx,dy,dx2,dy2,xmin,xmax,ymin,ymax,xmid,ymid;
509: Q sx,sy,ex,ey,cw,ch,ten,two;
510: Q s,t;
511: int new;
512: int w,h,m;
1.24 saito 513: if(XC(spos)<XC(epos) && YC(spos)<YC(epos)){
514: if(can->precise && !can->wide){
515: fakecan=*can;
516: ncan=&fakecan;
1.1 noro 517: } else {
1.24 saito 518: new=search_canvas();
519: ncan=canvas[new];
1.1 noro 520: }
1.24 saito 521: ncan->mode=can->mode;
522: ncan->zmin=can->zmin; ncan->zmax=can->zmax;
523: ncan->nzstep=can->nzstep;
524: ncan->wname=can->wname;
525: ncan->vx=can->vx; ncan->vy=can->vy;
526: ncan->formula=can->formula;
527: w=XC(epos)-XC(spos);
528: h=YC(epos)-YC(spos);
529: m=MAX(can->width,can->height);
530: if(can->precise){
531: ncan->width=w;
532: ncan->height=h;
533: } else if(w>h){
534: ncan->width=m;
535: ncan->height=m*h/w;
1.1 noro 536: } else {
1.24 saito 537: ncan->width=m*w/h;
538: ncan->height=m;
1.1 noro 539: }
1.24 saito 540: if(can->wide){
541: STOQ(10,ten);
542: STOQ(2,two);
543: subq(can->qxmax,can->qxmin,&t);
544: mulq(t,ten,&dx);
545: subq(can->qymax,can->qymin,&t);
546: mulq(t,ten,&dy);
547: addq(can->qxmax,can->qxmin,&t);
548: divq(t,two,&xmid);
549: addq(can->qymax,can->qymin,&t);
550: divq(t,two,&ymid);
551: divq(dx,two,&dx2);
552: divq(dy,two,&dy2);
553: subq(xmid,dx2,&xmin);
554: addq(xmid,dx2,&xmax);
555: subq(ymid,dy2,&ymin);
556: addq(ymid,dy2,&ymax);
1.1 noro 557: } else {
1.24 saito 558: subq(can->qxmax,can->qxmin,&dx);
559: subq(can->qymax,can->qymin,&dy);
560: xmin=can->qxmin;
561: xmax=can->qxmax;
562: ymin=can->qymin;
563: ymax=can->qymax;
1.1 noro 564: }
565: STOQ(XC(spos),sx); STOQ(YC(spos),sy); STOQ(XC(epos),ex); STOQ(YC(epos),ey);
566: STOQ(can->width,cw); STOQ(can->height,ch);
567: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
568: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
569: mulq(ey,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymin);
570: mulq(sy,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymax);
1.24 saito 571: ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax);
572: ncan->ymin=ToReal(ncan->qymin); ncan->ymax=ToReal(ncan->qymax);
573: if(can->precise && !can->wide){
574: current_can=can;
1.1 noro 575: alloc_pixmap(ncan);
1.34 fujimoto 576: #if defined(VISUAL) || defined(__MINGW32__)
1.24 saito 577: ncan->real_can=can;
1.4 noro 578: #endif
1.1 noro 579: qifplotmain(ncan);
580: copy_subimage(ncan,can,spos);
581: copy_to_canvas(can);
582: } else {
583: create_canvas(ncan);
1.24 saito 584: if( can->precise ) qifplotmain(ncan);
1.32 ohara 585: else ifplotmain(ncan);
1.1 noro 586: copy_to_canvas(ncan);
587: }
588: }
589: }
1.30 saito 590: */
1.1 noro 591:
1.24 saito 592: void plot_resize(struct canvas *can,POINT spos,POINT epos){
1.1 noro 593: struct canvas *ncan;
1.30 saito 594: Q dx,dx2,xmin,xmax,xmid,sx,ex,cw,ten,two,s,t;
1.7 noro 595: double dy,ymin,ymax,ymid;
1.30 saito 596: int new,w,h,m;
1.1 noro 597:
1.24 saito 598: if( XC(spos)<XC(epos) && YC(spos)<YC(epos) ){
599: new=search_canvas(); ncan=canvas[new];
600: ncan->mode=can->mode;
601: ncan->zmin=can->zmin; ncan->zmax=can->zmax;
602: ncan->nzstep=can->nzstep;
603: ncan->wname=can->wname;
604: ncan->vx=can->vx; ncan->vy=can->vy;
605: ncan->formula=can->formula;
1.30 saito 606: ncan->color=can->color;
1.24 saito 607: w=XC(epos)-XC(spos);
608: h=YC(epos)-YC(spos);
609: m=MAX(can->width,can->height);
610: if( w>h ){
1.30 saito 611: ncan->width=m;
612: ncan->height=m * h/w;
1.1 noro 613: } else {
1.30 saito 614: ncan->width=m * w/h;
615: ncan->height=m;
1.1 noro 616: }
1.24 saito 617: if( can->wide ){
1.1 noro 618: STOQ(10,ten); STOQ(2,two);
619: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
620: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
621: divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
1.24 saito 622: dy=(can->ymax-can->ymin)*10;
623: ymid=(can->ymax+can->ymin)/2;
624: ymin=ymid-dy/2; ymax=ymid+dy/2;
1.1 noro 625: } else {
626: subq(can->qxmax,can->qxmin,&dx);
1.30 saito 627: xmin=can->qxmin;
628: xmax=can->qxmax;
1.24 saito 629: dy=can->ymax-can->ymin;
1.30 saito 630: ymin=can->ymin;
631: ymax=can->ymax;
1.1 noro 632: }
633: STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw);
634: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
635: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
1.24 saito 636: ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax);
637: ncan->ymin=ymax-YC(epos)*dy/can->height;
638: ncan->ymax=ymax-YC(spos)*dy/can->height;
1.36 ! noro 639: ncan->prec = can->prec;
1.30 saito 640: create_canvas(ncan);
1.1 noro 641:
1.30 saito 642: switch (ncan->mode){
643: case 0://IFPLOT
644: case 1://CONPLOT
645: ifplotmain(ncan);
646: break;
647: case 2://PLOT
648: plotcalc(ncan);
649: plot_print(display,ncan);
650: break;
651: case 4://POLARPLOT
652: polarcalc(ncan);
653: plot_print(display,ncan);
654: break;
655: case 30://MEMORY_PLOT
656: break;
657: case 31://ARRAYPLOT
658: break;
659: case 33://DRAWCIRCLE
660: break;
661: case 34://DRAW_OBJ
662: break;
663: case 35://DRAW_STRING
664: break;
665: case 36://OBJ_CP
666: break;
667: case 6://IFPLOTD
668: case 7://IFPLOTQ
669: case 8://IFPLOTB
670: case 9://INEQND
671: case 10://INEQNQ
672: case 11://INEQNB
673: case 21://CONPLOTD
674: case 22://CONPLOTQ
675: case 23://CONPLOTB
676: case 24://ITVIFPLOT
677: //ifplotNG
678: ifplotmainNG(ncan);
679: break;
680: case 12://INEQNDAND
681: case 13://INEQNQAND
682: case 14://INEQNBAND
683: case 15://INEQNDOR
684: case 16://INEQNQOR
685: case 17://INEQNBOR
686: case 18://INEQNDXOR
687: case 19://INEQNQXOR
688: case 20://INEQNBXOR
689: case 25://PLOTOVERD
690: case 26://PLOTOVERQ
691: case 27://PLOTOVERB
692: //ifplotOP
693: ifplotmainNG(ncan);
694: break;
695: case 38://POLARPLOTD
696: //polarplotNG
697: polarcalcNG(ncan);
698: polar_print(display,ncan);
699: break;
700: }
1.1 noro 701: copy_to_canvas(ncan);
702: }
703: }
704:
1.24 saito 705: void qifplotmain(struct canvas *can)
1.1 noro 706: {
707: int width,height;
1.24 saito 708: char **tabe,*tabeb;
1.1 noro 709: int i;
710:
1.24 saito 711: width=can->width; height=can->height;
712: tabe=(char **)ALLOCA(width*sizeof(char *)+width*height*sizeof(char));
713: bzero((void *)tabe,width*sizeof(char *)+width*height*sizeof(char));
714: for( i=0, tabeb=(char *)(tabe+width); i<width; i++ )
715: tabe[i]=tabeb + height*i;
1.1 noro 716: define_cursor(can->window,runningcur);
717: set_busy(can); set_selection();
1.24 saito 718: qcalc(tabe,can); qif_print(display,tabe,can);
1.1 noro 719: reset_selection(); reset_busy(can);
720: define_cursor(can->window,normalcur);
721: }
722:
1.24 saito 723: //*******************ifplotNG
1.27 saito 724: int ifplotNG(NODE arg,int func){
1.30 saito 725: int id,op_code;
726: unsigned int color;
1.24 saito 727: NODE n;
728: struct canvas *can;
729: P formula;
730: LIST xrange,yrange,zrange,wsize;
731: STRING wname;
732:
1.30 saito 733: can=canvas[id=search_canvas()];
1.24 saito 734: formula=(P)ARG0(arg);
1.30 saito 735: can->color=QTOS((Q)ARG1(arg));
1.24 saito 736: xrange=(LIST)ARG2(arg);
737: yrange=(LIST)ARG3(arg);
738: zrange=(LIST)ARG4(arg);
739: wsize=(LIST)ARG5(arg);
740: wname=(STRING)ARG6(arg);
741: can->division=0;
742: // set canvas data
743: if(xrange){
744: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
745: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
746: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
747: }
748: if(yrange){
749: n=BDY(yrange); can->vy=VR((P)BDY(n)); n=NEXT(n);
750: can->qymin=(Q)BDY(n); n=NEXT(n); can->qymax=(Q)BDY(n);
751: can->ymin=ToReal(can->qymin); can->ymax=ToReal(can->qymax);
752: }
753: if(zrange){
754: n=BDY(zrange); can->zmin=ToReal(BDY(n));
755: n=NEXT(n); can->zmax=ToReal(BDY(n));
756: n=NEXT(n); can->nzstep=QTOS((Q)BDY(n));
757: }
758: if(!wsize){
759: can->width=DEFAULTWIDTH;
760: can->height=DEFAULTHEIGHT;
761: } else {
762: can->width=QTOS((Q)BDY(BDY(wsize)));
763: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
764: }
765: if(wname) can->wname=BDY(wname);
766: else can->wname="";
767: can->formula=formula;
1.30 saito 768: set_drawcolor(can->color);
1.27 saito 769: can->mode=func;
1.24 saito 770: create_canvas(can);
1.30 saito 771: ifplotmainNG(can);
1.24 saito 772: copy_to_canvas(can);
773: return id;
774: }
775:
1.27 saito 776: int ifplotOP(NODE arg,int func){
777: //ineqnor[D,Q,B],ineqnand[D,Q,B],ineqnxor[D,Q,b],plotover[D,Q,B]
1.30 saito 778: int index,op_code;
779: unsigned int orgcolor,color;
1.27 saito 780: P formula;
781: struct canvas *can;
782: VL vl,vl0;
1.24 saito 783: NODE n;
1.27 saito 784:
1.24 saito 785: index=QTOS((Q)ARG0(arg));
786: formula=(P)ARG1(arg);
787: color=QTOS((Q)ARG2(arg));
1.27 saito 788: // set canvas data
1.24 saito 789: can=canvas[index];
790: orgcolor=can->color;
791: can->color=color;
792: can->formula=formula;
1.27 saito 793: current_can=can;
794: get_vars_recursive((Obj)formula,&vl);
795: for(vl0=vl;vl0;vl0=NEXT(vl0))
796: if(vl0->v->attr==(pointer)V_IND)
797: if(vl->v!=can->vx && vl->v!=can->vy)return -1;
1.34 fujimoto 798: #if !defined(VISUAL) && !defined(__MINGW32__)
1.27 saito 799: set_drawcolor(can->color);
800: #endif
801: can->mode=func;
1.24 saito 802: set_drawcolor(color);
1.30 saito 803: ifplotmainNG(can);
1.24 saito 804: set_drawcolor(orgcolor);
805: copy_to_canvas(can);
806: can->color=orgcolor;
1.34 fujimoto 807: #if !defined(VISUAL) && !defined(__MINGW32__)
1.27 saito 808: set_drawcolor(can->color);
809: #endif
1.24 saito 810: return index;
811: }
812:
1.30 saito 813: void ifplotmainNG(struct canvas *can){
1.24 saito 814: int width,height,i,j,ix,iy,**mask;
815: double **tabe;
1.1 noro 816:
1.24 saito 817: width=can->width; height=can->height;
818: tabe=(double **)ALLOCA((width+1)*sizeof(double *));
819: for(i=0;i<width;i++)tabe[i]=(double *)ALLOCA((height+1)*sizeof(double));
1.1 noro 820: define_cursor(can->window,runningcur);
821: set_busy(can); set_selection();
1.24 saito 822: set_drawcolor(can->color);
823: switch(can->mode){
1.27 saito 824: case 6://IFPLOTD
1.24 saito 825: calc(tabe,can,0);
1.30 saito 826: if_printNG(display,tabe,can,1);
1.24 saito 827: break;
1.27 saito 828: case 7://IFPLOTQ
1.24 saito 829: calcq(tabe,can,0);
1.30 saito 830: if_printNG(display,tabe,can,1);
1.24 saito 831: break;
1.27 saito 832: case 8://IFPLOTB
1.24 saito 833: calcb(tabe,can,0);
1.30 saito 834: if_printNG(display,tabe,can,0);
1.24 saito 835: break;
1.27 saito 836: case 9://INEQND
1.24 saito 837: calc(tabe,can,0);
838: area_print(display,tabe,can,0);
839: break;
1.27 saito 840: case 10://INEQNQ
1.24 saito 841: calcq(tabe,can,0);
842: area_print(display,tabe,can,0);
843: break;
1.27 saito 844: case 11://INEQNB
1.24 saito 845: calcb(tabe,can,0);
846: area_print(display,tabe,can,0);
847: break;
1.27 saito 848: case 12://INEQNFAND
1.24 saito 849: calc(tabe,can,0);
1.27 saito 850: area_print(display,tabe,can,2);
1.24 saito 851: break;
1.27 saito 852: case 13://INEQNQAND
1.24 saito 853: calcq(tabe,can,0);
854: area_print(display,tabe,can,2);
855: break;
1.27 saito 856: case 14://INEQNBAND
1.24 saito 857: calcb(tabe,can,0);
858: area_print(display,tabe,can,2);
859: break;
1.27 saito 860: case 15://INEQNDOR
1.24 saito 861: calc(tabe,can,0);
862: area_print(display,tabe,can,3);
863: break;
1.27 saito 864: case 16://INEQNQOR
1.24 saito 865: calcq(tabe,can,0);
866: area_print(display,tabe,can,3);
867: break;
1.27 saito 868: case 17://INEQNBOR
1.24 saito 869: calcb(tabe,can,0);
870: area_print(display,tabe,can,3);
871: break;
1.27 saito 872: case 18://INEQNDXOR
1.24 saito 873: calc(tabe,can,0);
874: area_print(display,tabe,can,4);
875: break;
1.27 saito 876: case 19://INEQNQXOR
1.24 saito 877: calcq(tabe,can,0);
878: area_print(display,tabe,can,4);
879: break;
1.27 saito 880: case 20://INEQNBXOR
1.24 saito 881: calcb(tabe,can,0);
882: area_print(display,tabe,can,4);
883: break;
1.27 saito 884: case 21://CONPLOTD
1.24 saito 885: calc(tabe,can,0);
886: con_print(display,tabe,can);
887: break;
1.27 saito 888: case 22://CONPLOTQ
889: calcq(tabe,can,0);
890: con_print(display,tabe,can);
891: break;
892: case 23://CONPLOTB
1.24 saito 893: calcb(tabe,can,0);
894: con_print(display,tabe,can);
895: break;
1.30 saito 896: #if defined(INTERVAL)
1.27 saito 897: case 24://ITVIFPLOT:
898: itvcalc(tabe,can,1);
1.30 saito 899: if_printNG(display,tabe,can,1);
1.24 saito 900: break;
1.30 saito 901: #endif
1.27 saito 902: case 25://PLOTOVERD
1.24 saito 903: calc(tabe,can,0);
904: over_print(display,tabe,can,0);
905: break;
1.27 saito 906: case 26://PLOTOVERQ:
1.24 saito 907: calcq(tabe,can,0);
908: over_print(display,tabe,can,0);
909: break;
1.27 saito 910: case 27://PLOTOVERB:
1.24 saito 911: calcb(tabe,can,0);
912: over_print(display,tabe,can,0);
913: break;
914: }
915: set_drawcolor(can->color);
1.1 noro 916: reset_selection(); reset_busy(can);
917: define_cursor(can->window,normalcur);
918: }
1.22 saito 919:
1.34 fujimoto 920: #if !defined(VISUAL) && !defined(__MINGW32__)
1.24 saito 921: int objcp(NODE arg){
1.22 saito 922: int idsrc, idtrg, op_code;
923: struct canvas *cansrc, *cantrg;
924:
1.24 saito 925: idsrc=QTOS((Q)ARG0(arg));
926: idtrg=QTOS((Q)ARG1(arg));
927: op_code=QTOS((Q)ARG2(arg));
928: cansrc=canvas[idsrc];
929: cantrg=canvas[idtrg];
1.22 saito 930: obj_op(cansrc, cantrg, op_code);
931: return idsrc;
932: }
933:
1.24 saito 934: void obj_op(struct canvas *cansrc, struct canvas *cantrg, int op){
1.22 saito 935: XImage *imgsrc, *imgtrg;
936: int width, height, i, j;
937: unsigned long src, trg, black, white;
938:
1.24 saito 939: width=cansrc->width; height=cansrc->height;
940: imgsrc=XGetImage(display, cansrc->pix, 0, 0, width, height, -1, ZPixmap);
941: imgtrg=XGetImage(display, cantrg->pix, 0, 0, width, height, -1, ZPixmap);
1.22 saito 942: black=GetColor(display, "black");
943: white=GetColor(display, "white");
944: flush();
945: define_cursor(cantrg->window,runningcur);
946: set_busy(cantrg); set_selection();
1.24 saito 947: cantrg->precise=cansrc->precise;
948: cantrg->noaxis=cansrc->noaxis;
949: cantrg->noaxisb=cansrc->noaxisb;
950: cantrg->vx=cansrc->vx;
951: cantrg->vy=cansrc->vy;
952: cantrg->formula=cansrc->formula;
953: cantrg->width=cansrc->width;
954: cantrg->height=cansrc->height;
955: cantrg->xmin=cansrc->xmin;
956: cantrg->xmax=cansrc->xmax;
957: cantrg->ymin=cansrc->ymin;
958: cantrg->ymax=cansrc->ymax;
959: cantrg->zmin=cansrc->zmin;
960: cantrg->zmax=cansrc->zmax;
961: cantrg->nzstep=cansrc->nzstep;
962: cantrg->qxmin=cansrc->qxmin;
963: cantrg->qxmax=cansrc->qxmax;
964: cantrg->qymin=cansrc->qymin;
965: cantrg->qymax=cansrc->qymax;
966: cantrg->pa=cansrc->pa;
967: switch(op){
1.22 saito 968: case 1:/* and case */
969: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 970: src=XGetPixel(imgsrc,i,j);
971: trg=XGetPixel(imgtrg,i,j);
972: if( (src == black) || (trg == black) )
1.22 saito 973: XPutPixel(imgtrg,i,j,black);
1.24 saito 974: else if( (src == white) || (trg == white) )
1.22 saito 975: XPutPixel(imgtrg,i,j,white);
976: else XPutPixel(imgtrg,i,j,(src & trg));
977: }
978: break;
979: case 3:/* copy case */
1.24 saito 980: imgtrg->data=imgsrc->data;
1.22 saito 981: break;
982: case 6:/* xor case */
983: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 984: src=XGetPixel(imgsrc,i,j);
985: trg=XGetPixel(imgtrg,i,j);
986: if( (src == black) || (trg == black) )
1.22 saito 987: XPutPixel(imgtrg,i,j,black);
1.24 saito 988: else if( (src == white) && (trg == white) )
1.22 saito 989: XPutPixel(imgtrg,i,j,trg|src);
1.24 saito 990: else if( (src != white) && (trg != white) )
1.22 saito 991: XPutPixel(imgtrg,i,j,white);
1.24 saito 992: else if( src == white )
1.22 saito 993: XPutPixel(imgtrg,i,j,src);
994: }
995: break;
996: case 7:/* or case */
997: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 998: src=XGetPixel(imgsrc,i,j);
999: trg=XGetPixel(imgtrg,i,j);
1000: if( (src == black) || (trg == black) )
1.22 saito 1001: XPutPixel(imgtrg,i,j,black);
1.24 saito 1002: else if(src == white)
1.22 saito 1003: XPutPixel(imgtrg,i,j,trg);
1.24 saito 1004: else if(trg == white)
1.22 saito 1005: XPutPixel(imgtrg,i,j,src);
1006: }
1007: break;
1008: default:
1009: break;
1010: }
1011: XPutImage(display, cantrg->pix, drawGC, imgtrg, 0, 0, 0, 0, width, height);
1012: reset_selection(); reset_busy(cantrg);
1013: define_cursor(cantrg->window,normalcur);
1014: copy_to_canvas(cantrg);
1015: count_and_flush();
1016: flush();
1017: }
1.32 ohara 1018: #endif
1.30 saito 1019:
1.24 saito 1020: int polarplotNG(NODE arg){
1.30 saito 1021: int i,id,width,height;
1.22 saito 1022: NODE n;
1023: struct canvas *can;
1.27 saito 1024: LIST range,geom;
1.22 saito 1025: STRING wname;
1.24 saito 1026: V v;
1.22 saito 1027:
1.30 saito 1028: id=search_canvas();
1029: can=canvas[id];
1030: can->mode=modeNO(POLARPLOTD);
1031: can->formula=(P)ARG0(arg);
1032: can->color=QTOS((Q)ARG1(arg));
1.27 saito 1033: range=(LIST)ARG2(arg);
1034: geom=(LIST)ARG3(arg);
1.24 saito 1035: wname=(STRING)ARG4(arg);
1036:
1.27 saito 1037: if(range){
1038: n=NEXT(BDY(range));
1039: can->zmin=ToReal(BDY(n));
1040: n=NEXT(n);can->zmax=ToReal(BDY(n));
1041: n=NEXT(n);
1042: can->vx=VR((P)BDY(BDY(range)));
1043: can->nzstep=n?QTOS((Q)BDY(n)):DEFAULTPOLARSTEP;
1.24 saito 1044: }
1.27 saito 1045: if(geom){
1046: can->width=width=QTOS((Q)BDY(BDY(geom)));
1047: can->height=height=QTOS((Q)BDY(NEXT(BDY(geom))));
1.22 saito 1048: }
1.24 saito 1049: if(wname)can->wname=BDY(wname);
1050: else can->wname="";
1.30 saito 1051: polarcalcNG(can);
1.22 saito 1052: create_canvas(can);
1.30 saito 1053: set_drawcolor(can->color);
1.27 saito 1054: polar_print(display,can);
1.30 saito 1055: reset_selection();
1056: reset_busy(can);
1.27 saito 1057: define_cursor(can->window,normalcur);
1.22 saito 1058: return id;
1059: }
1.30 saito 1060:
1061: void MSGdraw(char *str){
1062: int id,x,y;
1063: struct canvas *can;
1064:
1065: id=search_canvas();
1066: can=canvas[id];
1067: can->mode=modeNO(INTERACTIVE);
1068: can->width=300;
1069: can->height=300;
1070: can->wname="MSG";
1071: x=100;
1072: y=100;
1073: create_canvas(can);
1074: draw_character_string(display,can,x,y,str,0xff0000);
1075: }
1076:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>