114
116
integer closeflag=0,n=2,vx[2],vy[2],i,j;
116
118
integer verbose=0,narg,xz[10];
117
/* Recording command */
118
if (GetDriver()=='R') StoreGrid("xgrid",style);
119
/* changes dash style if necessary */
120
C2F(dr)("xget","color",&verbose,xz,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
121
C2F(dr)("xset","color",style,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
122
/** Get current scale **/
123
pas = ((double) Cscale.WIRect1[2]) / ((double) Cscale.Waaint1[1]);
124
/** x-axis grid (i.e vertical lines ) */
125
for ( i=0 ; i < Cscale.Waaint1[1]; i++)
119
if (version_flag() == 0)
121
sciPointObj *psubwin;
122
psubwin = sciGetSelectedSubWin (sciGetCurrentFigure ());
123
for (i=0 ; i<3 ; i++) /**DJ.Abdmouche 2003**/
124
pSUBWIN_FEATURE (psubwin)->grid[i] = *style;
129
{ /* Recording command */
130
if (GetDriver()=='R') StoreGrid("xgrid",style);
132
/* changes dash style if necessary */
133
C2F(dr)("xget","color",&verbose,xz,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
134
C2F(dr)("xset","color",style,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
135
/** Get current scale **/
136
pas = ((double) Cscale.WIRect1[2]) / ((double) Cscale.Waaint1[1]);
137
/** x-axis grid (i.e vertical lines ) */
138
for ( i=0 ; i < Cscale.Waaint1[1]; i++)
127
140
vy[0]=Cscale.WIRect1[1];
128
141
vy[1]=Cscale.WIRect1[1]+Cscale.WIRect1[3];
129
142
vx[0]=vx[1]= Cscale.WIRect1[0] + inint( ((double) i)*pas);
138
151
C2F(dr)("xlines","void",&n, vx, vy,&closeflag,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
142
/** y-axis grid (i.e horizontal lines ) **/
143
pas = ((double) Cscale.WIRect1[3]) / ((double) Cscale.Waaint1[3]);
144
for ( i=0 ; i < Cscale.Waaint1[3]; i++)
146
vx[0]=Cscale.WIRect1[0];
155
/** y-axis grid (i.e horizontal lines ) **/
156
pas = ((double) Cscale.WIRect1[3]) / ((double) Cscale.Waaint1[3]);
157
for ( i=0 ; i < Cscale.Waaint1[3]; i++)
159
vx[0]=Cscale.WIRect1[0];
147
160
vx[1]=Cscale.WIRect1[0]+Cscale.WIRect1[2];
148
161
vy[0]=vy[1]= Cscale.WIRect1[1] + inint( ((double) i)*pas);
149
162
if (i!=0) C2F(dr)("xlines","void",&n, vx, vy,&closeflag,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
154
167
for (j= jinit; j < 10 ; j++)
156
169
vy[0]=vy[1]= Cscale.WIRect1[1] + inint( ((double) i+1)*pas)- inint(log10(((double)j))*pas);
157
C2F(dr)("xlines","void",&n, vx, vy,&closeflag,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
170
C2F(dr)("xlines","void",&n, vx, vy,&closeflag,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
174
C2F(dr)("xset","color",xz,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
161
C2F(dr)("xset","color",xz,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
198
217
if ( (int)strlen(xf) < 1) c='g' ; else c=xf[0];
201
case 'e' : xmin= 1.0 ; xmax = (*n2);break;
202
case 'o' : xmax= Maxi(x,(*n2)); xmin= Mini(x,(*n2)); break;
204
default: xmax= Maxi(x, size_x); xmin= Mini(x, size_x); break;
220
case 'e' : xmin= 1.0 ; xmax = (*n2);break; /* F.Leray obsolete ??*/
221
case 'o' : xmax= Maxi(x,(*n2)); xmin= Mini(x,(*n2)); break; /* F.Leray obsolete ??*/
222
case 'g' : /* F.Leray obsolete ??*/
223
/* F.Leray : look for the min/max inside the x/y vector of size size_x/size-y*/
224
default: xmax= Maxi(x, size_x); xmin= Mini(x, size_x); break; /* for x*/
206
ymin= Mini(y, size_y); ymax= Maxi(y,size_y);
226
ymin= Mini(y, size_y); ymax= Maxi(y,size_y); /* for y*/
207
227
/* back to default values for x=[] and y = [] */
208
228
if ( ymin == LARGEST_REAL ) { ymin = 0; ymax = 10.0 ;}
209
229
if ( xmin == LARGEST_REAL ) { xmin = 0; xmax = 10.0 ;}
234
/* BLOCK that moved is HERE F.Leray 20.04.04 */
235
/* FRect gives the plotting boundaries xmin,ymin,xmax,ymax */
236
if (version_flag() == 0)
237
{/*update A.Djalel for new graphics auto scaling*/
238
subwindowtmp = sciGetSelectedSubWin(sciGetCurrentFigure()); /**DJ.Abdmouche 2003**/
241
if ((pSUBWIN_FEATURE (subwindowtmp)->axes.limits[1] !=0 ) || (pSUBWIN_FEATURE (subwindowtmp)->axes.limits[3] !=0 ))
243
xmin=(double) Min(pSUBWIN_FEATURE (subwindowtmp)->axes.limits[1],xmin);
244
xmax=(double) Max(pSUBWIN_FEATURE (subwindowtmp)->axes.limits[3],xmax);
246
pSUBWIN_FEATURE (subwindowtmp)->axes.limits[1]=xmin;
247
pSUBWIN_FEATURE (subwindowtmp)->axes.limits[3]=xmax;
249
if ((pSUBWIN_FEATURE (subwindowtmp)->axes.limits[2] !=0 ) || (pSUBWIN_FEATURE (subwindowtmp)->axes.limits[4] !=0 ))
251
ymin=(double) Min(pSUBWIN_FEATURE (subwindowtmp)->axes.limits[2],ymin);
252
ymax=(double) Max(pSUBWIN_FEATURE (subwindowtmp)->axes.limits[4],ymax);
254
pSUBWIN_FEATURE (subwindowtmp)->axes.limits[2]=ymin;
255
pSUBWIN_FEATURE (subwindowtmp)->axes.limits[4]=ymax;
214
261
* modify computed min,max if isoview requested
217
264
if ( strflag[1] == '3' || strflag[1] == '4')
219
266
/* code added by S. Mottelet 11/7/2000 */
220
double FRect[4],WRect[4],ARect[4];
267
double FFRect[4],WRect[4],ARect[4];
268
/*char logscale[4]; */ /* F.Leray 24.03.04 */
222
270
/* end of added code by S. Mottelet 11/7/2000 */
224
int verbose=0,wdim[2],narg;
272
int verbose=0,wdim[2],narg; /* verbose set to 1 F.Leray 05.04.04 AND reset to 0 07.04.04*/
225
273
C2F(dr)("xget","wdim",&verbose,wdim,&narg, PI0, PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
229
277
/* code added by S. Mottelet 11/7/2000 */
230
getscale2d(WRect,FRect,logscale,ARect);
278
getscale2d(WRect,FFRect,logscale,ARect);
232
280
wdim[0]=linint((double)wdim[0] * WRect[2]);
233
281
wdim[1]=linint((double)wdim[1] * WRect[3]);
234
282
/* end of added code by S. Mottelet 11/7/2000 */
236
286
if ( hx/(double)wdim[0] <hy/(double) wdim[1] )
238
288
hx1=wdim[0]*hy/wdim[1];
299
349
Scistring("Warning: you cannot use automatic rescale if you switch from log to normal or normal to log \n");
303
FRect[0] = Min(FRect[0],Cscale.frect[0]);
304
FRect[1] = Min(FRect[1],Cscale.frect[1]);
305
FRect[2] = Max(FRect[2],Cscale.frect[2]);
306
FRect[3] = Max(FRect[3],Cscale.frect[3]);
353
if (version_flag() != 0){
354
FRect[0] = Min(FRect[0],Cscale.frect[0]);
355
FRect[1] = Min(FRect[1],Cscale.frect[1]);
356
FRect[2] = Max(FRect[2],Cscale.frect[2]);
357
FRect[3] = Max(FRect[3],Cscale.frect[3]);
360
subwindowtmp = sciGetSelectedSubWin(sciGetCurrentFigure()); /* rajout F.Leray*/
361
FRect[0] = Min(FRect[0],pSUBWIN_FEATURE (subwindowtmp)->FRect[0]);
362
FRect[1] = Min(FRect[1],pSUBWIN_FEATURE (subwindowtmp)->FRect[1]);
363
FRect[2] = Max(FRect[2],pSUBWIN_FEATURE (subwindowtmp)->FRect[2]);
364
FRect[3] = Max(FRect[3],pSUBWIN_FEATURE (subwindowtmp)->FRect[3]);
307
366
if ( FRect[0] < Cscale.frect[0]
308
367
|| FRect[1] < Cscale.frect[1]
309
368
|| FRect[2] > Cscale.frect[2]
310
369
|| FRect[3] > Cscale.frect[3] )
371
/* F.Leray 15.04.04 */
372
/* Here the redraw and the computed FRect will be used below */
373
/* in Tape_ReplayNewScale1(" ",&ww,flag,PI0,aaint,PI0,PI0,FRect,PD0,PD0,PD0);*/
374
/* in this case (if (strflag[1] == '7' || strflag[1] == '8' )), */
375
/* we also recomput FRect */
314
378
/* and we force flag back to 5 */
324
388
case '6' : strflag[1]='5';break;
328
if ( (int)strlen(strflag) >=2 && ( strflag[1]=='5' || strflag[1]=='6' ))
391
if ( (int)strlen(strflag) >=2 && ( strflag[1]=='5' || strflag[1]=='6' ))
330
393
/* recherche automatique des bornes et graduations */
331
Gr_Rescale(&xf[1],FRect,Xdec,Ydec,&(aaint[0]),&(aaint[2]));
332
Gr_Rescale(&xf[1],FRect,Xdec,Ydec,&(aaint[0]),&(aaint[2]));
394
Gr_Rescale(&xf[1],FRect,Xdec,Ydec,&(aaint[0]),&(aaint[2])); /* F.Leray 15.04.04 Here we change the value of FRect */
397
Xdec[0]=inint(FRect[0]);Xdec[1]=inint(FRect[2]);Xdec[2]=0;
398
Ydec[0]=inint(FRect[1]);Ydec[1]=inint(FRect[3]);Ydec[2]=0;
335
401
/* Update the current scale */
402
set_scale("tftttf",NULL,FRect,aaint,xf+1,NULL);
404
if (version_flag() == 0){
405
subwindowtmp = sciGetSelectedSubWin(sciGetCurrentFigure());
406
if (!(sciGetZooming(subwindowtmp))){
407
pSUBWIN_FEATURE (subwindowtmp)->FRect[0] = FRect[0];
408
pSUBWIN_FEATURE (subwindowtmp)->FRect[1] = FRect[1];
409
pSUBWIN_FEATURE (subwindowtmp)->FRect[2] = FRect[2];
410
pSUBWIN_FEATURE (subwindowtmp)->FRect[3] = FRect[3];}
412
pSUBWIN_FEATURE (subwindowtmp)->FRect_kp[0] = FRect[0];
413
pSUBWIN_FEATURE (subwindowtmp)->FRect_kp[1] = FRect[1];
414
pSUBWIN_FEATURE (subwindowtmp)->FRect_kp[2] = FRect[2];
415
pSUBWIN_FEATURE (subwindowtmp)->FRect_kp[3] = FRect[3];}
337
set_scale("tftttf",NULL,FRect,aaint,xf+1,NULL);
339
420
/* Should be added to set_scale */
341
422
for (i=0; i < 3 ; i++ ) Cscale.xtics[i] = Xdec[i];
342
423
for (i=0; i < 3 ; i++ ) Cscale.ytics[i] = Ydec[i];
343
424
Cscale.xtics[3] = aaint[1];
344
Cscale.ytics[3] = aaint[3];
346
/* Changing back min,max and aaint if using log scaling X axis */
425
Cscale.ytics[3] = aaint[3];
427
if (version_flag() == 0){
428
subwindowtmp = sciGetSelectedSubWin(sciGetCurrentFigure());
429
for (i=0 ; i<4 ; i++)
431
pSUBWIN_FEATURE (subwindowtmp)->axes.xlim[i]=Cscale.xtics[i];
432
pSUBWIN_FEATURE (subwindowtmp)->axes.ylim[i]=Cscale.ytics[i];
436
/* Changing back min,max and aaint if using log scaling X axis */ /* F.Leray 15.04.04 WHY NOT MAKE set_scale after this change ??? */
347
437
if ((int)strlen(xf) >= 2 && xf[1]=='l' && (int)strlen(strflag) >= 2 && strflag[1] != '0')
349
439
FRect[0]=exp10(xmin);FRect[2]=exp10(xmax);
361
453
/* Redraw previous graphics with new Scale */
362
454
integer ww,verbose=0,narg;
363
455
GetDriver1(driver,PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0);
364
if (strcmp("Rec",driver) != 0)
366
Scistring("Auto rescale only works with the rec driver\n" );
369
C2F(dr1)("xget","window",&verbose,&ww,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
370
C2F(SetDriver)("X11",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0);
371
C2F(dr1)("xclear","v",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
372
Tape_ReplayNewScale1(" ",&ww,flag,PI0,aaint,PI0,PI0,FRect,PD0,PD0,PD0);
457
if (version_flag() != 0) /* F.Leray*/
459
if (strcmp("Rec",driver) != 0)
461
Scistring("Auto rescale only works with the rec driver\n" );
464
C2F(dr1)("xget","window",&verbose,&ww,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
465
C2F(SetDriver)("X11",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0);
466
C2F(dr1)("xclear","v",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
467
Tape_ReplayNewScale1(" ",&ww,flag,PI0,aaint,PI0,PI0,FRect,PD0,PD0,PD0);
471
sciDrawObj(subwindowtmp);
373
474
C2F(SetDriver)(driver,PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0);