/src/sys/draw/impls/x/xops.c.html
HTML | 519 lines | 450 code | 69 blank | 0 comment | 0 complexity | d430ed3a85d99029804b2208f990bf64 MD5 | raw file
- <center><a href="xops.c">Actual source code: xops.c</a></center><br>
- <html>
- <head> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/src/sys/draw/impls/x/xops.c.html" />
- <title></title>
- <meta name="generator" content="c2html 0.9.5">
- <meta name="date" content="2012-08-29T16:33:55+00:00">
- </head>
- <body bgcolor="#FFFFFF">
- <div id="version" align=right><b>petsc-3.3-p3 2012-08-29</b></div>
- <pre width="80">
- <a name="line2"> 2: </a><font color="#B22222">/*</font>
- <a name="line3"> 3: </a><font color="#B22222"> Defines the operations for the X <A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> implementation.</font>
- <a name="line4"> 4: </a><font color="#B22222">*/</font>
- <a name="line6"> 6: </a><font color="#A020F0">#include <../src/sys/draw/impls/x/ximpl.h> </font><font color="#B22222">/*I "petscsys.h" I*/</font><font color="#A020F0"></font>
- <a name="line8"> 8: </a><font color="#B22222">/*</font>
- <a name="line9"> 9: </a><font color="#B22222"> These macros transform from the users coordinates to the </font>
- <a name="line10"> 10: </a><font color="#B22222"> X-window pixel coordinates.</font>
- <a name="line11"> 11: </a><font color="#B22222">*/</font>
- <a name="line12"> 12: </a><strong><font color="#228B22">#define XTRANS(draw,xwin,x) \</font></strong>
- <a name="line13"> 13: </a><strong><font color="#228B22"> (int)(((xwin)->w)*((draw)->port_xl + (((x - (draw)->coor_xl)*((draw)->port_xr - (draw)->port_xl))/((draw)->coor_xr - (draw)->coor_xl))))</font></strong>
- <a name="line14"> 14: </a><strong><font color="#228B22">#define YTRANS(draw,xwin,y) \</font></strong>
- <a name="line15"> 15: </a><strong><font color="#228B22"> (int)(((xwin)->h)*(1.0-(draw)->port_yl - (((y - (draw)->coor_yl)*((draw)->port_yr - (draw)->port_yl))/((draw)->coor_yr - (draw)->coor_yl))))</font></strong>
- <a name="line19"> 19: </a><strong><font color="#4169E1"><a name="PetscDrawLine_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawLine_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr,int cl)</font></strong>
- <a name="line20"> 20: </a>{
- <a name="line21"> 21: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line22"> 22: </a> int x1,y_1,x2,y2;
- <a name="line25"> 25: </a> PetscDrawXiSetColor(XiWin,cl);
- <a name="line26"> 26: </a> x1 = XTRANS(draw,XiWin,xl); x2 = XTRANS(draw,XiWin,xr);
- <a name="line27"> 27: </a> y_1 = YTRANS(draw,XiWin,yl); y2 = YTRANS(draw,XiWin,yr);
- <a name="line28"> 28: </a> <font color="#4169E1">if</font> (x1 == x2 && y_1 == y2) <font color="#4169E1">return</font>(0);
- <a name="line29"> 29: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,x2,y2);
- <a name="line30"> 30: </a> <font color="#4169E1">return</font>(0);
- <a name="line31"> 31: </a>}
- <a name="line35"> 35: </a><strong><font color="#4169E1"><a name="PetscDrawArrow_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawArrow_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr,int cl)</font></strong>
- <a name="line36"> 36: </a>{
- <a name="line37"> 37: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line38"> 38: </a> int x1,y_1,x2,y2;
- <a name="line41"> 41: </a> PetscDrawXiSetColor(XiWin,cl);
- <a name="line42"> 42: </a> x1 = XTRANS(draw,XiWin,xl); x2 = XTRANS(draw,XiWin,xr);
- <a name="line43"> 43: </a> y_1 = YTRANS(draw,XiWin,yl); y2 = YTRANS(draw,XiWin,yr);
- <a name="line44"> 44: </a> <font color="#4169E1">if</font> (x1 == x2 && y_1 == y2) <font color="#4169E1">return</font>(0);
- <a name="line45"> 45: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,x2,y2);
- <a name="line46"> 46: </a> <font color="#4169E1">if</font> (x1 == x2 && PetscAbs(y_1 - y2) > 7) {
- <a name="line47"> 47: </a> <font color="#4169E1">if</font> (y2 > y_1) {
- <a name="line48"> 48: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2-3,y2-3);
- <a name="line49"> 49: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2+3,y2-3);
- <a name="line50"> 50: </a> } <font color="#4169E1">else</font> {
- <a name="line51"> 51: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2-3,y2+3);
- <a name="line52"> 52: </a> XDrawLine(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x2,y2,x2+3,y2+3);
- <a name="line53"> 53: </a> }
- <a name="line54"> 54: </a> }
- <a name="line55"> 55: </a> <font color="#4169E1">return</font>(0);
- <a name="line56"> 56: </a>}
- <a name="line60"> 60: </a><strong><font color="#4169E1"><a name="PetscDrawPoint_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawPoint_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c)</font></strong>
- <a name="line61"> 61: </a>{
- <a name="line62"> 62: </a> int xx,yy;
- <a name="line63"> 63: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line66"> 66: </a> xx = XTRANS(draw,XiWin,x); yy = YTRANS(draw,XiWin,y);
- <a name="line67"> 67: </a> PetscDrawXiSetColor(XiWin,c);
- <a name="line68"> 68: </a> XDrawPoint(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx,yy);
- <a name="line69"> 69: </a> <font color="#4169E1">return</font>(0);
- <a name="line70"> 70: </a>}
- <a name="line74"> 74: </a><strong><font color="#4169E1"><a name="PetscDrawRectangle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawRectangle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr,int c1,int c2,int c3,int c4)</font></strong>
- <a name="line75"> 75: </a>{
- <a name="line76"> 76: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line77"> 77: </a> int x1,y_1,w,h,c = (c1 + c2 + c3 + c4)/4;
- <a name="line80"> 80: </a> PetscDrawXiSetColor(XiWin,c);
- <a name="line81"> 81: </a> x1 = XTRANS(draw,XiWin,xl); w = XTRANS(draw,XiWin,xr) - x1;
- <a name="line82"> 82: </a> y_1 = YTRANS(draw,XiWin,yr); h = YTRANS(draw,XiWin,yl) - y_1;
- <a name="line83"> 83: </a> <font color="#4169E1">if</font> (w <= 0) w = 1; <font color="#4169E1">if</font> (h <= 0) h = 1;
- <a name="line84"> 84: </a> XFillRectangle(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x1,y_1,w,h);
- <a name="line85"> 85: </a> <font color="#4169E1">return</font>(0);
- <a name="line86"> 86: </a>}
- <a name="line90"> 90: </a><strong><font color="#4169E1"><a name="PetscDrawEllipse_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawEllipse_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> Win, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> a, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> b, int c)</font></strong>
- <a name="line91"> 91: </a>{
- <a name="line92"> 92: </a> PetscDraw_X* XiWin = (PetscDraw_X*) Win->data;
- <a name="line93"> 93: </a> int xA, yA, w, h;
- <a name="line96"> 96: </a> PetscDrawXiSetColor(XiWin, c);
- <a name="line97"> 97: </a> xA = XTRANS(Win, XiWin, x - a/2.0); w = XTRANS(Win, XiWin, x + a/2.0) - xA;
- <a name="line98"> 98: </a> yA = YTRANS(Win, XiWin, y + b/2.0); h = YTRANS(Win, XiWin, y - b/2.0) - yA;
- <a name="line99"> 99: </a> XFillArc(XiWin->disp, PetscDrawXiDrawable(XiWin), XiWin->gc.set, xA, yA, w, h, 0, 23040);
- <a name="line100">100: </a> <font color="#4169E1">return</font>(0);
- <a name="line101">101: </a>}
- <a name="line103">103: </a><strong><font color="#4169E1">extern <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawInterpolatedTriangle_X(PetscDraw_X*,int,int,int,int,int,int,int,int,int)</font></strong>;
- <a name="line107">107: </a><strong><font color="#4169E1"><a name="PetscDrawTriangle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawTriangle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X1,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y_1,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X2,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y2,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X3,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y3,int c1,int c2,int c3)</font></strong>
- <a name="line108">108: </a>{
- <a name="line109">109: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line113">113: </a> <font color="#4169E1">if</font> (c1 == c2 && c2 == c3) {
- <a name="line114">114: </a> XPoint pt[3];
- <a name="line115">115: </a> PetscDrawXiSetColor(XiWin,c1);
- <a name="line116">116: </a> pt[0].x = XTRANS(draw,XiWin,X1);
- <a name="line117">117: </a> pt[0].y = YTRANS(draw,XiWin,Y_1);
- <a name="line118">118: </a> pt[1].x = XTRANS(draw,XiWin,X2);
- <a name="line119">119: </a> pt[1].y = YTRANS(draw,XiWin,Y2);
- <a name="line120">120: </a> pt[2].x = XTRANS(draw,XiWin,X3);
- <a name="line121">121: </a> pt[2].y = YTRANS(draw,XiWin,Y3);
- <a name="line122">122: </a> XFillPolygon(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,pt,3,Convex,CoordModeOrigin);
- <a name="line123">123: </a> } <font color="#4169E1">else</font> {
- <a name="line124">124: </a> int x1,y_1,x2,y2,x3,y3;
- <a name="line125">125: </a> x1 = XTRANS(draw,XiWin,X1);
- <a name="line126">126: </a> y_1 = YTRANS(draw,XiWin,Y_1);
- <a name="line127">127: </a> x2 = XTRANS(draw,XiWin,X2);
- <a name="line128">128: </a> y2 = YTRANS(draw,XiWin,Y2);
- <a name="line129">129: </a> x3 = XTRANS(draw,XiWin,X3);
- <a name="line130">130: </a> y3 = YTRANS(draw,XiWin,Y3);
- <a name="line131">131: </a> PetscDrawInterpolatedTriangle_X(XiWin,x1,y_1,c1,x2,y2,c2,x3,y3,c3);
- <a name="line132">132: </a> }
- <a name="line133">133: </a> <font color="#4169E1">return</font>(0);
- <a name="line134">134: </a>}
- <a name="line138">138: </a><strong><font color="#4169E1"><a name="PetscDrawString_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawString_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c,const char chrs[])</font></strong>
- <a name="line139">139: </a>{
- <a name="line141">141: </a> int xx,yy;
- <a name="line142">142: </a> size_t len;
- <a name="line143">143: </a> PetscDraw_X *XiWin = (PetscDraw_X*)draw->data;
- <a name="line144">144: </a> char *substr;
- <a name="line145">145: </a> <A href="../../../../../docs/manualpages/Sys/PetscToken.html#PetscToken">PetscToken</A> token;
- <a name="line148">148: </a> xx = XTRANS(draw,XiWin,x); yy = YTRANS(draw,XiWin,y);
- <a name="line149">149: </a> PetscDrawXiSetColor(XiWin,c);
- <a name="line150">150: </a>
- <a name="line151">151: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenCreate.html#PetscTokenCreate">PetscTokenCreate</A>(chrs,'\n',&token);
- <a name="line152">152: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line153">153: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(substr,&len);
- <a name="line154">154: </a> XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
- <a name="line155">155: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line156">156: </a> <font color="#4169E1">while</font> (substr) {
- <a name="line157">157: </a> yy += 4*XiWin->font->font_descent;
- <a name="line158">158: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(substr,&len);
- <a name="line159">159: </a> XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
- <a name="line160">160: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line161">161: </a> }
- <a name="line162">162: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenDestroy.html#PetscTokenDestroy">PetscTokenDestroy</A>(&token);
- <a name="line164">164: </a> <font color="#4169E1">return</font>(0);
- <a name="line165">165: </a>}
- <a name="line167">167: </a><strong><font color="#4169E1">extern <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawXiFontFixed(PetscDraw_X*,int,int,PetscDrawXiFont **)</font></strong>;
- <a name="line171">171: </a><strong><font color="#4169E1"><a name="PetscDrawStringSetSize_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringSetSize_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y)</font></strong>
- <a name="line172">172: </a>{
- <a name="line173">173: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line175">175: </a> int w,h;
- <a name="line178">178: </a> w = (int)((XiWin->w)*x*(draw->port_xr - draw->port_xl)/(draw->coor_xr - draw->coor_xl));
- <a name="line179">179: </a> h = (int)((XiWin->h)*y*(draw->port_yr - draw->port_yl)/(draw->coor_yr - draw->coor_yl));
- <a name="line180">180: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(XiWin->font);
- <a name="line181">181: </a> PetscDrawXiFontFixed(XiWin,w,h,&XiWin->font);
- <a name="line182">182: </a> <font color="#4169E1">return</font>(0);
- <a name="line183">183: </a>}
- <a name="line187">187: </a><strong><font color="#4169E1"><a name="PetscDrawStringGetSize_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringGetSize_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y)</font></strong>
- <a name="line188">188: </a>{
- <a name="line189">189: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line190">190: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> w,h;
- <a name="line193">193: </a> w = XiWin->font->font_w; h = XiWin->font->font_h;
- <a name="line194">194: </a> *x = w*(draw->coor_xr - draw->coor_xl)/((XiWin->w)*(draw->port_xr - draw->port_xl));
- <a name="line195">195: </a> *y = h*(draw->coor_yr - draw->coor_yl)/((XiWin->h)*(draw->port_yr - draw->port_yl));
- <a name="line196">196: </a> <font color="#4169E1">return</font>(0);
- <a name="line197">197: </a>}
- <a name="line201">201: </a><strong><font color="#4169E1"><a name="PetscDrawStringVertical_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringVertical_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c,const char chrs[])</font></strong>
- <a name="line202">202: </a>{
- <a name="line204">204: </a> int xx,yy;
- <a name="line205">205: </a> PetscDraw_X *XiWin = (PetscDraw_X*)draw->data;
- <a name="line206">206: </a> char tmp[2];
- <a name="line207">207: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> tw,th;
- <a name="line208">208: </a> size_t i,n;
- <a name="line209">209: </a>
- <a name="line211">211: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(chrs,&n);
- <a name="line212">212: </a> tmp[1] = 0;
- <a name="line213">213: </a> PetscDrawXiSetColor(XiWin,c);
- <a name="line214">214: </a> PetscDrawStringGetSize_X(draw,&tw,&th);
- <a name="line215">215: </a> xx = XTRANS(draw,XiWin,x);
- <a name="line216">216: </a> <font color="#4169E1">for</font> (i=0; i<n; i++) {
- <a name="line217">217: </a> tmp[0] = chrs[i];
- <a name="line218">218: </a> yy = YTRANS(draw,XiWin,y-th*i);
- <a name="line219">219: </a> XDrawString(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set, xx,yy - XiWin->font->font_descent,tmp,1);
- <a name="line220">220: </a> }
- <a name="line221">221: </a> <font color="#4169E1">return</font>(0);
- <a name="line222">222: </a>}
- <a name="line226">226: </a><strong><font color="#4169E1"><a name="PetscDrawFlush_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawFlush_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line227">227: </a>{
- <a name="line228">228: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line231">231: </a> <font color="#4169E1">if</font> (XiWin->drw) {
- <a name="line232">232: </a> XCopyArea(XiWin->disp,XiWin->drw,XiWin->win,XiWin->gc.set,0,0,XiWin->w,XiWin->h,0,0);
- <a name="line233">233: </a> }
- <a name="line234">234: </a> XFlush(XiWin->disp); XSync(XiWin->disp,False);
- <a name="line235">235: </a> <font color="#4169E1">return</font>(0);
- <a name="line236">236: </a>}
- <a name="line240">240: </a><strong><font color="#4169E1"><a name="PetscDrawSynchronizedFlush_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSynchronizedFlush_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line241">241: </a>{
- <a name="line243">243: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line244">244: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line247">247: </a> XFlush(XiWin->disp);
- <a name="line248">248: </a> <font color="#4169E1">if</font> (XiWin->drw) {
- <a name="line249">249: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line250">250: </a> <font color="#B22222">/* make sure data has actually arrived at server */</font>
- <a name="line251">251: </a> XSync(XiWin->disp,False);
- <a name="line252">252: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line253">253: </a> <font color="#4169E1">if</font> (!rank) {
- <a name="line254">254: </a> XCopyArea(XiWin->disp,XiWin->drw,XiWin->win,XiWin->gc.set,0,0,XiWin->w,XiWin->h,0,0);
- <a name="line255">255: </a> XFlush(XiWin->disp);
- <a name="line256">256: </a> }
- <a name="line257">257: </a> XSync(XiWin->disp,False);
- <a name="line258">258: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line259">259: </a> } <font color="#4169E1">else</font> {
- <a name="line260">260: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line261">261: </a> XSync(XiWin->disp,False);
- <a name="line262">262: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line263">263: </a> }
- <a name="line264">264: </a> <font color="#4169E1">return</font>(0);
- <a name="line265">265: </a>}
- <a name="line269">269: </a><strong><font color="#4169E1"><a name="PetscDrawSetViewport_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetViewport_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr)</font></strong>
- <a name="line270">270: </a>{
- <a name="line271">271: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line272">272: </a> XRectangle box;
- <a name="line275">275: </a> box.x = (int)(xl*XiWin->w); box.y = (int)((1.0-yr)*XiWin->h);
- <a name="line276">276: </a> box.width = (int)((xr-xl)*XiWin->w);box.height = (int)((yr-yl)*XiWin->h);
- <a name="line277">277: </a> XSetClipRectangles(XiWin->disp,XiWin->gc.set,0,0,&box,1,Unsorted);
- <a name="line278">278: </a> <font color="#4169E1">return</font>(0);
- <a name="line279">279: </a>}
- <a name="line283">283: </a><strong><font color="#4169E1"><a name="PetscDrawClear_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawClear_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line284">284: </a>{
- <a name="line285">285: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line286">286: </a> int x, y, w, h;
- <a name="line290">290: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawSave.html#PetscDrawSave">PetscDrawSave</A>(draw);
- <a name="line291">291: </a> x = (int)(draw->port_xl*XiWin->w);
- <a name="line292">292: </a> w = (int)((draw->port_xr - draw->port_xl)*XiWin->w);
- <a name="line293">293: </a> y = (int)((1.0-draw->port_yr)*XiWin->h);
- <a name="line294">294: </a> h = (int)((draw->port_yr - draw->port_yl)*XiWin->h);
- <a name="line295">295: </a> PetscDrawXiSetPixVal(XiWin,XiWin->background);
- <a name="line296">296: </a> XFillRectangle(XiWin->disp,PetscDrawXiDrawable(XiWin),XiWin->gc.set,x,y,w,h);
- <a name="line297">297: </a> <font color="#4169E1">return</font>(0);
- <a name="line298">298: </a>}
- <a name="line302">302: </a><strong><font color="#4169E1"><a name="PetscDrawSynchronizedClear_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSynchronizedClear_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line303">303: </a>{
- <a name="line305">305: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line306">306: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line309">309: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line310">310: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line311">311: </a> <font color="#4169E1">if</font> (!rank) {
- <a name="line312">312: </a> PetscDrawClear_X(draw);
- <a name="line313">313: </a> }
- <a name="line314">314: </a> XFlush(XiWin->disp);
- <a name="line315">315: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line316">316: </a> XSync(XiWin->disp,False);
- <a name="line317">317: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line318">318: </a> <font color="#4169E1">return</font>(0);
- <a name="line319">319: </a>}
- <a name="line323">323: </a><strong><font color="#4169E1"><a name="PetscDrawSetDoubleBuffer_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetDoubleBuffer_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line324">324: </a>{
- <a name="line325">325: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line327">327: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line330">330: </a> <font color="#4169E1">if</font> (win->drw) <font color="#4169E1">return</font>(0);
- <a name="line332">332: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line333">333: </a> <font color="#4169E1">if</font> (!rank) {
- <a name="line334">334: </a> win->drw = XCreatePixmap(win->disp,win->win,win->w,win->h,win->depth);
- <a name="line335">335: </a> }
- <a name="line336">336: </a> <font color="#B22222">/* try to make sure it is actually done before passing info to all */</font>
- <a name="line337">337: </a> XSync(win->disp,False);
- <a name="line338">338: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&win->drw,1,MPI_UNSIGNED_LONG,0,((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line339">339: </a> <font color="#4169E1">return</font>(0);
- <a name="line340">340: </a>}
- <a name="line342">342: </a><font color="#A020F0">#include <X11/cursorfont.h></font>
- <a name="line346">346: </a><strong><font color="#4169E1"><a name="PetscDrawGetMouseButton_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetMouseButton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDrawButton.html#PetscDrawButton">PetscDrawButton</A> *button,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>* x_user,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y_user,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *x_phys,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y_phys)</font></strong>
- <a name="line347">347: </a>{
- <a name="line348">348: </a> XEvent report;
- <a name="line349">349: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line350">350: </a> Window root,child;
- <a name="line351">351: </a> int root_x,root_y,px,py;
- <a name="line352">352: </a> unsigned int keys_button;
- <a name="line353">353: </a> Cursor cursor = 0;
- <a name="line356">356: </a> <font color="#B22222">/* change cursor to indicate input */</font>
- <a name="line357">357: </a> <font color="#4169E1">if</font> (!cursor) {
- <a name="line358">358: </a> cursor = XCreateFontCursor(win->disp,XC_hand2);
- <a name="line359">359: </a> <font color="#4169E1">if</font> (!cursor) <A href="../../../../../docs/manualpages/Sys/SETERRQ.html#SETERRQ">SETERRQ</A>(<A href="../../../../../docs/manualpages/Sys/PETSC_COMM_SELF.html#PETSC_COMM_SELF">PETSC_COMM_SELF</A>,PETSC_ERR_LIB,<font color="#666666">"Unable to create X cursor"</font>);
- <a name="line360">360: </a> }
- <a name="line361">361: </a> XDefineCursor(win->disp,win->win,cursor);
- <a name="line362">362: </a> XSelectInput(win->disp,win->win,ButtonPressMask | ButtonReleaseMask);
- <a name="line364">364: </a> <font color="#4169E1">while</font> (XCheckTypedEvent(win->disp,ButtonPress,&report));
- <a name="line365">365: </a> XMaskEvent(win->disp,ButtonReleaseMask,&report);
- <a name="line366">366: </a> <font color="#4169E1">switch</font> (report.xbutton.button) {
- <a name="line367">367: </a> <font color="#4169E1">case</font> Button1:
- <a name="line368">368: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line369">369: </a> *button = PETSC_BUTTON_LEFT_SHIFT;
- <a name="line370">370: </a> <font color="#4169E1">else</font>
- <a name="line371">371: </a> *button = PETSC_BUTTON_LEFT;
- <a name="line372">372: </a> <font color="#4169E1">break</font>;
- <a name="line373">373: </a> <font color="#4169E1">case</font> Button2:
- <a name="line374">374: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line375">375: </a> *button = PETSC_BUTTON_CENTER_SHIFT;
- <a name="line376">376: </a> <font color="#4169E1">else</font>
- <a name="line377">377: </a> *button = PETSC_BUTTON_CENTER;
- <a name="line378">378: </a> <font color="#4169E1">break</font>;
- <a name="line379">379: </a> <font color="#4169E1">case</font> Button3:
- <a name="line380">380: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line381">381: </a> *button = PETSC_BUTTON_RIGHT_SHIFT;
- <a name="line382">382: </a> <font color="#4169E1">else</font>
- <a name="line383">383: </a> *button = PETSC_BUTTON_RIGHT;
- <a name="line384">384: </a> <font color="#4169E1">break</font>;
- <a name="line385">385: </a> }
- <a name="line386">386: </a> XQueryPointer(win->disp,report.xmotion.window,&root,&child,&root_x,&root_y,&px,&py,&keys_button);
- <a name="line388">388: </a> <font color="#4169E1">if</font> (x_phys) *x_phys = ((double)px)/((double)win->w);
- <a name="line389">389: </a> <font color="#4169E1">if</font> (y_phys) *y_phys = 1.0 - ((double)py)/((double)win->h);
- <a name="line391">391: </a> <font color="#4169E1">if</font> (x_user) *x_user = draw->coor_xl + ((((double)px)/((double)win->w)-draw->port_xl))*(draw->coor_xr - draw->coor_xl)/(draw->port_xr - draw->port_xl);
- <a name="line392">392: </a> <font color="#4169E1">if</font> (y_user) *y_user = draw->coor_yl + ((1.0 - ((double)py)/((double)win->h)-draw->port_yl))*(draw->coor_yr - draw->coor_yl)/(draw->port_yr - draw->port_yl);
- <a name="line394">394: </a> XUndefineCursor(win->disp,win->win);
- <a name="line395">395: </a> XFlush(win->disp); XSync(win->disp,False);
- <a name="line396">396: </a> <font color="#4169E1">return</font>(0);
- <a name="line397">397: </a>}
- <a name="line401">401: </a><strong><font color="#4169E1"><a name="PetscDrawPause_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawPause_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line402">402: </a>{
- <a name="line406">406: </a> <font color="#4169E1">if</font> (draw->pause > 0) <A href="../../../../../docs/manualpages/Sys/PetscSleep.html#PetscSleep">PetscSleep</A>(draw->pause);
- <a name="line407">407: </a> <font color="#4169E1">else</font> <font color="#4169E1">if</font> (draw->pause < 0) {
- <a name="line408">408: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawButton.html#PetscDrawButton">PetscDrawButton</A> button;
- <a name="line409">409: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line410">410: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line411">411: </a> <font color="#4169E1">if</font> (!rank) {
- <a name="line412">412: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawGetMouseButton.html#PetscDrawGetMouseButton">PetscDrawGetMouseButton</A>(draw,&button,0,0,0,0);
- <a name="line413">413: </a> <font color="#4169E1">if</font> (button == PETSC_BUTTON_CENTER) draw->pause = 0;
- <a name="line414">414: </a> }
- <a name="line415">415: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&draw->pause,1,MPI_INT,0,((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line416">416: </a> }
- <a name="line417">417: </a> <font color="#4169E1">return</font>(0);
- <a name="line418">418: </a>}
- <a name="line422">422: </a><strong><font color="#4169E1"><a name="PetscDrawGetPopup_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetPopup_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> *popup)</font></strong>
- <a name="line423">423: </a>{
- <a name="line425">425: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line428">428: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawOpenX.html#PetscDrawOpenX">PetscDrawOpenX</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,<A href="../../../../../docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A>,<A href="../../../../../docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A>,win->x,win->y+win->h+36,220,220,popup);
- <a name="line429">429: </a> draw->popup = *popup;
- <a name="line430">430: </a> <font color="#4169E1">return</font>(0);
- <a name="line431">431: </a>}
- <a name="line435">435: </a><strong><font color="#4169E1"><a name="PetscDrawSetTitle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetTitle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,const char title[])</font></strong>
- <a name="line436">436: </a>{
- <a name="line437">437: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line438">438: </a> XTextProperty prop;
- <a name="line440">440: </a> size_t len;
- <a name="line443">443: </a> XGetWMName(win->disp,win->win,&prop);
- <a name="line444">444: </a> XFree((void*)prop.value);
- <a name="line445">445: </a> prop.value = (unsigned char *)title;
- <a name="line446">446: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(title,&len);
- <a name="line447">447: </a> prop.nitems = (long) len;
- <a name="line448">448: </a> XSetWMName(win->disp,win->win,&prop);
- <a name="line449">449: </a> <font color="#4169E1">return</font>(0);
- <a name="line450">450: </a>}
- <a name="line454">454: </a><strong><font color="#4169E1"><a name="PetscDrawResizeWindow_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawResizeWindow_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,int w,int h)</font></strong>
- <a name="line455">455: </a>{
- <a name="line456">456: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line457">457: </a> unsigned int ww,hh,border,depth;
- <a name="line458">458: </a> int x,y;
- <a name="line460">460: </a> Window root;
- <a name="line463">463: </a> XResizeWindow(win->disp,win->win,w,h);
- <a name="line464">464: </a> XGetGeometry(win->disp,win->win,&root,&x,&y,&ww,&hh,&border,&depth);
- <a name="line465">465: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawCheckResizedWindow.html#PetscDrawCheckResizedWindow">PetscDrawCheckResizedWindow</A>(draw);
- <a name="line466">466: </a> <font color="#4169E1">return</font>(0);
- <a name="line467">467: </a>}
- <a name="line471">471: </a><strong><font color="#4169E1"><a name="PetscDrawCheckResizedWindow_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawCheckResizedWindow_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line472">472: </a>{
- <a name="line473">473: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line475">475: </a> int x,y;
- <a name="line476">476: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line477">477: </a> Window root;
- <a name="line478">478: </a> unsigned int w,h,border,depth,geo[2];
- <a name="line479">479: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,xr,yl,yr;
- <a name="line480">480: </a> XRectangle box;
- <a name="line483">483: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line484">484: </a> <font color="#4169E1">if</font> (!rank) {
- <a name="line485">485: </a> XSync(win->disp,False);
- <a name="line486">486: </a> XGetGeometry(win->disp,win->win,&root,&x,&y,geo,geo+1,&border,&depth);
- <a name="line487">487: </a> }
- <a name="line488">488: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(geo,2,MPI_INT,0,((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line489">489: </a> w = geo[0];
- <a name="line490">490: </a> h = geo[1];
- <a name="line491">491: </a> <font color="#4169E1">if</font> (w == (unsigned int) win->w && h == (unsigned int) win->h) <font color="#4169E1">return</font>(0);
- <a name="line493">493: </a> <font color="#B22222">/* record new window sizes */</font>
- <a name="line495">495: </a> win->h = h; win->w = w;
- <a name="line497">497: </a> <font color="#B22222">/* Free buffer space and create new version (only first processor does this) */</font>
- <a name="line498">498: </a> <font color="#4169E1">if</font> (win->drw) {
- <a name="line499">499: </a> win->drw = XCreatePixmap(win->disp,win->win,win->w,win->h,win->depth);
- <a name="line500">500: </a> }
- <a name="line501">501: </a> <font color="#B22222">/* reset the clipping */</font>
- <a name="line502">502: </a> xl = draw->port_xl; yl = draw->port_yl;
- <a name="line503">503: </a> xr = draw->port_xr; yr = draw->port_yr;
- <a name="line504">504: </a> box.x = (int)(xl*win->w); box.y = (int)((1.0-yr)*win->h);
- <a name="line505">505: </a> box.width = (int)((xr-xl)*win->w);box.height = (int)((yr-yl)*win->h);
- <a name="line506">506: </a> XSetClipRectangles(win->disp,win->gc.set,0,0,&box,1,Unsorted);
- <a name="line508">508: </a> <font color="#B22222">/* try to make sure it is actually done before passing info to all */</font>
- <a name="line509">509: </a> XSync(win->disp,False);
- <a name="line510">510: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&win->drw,1,MPI_UNSIGNED_LONG,0,((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm);
- <a name="line511">511: </a> <font color="#4169E1">return</font>(0);
- <a name="line512">512: </a>}
- <a name="line514">514: </a><strong><font color="#4169E1">static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>*)</font></strong>;
- <a name="line515">515: </a><strong><font color="#4169E1">static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawRestoreSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>*)</font></strong>;
- <a name="line519">519: </a><strong><font color="#4169E1"><a name="PetscDrawDestroy_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawDestroy_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line520">520: </a>{
- <a name="line521">521: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line523">523: </a><font color="#A020F0">#if defined(PETSC_HAVE_POPEN)</font>
- <a name="line524">524: </a> char command[PETSC_MAX_PATH_LEN];
- <a name="line525">525: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> rank;
- <a name="line526">526: </a> FILE *fd;
- <a name="line527">527: </a><font color="#A020F0">#endif</font>
- <a name="line530">530: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawSynchronizedClear.html#PetscDrawSynchronizedClear">PetscDrawSynchronizedClear</A>(draw);
- <a name="line532">532: </a><font color="#A020F0">#if defined(PETSC_HAVE_POPEN)</font>
- <a name="line533">533: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,&rank);
- <a name="line534">534: </a> <font color="#4169E1">if</font> (draw->savefilename && !rank && draw->savefilemovie) {
- <a name="line535">535: </a> <A href="../../../../../docs/manualpages/Sys/PetscSNPrintf.html#PetscSNPrintf">PetscSNPrintf</A>(command,PETSC_MAX_PATH_LEN,<font color="#666666">"ffmpeg -i %s_%%d.Gif %s.m4v"</font>,draw->savefilename,draw->savefilename);
- <a name="line536">536: </a> <A href="../../../../../docs/manualpages/Sys/PetscPOpen.html#PetscPOpen">PetscPOpen</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,<A href="../../../../../docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A>,command,<font color="#666666">"r"</font>,&fd);
- <a name="line537">537: </a> <A href="../../../../../docs/manualpages/Sys/PetscPClose.html#PetscPClose">PetscPClose</A>(((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)draw)->comm,fd);
- <a name="line538">538: </a> }
- <a name="line539">539: </a><font color="#A020F0">#endif</font>
- <a name="line541">541: </a> XFreeGC(win->disp,win->gc.set);
- <a name="line542">542: </a> XCloseDisplay(win->disp);
- <a name="line543">543: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawDestroy.html#PetscDrawDestroy">PetscDrawDestroy</A>(&draw->popup);
- <a name="line544">544: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(win->font);
- <a name="line545">545: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(win);
- <a name="line546">546: </a> <font color="#4169E1">return</font>(0);
- <a name="line547">547: </a>}
- <a name="line549">549: </a><strong><font color="#4169E1"><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSave_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>)</font></strong>;
- <a name="line550">550: </a><strong><font color="#4169E1"><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetSave_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>,const char*)</font></strong>;
- <a name="line552">552: </a>static <font color="#4169E1">struct _PetscDrawOps</font> DvOps = { PetscDrawSetDoubleBuffer_X,
- <a name="line553">553: </a> PetscDrawFlush_X,PetscDrawLine_X,
- <a name="line554">554: </a> 0,
- <a name="line555">555: </a> 0,
- <a name="line556">556: </a> PetscDrawPoint_X,
- <a name="line557">557: </a> 0,
- <a name="line558">558: </a> PetscDrawString_X,
- <a name="line559">559: </a> PetscDrawStringVertical_X,
- <a name="line560">560: </a> PetscDrawStringSetSize_X,
- <a name="line561">561: </a> PetscDrawStringGetSize_X,
- <a name="line562">562: </a> PetscDrawSetViewport_X,
- <a name="line563">563: </a> PetscDrawClear_X,
- <a name="line564">564: </a> PetscDrawSynchronizedFlush_X,
- <a name="line565">565: </a> PetscDrawRectangle_X,
- <a name="line566">566: </a> PetscDrawTriangle_X,
- <a name="line567">567: </a> PetscDrawEllipse_X,
- <a name="line568">568: </a> PetscDrawGetMouseButton_X,
- <a name="line569">569: </a> PetscDrawPause_X,
- <a name="line570">570: </a> PetscDrawSynchronizedClear_X,
- <a name="line571">571: </a> 0,
- <a name="line572">572: </a> 0,
- <a name="line573">573: </a> PetscDrawGetPopup_X,
- <a name="line574">574: </a> PetscDrawSetTitle_X,
- <a name="line575">575: </a> PetscDrawCheckResizedWindow_X,
- <a name="line576">576: </a> PetscDrawResizeWindow_X,
- <a name="line577">577: </a> PetscDrawDestroy_X,
- <a name="line578">578: </a> 0,
- <a name="line579">579: </a> PetscDrawGetSingleton_X,
- <a name="line580">580: </a> PetscDrawRestoreSingleton_X,
- <a name="line581">581: </a><font color="#A020F0">#if defined(PETSC_HAVE_AFTERIMAGE)</font>
- <a name="line582">582: </a> PetscDrawSave_X,
- <a name="line583">583: </a><font color="#A020F0">#else</font>
- <a name="line584">584: </a> 0,
- <a name="line585">585: </a><font color="#A020F0">#endif</font>
- <a name="line586">586: </a> PetscDrawSetSave_X,
- <a name="line587">587: </a> 0,
- <a name="line588">588: </a> PetscDrawArrow_X};
- <a name="line591">591: </a><strong><font colo