00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <string.h>
00023 #include <math.h>
00024 #include <stdlib.h>
00025 #include <stdarg.h>
00026 #include <time.h>
00027
00028 #include "SetProperty.h"
00029 #include "GetProperty.h"
00030 #include "InitObjects.h"
00031 #include "bcg.h"
00032 #include "DrawObjects.h"
00033 #include "BuildObjects.h"
00034 #include "Xcall1.h"
00035 #include "math_graphics.h"
00036 #include "sciprint.h"
00037 #include "../../gui/includes/GraphicWindow.h"
00038 #include "CurrentObjectsManagement.h"
00039 #include "ObjectSelection.h"
00040
00041 #include "MALLOC.h"
00042
00043
00044
00045
00046
00047
00048 int setSubWinAngles( sciPointObj *psubwin, double theta, double alpha )
00049 {
00051 sciSubWindow * ppSubWin = pSUBWIN_FEATURE (psubwin) ;
00052
00053 ppSubWin->alpha = alpha ;
00054 ppSubWin->theta = theta ;
00055
00056 if ((alpha == 0.0) && (theta == 270.0))
00057 {
00058 ppSubWin->is3d = FALSE ;
00059 ppSubWin->project[2]= 0;
00060 return 0;
00061 }
00062
00063 ppSubWin->is3d = TRUE ;
00064 if ((alpha == 0.0 ) || (alpha == 180.0 ) || (alpha == -180.0 ))
00065 {
00066 ppSubWin->project[2]= 0;
00067 }
00068 else
00069 {
00070 ppSubWin->project[2]= 1;
00071 if ( ((alpha == 90.0 ) || (alpha == 270.0 ) || (alpha == -90.0 ) || (alpha == -270.0 ))
00072 && ((theta == 90.0 ) || (theta == -90.0 ) || (theta == 270.0 ) || (theta == -270.0 )))
00073 {
00074 ppSubWin->project[1]= 0;
00075 }
00076 else
00077 {
00078 ppSubWin->project[1]= 1;
00079 if ( ( (alpha == 90.0 ) || (alpha == 270.0 ) || (alpha == -90.0 ) || (alpha == -270.0 ))
00080 && ( (theta == 0.0 ) || (theta == 180.0 ) || (alpha == -180.0 ) ))
00081 {
00082 ppSubWin->project[0]= 0;
00083 }
00084 else
00085 {
00086 ppSubWin->project[0]= 1;
00087 }
00088 }
00089 }
00090 return 0 ;
00091 }
00092
00093
00094
00095
00096
00097
00098 void Obj_RedrawNewAngle( sciPointObj * pSubWin, double theta, double alpha )
00099 {
00100
00101 sciPointObj * pParentFigure = sciGetParentFigure( pSubWin ) ;
00102 if ( pFIGURE_FEATURE(pParentFigure)->rotstyle == 1 )
00103 {
00104
00105 sciSons * subWins = sciGetSons( pParentFigure ) ;
00106
00107
00108 while ( subWins != NULL )
00109 {
00110 sciPointObj * curSubWin = subWins->pointobj ;
00111 if ( curSubWin->entitytype == SCI_SUBWIN )
00112 {
00113 setSubWinAngles( curSubWin, theta, alpha ) ;
00114 }
00115 subWins = subWins->pnext ;
00116 }
00117 }
00118 else
00119 {
00120
00121 setSubWinAngles( pSubWin, theta, alpha ) ;
00122 }
00123 }
00124
00125
00126
00127
00128
00132 int
00133 sciSetEntityType (sciPointObj * pobj, sciEntityType value)
00134 {
00135 if (pobj != (sciPointObj *) NULL)
00136 {
00137 pobj->entitytype = value ;
00138 return 0 ;
00139 }
00140 else
00141 {
00142 return -1 ;
00143 }
00144 }
00145
00146
00147
00153 int
00154 sciSetColormap ( sciPointObj * pobj, double *rgbmat, integer m, integer n )
00155 {
00156 int k,old_m,m1;
00157 int curWinIndex = sciGetNum( sciGetCurrentFigure() ) ;
00158 double * cmap = NULL ;
00159 int notSucceed = 0 ;
00160 sciFigure * pFigure = NULL ;
00161
00162 if(n != 3)
00163 {
00164 sciprint("colormap : number of colums must be 3\n");
00165 return -1 ;
00166 }
00167
00168 if(SCI_FIGURE != sciGetEntityType(pobj))
00169 {
00170 sciprint("sciSetColormap Error: Object must be a SCI_FIGURE\n");
00171 return -1 ;
00172 }
00173
00174 pFigure = pFIGURE_FEATURE( pobj ) ;
00175
00176 old_m = sciGetNumColors(pobj);
00177 m1 = m ;
00178 if ( pobj != getFigureModel() )
00179 {
00180 int verbose = 0 ;
00181 sciSetUsedWindow( sciGetNum( pobj ) ) ;
00182
00183
00184 C2F(dr)("xset","colormap",&m,&n,¬Succeed,PI0,PI0,PI0,rgbmat,PD0,PD0,PD0,0L,0L);
00185 C2F(dr)("xget","cmap_size", &verbose, &m1, PI0, PI0, PI0, PI0, PD0, PD0, PD0, PD0, 0L, 0L ) ;
00186 sciSetNumColors( pobj, m1 ) ;
00187 sciSetUsedWindow( curWinIndex ) ;
00188 }
00189
00190 if ( notSucceed == 1 )
00191 {
00192
00193 sciprint ("Failed to change colormap : Allocation failed or missing xinit detected\n");
00194 return -1;
00195 }
00196
00197 if ( m1 != old_m )
00198 {
00199
00200 if ( ( cmap = MALLOC ( m * n * sizeof(double) ) ) == NULL )
00201 {
00202
00203 if (pobj != getFigureModel())
00204 {
00205 sciSetUsedWindow( sciGetNum( pobj ) ) ;
00206 C2F(dr)("xset","colormap",&old_m,&n,¬Succeed,PI0,PI0,PI0,
00207 pFigure->pcolormap,PD0,PD0,PD0,0L,0L);
00208
00209 if ( notSucceed == 1 )
00210 {
00211
00212 sciprint ("Failed to change colormap : Allocation failed or missing xinit detected\n");
00213 return -1;
00214 }
00215 sciSetUsedWindow( curWinIndex ) ;
00216 }
00217 sciprint ("Not enough memory available for colormap, previous one kept\n");
00218 return -1;
00219 }
00220 if (pFigure->pcolormap) FREE( pFigure->pcolormap ) ;
00221 pFigure->pcolormap = cmap ;
00222 }
00223 for ( k = 0 ; k < m1 * n ; k++ )
00224 {
00225 pFigure->pcolormap[k] = rgbmat[k];
00226 }
00227 pFigure->numcolors = m1 ;
00228
00229 if ( pobj != getFigureModel() )
00230 {
00231 sciRecursiveUpdateBaW( pobj, old_m, m ) ;
00232 }
00233
00234 return 0;
00235 }
00236
00237
00238 void sciRecursiveUpdateBaW(sciPointObj *pobj, int old_m, int m)
00239 {
00240 sciSons *psonstmp;
00241
00242 sciSetNumColors (pobj,old_m);
00243
00244
00245 if((sciGetEntityType(pobj) != SCI_TEXT) &&
00246 (sciGetEntityType(pobj) != SCI_TITLE) &&
00247 (sciGetEntityType(pobj) != SCI_LEGEND) &&
00248 (sciGetEntityType(pobj) != SCI_AXES) &&
00249 (sciGetEntityType(pobj) != SCI_MENU) &&
00250 (sciGetEntityType(pobj) != SCI_MENUCONTEXT) &&
00251 (sciGetEntityType(pobj) != SCI_STATUSB) &&
00252 (sciGetEntityType(pobj) != SCI_LABEL) &&
00253 (sciGetEntityType(pobj) != SCI_UIMENU) )
00254 {
00255 if(old_m +1 == sciGetForeground(pobj)) {
00256 sciSetNumColors (pobj,m);
00257 sciUpdateBaW (pobj,0,-1);
00258 sciSetNumColors (pobj,old_m);
00259 }
00260 else if(old_m +2 == sciGetForeground(pobj)) {
00261 sciSetNumColors (pobj,m);
00262 sciUpdateBaW (pobj,0,-2);
00263 sciSetNumColors (pobj,old_m);
00264 }
00265 if(old_m +1 == sciGetBackground(pobj)) {
00266 sciSetNumColors (pobj,m);
00267 sciUpdateBaW (pobj,1,-1);
00268 sciSetNumColors (pobj,old_m);
00269 }
00270 else if(old_m +2 == sciGetBackground(pobj)) {
00271 sciSetNumColors (pobj,m);
00272 sciUpdateBaW (pobj,1,-2);
00273 sciSetNumColors (pobj,old_m);
00274 }
00275 }
00276
00277 if((sciGetEntityType(pobj) == SCI_TEXT) ||
00278 (sciGetEntityType(pobj) == SCI_TITLE) ||
00279 (sciGetEntityType(pobj) == SCI_LEGEND) ||
00280 (sciGetEntityType(pobj) == SCI_AXES) ||
00281 (sciGetEntityType(pobj) == SCI_MENU) ||
00282 (sciGetEntityType(pobj) == SCI_MENUCONTEXT) ||
00283 (sciGetEntityType(pobj) == SCI_STATUSB) ||
00284 (sciGetEntityType(pobj) == SCI_SUBWIN) ||
00285 (sciGetEntityType(pobj) == SCI_FIGURE) ||
00286 (sciGetEntityType(pobj) == SCI_LABEL))
00287 {
00288 if(old_m +1 == sciGetFontForeground(pobj)) {
00289
00290 sciSetNumColors (pobj,m);
00291 sciUpdateBaW (pobj,2,-1);
00292 sciSetNumColors (pobj,old_m);
00293 }
00294 else if(old_m +2 == sciGetFontForeground(pobj)) {
00295 sciSetNumColors (pobj,m);
00296 sciUpdateBaW (pobj,2,-2);
00297 sciSetNumColors (pobj,old_m);
00298 }
00299
00300 if(old_m +1 == sciGetFontBackground(pobj)) {
00301 sciSetNumColors (pobj,m);
00302 sciUpdateBaW (pobj,3,-1);
00303 sciSetNumColors (pobj,old_m);
00304 }
00305 else if(old_m +2 == sciGetFontBackground(pobj)) {
00306 sciSetNumColors (pobj,m);
00307 sciUpdateBaW (pobj,3,-2);
00308 sciSetNumColors (pobj,old_m);
00309 }
00310 }
00311
00312
00313
00314 if((sciGetEntityType(pobj) == SCI_FIGURE) ||
00315 (sciGetEntityType(pobj) == SCI_SUBWIN) ||
00316 (sciGetEntityType(pobj) == SCI_LEGEND) ||
00317 (sciGetEntityType(pobj) == SCI_ARC) ||
00318 (sciGetEntityType(pobj) == SCI_POLYLINE) ||
00319 (sciGetEntityType(pobj) == SCI_RECTANGLE) ||
00320 (sciGetEntityType(pobj) == SCI_SURFACE) ||
00321 (sciGetEntityType(pobj) == SCI_AXES) ||
00322 (sciGetEntityType(pobj) == SCI_SEGS))
00323 {
00324 if(old_m +1 == sciGetMarkForeground(pobj)) {
00325 sciSetNumColors (pobj,m);
00326 sciUpdateBaW (pobj,4,-1);
00327 sciSetNumColors (pobj,old_m);
00328 }
00329 else if(old_m +2 == sciGetMarkForeground(pobj)) {
00330 sciSetNumColors (pobj,m);
00331 sciUpdateBaW (pobj,4,-2);
00332 sciSetNumColors (pobj,old_m);
00333 }
00334 if(old_m +1 == sciGetMarkBackground(pobj)) {
00335 sciSetNumColors (pobj,m);
00336 sciUpdateBaW (pobj,5,-1);
00337 sciSetNumColors (pobj,old_m);
00338 }
00339 else if(old_m +2 == sciGetMarkBackground(pobj)) {
00340 sciSetNumColors (pobj,m);
00341 sciUpdateBaW (pobj,5,-2);
00342 sciSetNumColors (pobj,old_m);
00343 }
00344 }
00345
00346 sciSetNumColors (pobj,m);
00347
00348 psonstmp = sciGetLastSons (pobj);
00349 while (psonstmp != (sciSons *) NULL)
00350 {
00351 sciRecursiveUpdateBaW(psonstmp->pointobj, old_m, m);
00352 psonstmp = psonstmp->pprev;
00353 }
00354 }
00355
00356
00357 int
00358 sciUpdateBaW (sciPointObj * pobj, int flag, int value)
00359 {
00360 switch (flag)
00361 {
00362 case 0:
00363 switch (sciGetEntityType (pobj))
00364 {
00365 case SCI_POLYLINE:
00366 case SCI_FIGURE:
00367 case SCI_SUBWIN:
00368 case SCI_ARC:
00369 case SCI_SEGS:
00370 case SCI_FEC:
00371 case SCI_GRAYPLOT:
00372 case SCI_RECTANGLE:
00373 case SCI_SURFACE:
00374 case SCI_LIGHT:
00375 case SCI_AXES:
00376 case SCI_MENU:
00377 case SCI_MENUCONTEXT:
00378 case SCI_STATUSB:
00379 case SCI_LABEL:
00380 case SCI_TEXT:
00381 sciSetForeground(pobj,value);
00382 break;
00383 case SCI_UIMENU:
00384 case SCI_AGREG:
00385 case SCI_TITLE:
00386 case SCI_LEGEND:
00387 case SCI_PANNER:
00388 case SCI_SBH:
00389 case SCI_SBV:
00390 default:
00391 return -1;
00392 break;
00393 }
00394 break;
00395 case 1:
00396 switch (sciGetEntityType (pobj))
00397 {
00398 case SCI_FIGURE:
00399 case SCI_SUBWIN:
00400 case SCI_ARC:
00401 case SCI_SEGS:
00402 case SCI_FEC:
00403 case SCI_GRAYPLOT:
00404 case SCI_POLYLINE:
00405 case SCI_RECTANGLE:
00406 case SCI_SURFACE:
00407 case SCI_LIGHT:
00408 case SCI_AXES:
00409 case SCI_MENU:
00410 case SCI_MENUCONTEXT:
00411 case SCI_STATUSB:
00412 case SCI_LABEL:
00413 case SCI_TEXT:
00414 sciSetBackground(pobj,value);
00415 break;
00416 case SCI_UIMENU:
00417 case SCI_AGREG:
00418 case SCI_TITLE:
00419 case SCI_LEGEND:
00420 case SCI_PANNER:
00421 case SCI_SBH:
00422 case SCI_SBV:
00423 default:
00424 return -1;
00425 break;
00426 }
00427 break;
00428 case 2:
00429 switch (sciGetEntityType (pobj))
00430 {
00431 case SCI_AXES:
00432 case SCI_MENU:
00433 case SCI_MENUCONTEXT:
00434 case SCI_STATUSB:
00435 case SCI_TEXT:
00436 case SCI_TITLE:
00437 case SCI_LEGEND:
00438 case SCI_FIGURE:
00439 case SCI_SUBWIN:
00440 case SCI_LABEL:
00441 sciSetFontForeground(pobj,value);
00442 break;
00443 default:
00444 return -1;
00445 break;
00446 }
00447 break;
00448 case 3:
00449 switch (sciGetEntityType (pobj))
00450 {
00451 case SCI_AXES:
00452 case SCI_MENU:
00453 case SCI_MENUCONTEXT:
00454 case SCI_STATUSB:
00455 case SCI_TEXT:
00456 case SCI_TITLE:
00457 case SCI_LEGEND:
00458 case SCI_FIGURE:
00459 case SCI_SUBWIN:
00460 case SCI_LABEL:
00461 sciSetFontBackground(pobj,value);
00462 break;
00463 case SCI_UIMENU:
00464 default:
00465 return -1;
00466 break;
00467 }
00468 break;
00469 case 4:
00470 switch (sciGetEntityType (pobj))
00471 {
00472 case SCI_FIGURE:
00473 case SCI_SUBWIN:
00474 case SCI_LEGEND:
00475 case SCI_ARC:
00476 case SCI_POLYLINE:
00477 case SCI_RECTANGLE:
00478 case SCI_SURFACE:
00479 case SCI_AXES:
00480 case SCI_SEGS:
00481 sciSetMarkForeground(pobj,value);
00482 break;
00483 case SCI_UIMENU:
00484 default:
00485 return -1;
00486 break;
00487 }
00488 break;
00489 case 5:
00490 switch (sciGetEntityType (pobj))
00491 {
00492 case SCI_FIGURE:
00493 case SCI_SUBWIN:
00494 case SCI_LEGEND:
00495 case SCI_ARC:
00496 case SCI_POLYLINE:
00497 case SCI_RECTANGLE:
00498 case SCI_SURFACE:
00499 case SCI_AXES:
00500 case SCI_SEGS:
00501 sciSetMarkBackground(pobj,value);
00502 break;
00503 case SCI_UIMENU:
00504 default:
00505 return -1;
00506 break;
00507 }
00508 break;
00509
00510 default:
00511 return -1;
00512 break;
00513 }
00514
00515 return 0;
00516 }
00517
00518 int sciInitNumColors( sciPointObj * pobj, int numcolors)
00519 {
00520
00521
00522 switch (sciGetEntityType (pobj))
00523 {
00524 case SCI_FIGURE:
00525 if ( sciGetScilabXgc( pobj ) != NULL )
00526 {
00527 sciGetScilabXgc( pobj )->Numcolors = numcolors ;
00528 }
00529 pFIGURE_FEATURE(pobj)->numcolors = numcolors ;
00530 return 0 ;
00531 default:
00532 return sciSetNumColors( sciGetParentFigure( pobj ), numcolors ) ;
00533 }
00534 return -1 ;
00535 }
00536
00543 int
00544 sciSetNumColors (sciPointObj * pobj, int numcolors)
00545 {
00546 if ( sciGetNumColors( pobj ) == numcolors )
00547 {
00548
00549 return 1 ;
00550 }
00551 return sciInitNumColors( pobj, numcolors ) ;
00552
00553 }
00554
00555
00556
00557
00558
00559 int sciSetGoodIndex(sciPointObj * pobj, int colorindex)
00560 {
00561 int m = sciGetNumColors (pobj);
00562
00563 if( colorindex == -1 )
00564 return m + 1 ;
00565 else if( colorindex == -2 )
00566 return m + 2 ;
00567 else
00568 return colorindex;
00569 }
00570
00574 int sciInitMdlBackground( sciPointObj * pobj, int colorIndex )
00575 {
00576 int m = sciGetNumColors(pobj);
00577 int goodIndex ;
00578 if(colorIndex < -2 || colorIndex > m+2) return 0;
00579
00580 goodIndex = sciSetGoodIndex(pobj,colorIndex);
00581
00582
00583
00584 if (sciGetScilabXgc (pobj)->CurColorStatus == 1)
00585 {
00586
00587 sciGetScilabXgc (pobj)->NumBackground =
00588 Max (0, Min (goodIndex - 1, m + 1));
00589 C2F(dr)("xset","alufunction",&(sciGetScilabXgc (pobj)->CurDrawFunction),
00590 PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00591 }
00592 return sciInitBackground( pobj, colorIndex ) ;
00593 }
00594
00595 int sciInitBackground( sciPointObj * pobj, int colorindex )
00596 {
00597 int m = sciGetNumColors(pobj);
00598 if(colorindex < -2 || colorindex > m+2) return 0;
00599
00600 colorindex = sciSetGoodIndex(pobj,colorindex);
00601
00602 switch (sciGetEntityType (pobj))
00603 {
00604 case SCI_FIGURE:
00605 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00606 break;
00607 case SCI_SUBWIN:
00608 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00609 break;
00610 case SCI_TEXT:
00611 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00612 break;
00613 case SCI_TITLE:
00614 (sciGetFontContext (pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00615 break;
00616 case SCI_LEGEND:
00617 (sciGetFontContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00618 break;
00619 case SCI_ARC:
00620 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00621 break;
00622 case SCI_POLYLINE:
00623 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00624 break;
00625 case SCI_RECTANGLE:
00626 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00627 break;
00628 case SCI_SURFACE:
00629 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00630 break;
00631 case SCI_LIGHT:
00632 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00633 break;
00634 case SCI_AXES:
00635 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00636 break;
00637 case SCI_MENU:
00638 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00639 break;
00640 case SCI_MENUCONTEXT:
00641 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00642 break;
00643 case SCI_STATUSB:
00644 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00645 break;
00646 case SCI_LABEL:
00647 (sciGetGraphicContext(pobj))->backgroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00648 break;
00649 case SCI_SEGS:
00650 case SCI_FEC:
00651 case SCI_GRAYPLOT:
00652 case SCI_PANNER:
00653 case SCI_SBH:
00654 case SCI_SBV:
00655 case SCI_AGREG:
00656 case SCI_UIMENU:
00657 default:
00658 return -1 ;
00659 break;
00660 }
00661 return 0;
00662 }
00663
00667 int
00668 sciSetBackground (sciPointObj * pobj, int colorindex)
00669 {
00670 if ( sciGetBackground( pobj ) == colorindex )
00671 {
00672
00673 return 1 ;
00674 }
00675
00676 return sciInitBackground( pobj, colorindex ) ;
00677
00678 }
00679
00683 int sciInitMdlForeground( sciPointObj * pObj, int colorIndex )
00684 {
00685 int m = sciGetNumColors(pObj);
00686 int goodIndex ;
00687 if(colorIndex < -2 || colorIndex > m+2) return 0;
00688
00689 goodIndex = sciSetGoodIndex(pObj,colorIndex);
00690
00691 if (sciGetScilabXgc (pObj)->CurColorStatus == 1)
00692 {
00693 sciGetScilabXgc (pObj)->NumForeground =
00694 Max (0, Min (goodIndex - 1, m + 1));
00695 C2F(dr)("xset","alufunction",&(sciGetScilabXgc (pObj)->CurDrawFunction),
00696 PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,11L);
00697 }
00698 return sciInitForeground( pObj, colorIndex ) ;
00699 }
00700
00701 int sciInitForeground( sciPointObj * pobj, int colorindex )
00702 {
00703 int m = sciGetNumColors(pobj);
00704 if(colorindex < -2 || colorindex > m+2) return 0;
00705
00706 colorindex = sciSetGoodIndex(pobj,colorindex);
00707
00708 switch (sciGetEntityType (pobj))
00709 {
00710 case SCI_FIGURE:
00711 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00712 break;
00713 case SCI_SUBWIN:
00714 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00715 break;
00716 case SCI_TEXT:
00717 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00718 break;
00719 case SCI_TITLE:
00720 (sciGetFontContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00721 break;
00722 case SCI_LEGEND:
00723 (sciGetFontContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00724 break;
00725 case SCI_ARC:
00726 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00727 break;
00728 case SCI_POLYLINE:
00729 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00730 break;
00731 case SCI_RECTANGLE:
00732 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00733 break;
00734 case SCI_SURFACE:
00735 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00736 break;
00737 case SCI_LIGHT:
00738 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00739 break;
00740 case SCI_AXES:
00741 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00742 break;
00743 case SCI_MENU:
00744 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00745 break;
00746 case SCI_MENUCONTEXT:
00747 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00748 break;
00749 case SCI_STATUSB:
00750 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00751 break;
00752 case SCI_LABEL:
00753 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00754 break;
00755 case SCI_SEGS:
00756 (sciGetGraphicContext(pobj))->foregroundcolor = Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
00757 break;
00758 case SCI_FEC:
00759 case SCI_GRAYPLOT:
00760 case SCI_AGREG:
00761 case SCI_PANNER:
00762 case SCI_SBH:
00763 case SCI_SBV:
00764 case SCI_UIMENU:
00765 default:
00766 return -1 ;
00767 break;
00768 }
00769 return 0;
00770 }
00771
00775 int
00776 sciSetForeground (sciPointObj * pobj, int colorindex)
00777 {
00778 if ( sciGetForeground( pobj ) == colorindex )
00779 {
00780 return 1 ;
00781 }
00782 return sciInitForeground( pobj, colorindex ) ;
00783
00784 }
00785
00786 int sciSetLineWidth( sciPointObj * pobj, int linewidth )
00787 {
00788 if ( sciGetLineWidth( pobj ) == linewidth )
00789 {
00790
00791 return 1 ;
00792 }
00793 return sciInitLineWidth( pobj, linewidth ) ;
00794 }
00795
00796
00800 int
00801 sciInitLineWidth (sciPointObj * pobj, int linewidth)
00802 {
00803
00804 if (linewidth < 0)
00805 {
00806 sciprint ("the line width must be greater than 0\n");
00807 return -1;
00808 }
00809 else
00810 {
00811 switch (sciGetEntityType (pobj))
00812 {
00813 case SCI_FIGURE:
00814 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00815 return 0;
00816 break;
00817 case SCI_SUBWIN:
00818 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00819
00820 return 0;
00821 break;
00822 case SCI_ARC:
00823 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00824 return 0;
00825 break;
00826 case SCI_POLYLINE:
00827 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00828 return 0;
00829 break;
00830 case SCI_RECTANGLE:
00831 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00832 return 0;
00833 break;
00834 case SCI_SURFACE:
00835 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00836 return 0;
00837 break;
00838 case SCI_LIGHT:
00839 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00840 return 0;
00841 break;
00842 case SCI_AXES:
00843 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00844 return 0;
00845 break;
00846 case SCI_MENU:
00847 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00848 return 0;
00849 break;
00850 case SCI_MENUCONTEXT:
00851 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00852 return 0;
00853 break;
00854 case SCI_STATUSB:
00855 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00856 break;
00857 case SCI_SEGS:
00858 (sciGetGraphicContext(pobj))->linewidth = linewidth;
00859 break;
00860 case SCI_AGREG:
00861 case SCI_FEC:
00862 case SCI_GRAYPLOT:
00863 case SCI_PANNER:
00864 case SCI_SBH:
00865 case SCI_SBV:
00866 case SCI_TEXT:
00867 case SCI_TITLE:
00868 case SCI_LEGEND:
00869 case SCI_LABEL:
00870 case SCI_UIMENU:
00871 default:
00872
00873 sciprint ("This object has no line width \n");
00874 return -1;
00875 break;
00876 }
00877 }
00878 return 0;
00879 }
00880
00881
00882 int sciSetLineStyle( sciPointObj * pobj, int linestyle )
00883 {
00884 if ( sciGetLineStyle( pobj ) == linestyle )
00885 {
00886
00887 return 1 ;
00888 }
00889 return sciInitLineStyle( pobj, linestyle ) ;
00890 }
00891
00895 int
00896 sciInitLineStyle (sciPointObj * pobj, int linestyle)
00897 {
00898
00899 if (linestyle < 0)
00900 {
00901 sciprint ("the line style must be greater than 0\n");
00902 return -1;
00903 }
00904 else
00905 {
00906 switch (sciGetEntityType (pobj))
00907 {
00908 case SCI_FIGURE:
00909 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00910 return 0;
00911 break;
00912 case SCI_SUBWIN:
00913 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00914 return 0;
00915 break;
00916 case SCI_ARC:
00917 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00918 return 0;
00919 break;
00920 case SCI_POLYLINE:
00921 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00922 return 0;
00923 break;
00924 case SCI_RECTANGLE:
00925 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00926 return 0;
00927 break;
00928 case SCI_SURFACE:
00929 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00930 return 0;
00931 break;
00932 case SCI_LIGHT:
00933 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00934 return 0;
00935 break;
00936 case SCI_AXES:
00937 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00938 return 0;
00939 break;
00940 case SCI_MENU:
00941 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00942 return 0;
00943 break;
00944 case SCI_MENUCONTEXT:
00945 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00946 return 0;
00947 break;
00948 case SCI_STATUSB:
00949 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00950 break;
00951 case SCI_SEGS:
00952 (sciGetGraphicContext(pobj))->linestyle = linestyle;
00953 break;
00954 case SCI_FEC:
00955 case SCI_GRAYPLOT:
00956 case SCI_AGREG:
00957 case SCI_PANNER:
00958 case SCI_SBH:
00959 case SCI_SBV:
00960 case SCI_TEXT:
00961 case SCI_TITLE:
00962 case SCI_LEGEND:
00963 case SCI_LABEL:
00964 case SCI_UIMENU:
00965 default:
00966
00967 sciprint ("This object has no line width \n");
00968 return -1;
00969 break;
00970 }
00971 }
00972 return 0;
00973 }
00974
00975
00976 int sciInitIsMark( sciPointObj * pobj, BOOL ismark )
00977 {
00978 switch (sciGetEntityType (pobj))
00979 {
00980 case SCI_FIGURE:
00981 (sciGetGraphicContext(pobj))->ismark = ismark;
00982 return 0;
00983 break;
00984 case SCI_SUBWIN:
00985 (sciGetGraphicContext(pobj))->ismark = ismark;
00986 return 0;
00987 break;
00988 case SCI_ARC:
00989 (sciGetGraphicContext(pobj))->ismark = ismark;
00990 return 0;
00991 break;
00992 case SCI_POLYLINE:
00993 (sciGetGraphicContext(pobj))->ismark = ismark;
00994 return 0;
00995 break;
00996 case SCI_RECTANGLE:
00997 (sciGetGraphicContext(pobj))->ismark = ismark;
00998 return 0;
00999 break;
01000 case SCI_SURFACE:
01001 (sciGetGraphicContext(pobj))->ismark = ismark;
01002 return 0;
01003 break;
01004 case SCI_AXES:
01005 (sciGetGraphicContext(pobj))->ismark = ismark;
01006 return 0;
01007 break;
01008 case SCI_LEGEND:
01009 (sciGetGraphicContext(pobj))->ismark = ismark;
01010 return 0;
01011 break;
01012 case SCI_SEGS:
01013 (sciGetGraphicContext(pobj))->ismark = ismark;
01014 return 0;
01015 break;
01016 case SCI_FEC:
01017 case SCI_GRAYPLOT:
01018 case SCI_MENU:
01019 case SCI_MENUCONTEXT:
01020 case SCI_STATUSB:
01021 case SCI_LIGHT:
01022 case SCI_AGREG:
01023 case SCI_PANNER:
01024 case SCI_SBH:
01025 case SCI_SBV:
01026 case SCI_TEXT:
01027 case SCI_TITLE:
01028 case SCI_LABEL:
01029 case SCI_UIMENU:
01030 default:
01031
01032 sciprint ("This object has no ismark \n");
01033 return -1;
01034 break;
01035 }
01036 return 0;
01037
01038 }
01039
01043 int
01044 sciSetIsMark (sciPointObj * pobj, BOOL ismark)
01045 {
01046
01047 if ( sciGetIsMark(pobj) == ismark )
01048 {
01049
01050 return 1 ;
01051 }
01052 return sciInitIsMark( pobj, ismark ) ;
01053
01054 }
01055
01056
01057 int sciInitMarkForeground( sciPointObj * pobj, int colorindex )
01058 {
01059 colorindex = sciSetGoodIndex(pobj,colorindex);
01060 switch (sciGetEntityType (pobj))
01061 {
01062 case SCI_FIGURE:
01063 (sciGetGraphicContext(pobj))->markforeground =
01064 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01065 break;
01066 case SCI_SUBWIN:
01067 (sciGetGraphicContext(pobj))->markforeground =
01068 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01069 break;
01070 case SCI_ARC:
01071 (sciGetGraphicContext(pobj))->markforeground =
01072 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01073 break;
01074 case SCI_POLYLINE:
01075 (sciGetGraphicContext(pobj))->markforeground =
01076 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01077 break;
01078 case SCI_RECTANGLE:
01079 (sciGetGraphicContext(pobj))->markforeground =
01080 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01081 break;
01082 case SCI_AXES:
01083 (sciGetGraphicContext(pobj))->markforeground =
01084 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01085 break;
01086 case SCI_SEGS:
01087 (sciGetGraphicContext(pobj))->markforeground =
01088 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01089 break;
01090 case SCI_SURFACE:
01091 (sciGetGraphicContext(pobj))->markforeground =
01092 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01093 break;
01094 case SCI_LEGEND:
01095 (sciGetGraphicContext(pobj))->markforeground =
01096 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01097 break;
01098 case SCI_LABEL:
01099 case SCI_MENU:
01100 case SCI_MENUCONTEXT:
01101 case SCI_STATUSB:
01102 case SCI_TITLE:
01103 case SCI_TEXT:
01104 case SCI_FEC:
01105 case SCI_GRAYPLOT:
01106 case SCI_LIGHT:
01107 case SCI_PANNER:
01108 case SCI_SBH:
01109 case SCI_SBV:
01110 case SCI_AGREG:
01111 case SCI_UIMENU:
01112 default:
01113 return -1;
01114 break;
01115 }
01116 return 0;
01117
01118 }
01119
01123 int
01124 sciSetMarkForeground (sciPointObj * pobj, int colorindex)
01125 {
01126
01127 colorindex = sciSetGoodIndex(pobj,colorindex);
01128 if ( sciGetMarkForeground( pobj ) == colorindex )
01129 {
01130
01131 return 1 ;
01132 }
01133 return sciInitMarkForeground( pobj, colorindex ) ;
01134
01135 }
01136
01137 int sciInitMarkBackground( sciPointObj * pobj, int colorindex )
01138 {
01139 colorindex = sciSetGoodIndex(pobj,colorindex);
01140
01141 switch (sciGetEntityType (pobj))
01142 {
01143 case SCI_FIGURE:
01144 (sciGetGraphicContext(pobj))->markbackground =
01145 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01146 break;
01147 case SCI_SUBWIN:
01148 (sciGetGraphicContext(pobj))->markbackground =
01149 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01150 break;
01151 case SCI_ARC:
01152 (sciGetGraphicContext(pobj))->markbackground =
01153 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01154 break;
01155 case SCI_POLYLINE:
01156 (sciGetGraphicContext(pobj))->markbackground =
01157 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01158 break;
01159 case SCI_RECTANGLE:
01160 (sciGetGraphicContext(pobj))->markbackground =
01161 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01162 break;
01163 case SCI_AXES:
01164 (sciGetGraphicContext(pobj))->markbackground =
01165 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01166 break;
01167 case SCI_SEGS:
01168 (sciGetGraphicContext(pobj))->markbackground =
01169 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01170 break;
01171 case SCI_SURFACE:
01172 (sciGetGraphicContext(pobj))->markbackground =
01173 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01174 break;
01175 case SCI_LEGEND:
01176 (sciGetGraphicContext(pobj))->markbackground =
01177 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
01178 break;
01179 case SCI_LABEL:
01180 case SCI_MENU:
01181 case SCI_MENUCONTEXT:
01182 case SCI_STATUSB:
01183 case SCI_TITLE:
01184 case SCI_TEXT:
01185 case SCI_FEC:
01186 case SCI_GRAYPLOT:
01187 case SCI_LIGHT:
01188 case SCI_PANNER:
01189 case SCI_SBH:
01190 case SCI_SBV:
01191 case SCI_AGREG:
01192 case SCI_UIMENU:
01193 default:
01194 return -1;
01195 break;
01196 }
01197 return 0;
01198 }
01199
01203 int
01204 sciSetMarkBackground (sciPointObj * pobj, int colorindex)
01205 {
01206
01207 colorindex = sciSetGoodIndex(pobj,colorindex);
01208
01209 if ( sciGetMarkBackground( pobj ) == colorindex )
01210 {
01211
01212 return 1 ;
01213 }
01214 return sciInitMarkBackground( pobj, colorindex ) ;
01215
01216 }
01217
01218
01219
01220 int sciInitMarkStyle( sciPointObj * pobj, int markstyle )
01221 {
01222 if (markstyle < 0)
01223 {
01224 sciprint ("the mark style must be greater or equal than 0\n");
01225 return -1;
01226 }
01227 else
01228 {
01229 switch (sciGetEntityType (pobj))
01230 {
01231 case SCI_FIGURE:
01232 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01233 return 0;
01234 break;
01235 case SCI_SUBWIN:
01236 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01237
01238 return 0;
01239 break;
01240 case SCI_ARC:
01241 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01242 return 0;
01243 break;
01244 case SCI_POLYLINE:
01245 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01246 return 0;
01247 break;
01248 case SCI_RECTANGLE:
01249 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01250 return 0;
01251 break;
01252 case SCI_SURFACE:
01253 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01254 return 0;
01255 break;
01256 case SCI_AXES:
01257 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01258 return 0;
01259 break;
01260 case SCI_LEGEND:
01261 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01262 return 0;
01263 break;
01264 case SCI_SEGS:
01265 (sciGetGraphicContext(pobj))->markstyle = markstyle;
01266 return 0;
01267 break;
01268 case SCI_FEC:
01269 case SCI_GRAYPLOT:
01270 case SCI_MENU:
01271 case SCI_MENUCONTEXT:
01272 case SCI_STATUSB:
01273 case SCI_LIGHT:
01274 case SCI_AGREG:
01275 case SCI_PANNER:
01276 case SCI_SBH:
01277 case SCI_SBV:
01278 case SCI_TEXT:
01279 case SCI_TITLE:
01280 case SCI_LABEL:
01281 case SCI_UIMENU:
01282 default:
01283
01284 sciprint ("This object has no mark \n");
01285 return -1;
01286 break;
01287 }
01288 }
01289 return 0;
01290 }
01291
01292
01296 int
01297 sciSetMarkStyle (sciPointObj * pobj, int markstyle)
01298 {
01299
01300 if ( sciGetMarkStyle( pobj ) == markstyle )
01301 {
01302
01303 return 1 ;
01304 }
01305 return sciInitMarkStyle( pobj, markstyle ) ;
01306 }
01307
01308 int sciInitMarkSize( sciPointObj * pobj, int marksize )
01309 {
01310 if (marksize < 0)
01311 {
01312 sciprint ("the mark size must be greater or equal than 0\n");
01313 return -1;
01314 }
01315 else
01316 {
01317 switch (sciGetEntityType (pobj))
01318 {
01319 case SCI_FIGURE:
01320 (sciGetGraphicContext(pobj))->marksize = marksize;
01321 return 0;
01322 break;
01323 case SCI_SUBWIN:
01324 (sciGetGraphicContext(pobj))->marksize = marksize;
01325
01326 return 0;
01327 break;
01328 case SCI_ARC:
01329 (sciGetGraphicContext(pobj))->marksize = marksize;
01330 return 0;
01331 break;
01332 case SCI_POLYLINE:
01333 (sciGetGraphicContext(pobj))->marksize = marksize;
01334 return 0;
01335 break;
01336 case SCI_RECTANGLE:
01337 (sciGetGraphicContext(pobj))->marksize = marksize;
01338 return 0;
01339 break;
01340 case SCI_SURFACE:
01341 (sciGetGraphicContext(pobj))->marksize = marksize;
01342 return 0;
01343 break;
01344 case SCI_AXES:
01345 (sciGetGraphicContext(pobj))->marksize = marksize;
01346 return 0;
01347 break;
01348 case SCI_LEGEND:
01349 (sciGetGraphicContext(pobj))->marksize = marksize;
01350 return 0;
01351 break;
01352 case SCI_SEGS:
01353 (sciGetGraphicContext(pobj))->marksize = marksize;
01354 return 0;
01355 break;
01356 case SCI_LABEL:
01357 case SCI_TEXT:
01358 (sciGetGraphicContext(pobj))->marksize = marksize;
01359 return 0;
01360 break;
01361 case SCI_FEC:
01362 case SCI_GRAYPLOT:
01363 case SCI_MENU:
01364 case SCI_MENUCONTEXT:
01365 case SCI_STATUSB:
01366 case SCI_LIGHT:
01367 case SCI_AGREG:
01368 case SCI_PANNER:
01369 case SCI_SBH:
01370 case SCI_SBV:
01371 case SCI_TITLE:
01372 case SCI_UIMENU:
01373 default:
01374
01375 sciprint ("This object has no mark \n");
01376 return -1;
01377 break;
01378 }
01379 }
01380 return 0;
01381 }
01382
01386 int
01387 sciSetMarkSize (sciPointObj * pobj, int marksize)
01388 {
01389 if ( sciGetMarkSize( pobj ) == marksize )
01390 {
01391
01392 return 1 ;
01393 }
01394 return sciInitMarkSize( pobj, marksize ) ;
01395
01396 }
01397
01398 int sciInitMarkSizeUnit( sciPointObj * pobj, int marksizeunit )
01399 {
01400 if (marksizeunit < 0)
01401 {
01402 sciprint ("the mark size unit must be greater than 0\n");
01403 return -1;
01404 }
01405 else
01406 {
01407 switch (sciGetEntityType (pobj))
01408 {
01409 case SCI_FIGURE:
01410 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01411 return 0;
01412 break;
01413 case SCI_SUBWIN:
01414 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01415 return 0;
01416 break;
01417 case SCI_ARC:
01418 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01419 return 0;
01420 break;
01421 case SCI_POLYLINE:
01422 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01423 return 0;
01424 break;
01425 case SCI_RECTANGLE:
01426 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01427 return 0;
01428 break;
01429 case SCI_SURFACE:
01430 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01431 return 0;
01432 break;
01433 case SCI_AXES:
01434 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01435 return 0;
01436 break;
01437 case SCI_LEGEND:
01438 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01439 return 0;
01440 break;
01441 case SCI_SEGS:
01442 (sciGetGraphicContext(pobj))->marksizeunit = marksizeunit;
01443 return 0;
01444 break;
01445 case SCI_FEC:
01446 case SCI_GRAYPLOT:
01447 case SCI_MENU:
01448 case SCI_MENUCONTEXT:
01449 case SCI_STATUSB:
01450 case SCI_LIGHT:
01451 case SCI_AGREG:
01452 case SCI_PANNER:
01453 case SCI_SBH:
01454 case SCI_SBV:
01455 case SCI_TEXT:
01456 case SCI_TITLE:
01457 case SCI_LABEL:
01458 case SCI_UIMENU:
01459 default:
01460
01461 sciprint ("This object has no mark \n");
01462 return -1;
01463 break;
01464 }
01465 }
01466 return 0;
01467 }
01468
01473 int
01474 sciSetMarkSizeUnit (sciPointObj * pobj, int marksizeunit)
01475 {
01476
01477 if ( sciGetMarkSizeUnit( pobj ) == marksizeunit )
01478 {
01479
01480 return 1 ;
01481 }
01482 return sciInitMarkSizeUnit( pobj, marksizeunit ) ;
01483 }
01484
01485 int sciInitIsLine( sciPointObj * pobj, BOOL isline )
01486 {
01487 switch (sciGetEntityType (pobj))
01488 {
01489 case SCI_FIGURE:
01490 (sciGetGraphicContext(pobj))->isline = isline;
01491 return 0;
01492 break;
01493 case SCI_SUBWIN:
01494 (sciGetGraphicContext(pobj))->isline = isline;
01495 return 0;
01496 break;
01497 case SCI_ARC:
01498 (sciGetGraphicContext(pobj))->isline = isline;
01499 return 0;
01500 break;
01501 case SCI_POLYLINE:
01502 (sciGetGraphicContext(pobj))->isline = isline;
01503 return 0;
01504 break;
01505 case SCI_RECTANGLE:
01506 (sciGetGraphicContext(pobj))->isline = isline;
01507 return 0;
01508 break;
01509 case SCI_SURFACE:
01510 (sciGetGraphicContext(pobj))->isline = isline;
01511 return 0;
01512 break;
01513 case SCI_AXES:
01514 (sciGetGraphicContext(pobj))->isline = isline;
01515 return 0;
01516 break;
01517 case SCI_LEGEND:
01518 (sciGetGraphicContext(pobj))->isline = isline;
01519 return 0;
01520 break;
01521 case SCI_SEGS:
01522 (sciGetGraphicContext(pobj))->isline = isline;
01523 return 0;
01524 break;
01525 case SCI_TEXT:
01526 pTEXT_FEATURE( pobj )->isline = isline;
01527 return 0;
01528 break;
01529 case SCI_FEC:
01530 case SCI_GRAYPLOT:
01531 case SCI_MENU:
01532 case SCI_MENUCONTEXT:
01533 case SCI_STATUSB:
01534 case SCI_LIGHT:
01535 case SCI_AGREG:
01536 case SCI_PANNER:
01537 case SCI_SBH:
01538 case SCI_SBV:
01539 case SCI_TITLE:
01540 case SCI_LABEL:
01541 case SCI_UIMENU:
01542 default:
01543
01544 sciprint ("This object has no isline \n");
01545 return -1;
01546 break;
01547 }
01548 return 0;
01549 }
01550
01554 int
01555 sciSetIsLine (sciPointObj * pobj, BOOL isline)
01556 {
01557
01558 if ( sciGetIsLine( pobj ) == isline )
01559 {
01560
01561 return 1 ;
01562 }
01563 return sciInitIsLine( pobj, isline ) ;
01564 }
01565
01566 int sciInitFillStyle( sciPointObj * pobj, int fillstyle )
01567 {
01568 if (fillstyle < 0)
01569 {
01570 sciprint ("the fill width must be equal or greater than 0\n");
01571 return -1;
01572 }
01573 else
01574 {
01575 switch (sciGetEntityType (pobj))
01576 {
01577 case SCI_FIGURE:
01578 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01579 return 0;
01580 break;
01581 case SCI_SUBWIN:
01582 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01583
01584 return 0;
01585 break;
01586 case SCI_ARC:
01587 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01588 return 0;
01589 break;
01590 case SCI_POLYLINE:
01591 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01592 return 0;
01593 break;
01594 case SCI_RECTANGLE:
01595 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01596 return 0;
01597 break;
01598 case SCI_SURFACE:
01599 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01600 return 0;
01601 break;
01602 case SCI_AXES:
01603 (sciGetGraphicContext(pobj))->fillstyle = fillstyle;
01604 return 0;
01605 break;
01606 case SCI_SEGS:
01607 case SCI_FEC:
01608 case SCI_GRAYPLOT:
01609 case SCI_LIGHT:
01610 case SCI_PANNER:
01611 case SCI_SBH:
01612 case SCI_SBV:
01613 case SCI_MENU:
01614 case SCI_MENUCONTEXT:
01615 case SCI_STATUSB:
01616 case SCI_AGREG:
01617 case SCI_TEXT:
01618 case SCI_TITLE:
01619 case SCI_LEGEND:
01620 case SCI_LABEL:
01621 case SCI_UIMENU:
01622 default:
01623 sciprint ("This object has no line style \n");
01624 return -1;
01625 break;
01626 }
01627 }
01628 return 0;
01629 }
01630
01634 int
01635 sciSetFillStyle (sciPointObj * pobj, int fillstyle)
01636 {
01637 if ( sciGetFillStyle( pobj ) == fillstyle )
01638 {
01639 return 1 ;
01640 }
01641 return sciInitFillStyle( pobj, fillstyle ) ;
01642 }
01643
01644
01645 int sciInitFontDeciWidth( sciPointObj * pobj, int fontdeciwidth )
01646 {
01647 if (fontdeciwidth < 0)
01648 {
01649 sciprint ("The font size must be greater than 0\n");
01650 return -1;
01651 }
01652 else
01653 {
01654 switch (sciGetEntityType (pobj))
01655 {
01656 case SCI_FIGURE:
01657
01658
01659
01660 (sciGetFontContext(pobj))->fontdeciwidth = fontdeciwidth;
01661 return 0;
01662 break;
01663 case SCI_SUBWIN:
01664
01665
01666
01667
01668 (sciGetFontContext(pobj))->fontdeciwidth = fontdeciwidth;
01669 return 0;
01670 break;
01671 case SCI_TEXT:
01672 (sciGetFontContext(pobj))->fontdeciwidth = fontdeciwidth;
01673 return 0;
01674 break;
01675 case SCI_TITLE:
01676 (sciGetFontContext(pobj))->fontdeciwidth =
01677 fontdeciwidth;
01678 return 0;
01679 break;
01680 case SCI_LEGEND:
01681 (sciGetFontContext(pobj))->fontdeciwidth =
01682 fontdeciwidth;
01683 return 0;
01684 break;
01685 case SCI_ARC:
01686
01687 sciprint ("This object has no Font width \n");
01688 return -1;
01689 break;
01690 case SCI_POLYLINE:
01691
01692 sciprint ("This object has no Font width \n");
01693 return -1;
01694 break;
01695 case SCI_RECTANGLE:
01696
01697 sciprint ("This object has no Font width \n");
01698 return -1;
01699 break;
01700 case SCI_SURFACE:
01701
01702 sciprint ("This object has no font width \n");
01703 return -1;
01704 break;
01705 case SCI_LIGHT:
01706
01707 sciprint ("This object has no font width \n");
01708 return -1;
01709 break;
01710 case SCI_AXES:
01711 (sciGetFontContext(pobj))->fontdeciwidth =
01712 fontdeciwidth;
01713 return 0;
01714 break;
01715 case SCI_PANNER:
01716 case SCI_SBH:
01717 case SCI_SBV:
01718
01719 sciprint ("This object has no font width \n");
01720 return -1;
01721 break;
01722 case SCI_MENU:
01723 (sciGetFontContext(pobj))->fontdeciwidth =
01724 fontdeciwidth;
01725 return 0;
01726 break;
01727 case SCI_MENUCONTEXT:
01728 (sciGetFontContext(pobj))->fontdeciwidth =
01729 fontdeciwidth;
01730 return 0;
01731 break;
01732 case SCI_STATUSB:
01733 (sciGetFontContext(pobj))->fontdeciwidth =
01734 fontdeciwidth;
01735 break;
01736 case SCI_LABEL:
01737 (sciGetFontContext(pobj))->fontdeciwidth =
01738 fontdeciwidth;
01739 break;
01740 case SCI_SEGS:
01741 case SCI_FEC:
01742 case SCI_GRAYPLOT:
01743 case SCI_AGREG:
01744 case SCI_UIMENU:
01745 default:
01746 sciprint ("This object has no font width \n");
01747 return -1 ;
01748 break;
01749 }
01750 }
01751 return 0;
01752 }
01753
01757 int
01758 sciSetFontDeciWidth (sciPointObj * pobj, int fontdeciwidth)
01759 {
01760
01761 if ( sciGetFontDeciWidth( pobj ) == fontdeciwidth )
01762 {
01763
01764 return 1 ;
01765 }
01766 return sciInitFontDeciWidth( pobj, fontdeciwidth ) ;
01767
01768 }
01769
01770
01771 int sciInitFontOrientation( sciPointObj * pobj, int textorientation )
01772 {
01773 if (textorientation < 0)
01774 {
01775 sciprint ("The font angle must be greater than 0\n");
01776 return -1;
01777 }
01778 else
01779 {
01780 switch (sciGetEntityType (pobj))
01781 {
01782 case SCI_TEXT:
01783 (sciGetFontContext(pobj))->textorientation = textorientation;
01784 return 0;
01785 break;
01786 case SCI_TITLE:
01787 (sciGetFontContext(pobj))->textorientation = textorientation;
01788 return 0;
01789 break;
01790 case SCI_LEGEND:
01791 (sciGetFontContext(pobj))->textorientation = textorientation;
01792 return 0;
01793 break;
01794 case SCI_AXES:
01795 (sciGetFontContext(pobj))->textorientation = textorientation;
01796 return 0;
01797 break;
01798 case SCI_MENU:
01799 (sciGetFontContext(pobj))->textorientation = textorientation;
01800 return 0;
01801 break;
01802 case SCI_MENUCONTEXT:
01803 (sciGetFontContext(pobj))->textorientation = textorientation;
01804 return 0;
01805 break;
01806 case SCI_STATUSB:
01807 (sciGetFontContext(pobj))->textorientation = textorientation;
01808 break;
01809 case SCI_SUBWIN:
01810
01811 (sciGetFontContext(pobj))->textorientation = textorientation;
01812 return 0;
01813 break;
01814 case SCI_FIGURE:
01815 (sciGetFontContext(pobj))->textorientation = textorientation;
01816 return 0;
01817 break;
01818 case SCI_LABEL:
01819 (sciGetFontContext(pobj))->textorientation = textorientation;
01820 return 0;
01821 break;
01822 case SCI_ARC:
01823 case SCI_SEGS:
01824 case SCI_FEC:
01825 case SCI_GRAYPLOT:
01826 case SCI_POLYLINE:
01827 case SCI_RECTANGLE:
01828 case SCI_SURFACE:
01829 case SCI_LIGHT:
01830 case SCI_PANNER:
01831 case SCI_SBH:
01832 case SCI_SBV:
01833 case SCI_AGREG:
01834 case SCI_UIMENU:
01835 default:
01836
01837 sciprint ("This object has no font width \n");
01838 return -1;
01839 break;
01840
01841 }
01842 }
01843 return 0;
01844 }
01845
01849 int
01850 sciSetFontOrientation (sciPointObj * pobj, int textorientation)
01851 {
01852
01853 if ( sciGetFontOrientation( pobj ) == textorientation )
01854 {
01855
01856 return 1 ;
01857 }
01858 return sciInitFontOrientation( pobj, textorientation ) ;
01859
01860 }
01861
01862 int sciSetStrings( sciPointObj * pObjDest, const StringMatrix * pStrings )
01863 {
01864 switch (sciGetEntityType (pObjDest))
01865 {
01866 case SCI_TEXT:
01867 deleteMatrix( pTEXT_FEATURE (pObjDest)->pStrings ) ;
01868 pTEXT_FEATURE (pObjDest)->pStrings = copyStringMatrix( pStrings ) ;
01869 if ( pTEXT_FEATURE (pObjDest)->pStrings == NULL )
01870 {
01871 return -1 ;
01872 }
01873 break;
01874 case SCI_TITLE:
01875 deleteMatrix( pTITLE_FEATURE (pObjDest)->text.pStrings ) ;
01876 pTITLE_FEATURE (pObjDest)->text.pStrings = copyStringMatrix( pStrings ) ;
01877 if ( pTITLE_FEATURE (pObjDest)->text.pStrings == NULL )
01878 {
01879 return -1 ;
01880 }
01881 break;
01882 case SCI_LEGEND:
01883 deleteMatrix( pLEGEND_FEATURE (pObjDest)->text.pStrings ) ;
01884 pLEGEND_FEATURE (pObjDest)->text.pStrings = copyStringMatrix( pStrings ) ;
01885 if ( pLEGEND_FEATURE (pObjDest)->text.pStrings == NULL )
01886 {
01887 return -1 ;
01888 }
01889 break;
01890 case SCI_LABEL:
01891 return sciSetStrings( pLABEL_FEATURE(pObjDest)->text, pStrings ) ;
01892 break;
01893 case SCI_UIMENU:
01894 deleteMatrix( pUIMENU_FEATURE (pObjDest)->label.pStrings ) ;
01895 pUIMENU_FEATURE (pObjDest)->label.pStrings = copyStringMatrix( pStrings ) ;
01896 if ( pUIMENU_FEATURE (pObjDest)->label.pStrings == NULL )
01897 {
01898 return -1 ;
01899 }
01900 break;
01901 case SCI_FIGURE:
01902 case SCI_SUBWIN:
01903 case SCI_ARC:
01904 case SCI_SEGS:
01905 case SCI_FEC:
01906 case SCI_GRAYPLOT:
01907 case SCI_POLYLINE:
01908 case SCI_RECTANGLE:
01909 case SCI_SURFACE:
01910 case SCI_LIGHT:
01911 case SCI_AXES:
01912 case SCI_PANNER:
01913 case SCI_SBH:
01914 case SCI_SBV:
01915 case SCI_MENU:
01916 case SCI_MENUCONTEXT:
01917 case SCI_STATUSB:
01918 case SCI_AGREG:
01919 default:
01920 sciprint ("This object has no text !\n");
01921 return -1;
01922 break;
01923 }
01924 return 0;
01925 }
01926
01935 int
01936 sciSetText (sciPointObj * pobj, char ** text, int nbRow, int nbCol )
01937 {
01938 switch (sciGetEntityType (pobj))
01939 {
01940 case SCI_TEXT:
01941 deleteMatrix( pTEXT_FEATURE (pobj)->pStrings ) ;
01942 pTEXT_FEATURE (pobj)->pStrings = newFullStringMatrix( text, nbRow, nbCol ) ;
01943 if ( pTEXT_FEATURE (pobj)->pStrings == NULL )
01944 {
01945 return -1 ;
01946 }
01947 break;
01948 case SCI_TITLE:
01949 deleteMatrix( pTITLE_FEATURE (pobj)->text.pStrings ) ;
01950 pTITLE_FEATURE (pobj)->text.pStrings = newFullStringMatrix( text, nbRow, nbCol ) ;
01951 if ( pTITLE_FEATURE (pobj)->text.pStrings == NULL )
01952 {
01953 return -1 ;
01954 }
01955 break;
01956 case SCI_LEGEND:
01957 deleteMatrix( pLEGEND_FEATURE (pobj)->text.pStrings ) ;
01958 pLEGEND_FEATURE (pobj)->text.pStrings = newFullStringMatrix( text, nbRow, nbCol ) ;
01959 if ( pLEGEND_FEATURE (pobj)->text.pStrings == NULL )
01960 {
01961 return -1 ;
01962 }
01963 break;
01964 case SCI_LABEL:
01965 return sciSetText( pLABEL_FEATURE(pobj)->text, text, nbRow, nbCol ) ;
01966 break;
01967 case SCI_UIMENU:
01968 deleteMatrix( pUIMENU_FEATURE (pobj)->label.pStrings ) ;
01969 pUIMENU_FEATURE (pobj)->label.pStrings = newFullStringMatrix( text, nbRow, nbCol ) ;
01970 if ( pUIMENU_FEATURE (pobj)->label.pStrings == NULL )
01971 {
01972 return -1 ;
01973 }
01974 break;
01975 case SCI_FIGURE:
01976 case SCI_SUBWIN:
01977 case SCI_ARC:
01978 case SCI_SEGS:
01979 case SCI_FEC:
01980 case SCI_GRAYPLOT:
01981 case SCI_POLYLINE:
01982 case SCI_RECTANGLE:
01983 case SCI_SURFACE:
01984 case SCI_LIGHT:
01985 case SCI_AXES:
01986 case SCI_PANNER:
01987 case SCI_SBH:
01988 case SCI_SBV:
01989 case SCI_MENU:
01990 case SCI_MENUCONTEXT:
01991 case SCI_STATUSB:
01992 case SCI_AGREG:
01993 default:
01994 sciprint ("This object has no text !\n");
01995 return -1;
01996 break;
01997 }
01998 return 0;
01999 }
02000
02001
02002 int sciInitFontBackground( sciPointObj * pobj, int colorindex )
02003 {
02004 colorindex = sciSetGoodIndex(pobj,colorindex);
02005 switch (sciGetEntityType (pobj))
02006 {
02007 case SCI_TEXT:
02008 (sciGetFontContext(pobj))->backgroundcolor =
02009 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));;
02010 break;
02011 case SCI_TITLE:
02012 (sciGetFontContext(pobj))->backgroundcolor =
02013 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02014 break;
02015 case SCI_LEGEND:
02016 (sciGetFontContext(pobj))->backgroundcolor =
02017 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02018 break;
02019 case SCI_AXES:
02020 (sciGetFontContext(pobj))->backgroundcolor =
02021 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02022 break;
02023 case SCI_MENU:
02024 (sciGetFontContext(pobj))->backgroundcolor =
02025 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02026 break;
02027 case SCI_MENUCONTEXT:
02028 (sciGetFontContext(pobj))->backgroundcolor =
02029 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02030 break;
02031 case SCI_STATUSB:
02032 (sciGetFontContext(pobj))->backgroundcolor =
02033 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02034 break;
02035 case SCI_SUBWIN:
02036 (sciGetFontContext(pobj))->backgroundcolor =
02037 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02038 break;
02039 case SCI_FIGURE:
02040 (sciGetFontContext(pobj))->backgroundcolor =
02041 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02042 break;
02043 case SCI_LABEL:
02044 (sciGetFontContext(pobj))->backgroundcolor =
02045 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02046 break;
02047 case SCI_UIMENU:
02048 case SCI_ARC:
02049 case SCI_SEGS:
02050 case SCI_FEC:
02051 case SCI_GRAYPLOT:
02052 case SCI_POLYLINE:
02053 case SCI_RECTANGLE:
02054 case SCI_SURFACE:
02055 case SCI_LIGHT:
02056 case SCI_PANNER:
02057 case SCI_SBH:
02058 case SCI_SBV:
02059 case SCI_AGREG:
02060 default:
02061 return -1;
02062 break;
02063 }
02064 return 0;
02065 }
02066
02072 int
02073 sciSetFontBackground (sciPointObj * pobj, int colorindex)
02074 {
02075 colorindex = sciSetGoodIndex(pobj,colorindex);
02076
02077 if ( sciGetFontBackground( pobj ) == colorindex )
02078 {
02079
02080 return 1 ;
02081 }
02082 return sciInitFontBackground( pobj, colorindex ) ;
02083
02084 }
02085
02086 int sciInitFontForeground( sciPointObj * pobj, int colorindex )
02087 {
02088 colorindex = sciSetGoodIndex(pobj,colorindex);
02089
02090 switch (sciGetEntityType (pobj))
02091 {
02092 case SCI_TEXT:
02093 (sciGetFontContext(pobj))->foregroundcolor =
02094 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02095 break;
02096 case SCI_TITLE:
02097 (sciGetFontContext(pobj))->foregroundcolor =
02098 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02099 break;
02100 case SCI_LEGEND:
02101 (sciGetFontContext(pobj))->foregroundcolor =
02102 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02103 break;
02104 case SCI_AXES:
02105 (sciGetFontContext(pobj))->foregroundcolor =
02106 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02107 break;
02108 case SCI_MENU:
02109 (sciGetFontContext(pobj))->foregroundcolor =
02110 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02111 break;
02112 case SCI_MENUCONTEXT:
02113 (sciGetFontContext(pobj))->foregroundcolor =
02114 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02115 break;
02116 case SCI_STATUSB:
02117 (sciGetFontContext(pobj))->foregroundcolor =
02118 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02119 break;
02120 case SCI_SUBWIN:
02121 (sciGetFontContext(pobj))->foregroundcolor =
02122 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02123 break;
02124 case SCI_FIGURE:
02125 (sciGetFontContext(pobj))->foregroundcolor =
02126 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02127 break;
02128 case SCI_LABEL:
02129 (sciGetFontContext(pobj))->foregroundcolor =
02130 Max (0, Min (colorindex - 1, sciGetNumColors (pobj) + 1));
02131 break;
02132 case SCI_UIMENU:
02133 case SCI_ARC:
02134 case SCI_SEGS:
02135 case SCI_FEC:
02136 case SCI_GRAYPLOT:
02137 case SCI_POLYLINE:
02138 case SCI_RECTANGLE:
02139 case SCI_SURFACE:
02140 case SCI_LIGHT:
02141 case SCI_PANNER:
02142 case SCI_SBH:
02143 case SCI_SBV:
02144 case SCI_AGREG:
02145 default:
02146 return -1;
02147 break;
02148 }
02149 return 0;
02150 }
02151
02157 int
02158 sciSetFontForeground (sciPointObj * pobj, int colorindex)
02159 {
02160 colorindex = sciSetGoodIndex(pobj,colorindex);
02161
02162 if ( sciGetFontForeground( pobj ) == colorindex )
02163 {
02164
02165 return 1 ;
02166 }
02167
02168 return sciInitFontForeground( pobj, colorindex ) ;
02169 }
02170
02171
02172 int sciInitFontStyle( sciPointObj * pobj, int iAttributes )
02173 {
02174 switch (sciGetEntityType (pobj))
02175 {
02176 case SCI_TEXT:
02177 case SCI_TITLE:
02178 case SCI_LEGEND:
02179 case SCI_SUBWIN:
02180 case SCI_FIGURE:
02181 case SCI_LABEL:
02182 (sciGetFontContext(pobj))->fonttype =iAttributes;
02183 break;
02184 case SCI_UIMENU:
02185 case SCI_ARC:
02186 case SCI_SEGS:
02187 case SCI_FEC:
02188 case SCI_GRAYPLOT:
02189 case SCI_POLYLINE:
02190 case SCI_RECTANGLE:
02191 case SCI_SURFACE:
02192 case SCI_LIGHT:
02193 case SCI_AXES:
02194 case SCI_PANNER:
02195 case SCI_SBH:
02196 case SCI_SBV:
02197 case SCI_MENU:
02198 case SCI_MENUCONTEXT:
02199 case SCI_STATUSB:
02200 case SCI_AGREG:
02201 default:
02202 return -1;
02203 break;
02204 }
02205 return 0;
02206 }
02207
02214 int
02215 sciSetFontStyle (sciPointObj * pobj, int iAttributes )
02216 {
02217 if ( sciGetFontStyle( pobj ) == iAttributes )
02218 {
02219
02220 return 1 ;
02221 }
02222 return sciInitFontStyle( pobj, iAttributes ) ;
02223
02224 }
02225
02226
02234 int
02235 sciSetFontName (sciPointObj * pobj, char pfontname[], int n)
02236 {
02237 switch (sciGetEntityType (pobj))
02238 {
02239 case SCI_TEXT:
02240
02241
02242
02243
02244
02245
02246 return -1 ;
02247 break;
02248 case SCI_TITLE:
02249
02250
02251
02252
02253
02254
02255
02256 return -1 ;
02257 break;
02258 case SCI_LEGEND:
02259
02260
02261
02262
02263
02264
02265
02266 return -1 ;
02267 break;
02268 case SCI_FIGURE:
02269 case SCI_SUBWIN:
02270 case SCI_ARC:
02271 case SCI_SEGS:
02272 case SCI_FEC:
02273 case SCI_GRAYPLOT:
02274 case SCI_POLYLINE:
02275 case SCI_RECTANGLE:
02276 case SCI_SURFACE:
02277 case SCI_LIGHT:
02278 case SCI_AXES:
02279 case SCI_PANNER:
02280 case SCI_SBH:
02281 case SCI_SBV:
02282 case SCI_MENU:
02283 case SCI_MENUCONTEXT:
02284 case SCI_STATUSB:
02285 case SCI_AGREG:
02286 case SCI_LABEL:
02287 case SCI_UIMENU:
02288 default:
02289 return -1;
02290 break;
02291 }
02292 return 0;
02293 }
02294
02295
02296 int sciInitTextPosX( sciPointObj * pobj, double x )
02297 {
02298 switch (sciGetEntityType (pobj))
02299 {
02300 case SCI_TEXT:
02301 pTEXT_FEATURE (pobj)->x = x;
02302 return 0;
02303 break;
02304 case SCI_TITLE:
02305 case SCI_LEGEND:
02306 case SCI_FIGURE:
02307 case SCI_SUBWIN:
02308 case SCI_ARC:
02309 case SCI_SEGS:
02310 case SCI_FEC:
02311 case SCI_GRAYPLOT:
02312 case SCI_POLYLINE:
02313 case SCI_RECTANGLE:
02314 case SCI_SURFACE:
02315 case SCI_LIGHT:
02316 case SCI_AXES:
02317 case SCI_PANNER:
02318 case SCI_SBH:
02319 case SCI_SBV:
02320 case SCI_MENU:
02321 case SCI_MENUCONTEXT:
02322 case SCI_STATUSB:
02323 case SCI_AGREG:
02324 case SCI_LABEL:
02325 case SCI_UIMENU:
02326 default:
02327 sciprint ("This object has no text position!\n");
02328 return 0;
02329 break;
02330 }
02331 return -1;
02332 }
02333
02339 int
02340 sciSetTextPosX (sciPointObj * pobj, double x)
02341 {
02342
02343 if ( sciGetTextPosX( pobj ) == x )
02344 {
02345
02346 return 1 ;
02347 }
02348 return sciInitTextPosX( pobj, x ) ;
02349
02350 }
02351
02352 int sciInitTextPosY( sciPointObj * pobj, double y )
02353 {
02354 switch (sciGetEntityType (pobj))
02355 {
02356 case SCI_TEXT:
02357 pTEXT_FEATURE (pobj)->y = y;
02358 return 0;
02359 break;
02360 case SCI_TITLE:
02361 case SCI_LEGEND:
02362 case SCI_FIGURE:
02363 case SCI_SUBWIN:
02364 case SCI_ARC:
02365 case SCI_SEGS:
02366 case SCI_FEC:
02367 case SCI_GRAYPLOT:
02368 case SCI_POLYLINE:
02369 case SCI_RECTANGLE:
02370 case SCI_SURFACE:
02371 case SCI_LIGHT:
02372 case SCI_AXES:
02373 case SCI_PANNER:
02374 case SCI_SBH:
02375 case SCI_SBV:
02376 case SCI_MENU:
02377 case SCI_MENUCONTEXT:
02378 case SCI_STATUSB:
02379 case SCI_AGREG:
02380 case SCI_LABEL:
02381 case SCI_UIMENU:
02382 default:
02383 sciprint ("This object has no text position!\n");
02384 return 0;
02385 break;
02386 }
02387 return -1;
02388 }
02389
02395 int
02396 sciSetTextPosY (sciPointObj * pobj, double y)
02397 {
02398
02399 if ( sciGetTextPosY( pobj ) == y )
02400 {
02401
02402 return 1 ;
02403 }
02404 return sciInitTextPosX( pobj, y ) ;
02405
02406 }
02407
02408
02414 int
02415 sciSetTitlePos (sciPointObj * pobj, int x, int y)
02416 {
02417 switch (sciGetEntityType (pobj))
02418 {
02419 case SCI_TITLE:
02420 pTITLE_FEATURE (pobj)->pos.x = x;
02421 pTITLE_FEATURE (pobj)->pos.y = y;
02422 break;
02423 case SCI_FIGURE:
02424 case SCI_SUBWIN:
02425 case SCI_TEXT:
02426 case SCI_LEGEND:
02427 case SCI_ARC:
02428 case SCI_SEGS:
02429 case SCI_FEC:
02430 case SCI_GRAYPLOT:
02431 case SCI_POLYLINE:
02432 case SCI_RECTANGLE:
02433 case SCI_SURFACE:
02434 case SCI_LIGHT:
02435 case SCI_AXES:
02436 case SCI_PANNER:
02437 case SCI_SBH:
02438 case SCI_SBV:
02439 case SCI_MENU:
02440 case SCI_MENUCONTEXT:
02441 case SCI_STATUSB:
02442 case SCI_AGREG:
02443 case SCI_LABEL:
02444 case SCI_UIMENU:
02445 default:
02446 sciprint ("Your are not using a title object !\n");
02447 return -1;
02448 break;
02449 }
02450 return 0;
02451 }
02452
02453
02454
02460 int
02461 sciSetTitlePlace (sciPointObj * pobj, sciTitlePlace place)
02462 {
02463 int x = 0;
02464 int y = 0;
02465
02466 if (sciGetEntityType (pobj) == SCI_TITLE)
02467 {
02468 pTITLE_FEATURE (pobj)->titleplace = place;
02469
02470
02471
02472
02473 sciSetTitlePos (pobj, x, y);
02474 return 0;
02475 }
02476 else
02477 sciprint ("Your are not using a title object !\n");
02478 return -1;
02479 }
02480
02481
02482
02483 int sciInitLegendPlace( sciPointObj * pobj, sciLegendPlace place )
02484 {
02485 int x = 0;
02486 int y = 0;
02487
02488 if (sciGetEntityType (pobj) == SCI_TITLE)
02489 {
02490 pLEGEND_FEATURE (pobj)->place = place;
02491
02492
02493
02494
02495 return sciInitLegendPos (pobj, x, y);
02496 }
02497
02498 sciprint ("Your are not using a legend object !\n");
02499 return -1;
02500 }
02501
02507 int
02508 sciSetLegendPlace (sciPointObj * pobj, sciLegendPlace place)
02509 {
02510
02511
02512 if ( sciGetLegendPlace( pobj ) == place )
02513 {
02514
02515 return 1 ;
02516 }
02517 return sciInitLegendPlace( pobj, place ) ;
02518
02519 }
02520
02521 int sciInitLegendPos( sciPointObj * pobj, int x, int y )
02522 {
02523 switch (sciGetEntityType (pobj))
02524 {
02525 case SCI_LEGEND:
02526 pLEGEND_FEATURE (pobj)->pos.x = x;
02527 pLEGEND_FEATURE (pobj)->pos.y = y;
02528 break;
02529 case SCI_TITLE:
02530 case SCI_FIGURE:
02531 case SCI_SUBWIN:
02532 case SCI_TEXT:
02533 case SCI_ARC:
02534 case SCI_SEGS:
02535 case SCI_FEC:
02536 case SCI_GRAYPLOT:
02537 case SCI_POLYLINE:
02538 case SCI_RECTANGLE:
02539 case SCI_SURFACE:
02540 case SCI_LIGHT:
02541 case SCI_AXES:
02542 case SCI_PANNER:
02543 case SCI_SBH:
02544 case SCI_SBV:
02545 case SCI_MENU:
02546 case SCI_MENUCONTEXT:
02547 case SCI_STATUSB:
02548 case SCI_AGREG:
02549 case SCI_LABEL:
02550 case SCI_UIMENU:
02551 default:
02552 sciprint ("Your are not using a legend object !\n");
02553 return -1;
02554 break;
02555 }
02556 return 0;
02557 }
02558
02564 int
02565 sciSetLegendPos (sciPointObj * pobj, int x, int y)
02566 {
02567
02568 POINT2D pos = sciGetLegendPos( pobj ) ;
02569 if ( pos.x == x && pos.y == y )
02570 {
02571
02572 return 1 ;
02573 }
02574 return sciInitLegendPos( pobj, x, y ) ;
02575 }
02576
02577 int sciInitIsClipping( sciPointObj * pobj, int value )
02578 {
02579 switch (sciGetEntityType (pobj))
02580 {
02581 case SCI_SUBWIN:
02582 pSUBWIN_FEATURE (pobj)->isclip = value;
02583 if(value>0) pSUBWIN_FEATURE (pobj)->clip_region_set=1;
02584 break;
02585 case SCI_ARC:
02586 pARC_FEATURE (pobj)->isclip = value;
02587 if(value>0) pARC_FEATURE (pobj)->clip_region_set=1;
02588 break;
02589 case SCI_POLYLINE:
02590 pPOLYLINE_FEATURE (pobj)->isclip = value;
02591 if(value>0) pPOLYLINE_FEATURE (pobj)->clip_region_set=1;
02592 break;
02593 case SCI_RECTANGLE:
02594 pRECTANGLE_FEATURE (pobj)->isclip = value;
02595 if(value>0) pRECTANGLE_FEATURE (pobj)->clip_region_set=1;
02596 break;
02597 case SCI_SEGS:
02598 pSEGS_FEATURE (pobj)->isclip = value;
02599 if(value>0) pSEGS_FEATURE (pobj)->clip_region_set=1;
02600 break;
02601 case SCI_TEXT:
02602 pTEXT_FEATURE (pobj)->isclip = value;
02603 if(value>0) pTEXT_FEATURE (pobj)->clip_region_set=1;
02604 break;
02605 case SCI_LIGHT:
02606 pLIGHT_FEATURE (pobj)->isclip = value;
02607 if(value>0) pLIGHT_FEATURE (pobj)->clip_region_set=1;
02608 break;
02609 case SCI_AXES:
02610 pAXES_FEATURE (pobj)->isclip = value;
02611 if(value>0) pAXES_FEATURE (pobj)->clip_region_set=1;
02612 break;
02613 case SCI_SURFACE:
02614 case SCI_LEGEND:
02615 case SCI_TITLE:
02616 case SCI_FEC:
02617 case SCI_GRAYPLOT:
02618 case SCI_AGREG:
02619 case SCI_FIGURE:
02620 case SCI_SBH:
02621 case SCI_PANNER:
02622 case SCI_SBV:
02623 case SCI_MENU:
02624 case SCI_MENUCONTEXT:
02625 case SCI_STATUSB:
02626 case SCI_LABEL:
02627 case SCI_UIMENU:
02628 default:
02629 return -1 ;
02630 break;
02631 }
02632 return 0 ;
02633 }
02634
02636 int
02637 sciSetIsClipping( sciPointObj * pobj, int value )
02638 {
02639
02640 if ( sciGetIsClipping( pobj ) == value )
02641 {
02642
02643 return 1 ;
02644 }
02645 return sciInitIsClipping( pobj, value ) ;
02646
02647 }
02648
02649
02655 int
02656 sciSetClipping (sciPointObj * pobj, double pclip[4] )
02657 {
02658 int i;
02659
02660 switch (sciGetEntityType (pobj))
02661 {
02662 case SCI_SUBWIN:
02663 for(i=0;i<4;i++) pSUBWIN_FEATURE (pobj)->clip_region[i] = pclip[i];
02664 break;
02665 case SCI_ARC:
02666 for(i=0;i<4;i++) pARC_FEATURE (pobj)->clip_region[i] = pclip[i];
02667 break;
02668 case SCI_POLYLINE:
02669 for(i=0;i<4;i++) pPOLYLINE_FEATURE (pobj)->clip_region[i] = pclip[i];
02670 break;
02671 case SCI_RECTANGLE:
02672 for(i=0;i<4;i++) pRECTANGLE_FEATURE (pobj)->clip_region[i] = pclip[i];
02673 break;
02674 case SCI_SEGS:
02675 for(i=0;i<4;i++) pSEGS_FEATURE (pobj)->clip_region[i] = pclip[i];
02676 break;
02677 case SCI_TEXT:
02678 for(i=0;i<4;i++) pTEXT_FEATURE (pobj)->clip_region[i] = pclip[i];
02679 break;
02680 case SCI_LIGHT:
02681 for(i=0;i<4;i++) pLIGHT_FEATURE (pobj)->clip_region[i] = pclip[i];
02682 break;
02683 case SCI_AXES:
02684 for(i=0;i<4;i++) pAXES_FEATURE (pobj)->clip_region[i] = pclip[i];
02685 break;
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705 case SCI_LABEL:
02706 return sciSetClipping( pLABEL_FEATURE (pobj)->text, pclip ) ;
02707 break;
02708 case SCI_SURFACE:
02709 case SCI_LEGEND:
02710 case SCI_TITLE:
02711 case SCI_AGREG:
02712 case SCI_FEC:
02713 case SCI_GRAYPLOT:
02714 case SCI_FIGURE:
02715 case SCI_UIMENU:
02716 default:
02717 return -1;
02718 break;
02719 }
02720 return 0;
02721
02722 }
02723
02724
02725 int sciInitHighLight( sciPointObj * pobj, BOOL value )
02726 {
02727 switch (sciGetEntityType (pobj))
02728 {
02729 case SCI_FIGURE:
02730
02731 break;
02732 case SCI_SUBWIN:
02733
02734
02735
02736
02737 break;
02738 case SCI_TEXT:
02739 case SCI_TITLE:
02740 case SCI_LEGEND:
02741 case SCI_ARC:
02742 case SCI_SEGS:
02743 case SCI_FEC:
02744 case SCI_GRAYPLOT:
02745 case SCI_POLYLINE:
02746 case SCI_RECTANGLE:
02747 case SCI_SURFACE:
02748 case SCI_LIGHT:
02749 case SCI_AXES:
02750 case SCI_MENU:
02751 case SCI_MENUCONTEXT:
02752 case SCI_AGREG:
02753 case SCI_LABEL:
02754 case SCI_UIMENU:
02755 default:
02756 sciprint ("We cannot highlight this object\n");
02757 return -1 ;
02758 break;
02759 }
02760 return 0 ;
02761 }
02762
02767 int
02768 sciSetHighLight (sciPointObj * pobj, BOOL value)
02769 {
02770
02771 if ( sciGetHighLight( pobj ) == value )
02772 {
02773
02774 return 1 ;
02775 }
02776 return sciInitHighLight( pobj, value ) ;
02777 }
02778
02779
02780 int sciInitAddPlot( sciPointObj * pobj, BOOL value )
02781 {
02782 switch (sciGetEntityType (pobj))
02783 {
02784 case SCI_FIGURE:
02785 (sciGetGraphicMode (pobj))->addplot = value;
02786 break;
02787 case SCI_SUBWIN:
02788 (sciGetGraphicMode (pobj))->addplot = value;
02789
02790 break;
02791 case SCI_TEXT:
02792 case SCI_TITLE:
02793 case SCI_LEGEND:
02794 case SCI_ARC:
02795 case SCI_SEGS:
02796 case SCI_FEC:
02797 case SCI_GRAYPLOT:
02798 case SCI_POLYLINE:
02799 case SCI_RECTANGLE:
02800 case SCI_SURFACE:
02801 case SCI_LIGHT:
02802 case SCI_AXES:
02803 case SCI_MENU:
02804 case SCI_MENUCONTEXT:
02805 case SCI_AGREG:
02806 case SCI_LABEL:
02807 case SCI_UIMENU:
02808 default:
02809 sciprint ("This object cannot be addploted\n");
02810 return -1 ;
02811 break;
02812 }
02813 return 0 ;
02814 }
02815
02820 int
02821 sciSetAddPlot (sciPointObj * pobj, BOOL value)
02822 {
02823 if ( sciGetAddPlot( pobj ) == value )
02824 {
02825
02826 return 1 ;
02827 }
02828 return sciInitAddPlot( pobj, value ) ;
02829
02830 }
02831
02832
02833 int sciInitAutoScale( sciPointObj * pobj, BOOL value )
02834 {
02835 switch (sciGetEntityType (pobj))
02836 {
02837 case SCI_FIGURE:
02838 if (pobj == getFigureModel())
02839 (sciGetGraphicMode (pobj))->autoscaling = value;
02840 else
02841 sciSetAutoScale(sciGetFirstTypedSelectedSon(pobj, SCI_SUBWIN),value);
02842 break;
02843 case SCI_SUBWIN:
02844 (sciGetGraphicMode (pobj))->autoscaling = value;
02845 break;
02846 case SCI_TEXT:
02847 case SCI_TITLE:
02848 case SCI_LEGEND:
02849 case SCI_ARC:
02850 case SCI_SEGS:
02851 case SCI_FEC:
02852 case SCI_GRAYPLOT:
02853 case SCI_POLYLINE:
02854 case SCI_RECTANGLE:
02855 case SCI_SURFACE:
02856 case SCI_LIGHT:
02857 case SCI_AXES:
02858 case SCI_MENU:
02859 case SCI_MENUCONTEXT:
02860 case SCI_AGREG:
02861 case SCI_LABEL:
02862 case SCI_UIMENU:
02863 default:
02864 sciprint ("This object cannot be autoscaled\n");
02865 return -1 ;
02866 break;
02867 }
02868
02869 return 0 ;
02870 }
02871
02875 int
02876 sciSetAutoScale (sciPointObj * pobj, BOOL value)
02877 {
02878
02879 if ( sciGetAutoScale( pobj ) == value )
02880 {
02881
02882 return 1 ;
02883 }
02884 return sciInitAutoScale( pobj, value ) ;
02885
02886 }
02887
02888 int sciInitZooming( sciPointObj * pobj, BOOL value )
02889 {
02890 switch (sciGetEntityType (pobj))
02891 {
02892 case SCI_FIGURE:
02893 (sciGetGraphicMode (pobj))->zooming = value;
02894 break;
02895 case SCI_SUBWIN:
02896 (sciGetGraphicMode (pobj))->zooming = value;
02897
02898 sciSetZooming (sciGetParentFigure (pobj), value);
02899 break;
02900 case SCI_TEXT:
02901 case SCI_TITLE:
02902 case SCI_LEGEND:
02903 case SCI_ARC:
02904 case SCI_SEGS:
02905 case SCI_FEC:
02906 case SCI_GRAYPLOT:
02907 case SCI_POLYLINE:
02908 case SCI_RECTANGLE:
02909 case SCI_SURFACE:
02910 case SCI_LIGHT:
02911 case SCI_AXES:
02912 case SCI_MENU:
02913 case SCI_MENUCONTEXT:
02914 case SCI_AGREG:
02915 case SCI_LABEL:
02916 case SCI_UIMENU:
02917 default:
02918 sciprint ("\r\nThis object cannot be zoomed\r\n");
02919 return -1 ;
02920 break;
02921 }
02922
02923 return 0 ;
02924 }
02925
02929 int
02930 sciSetZooming (sciPointObj * pobj, BOOL value)
02931 {
02932 if ( sciGetZooming( pobj ) == value )
02933 {
02934
02935 return 1 ;
02936 }
02937 return sciInitZooming( pobj, value ) ;
02938
02939 }
02940
02941
02947 int
02948 sciSetDefaultValues (void)
02949 {
02950 if ((sciInitGraphicContext (sciGetCurrentFigure()) == -1) ||
02951 (sciInitGraphicMode (sciGetCurrentFigure()) == -1) ||
02952 (sciInitFontContext (sciGetCurrentFigure()) == -1))
02953 {
02954 sciprint("\r\n default values cant not be loaded !");
02955 return -1 ;
02956 }
02957 else
02958 {
02959 C2F(dr)("xset","default",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,7L);
02960 return 0 ;
02961 }
02962 }
02963
02964
02965
02966 int sciInitXorMode( sciPointObj * pobj, int value )
02967 {
02968 if ( (pobj != getFigureModel()) && (pobj != getAxesModel()))
02969 {
02970 C2F(dr)("xset","alufunction",&(value),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,11L);
02971 }
02972 switch (sciGetEntityType (pobj))
02973 {
02974 case SCI_FIGURE:
02975 (sciGetGraphicMode (pobj))->xormode = value;
02976 break;
02977 case SCI_SUBWIN:
02978
02979 sciSetXorMode (sciGetParentFigure (pobj), value);
02980 break;
02981 case SCI_TEXT:
02982 case SCI_TITLE:
02983 case SCI_LEGEND:
02984 case SCI_ARC:
02985 case SCI_SEGS:
02986 case SCI_FEC:
02987 case SCI_GRAYPLOT:
02988 case SCI_POLYLINE:
02989 case SCI_RECTANGLE:
02990 case SCI_SURFACE:
02991 case SCI_LIGHT:
02992 case SCI_AXES:
02993 case SCI_MENU:
02994 case SCI_MENUCONTEXT:
02995 case SCI_AGREG:
02996 case SCI_LABEL:
02997 case SCI_UIMENU:
02998 default:
02999 sciprint ("\r\nNothing to do\n");
03000 return -1 ;
03001 break;
03002 }
03003
03004 return 0 ;
03005 }
03006
03015 int
03016 sciSetXorMode (sciPointObj * pobj, int value)
03017 {
03018
03019 if ( sciGetXorMode( pobj ) == value )
03020 {
03021
03022 return 1 ;
03023 }
03024 return sciInitXorMode( pobj, value ) ;
03025
03026 }
03027
03028 int sciInitVisibility( sciPointObj * pobj, BOOL value )
03029 {
03030
03031
03032 switch (sciGetEntityType (pobj))
03033 {
03034 case SCI_FIGURE:
03035 if (pFIGURE_FEATURE (pobj)->visible != value)
03036 {
03037 pFIGURE_FEATURE (pobj)->visible = value;
03038 }
03039 break;
03040 case SCI_SUBWIN:
03041 if (pSUBWIN_FEATURE (pobj)->visible != value)
03042 {
03043 pSUBWIN_FEATURE (pobj)->visible = value;
03044 }
03045 break;
03046 case SCI_TITLE:
03047 if (pTITLE_FEATURE (pobj)->visible != value)
03048 {
03049 pTITLE_FEATURE (pobj)->visible = value;
03050 }
03051 break;
03052 case SCI_LEGEND:
03053 if (pLEGEND_FEATURE (pobj)->visible != value)
03054 {
03055 pLEGEND_FEATURE (pobj)->visible = value;
03056 }
03057 break;
03058 case SCI_ARC:
03059 if (pARC_FEATURE (pobj)->visible != value)
03060 {
03061 pARC_FEATURE (pobj)->visible = value;
03062 }
03063 break;
03064 case SCI_POLYLINE:
03065 if (pPOLYLINE_FEATURE (pobj)->visible != value)
03066 {
03067 pPOLYLINE_FEATURE (pobj)->visible = value;
03068 }
03069 break;
03070 case SCI_RECTANGLE:
03071 if (pRECTANGLE_FEATURE (pobj)->visible != value)
03072 {
03073 pRECTANGLE_FEATURE (pobj)->visible = value;
03074 }
03075 break;
03076 case SCI_SURFACE:
03077 if (pSURFACE_FEATURE (pobj)->visible != value)
03078 {
03079 pSURFACE_FEATURE (pobj)->visible = value;
03080 }
03081 break;
03082 case SCI_SEGS:
03083 if (pSEGS_FEATURE (pobj)->visible != value)
03084 {
03085 pSEGS_FEATURE (pobj)->visible = value;
03086 }
03087 break;
03088 case SCI_FEC:
03089 if (pFEC_FEATURE (pobj)->visible != value)
03090 {
03091 pFEC_FEATURE (pobj)->visible = value;
03092 }
03093 break;
03094 case SCI_GRAYPLOT:
03095 if (pGRAYPLOT_FEATURE (pobj)->visible != value)
03096 {
03097 pGRAYPLOT_FEATURE (pobj)->visible = value;
03098 }
03099 break;
03100 case SCI_TEXT:
03101 if (pTEXT_FEATURE (pobj)->visible != value)
03102 {
03103 pTEXT_FEATURE (pobj)->visible = value;
03104 }
03105 break;
03106 case SCI_LIGHT:
03107 if(pLIGHT_FEATURE (pobj)->visible != value)
03108 {
03109 pLIGHT_FEATURE (pobj)->visible = value;
03110 }
03111
03112 break;
03113 case SCI_AXES:
03114 if (pAXES_FEATURE (pobj)->visible != value)
03115 {
03116 pAXES_FEATURE (pobj)->visible = value;
03117 }
03118 break;
03119 case SCI_AGREG:
03120 if (pAGREG_FEATURE (pobj)->visible != value )
03121 {
03122 pAGREG_FEATURE (pobj)->visible = value;
03123 }
03124 break;
03125 case SCI_LABEL:
03126 return sciInitVisibility( pLABEL_FEATURE(pobj)->text, value ) ;
03127 break;
03128 case SCI_UIMENU:
03129 if (pUIMENU_FEATURE(pobj)->visible != value)
03130 {
03131 pUIMENU_FEATURE(pobj)->visible=value;
03132 }
03133 break;
03134 case SCI_CONSOLE:
03135 pCONSOLE_FEATURE(pobj)->visible = value ;
03136 break;
03137 case SCI_FRAME:
03138 pFRAME_FEATURE(pobj)->visible = value ;
03139 break;
03140 case SCI_WINDOW:
03141 pWINDOW_FEATURE(pobj)->visible = value ;
03142 break;
03143 case SCI_WINDOWFRAME:
03144 pWINDOWFRAME_FEATURE(pobj)->visible = value ;
03145 break;
03146 case SCI_SCREEN:
03147 pSCREEN_FEATURE(pobj)->visible = value ;
03148 break;
03149
03150 case SCI_SBH:
03151 case SCI_PANNER:
03152 case SCI_SBV:
03153 case SCI_MENU:
03154 case SCI_MENUCONTEXT:
03155 case SCI_STATUSB:
03156 default:
03157 return -1 ;
03158 break;
03159 }
03160 return 0 ;
03161 }
03162
03164 int
03165 sciSetVisibility (sciPointObj * pobj, BOOL value)
03166 {
03167 if ( sciGetVisibility( pobj ) == value )
03168 {
03169
03170 return 1 ;
03171 }
03172 return sciInitVisibility( pobj, value ) ;
03173
03174 }
03175
03176
03177 int sciInitResize( sciPointObj * pobj, BOOL value )
03178 {
03179 integer num1 = (value ? 1 : 0);
03180
03181 if ( (pobj != getFigureModel()) && (pobj != getAxesModel()))
03182 {
03183 if (sciGetScilabXgc (pobj)->CurResizeStatus != num1)
03184 {
03185 C2F(dr)("xset","wresize",&(num1),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,5L);
03186 }
03187 }
03188 switch (sciGetEntityType (pobj))
03189 {
03190 case SCI_FIGURE:
03191 (sciGetGraphicMode (pobj))->wresize = value;
03192 break;
03193 case SCI_SUBWIN:
03194 (sciGetGraphicMode (pobj))->wresize = value;
03195 break;
03196 case SCI_TEXT:
03197 case SCI_TITLE:
03198 case SCI_LEGEND:
03199 case SCI_ARC:
03200 case SCI_SEGS:
03201 case SCI_FEC:
03202 case SCI_GRAYPLOT:
03203 case SCI_POLYLINE:
03204 case SCI_RECTANGLE:
03205 case SCI_SURFACE:
03206 case SCI_LIGHT:
03207 case SCI_AXES:
03208 case SCI_MENU:
03209 case SCI_MENUCONTEXT:
03210 case SCI_AGREG:
03211 case SCI_LABEL:
03212 case SCI_UIMENU:
03213 default:
03214 sciprint ("This object cannot be resized\n");
03215 return -1 ;
03216 break;
03217 }
03218 return 0 ;
03219 }
03220
03226 int
03227 sciSetResize (sciPointObj * pobj, BOOL value)
03228 {
03229
03230 if ( sciGetResize( pobj ) == value )
03231 {
03232
03233 return 1 ;
03234 }
03235 return sciInitResize( pobj, value ) ;
03236
03237 }
03238
03239
03240
03248 int
03249 sciSetName (sciPointObj * pobj, char *pvalue, int length)
03250 {
03251 switch (sciGetEntityType (pobj))
03252 {
03253 case SCI_FIGURE:
03254 {
03255
03256 int realLength = length + 1 ;
03257 int percentStatus = 0 ;
03258 if( realLength > SCI_FIGURE_NAME_LENGTH )
03259 {
03260 sciprint("Warning: Figure name is limited to %d characters.\n", SCI_FIGURE_NAME_LENGTH - 1 );
03261 return -1 ;
03262 }
03263
03264 percentStatus = checkPercent( pvalue ) ;
03265 if ( percentStatus < 0 )
03266 {
03267 sciprint("Figure name may not contains any %% character, except a single %%d.\n") ;
03268 return -1 ;
03269 }
03270
03271 strcpy (pFIGURE_FEATURE (pobj)->name, pvalue ) ;
03272 pFIGURE_FEATURE (pobj)->namelen = length ;
03273
03274 if (pobj != getFigureModel())
03275 {
03276 char * str = NULL ;
03277 if ( percentStatus == 0 )
03278 {
03279 str = CALLOC( realLength, sizeof(char) ) ;
03280 if ( str == NULL )
03281 {
03282 sciprint("No more memory left.\n");
03283 return -1 ;
03284 }
03285 strcpy( str, pvalue ) ;
03286 }
03287 else
03288 {
03289
03290
03291 int figureNumber = sciGetNum( pobj ) ;
03292 int nbDigits = GET_NB_DIGITS( figureNumber ) ;
03293 realLength = realLength + nbDigits - 2 ;
03294 str = CALLOC( realLength, sizeof(char) ) ;
03295 if ( str == NULL )
03296 {
03297 sciprint("No more memory left.\n");
03298 return -1 ;
03299 }
03300 sprintf( str, pvalue, figureNumber ) ;
03301 length = realLength - 1 ;
03302 }
03303 C2F(dr)("xname",str,PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,5L,(long) length ) ;
03304 FREE(str) ;
03305 }
03306
03307 break;
03308 }
03309 case SCI_SUBWIN:
03310 case SCI_AGREG:
03311 default:
03312 sciprint ("Only Figure can be named\n");
03313 return -1 ;
03314 break;
03315 }
03316 return 0 ;
03317 }
03318
03319 int sciInitNum( sciPointObj * pobj, int * value )
03320 {
03321 switch (sciGetEntityType (pobj))
03322 {
03323 case SCI_FIGURE:
03324 pFIGURE_FEATURE (pobj)->number = *value;
03325 break;
03326 case SCI_SUBWIN:
03327 pSUBWIN_FEATURE (pobj)->number = *value;
03328 sciSetNum (sciGetParentFigure (pobj), value);
03329 break;
03330 case SCI_AGREG:
03331 default:
03332 sciprint ("Only Figure be numerated\n");
03333 return -1 ;
03334 break;
03335 }
03336 return 0 ;
03337 }
03338
03344 int
03345 sciSetNum (sciPointObj * pobj, int *value )
03346 {
03347
03348 if ( sciGetNum(pobj) == *value )
03349 {
03350
03351 return 1 ;
03352 }
03353 return sciInitNum( pobj, value ) ;
03354
03355 }
03356
03357 int sciInitDim( sciPointObj * pobj, int * pwidth, int * pheight )
03358 {
03359 switch (sciGetEntityType (pobj))
03360 {
03361 case SCI_FIGURE:
03362 pFIGURE_FEATURE (pobj)->figuredimwidth = *pwidth;
03363 pFIGURE_FEATURE (pobj)->figuredimheight = *pheight;
03364 break;
03365 case SCI_SUBWIN:
03366 pSUBWIN_FEATURE (pobj)->windimwidth = *pwidth;
03367 pSUBWIN_FEATURE (pobj)->windimheight = *pheight;
03368 if (pobj != getAxesModel())
03369 C2F(dr)("xset","wdim",pwidth, pheight,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,4L);
03370 break;
03371 case SCI_CONSOLE:
03372
03373 break;
03374 case SCI_AGREG:
03375 default:
03376 sciprint ("Object can not have a size.\n");
03377 return -1 ;
03378 break;
03379 }
03380 return 0 ;
03381 }
03382
03383
03391 int
03392 sciSetDim (sciPointObj * pobj, int *pwidth, int *pheight)
03393 {
03394
03395 int width ;
03396 int height ;
03397 sciGetDim( pobj, &width, &height ) ;
03398 if ( width == *pwidth && height == *pheight )
03399 {
03400 return 1 ;
03401 }
03402 return sciInitDim( pobj, pwidth, pheight ) ;
03403
03404 }
03405
03406 int sciInitScreenPosition( sciPointObj * pobj, int pposx, int pposy )
03407 {
03408 integer y=0,cur,num,na ;
03409 switch (sciGetEntityType (pobj))
03410 {
03411 case SCI_FIGURE:
03412 if (pobj != getFigureModel()) {
03413 num=pFIGURE_FEATURE(pobj)->number;
03414 C2F(dr)("xget","window",&y,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03415 C2F(dr)("xset","window",&num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03416 C2F(dr)("xset","wpos",&pposx,&pposy,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,4L);
03417 C2F(dr)("xset","window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
03418
03419 }
03420 pFIGURE_FEATURE (pobj)->inrootposx = pposx;
03421 pFIGURE_FEATURE (pobj)->inrootposy = pposy;
03422 return 0;
03423 break;
03424 case SCI_CONSOLE:
03425
03426 break ;
03427 case SCI_FRAME:
03428
03429 break ;
03430 case SCI_WINDOW:
03431
03432 break ;
03433 case SCI_WINDOWFRAME:
03434
03435 break ;
03436 case SCI_SCREEN:
03437
03438 break ;
03439 default:
03440 sciprint ("Only Figure can return position\n");
03441 return -1;
03442 break;
03443 }
03444 return 0;
03445 }
03446
03450 int
03451 sciSetScreenPosition(sciPointObj * pobj, int pposx, int pposy)
03452 {
03453 int posX ;
03454 int posY ;
03455 sciGetScreenPosition( pobj, &posX, &posY ) ;
03456 if ( posX == pposx && posY == pposy )
03457 {
03458
03459 return 1 ;
03460 }
03461 return sciInitScreenPosition( pobj, pposx, pposy ) ;
03462
03463 }
03464
03465 int sciInitFigureIconify( sciPointObj * pobj, BOOL value )
03466 {
03467 switch (sciGetEntityType (pobj))
03468 {
03469 case SCI_FIGURE:
03470 pFIGURE_FEATURE (pobj)->isiconified = value;
03471 break;
03472 default:
03473 return sciSetFigureIconify(sciGetCurrentFigure(), value);
03474 break;
03475 }
03476 return 0 ;
03477 }
03478
03485 int
03486 sciSetFigureIconify (sciPointObj * pobj, BOOL value)
03487 {
03488 if ( sciGetIsFigureIconified( pobj ) == value )
03489 {
03490 return 1 ;
03491 }
03492 return sciInitFigureIconify( pobj, value ) ;
03493
03494 }
03495
03496 int sciInitSubWindowPos( sciPointObj * pobj, int *pposx, int *pposy)
03497 {
03498 switch (sciGetEntityType (pobj))
03499 {
03500 case SCI_SUBWIN:
03501
03502 pSUBWIN_FEATURE (pobj)->infigureposx = *pposx;
03503 pSUBWIN_FEATURE (pobj)->infigureposy = *pposy;
03504 return 0;
03505
03506 break;
03507 case SCI_AGREG:
03508 default:
03509 sciprint ("Only subwin can be return position\n");
03510 return -1;
03511 break;
03512 }
03513 return 0 ;
03514 }
03515
03524 int
03525 sciSetSubWindowPos (sciPointObj * pobj, int *pposx, int *pposy)
03526 {
03527
03528 if ( sciGetSubwindowPosX( pobj ) == *pposx && sciGetSubwindowPosY( pobj ) == *pposy )
03529 {
03530 return 1 ;
03531 }
03532 return sciInitSubWindowPos( pobj, pposx, pposy ) ;
03533 }
03534
03535
03536
03537
03538
03539
03540 void sciSelectFirstSubwin( sciPointObj * parentFigure )
03541 {
03542 sciSons * figureSons = sciGetSons ( parentFigure ) ;
03543 if ( figureSons != (sciSons *) NULL )
03544 {
03545
03546 while ( (figureSons->pnext != (sciSons *) NULL)
03547 && (sciGetEntityType (figureSons->pointobj) != SCI_SUBWIN))
03548 {
03549 figureSons = figureSons->pnext;
03550 }
03551
03552 if( sciGetEntityType (figureSons->pointobj) == SCI_SUBWIN )
03553 {
03554
03555 sciSetSelectedSubWin (figureSons->pointobj);
03556 }
03557 else
03558 {
03559 sciSetSelectedSubWin(NULL);
03560 }
03561 }
03562 }
03563
03564
03565 int sciInitSelectedSubWin( sciPointObj * psubwinobj )
03566 {
03567 sciSubWindow * ppSubWin = pSUBWIN_FEATURE ( psubwinobj ) ;
03568
03569 sciInitSelectedObject( psubwinobj ) ;
03570
03571 set_scale ("tttftt", ppSubWin->WRect,
03572 ppSubWin->FRect, NULL,
03573 ppSubWin->logflags, ppSubWin->ARect);
03574
03575
03576 return 0 ;
03577 }
03578
03584 int
03585 sciSetSelectedSubWin (sciPointObj * psubwinobj)
03586 {
03587
03588
03589
03590 if (sciGetEntityType (psubwinobj) != SCI_SUBWIN)
03591 {
03592 sciprint("This Handle is not a SubWindow\n");
03593 return -1;
03594 }
03595
03596
03597 if (sciGetIsSelected(psubwinobj))
03598 {
03599
03600 return 1 ;
03601 }
03602
03603 return sciInitSelectedSubWin( psubwinobj ) ;
03604 }
03605
03606
03607 int sciInitSelectedObject( sciPointObj * pObj )
03608 {
03609 sciAddUniqueSelectedSon(sciGetParent(pObj), pObj ) ;
03610 return 0 ;
03611 }
03612
03617 int sciSetSelectedObject( sciPointObj * pObj )
03618 {
03619 if ( sciGetIsSelected(pObj) )
03620 {
03621
03622 return 1 ;
03623 }
03624 return sciInitSelectedObject( pObj ) ;
03625 }
03626
03627
03634 int
03635 sciSetOriginalSubWin (sciPointObj * pfigure, sciPointObj * psubwin)
03636 {
03637 pFIGURE_FEATURE(pfigure)->originalsubwin0011 = psubwin;
03638 return 0;
03639 }
03640
03645 int
03646 sciSetPoint(sciPointObj * pthis, double *tab, int *numrow, int *numcol)
03647 {
03648 int i,n1,k,k1,k2;
03649 double * pvx = NULL ;
03650 double * pvy = NULL ;
03651 double * pvz = NULL ;
03652 double * pvfx = NULL ;
03653 double * pvfy = NULL ;
03654 double * pvfz = NULL ;
03655 int * pstyle = NULL;
03656
03657 switch (sciGetEntityType (pthis))
03658 {
03659 case SCI_POLYLINE:
03660 n1=pPOLYLINE_FEATURE (pthis)->n1;
03661 if ( (*numcol != 3) && (*numcol != 2) && (*numcol != 0) )
03662 {
03663 sciprint("The number of columns must be 2 (3 if three-dimensional axes) \n");
03664 return -1;
03665 }
03666 if (*numrow != n1)
03667 {
03668
03669 FREE(pPOLYLINE_FEATURE (pthis)->pvx); pPOLYLINE_FEATURE (pthis)->pvx = NULL;
03670 FREE(pPOLYLINE_FEATURE (pthis)->pvy); pPOLYLINE_FEATURE (pthis)->pvy = NULL;
03671 FREE(pPOLYLINE_FEATURE (pthis)->pvz); pPOLYLINE_FEATURE (pthis)->pvz = NULL;
03672
03673 n1=*numrow;
03674
03675 if ( *numcol > 0 )
03676 {
03677 if ((pvx = MALLOC (n1 * sizeof (double))) == NULL) return -1;
03678 if ((pvy = MALLOC (n1 * sizeof (double))) == NULL)
03679 {
03680 FREE(pvx); pvx = (double *) NULL;
03681 return -1;
03682 }
03683 if (*numcol == 3)
03684 {
03685 if ((pvz = MALLOC (n1 * sizeof (double))) == NULL)
03686 {
03687 FREE(pvx); pvx = (double *) NULL;
03688 FREE(pvy); pvy = (double *) NULL;
03689 return -1;
03690 }
03691 }
03692
03693 for ( i = 0 ; i < *numrow ; i++ )
03694 {
03695 pvx[i] = tab[i];
03696 pvy[i] = tab[i+ (*numrow)];
03697 if (*numcol == 3)
03698 {
03699 pvz[i] = tab[i+ 2*(*numrow)];
03700 }
03701 }
03702 pPOLYLINE_FEATURE (pthis)->pvx=pvx;
03703 pPOLYLINE_FEATURE (pthis)->pvy=pvy;
03704 pPOLYLINE_FEATURE (pthis)->pvz=pvz;
03705 }
03706
03707 pPOLYLINE_FEATURE (pthis)->n1 = n1 ;
03708 pPOLYLINE_FEATURE (pthis)->dim_icv = n1 ;
03709
03710 }
03711 else
03712 {
03713 for (i=0;i < *numrow;i++)
03714 {
03715 pPOLYLINE_FEATURE (pthis)->pvx[i] = tab[i];
03716 pPOLYLINE_FEATURE (pthis)->pvy[i] = tab[i+ (*numrow)];
03717 }
03718 if (*numcol == 3)
03719 {
03720 if(pPOLYLINE_FEATURE (pthis)->pvz==NULL)
03721 if ((pPOLYLINE_FEATURE (pthis)->pvz = MALLOC ((*numrow) * sizeof (double))) == NULL)
03722 return -1;
03723
03724 for (i=0;i < *numrow;i++)
03725 pPOLYLINE_FEATURE (pthis)->pvz[i] = tab[i+ 2*(*numrow)];
03726 }
03727 else
03728 {
03729 FREE(pPOLYLINE_FEATURE (pthis)->pvz);
03730 pPOLYLINE_FEATURE (pthis)->pvz=NULL;
03731 }
03732 }
03733
03734
03735
03736 return 0;
03737 break;
03738 case SCI_RECTANGLE:
03739 {
03740 int widthIndex = 2 ;
03741 int size = *numrow * *numcol ;
03742 if ( size != 5 && size != 4 )
03743 {
03744 sciprint("The number of element must be 4 (5 if z coordinate )\n");
03745 return -1;
03746 }
03747
03748 pRECTANGLE_FEATURE (pthis)->x = tab[0] ;
03749 pRECTANGLE_FEATURE (pthis)->y = tab[1] ;
03750
03751 if ( size == 5 )
03752 {
03753 pRECTANGLE_FEATURE (pthis)->z = tab[2] ;
03754 widthIndex = 3 ;
03755 }
03756
03757
03758 if ( tab[widthIndex] < 0.0 || tab[widthIndex + 1] < 0.0 )
03759 {
03760 Scierror(999,"Width and height must be positive.\n") ;
03761 return -1 ;
03762 }
03763 pRECTANGLE_FEATURE (pthis)->width = tab[widthIndex ] ;
03764 pRECTANGLE_FEATURE (pthis)->height = tab[widthIndex + 1] ;
03765
03766 return 0;
03767 }
03768 break;
03769 case SCI_ARC:
03770 if ((*numrow * *numcol != 7)&&(*numrow * *numcol != 6))
03771 {
03772 sciprint("The number of elements must be 6 (7 if z coordinate )\n");
03773 return -1;
03774 }
03775
03776 pARC_FEATURE (pthis)->x = tab[0];
03777 pARC_FEATURE (pthis)->y = tab[1];
03778 if (pSUBWIN_FEATURE (sciGetParentSubwin(pthis))->is3d)
03779 {
03780 pARC_FEATURE (pthis)->z = tab[2];
03781 pARC_FEATURE (pthis)->width = tab[3];
03782 pARC_FEATURE (pthis)->height = tab[4];
03783 pARC_FEATURE (pthis)->alphabegin = tab[5];
03784 pARC_FEATURE (pthis)->alphaend = tab[6];
03785 }
03786 else
03787 {
03788 pARC_FEATURE (pthis)->width = tab[2];
03789 pARC_FEATURE (pthis)->height = tab[3];
03790 pARC_FEATURE (pthis)->alphabegin = tab[4];
03791 pARC_FEATURE (pthis)->alphaend = tab[5];
03792 }
03793 return 0;
03794 break;
03795 case SCI_TEXT:
03796 if ((*numrow * *numcol != 2)&&(*numrow * *numcol != 3))
03797 {
03798 sciprint("The number of elements must be 2 (3 if z coordinate)\n");
03799 return -1;
03800 }
03801 pTEXT_FEATURE (pthis)->x = tab[0];
03802 pTEXT_FEATURE (pthis)->y = tab[1];
03803 if (pSUBWIN_FEATURE (sciGetParentSubwin(pthis))->is3d)
03804 pTEXT_FEATURE (pthis)->z = tab[2];
03805 return 0;
03806 break;
03807 case SCI_SEGS:
03808 if (pSEGS_FEATURE (pthis)->ptype <= 0) {
03809 if ((*numcol != 3)&&(*numcol != 2)) {
03810 sciprint("The number of columns must be 2 (3 if three-dimensional axes) \n");
03811 return -1;
03812 }
03813 n1=pSEGS_FEATURE (pthis)->Nbr1;
03814 if (*numrow != n1) {
03815 n1=*numrow;
03816 if ((pvx = MALLOC (n1 * sizeof (double))) == NULL) return -1;
03817 if ((pvy = MALLOC (n1 * sizeof (double))) == NULL) {
03818 FREE(pvx); pvx = (double *) NULL;
03819 return -1;
03820 }
03821 if (*numcol == 3)
03822 if ((pvz = MALLOC (n1 * sizeof (double))) == NULL) {
03823 FREE(pvx); pvx = (double *) NULL;
03824 FREE(pvy); pvy = (double *) NULL;
03825 return -1;
03826 }
03827 if ((pstyle = MALLOC (n1 * sizeof (int))) == NULL) {
03828 FREE(pvx); pvx = (double *) NULL;
03829 FREE(pvy); pvy = (double *) NULL;
03830 FREE(pvz); pvz = (double *) NULL;
03831 return -1;
03832 }
03833 FREE(pSEGS_FEATURE (pthis)->vx); pSEGS_FEATURE (pthis)->vx = NULL;
03834 FREE(pSEGS_FEATURE (pthis)->vy); pSEGS_FEATURE (pthis)->vx = NULL;
03835 if (*numcol == 3)
03836 FREE(pSEGS_FEATURE (pthis)->vz); pSEGS_FEATURE (pthis)->vz = NULL;
03837
03838 FREE(pSEGS_FEATURE (pthis)->pstyle); pSEGS_FEATURE (pthis)->pstyle = NULL;
03839 for (i=0;i < *numrow;i++)
03840 {
03841 pvx[i] = tab[i];
03842 pvy[i] = tab[i+ (*numrow)];
03843 if (*numcol == 3)
03844 pvz[i] = tab[i+ 2*(*numrow)];
03845 pstyle[i] = 0;
03846 }
03847 pSEGS_FEATURE (pthis)->vx=pvx;
03848 pSEGS_FEATURE (pthis)->vy=pvy;
03849 if (*numcol == 3)
03850 pSEGS_FEATURE (pthis)->vz=pvz;
03851 pSEGS_FEATURE (pthis)->Nbr1=n1;
03852 pSEGS_FEATURE (pthis)->pstyle=pstyle;
03853 }
03854 else {
03855 if ((*numcol == 3) && (pSEGS_FEATURE (pthis)->vz == NULL))
03856 if ((pSEGS_FEATURE (pthis)->vz = MALLOC (n1 * sizeof (double))) == NULL) return -1;
03857
03858 for (i=0;i < *numrow;i++) {
03859 pSEGS_FEATURE (pthis)->vx[i] = tab[i];
03860 pSEGS_FEATURE (pthis)->vy[i] = tab[i+ (*numrow)];
03861 if (*numcol == 3)
03862 pSEGS_FEATURE (pthis)->vz[i] = tab[i+ 2*(*numrow)];
03863 }
03864 }
03865 }
03866 else {
03867
03868
03869 n1=pSEGS_FEATURE (pthis)->Nbr1;
03870 if (*numrow != n1)
03871 {
03872 n1=*numrow;
03873 if ((pvx = MALLOC (n1 * sizeof (double))) == NULL) return -1;
03874 if ((pvy = MALLOC (n1 * sizeof (double))) == NULL) {
03875 FREE(pvx); pvx = (double *) NULL;
03876 return -1;
03877 }
03878 if ((pstyle = MALLOC (n1 * sizeof (int))) == NULL) {
03879 FREE(pvx); pvx = (double *) NULL;
03880 FREE(pvy); pvy = (double *) NULL;
03881 FREE(pvz); pvz = (double *) NULL;
03882 return -1;
03883 }
03884 if ((pvfx = MALLOC ((n1*n1) * sizeof (double))) == NULL) return -1;
03885 if ((pvfy = MALLOC ((n1*n1) * sizeof (double))) == NULL) {
03886 FREE(pvx); pvx = (double *) NULL;
03887 FREE(pvy); pvy = (double *) NULL;
03888 FREE(pvz); pvz = (double *) NULL;
03889 FREE(pvfx); pvfx = (double *) NULL;
03890 return -1;
03891 }
03892 if (*numcol == 3 +3*(*numrow * *numrow))
03893 {
03894 if ((pvz = MALLOC (n1 * sizeof (double))) == NULL) {
03895 FREE(pvx); pvx = (double *) NULL;
03896 FREE(pvy); pvy = (double *) NULL;
03897 return -1;
03898 }
03899 if ((pvfz = MALLOC ((n1*n1) * sizeof (double))) == NULL) {
03900 FREE(pvx); pvx = (double *) NULL;
03901 FREE(pvy); pvy = (double *) NULL;
03902 FREE(pvz); pvz = (double *) NULL;
03903 FREE(pvfx); pvfx = (double *) NULL;
03904 FREE(pvfy); pvfy = (double *) NULL;
03905 return -1;
03906 }
03907 FREE(pSEGS_FEATURE (pthis)->vz); pSEGS_FEATURE (pthis)->vz = NULL;
03908 FREE(pSEGS_FEATURE (pthis)->vfz); pSEGS_FEATURE (pthis)->vfz = NULL;
03909 }
03910 FREE(pSEGS_FEATURE (pthis)->vx); pSEGS_FEATURE (pthis)->vx = NULL;
03911 FREE(pSEGS_FEATURE (pthis)->vy); pSEGS_FEATURE (pthis)->vy = NULL;
03912 FREE(pSEGS_FEATURE (pthis)->vfx); pSEGS_FEATURE (pthis)->vfx = NULL;
03913 FREE(pSEGS_FEATURE (pthis)->vfy); pSEGS_FEATURE (pthis)->vfy = NULL;
03914 for (i=0;i < n1;i++)
03915 {
03916 pvx[i] = tab[i];
03917 pvy[i] = tab[i+ (*numrow)];
03918 if (*numcol == 3 +3*(*numrow * *numrow))
03919 pvz[i] = tab[i+ 2*(*numrow)];
03920
03921 }
03922 k=3*n1;
03923 for (i=0;i < n1*n1;i++)
03924 {
03925 pvfx[i] = tab[k+i];
03926 pvfy[i] = tab[k+n1*n1+i];
03927 if (*numcol == 3 +3*(*numrow * *numrow))
03928 pvfz[i] = tab[2*k+n1*n1+i];
03929
03930 }
03931 pSEGS_FEATURE (pthis)->vx=pvx;
03932 pSEGS_FEATURE (pthis)->vy=pvy;
03933 pSEGS_FEATURE (pthis)->vx=pvfx;
03934 pSEGS_FEATURE (pthis)->vy=pvfy;
03935 pSEGS_FEATURE (pthis)->Nbr1=n1;
03936 if (*numcol == 3 +3*(*numrow * *numrow))
03937 {
03938 pSEGS_FEATURE (pthis)->vz=pvz;
03939 pSEGS_FEATURE (pthis)->vy=pvfz;
03940 }
03941
03942 }
03943 else {
03944 for (i=0;i < *numrow;i++) {
03945 pSEGS_FEATURE (pthis)->vx[i] = tab[i];
03946 pSEGS_FEATURE (pthis)->vy[i] = tab[i+ (*numrow)];
03947 if (pSEGS_FEATURE (pthis)->vz != (double *)NULL)
03948 pSEGS_FEATURE (pthis)->vz[i] = tab[i+ 2*(*numrow)];
03949 }
03950 k=2* (*numrow);
03951 k1=k+ (*numrow * *numrow);
03952 k2=2*k+ (*numrow * *numrow);
03953 for (i=0;i < *numrow * *numrow ;i++) {
03954 pSEGS_FEATURE (pthis)->vfx[i] = tab[k+i];
03955 pSEGS_FEATURE (pthis)->vfy[i] = tab[k1+i];
03956 if (pSEGS_FEATURE (pthis)->vfz != (double *)NULL)
03957 pSEGS_FEATURE (pthis)->vfz[i] = tab[k2+i];
03958 }
03959 }
03960 }
03961 return 0;
03962 break;
03963
03964
03965 case SCI_SURFACE:
03966 sciprint ("Un handled data field\n");
03967 return -1;
03968 break;
03969 case SCI_GRAYPLOT:
03970 if (pGRAYPLOT_FEATURE (pthis)->type == 0) {
03971 double *pvecx,*pvecy,*pvecz;
03972 int nx,ny;
03973 nx=*numrow-1;
03974 ny=*numcol-1;
03975 if (pGRAYPLOT_FEATURE (pthis)->ny!=ny || pGRAYPLOT_FEATURE (pthis)->nx!=nx) {
03976 if ((pvecx = CALLOC(nx,sizeof(double))) == NULL) {
03977 sciprint ("Not enough memory\n");
03978 return -1;}
03979 if ((pvecy = CALLOC(ny,sizeof(double))) == NULL) {
03980 FREE(pvecx);
03981 sciprint ("Not enough memory\n");
03982 return -1;}
03983 if ((pvecz = CALLOC(nx*ny,sizeof(double))) == NULL) {
03984 FREE(pvecx);FREE(pvecy);
03985 sciprint ("Not enough memory\n");
03986 return -1;}
03987 FREE(pGRAYPLOT_FEATURE (pthis)->pvecx);pGRAYPLOT_FEATURE (pthis)->pvecx=pvecx;
03988 FREE(pGRAYPLOT_FEATURE (pthis)->pvecy);pGRAYPLOT_FEATURE (pthis)->pvecy=pvecy;
03989 FREE(pGRAYPLOT_FEATURE (pthis)->pvecz);pGRAYPLOT_FEATURE (pthis)->pvecz=pvecz;
03990 }
03991 for (i=0;i < nx;i++)
03992 pGRAYPLOT_FEATURE (pthis)->pvecx[i] = tab[i+1];
03993
03994 for (i=0;i < ny;i++)
03995 pGRAYPLOT_FEATURE (pthis)->pvecy[i] = tab[*numrow*(i+1)];
03996 for (i=0;i < ny;i++)
03997 for (k=0;k < nx;k++)
03998 pGRAYPLOT_FEATURE (pthis)->pvecz[nx*i+k]=tab[*numrow*(i+1)+k+1];
03999 pGRAYPLOT_FEATURE (pthis)->ny=ny;
04000 pGRAYPLOT_FEATURE (pthis)->nx=nx;
04001 }
04002 else {
04003 double *pvecz;
04004 int nx,ny;
04005 nx=*numrow;
04006 ny=*numcol;
04007 if (pGRAYPLOT_FEATURE (pthis)->ny!=ny+1 || pGRAYPLOT_FEATURE (pthis)->nx!=nx+1) {
04008 if ((pvecz = CALLOC(nx*ny,sizeof(double))) == NULL) {
04009 sciprint ("Not enough memory\n");
04010 return -1;}
04011 FREE(pGRAYPLOT_FEATURE (pthis)->pvecz);pGRAYPLOT_FEATURE (pthis)->pvecz=pvecz;
04012 }
04013 for (i=0;i < nx*ny;i++)
04014 pGRAYPLOT_FEATURE (pthis)->pvecz[i]=tab[i];
04015 pGRAYPLOT_FEATURE (pthis)->ny=ny+1;
04016 pGRAYPLOT_FEATURE (pthis)->nx=nx+1;
04017 }
04018 break;
04019 case SCI_FEC:
04020 {
04021 double *pvecx,*pvecy,*pfun;
04022 int Nnode;
04023 if (*numcol != 3) {
04024 sciprint ("The data must have 3 columns\n");
04025 return -1;}
04026
04027 Nnode = *numrow;
04028 if (pFEC_FEATURE (pthis)->Nnode!=Nnode) {
04029 if ((pvecx = CALLOC(Nnode,sizeof(double))) == NULL) {
04030 sciprint ("Not enough memory\n");
04031 return -1;}
04032 if ((pvecy = CALLOC(Nnode,sizeof(double))) == NULL) {
04033 sciprint ("Not enough memory\n");
04034 FREE(pvecx);
04035 return -1;}
04036 if ((pfun = CALLOC(Nnode,sizeof(double))) == NULL) {
04037 sciprint ("Not enough memory\n");
04038 FREE(pvecx);FREE(pvecy);
04039 return -1;}
04040 FREE( pFEC_FEATURE (pthis)->pvecx); pFEC_FEATURE (pthis)->pvecx=pvecx;
04041 FREE( pFEC_FEATURE (pthis)->pvecy); pFEC_FEATURE (pthis)->pvecy=pvecy;
04042 FREE( pFEC_FEATURE (pthis)->pfun); pFEC_FEATURE (pthis)->pfun=pfun;
04043 }
04044 for (i=0;i < Nnode;i++) {
04045 pFEC_FEATURE (pthis)->pvecx[i]=tab[i];
04046 pFEC_FEATURE (pthis)->pvecy[i]=tab[Nnode+i];
04047 pFEC_FEATURE (pthis)->pfun[i]=tab[2*Nnode+i];
04048 }
04049 }
04050 break;
04051 case SCI_SBV:
04052 case SCI_SBH:
04053 case SCI_FIGURE:
04054 case SCI_SUBWIN:
04055 case SCI_TITLE:
04056 case SCI_LEGEND:
04057 case SCI_LIGHT:
04058 case SCI_AXES:
04059 case SCI_PANNER:
04060 case SCI_MENU:
04061 case SCI_MENUCONTEXT:
04062 case SCI_STATUSB:
04063 case SCI_AGREG:
04064 case SCI_LABEL:
04065 case SCI_UIMENU:
04066 default:
04067 sciprint ("This object has no possibility to set points !\n");
04068 return -1;
04069 break;
04070 }
04071 return 0;
04072 }
04073
04074 int sciInitdrawmode( BOOL mode )
04075 {
04076 static sciPointObj * pobj ;
04077 pobj = sciGetFirstTypedSelectedSon(sciGetCurrentFigure(), SCI_SUBWIN);
04078 pSUBWIN_FEATURE(pobj)->visible = mode ;
04079 sciDrawObj(sciGetCurrentFigure ());
04080 return 0;
04081 }
04082
04083 int
04084 sciSetdrawmode (BOOL mode)
04085 {
04086 static sciPointObj * pobj ;
04087 pobj = sciGetFirstTypedSelectedSon(sciGetCurrentFigure(), SCI_SUBWIN);
04088 if ( sciGetdrawmode( pobj ) == mode )
04089 {
04090
04091 return 1 ;
04092 }
04093 return sciInitdrawmode( mode ) ;
04094
04095 }
04096
04097 int sciSwitchWindow(int *winnum)
04098 {
04099 struct BCG *CurXGC;
04100 static sciPointObj *mafigure;
04101 static sciPointObj *masousfen;
04102 integer v=0;
04103 double dv=0.0;
04104
04105
04106 if ( (sciPointObj *) sciIsExistingFigure(winnum) == (sciPointObj *) NULL)
04107 {
04110 C2F(dr)("xget","gc",&v,&v,&v,&v,&v,&v,(double *)&CurXGC,&dv,&dv,&dv,5L,10L);
04111
04112 if ((mafigure = ConstructFigure(NULL, CurXGC)) != NULL)
04113 {
04114 sciSetCurrentObj (mafigure);
04115 CurXGC->mafigure = mafigure;
04116 if ((masousfen = ConstructSubWin (mafigure, CurXGC->CurWindow)) != NULL) {
04117 sciSetCurrentObj (masousfen);
04118 sciSetOriginalSubWin (mafigure, masousfen);
04119 set_cf_type(1);
04120 }
04121 }
04122 else
04123 return -1;
04124
04125 }
04126 else
04127 set_cf_type(1);
04128 return 0;
04129 }
04130
04131
04135 int sciInitUsedWindow( int winNum )
04136 {
04137 int verbose = 0 ;
04138
04139 C2F(dr)("xset","window",&winNum,&verbose,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L) ;
04140
04141 return sciSwitchWindow( &winNum ) ;
04142 }
04143
04144
04148 int sciSetUsedWindow( int winNum )
04149 {
04150
04151 if ( sciGetCurPointedFigure() != NULL && sciGetNum( sciGetCurPointedFigure() ) == winNum )
04152 {
04153
04154 return 1 ;
04155 }
04156
04157 return sciInitUsedWindow( winNum ) ;
04158 }
04159
04160
04161
04162
04163
04164 int sciInitIsFilled( sciPointObj * pobj, BOOL isfilled )
04165 {
04166 switch (sciGetEntityType (pobj))
04167 {
04168 case SCI_POLYLINE:
04169 pPOLYLINE_FEATURE(pobj)->isfilled = isfilled;
04170 return 0;
04171 break;
04172 case SCI_RECTANGLE:
04173 pRECTANGLE_FEATURE(pobj)->fillflag = isfilled;
04174 return 0;
04175 break;
04176 case SCI_ARC:
04177 pARC_FEATURE(pobj)->fill = isfilled;
04178 return 0;
04179 break;
04180 case SCI_LABEL:
04181
04182 sciInitIsBoxed( pLABEL_FEATURE(pobj)->text, isfilled ) ;
04183 sciInitIsLine( pLABEL_FEATURE(pobj)->text, isfilled ) ;
04184 return sciInitIsFilled( pLABEL_FEATURE(pobj)->text, isfilled ) ;
04185 case SCI_TEXT:
04186 pTEXT_FEATURE(pobj)->isfilled = isfilled ;
04187 return 0 ;
04188 break ;
04189 case SCI_FIGURE:
04190 case SCI_SUBWIN:
04191 case SCI_SURFACE:
04192 case SCI_AXES:
04193 case SCI_LEGEND:
04194 case SCI_SEGS:
04195 case SCI_FEC:
04196 case SCI_GRAYPLOT:
04197 case SCI_MENU:
04198 case SCI_MENUCONTEXT:
04199 case SCI_STATUSB:
04200 case SCI_LIGHT:
04201 case SCI_AGREG:
04202 case SCI_PANNER:
04203 case SCI_SBH:
04204 case SCI_SBV:
04205 case SCI_TITLE:
04206 case SCI_UIMENU:
04207 default:
04208 sciprint ("This object has no isfilled \n");
04209 return -1;
04210 break;
04211 }
04212 return 0;
04213 }
04214
04218 int
04219 sciSetIsFilled (sciPointObj * pobj, BOOL isfilled)
04220 {
04221
04222 if ( sciGetIsFilled( pobj ) == isfilled )
04223 {
04224 return 1 ;
04225 }
04226 return sciInitIsFilled( pobj, isfilled ) ;
04227
04228 }
04229
04230
04231 int sciInitBoxType( sciPointObj * pobj, EAxesBoxType type )
04232 {
04233 switch (sciGetEntityType (pobj))
04234 {
04235 case SCI_SUBWIN:
04236 pSUBWIN_FEATURE(pobj)->axes.rect = type ;
04237
04238 switch ( type )
04239 {
04240 case BT_OFF:
04241 pSUBWIN_FEATURE(pobj)->axes.flag[2] = 0 ;
04242 break ;
04243 case BT_ON:
04244 pSUBWIN_FEATURE(pobj)->axes.flag[2] = 4 ;
04245 break ;
04246 case BT_HIDDEN_AXIS:
04247 pSUBWIN_FEATURE(pobj)->axes.flag[2] = 2 ;
04248 break ;
04249 case BT_BACK_HALF:
04250 pSUBWIN_FEATURE(pobj)->axes.flag[2] = 3 ;
04251 break ;
04252 }
04253 return 0;
04254 break;
04255 default:
04256 sciprint ("This object has no box type \n") ;
04257 return -1 ;
04258 break;
04259 }
04260 return 0;
04261 }
04262
04263
04264 int sciSetBoxType( sciPointObj * pobj, EAxesBoxType type )
04265 {
04266
04267 if ( sciGetBoxType( pobj ) == type )
04268 {
04269 return 1 ;
04270 }
04271 return sciInitBoxType( pobj, type ) ;
04272
04273 }
04274
04275
04276 int sciInitIsBoxed( sciPointObj * pobj, BOOL isboxed )
04277 {
04278 switch (sciGetEntityType (pobj))
04279 {
04280 case SCI_TEXT:
04281 pTEXT_FEATURE(pobj)->isboxed = isboxed;
04282 return 0;
04283 break;
04284 case SCI_SUBWIN:
04285 sciprint("Warning: SetProperty.c:sciSetIsBoxed : please use sciSetBoxType instead\n");
04286 if ( isboxed )
04287 {
04288 pSUBWIN_FEATURE(pobj)->axes.rect = BT_ON ;
04289 }
04290 else
04291 {
04292 pSUBWIN_FEATURE(pobj)->axes.rect = BT_OFF ;
04293 }
04294 return 0;
04295 break;
04296 case SCI_LABEL:
04297 case SCI_POLYLINE:
04298 case SCI_RECTANGLE:
04299 case SCI_ARC:
04300 case SCI_FIGURE:
04301 case SCI_SURFACE:
04302 case SCI_AXES:
04303 case SCI_LEGEND:
04304 case SCI_SEGS:
04305 case SCI_FEC:
04306 case SCI_GRAYPLOT:
04307 case SCI_MENU:
04308 case SCI_MENUCONTEXT:
04309 case SCI_STATUSB:
04310 case SCI_LIGHT:
04311 case SCI_AGREG:
04312 case SCI_PANNER:
04313 case SCI_SBH:
04314 case SCI_SBV:
04315 case SCI_TITLE:
04316 case SCI_UIMENU:
04317 default:
04318 sciprint ("This object has no isboxed \n");
04319 return -1;
04320 break;
04321 }
04322 return 0;
04323 }
04324
04328 int
04329 sciSetIsBoxed (sciPointObj * pobj, BOOL isboxed)
04330 {
04331
04332 if ( sciGetIsBoxed( pobj ) == isboxed )
04333 {
04334 return 1 ;
04335 }
04336 return sciInitIsBoxed( pobj, isboxed ) ;
04337
04338 }
04339
04340
04341 int
04342 sciSetInterpVector(sciPointObj * pobj, int size, int * value)
04343 {
04344 int i;
04345
04346 FREE(pPOLYLINE_FEATURE(pobj)->scvector);
04347
04348 if((pPOLYLINE_FEATURE(pobj)->scvector = MALLOC(size*sizeof(int)))==NULL){
04349 sciprint("Can not allocate room for shaded color vbector\n");
04350 return -1;
04351 }
04352
04353 for(i=0;i<size;i++)
04354 pPOLYLINE_FEATURE(pobj)->scvector[i] = value[i];
04355
04356 return 0;
04357 }
04358
04359 int sciInitPosition( sciPointObj * pobj, double x, double y )
04360 {
04361 switch (sciGetEntityType (pobj))
04362 {
04363 case SCI_LABEL:
04364 sciInitTextPosX( pLABEL_FEATURE(pobj)->text, x ) ;
04365 return sciInitTextPosY( pLABEL_FEATURE(pobj)->text, y ) ;
04366 break;
04367 case SCI_POLYLINE:
04368 case SCI_RECTANGLE:
04369 case SCI_ARC:
04370 case SCI_TEXT:
04371 case SCI_FIGURE:
04372 case SCI_SUBWIN:
04373 case SCI_SURFACE:
04374 case SCI_AXES:
04375 case SCI_FEC:
04376 case SCI_SEGS:
04377 case SCI_LEGEND:
04378 case SCI_GRAYPLOT:
04379 case SCI_LIGHT:
04380 case SCI_MENU:
04381 case SCI_MENUCONTEXT:
04382 case SCI_STATUSB:
04383 case SCI_PANNER:
04384 case SCI_SBH:
04385 case SCI_SBV:
04386 case SCI_AGREG:
04387 case SCI_TITLE:
04388 case SCI_UIMENU:
04389 default:
04390 sciprint ("This object has no position\n");
04391 return -1;
04392 break;
04393 }
04394 return 0;
04395 }
04396
04400 int
04401 sciSetPosition (sciPointObj * pobj, double x, double y)
04402 {
04403
04404 double curX ;
04405 double curY ;
04406 sciGetPosition( pobj, &curX, &curY ) ;
04407 if ( curX == x && curY == y )
04408 {
04409
04410 return 1 ;
04411 }
04412 return sciInitPosition( pobj, x, y ) ;
04413 }
04414
04415 int sciInitAutoRotation( sciPointObj * pObj, BOOL value )
04416 {
04417 switch (sciGetEntityType (pObj))
04418 {
04419 case SCI_LABEL:
04420 pLABEL_FEATURE(pObj)->auto_rotation = value ;
04421 break;
04422 case SCI_POLYLINE:
04423 case SCI_RECTANGLE:
04424 case SCI_ARC:
04425 case SCI_TEXT:
04426 case SCI_FIGURE:
04427 case SCI_SUBWIN:
04428 case SCI_SURFACE:
04429 case SCI_AXES:
04430 case SCI_FEC:
04431 case SCI_SEGS:
04432 case SCI_LEGEND:
04433 case SCI_GRAYPLOT:
04434 case SCI_LIGHT:
04435 case SCI_MENU:
04436 case SCI_MENUCONTEXT:
04437 case SCI_STATUSB:
04438 case SCI_PANNER:
04439 case SCI_SBH:
04440 case SCI_SBV:
04441 case SCI_AGREG:
04442 case SCI_TITLE:
04443 case SCI_UIMENU:
04444 default:
04445 return -1 ;
04446 break;
04447 }
04448
04449 return 0 ;
04450 }
04451
04452
04453 int sciSetAutoRotation ( sciPointObj * pObj, BOOL value )
04454 {
04455
04456 if ( sciGetAutoRotation( pObj ) == value )
04457 {
04458
04459 return 1 ;
04460 }
04461 return sciInitAutoRotation( pObj, value ) ;
04462
04463 }
04464
04465
04466 int sciInitAutoPosition( sciPointObj * pObj, BOOL value )
04467 {
04468 switch (sciGetEntityType (pObj))
04469 {
04470 case SCI_LABEL:
04471 pLABEL_FEATURE(pObj)->auto_position = value ;
04472 break;
04473 case SCI_POLYLINE:
04474 case SCI_RECTANGLE:
04475 case SCI_ARC:
04476 case SCI_TEXT:
04477 case SCI_FIGURE:
04478 case SCI_SUBWIN:
04479 case SCI_SURFACE:
04480 case SCI_AXES:
04481 case SCI_FEC:
04482 case SCI_SEGS:
04483 case SCI_LEGEND:
04484 case SCI_GRAYPLOT:
04485 case SCI_LIGHT:
04486 case SCI_MENU:
04487 case SCI_MENUCONTEXT:
04488 case SCI_STATUSB:
04489 case SCI_PANNER:
04490 case SCI_SBH:
04491 case SCI_SBV:
04492 case SCI_AGREG:
04493 case SCI_TITLE:
04494 case SCI_UIMENU:
04495 default:
04496 return -1 ;
04497 break;
04498 }
04499
04500 return 0 ;
04501 }
04502
04503
04504 int sciSetAutoPosition ( sciPointObj * pObj, BOOL value )
04505 {
04506
04507 if ( sciGetAutoPosition( pObj ) == value )
04508 {
04509
04510 return 1 ;
04511 }
04512 return sciInitAutoPosition( pObj, value ) ;
04513
04514 }
04515
04516
04517 int checkPercent( char * string )
04518 {
04519
04520 char * firstPercent = strchr( string, '%' ) ;
04521
04522 if ( firstPercent == NULL )
04523 {
04524
04525 return 0 ;
04526 }
04527 else if ( firstPercent[1] != 'd' )
04528 {
04529
04530 return -1 ;
04531 }
04532 else
04533 {
04534
04535 firstPercent++ ;
04536 firstPercent = strchr( firstPercent, '%' ) ;
04537 if ( firstPercent == NULL )
04538 {
04539
04540 return 1 ;
04541 }
04542 else
04543 {
04544 return -1 ;
04545 }
04546 }
04547 return -1 ;
04548 }
04549
04550 int sciInitAutoSize( sciPointObj * pObj, BOOL autoSize )
04551 {
04552 switch ( sciGetEntityType (pObj) )
04553 {
04554 case SCI_TEXT:
04555 pTEXT_FEATURE(pObj)->autoSize = autoSize ;
04556 return 0 ;
04557 default:
04558 sciprint ("This object hasn't any automoatic size\n");
04559 return -1 ;
04560 break;
04561 }
04562 return -1 ;
04563 }
04564
04565 int sciSetAutoSize( sciPointObj * pObj, BOOL autoSize )
04566 {
04567 if ( sciGetAutoSize( pObj ) == autoSize )
04568 {
04569
04570 return 1 ;
04571 }
04572 return sciInitAutoSize( pObj, autoSize ) ;
04573 }
04574
04575 int sciInitAlignment( sciPointObj * pObj, sciTextAlignment align )
04576 {
04577 switch (sciGetEntityType (pObj))
04578 {
04579 case SCI_TEXT:
04580 pTEXT_FEATURE(pObj)->stringsAlign = align ;
04581 return 0 ;
04582 default:
04583 sciprint ("This object has no Text Alignment\n");
04584 return -1 ;
04585 }
04586 return -1 ;
04587 }
04588
04589 int sciSetAlignment( sciPointObj * pObj, sciTextAlignment align )
04590 {
04591 if ( sciGetAlignment( pObj ) == align )
04592 {
04593
04594 return 1 ;
04595 }
04596 return sciInitAlignment( pObj, align ) ;
04597 }
04598
04599 int sciInitUserSize( sciPointObj * pObj, double width, double height )
04600 {
04601 switch( sciGetEntityType( pObj ) )
04602 {
04603 case SCI_TEXT:
04604 pTEXT_FEATURE(pObj)->userSize[0] = width ;
04605 pTEXT_FEATURE(pObj)->userSize[1] = height ;
04606 return 0 ;
04607 default:
04608 sciprint ("This object has no Specified Size\n");
04609 return -1 ;
04610 }
04611 return -1 ;
04612 }
04613
04614 int sciSetUserSize( sciPointObj * pObj, double width, double height )
04615 {
04616 double curWidth ;
04617 double curHeight ;
04618 sciGetUserSize( pObj, &curWidth, &curHeight ) ;
04619 if ( curWidth == width && curHeight == height )
04620 {
04621
04622 return 1 ;
04623 }
04624 return sciInitUserSize( pObj, width, height ) ;
04625 }
04626
04627 int sciInitCenterPos( sciPointObj * pObj, BOOL newCP )
04628 {
04629 switch( sciGetEntityType( pObj ) )
04630 {
04631 case SCI_TEXT:
04632 pTEXT_FEATURE(pObj)->centeredPos = newCP ;
04633 return 0 ;
04634 default:
04635 sciprint ("This object has no centered position.\n");
04636 return -1 ;
04637 }
04638 return -1 ;
04639 }
04640
04641 int sciSetCenterPos( sciPointObj * pObj, BOOL newCP )
04642 {
04643 if ( sciGetCenterPos( pObj ) == newCP )
04644 {
04645
04646 return 1 ;
04647 }
04648 return sciInitCenterPos( pObj, newCP ) ;
04649 }
04650
04651 int sciInitIs3d( sciPointObj * pObj, BOOL is3d )
04652 {
04653 switch( sciGetEntityType( pObj ) )
04654 {
04655 case SCI_SUBWIN:
04656 if ( is3d )
04657 {
04658 pSUBWIN_FEATURE (pObj)->is3d = TRUE ;
04659 Obj_RedrawNewAngle( pObj,
04660 pSUBWIN_FEATURE (pObj)->theta_kp,
04661 pSUBWIN_FEATURE (pObj)->alpha_kp ) ;
04662 wininfo("alpha=%.1f,theta=%.1f",
04663 pSUBWIN_FEATURE (pObj)->alpha_kp,
04664 pSUBWIN_FEATURE (pObj)->theta_kp ) ;
04665 }
04666 else
04667 {
04668
04669 if ( sciGetSurface(pObj) == NULL)
04670 {
04671 pSUBWIN_FEATURE (pObj)->is3d = FALSE;
04672 pSUBWIN_FEATURE (pObj)->project[2]= 0;
04673 }
04674 pSUBWIN_FEATURE (pObj)->theta_kp=pSUBWIN_FEATURE (pObj)->theta;
04675 pSUBWIN_FEATURE (pObj)->alpha_kp=pSUBWIN_FEATURE (pObj)->alpha;
04676 pSUBWIN_FEATURE (pObj)->alpha = 0.0;
04677 pSUBWIN_FEATURE (pObj)->theta = 270.0;
04678 if(sciGetCurrentScilabXgc () != NULL)
04679 {
04680 UpdateSubwinScale(pObj);
04681 }
04682 pSUBWIN_FEATURE(pObj)->is3d = FALSE;
04683 return 0 ;
04684 }
04685 return 0 ;
04686 case SCI_TEXT:
04687 pTEXT_FEATURE( pObj )->is3d = is3d ;
04688 return 0 ;
04689 case SCI_LABEL:
04690 return sciInitIs3d( pLABEL_FEATURE( pObj )->text, is3d ) ;
04691 default:
04692 sciprint ("This object has no 3d mode.\n");
04693 return -1 ;
04694 }
04695 return -1 ;
04696 }
04697
04701 int sciSetIs3d( sciPointObj * pObj, BOOL is3d )
04702 {
04703 if ( sciGetIs3d( pObj ) == is3d )
04704 {
04705
04706 return 1 ;
04707 }
04708 return sciInitIs3d( pObj, is3d ) ;
04709 }
04710
04711 int sciInitHiddenColor( sciPointObj * pObj, int newColor )
04712 {
04713 switch( sciGetEntityType( pObj ) )
04714 {
04715 case SCI_SUBWIN:
04716 pSUBWIN_FEATURE(pObj)->hiddencolor = newColor ;
04717 return 0 ;
04718 case SCI_SURFACE:
04719 pSURFACE_FEATURE(pObj)->hiddencolor = newColor ;
04720 return 0;
04721 default:
04722 sciprint ("This object has no hidden color.\n");
04723 return -1 ;
04724 }
04725 return -1 ;
04726 }
04727
04728 int sciSetHiddenColor( sciPointObj * pObj, int newColor )
04729 {
04730 if ( sciGetHiddenColor( pObj ) == newColor )
04731 {
04732
04733 return 1 ;
04734 }
04735 return sciInitHiddenColor( pObj, newColor ) ;
04736 }
04737
04738 int sciInitGridStyle( sciPointObj * pObj, int xStyle, int yStyle, int zStyle )
04739 {
04740 switch( sciGetEntityType( pObj ) )
04741 {
04742 case SCI_SUBWIN:
04743 pSUBWIN_FEATURE(pObj)->grid[0] = xStyle ;
04744 pSUBWIN_FEATURE(pObj)->grid[1] = yStyle ;
04745 pSUBWIN_FEATURE(pObj)->grid[2] = zStyle ;
04746 return 0 ;
04747 default:
04748 sciprint( "This object has no grid property.\n" ) ;
04749 return -1 ;
04750 }
04751 return -1 ;
04752 }
04753
04757 int sciSetGridStyle( sciPointObj * pObj, int xStyle, int yStyle, int zStyle )
04758 {
04759 int curX ;
04760 int curY ;
04761 int curZ ;
04762 sciGetGridStyle( pObj, &curX, &curY, &curZ ) ;
04763 if ( curX == xStyle && curY == yStyle && curZ == zStyle )
04764 {
04765
04766 return 1 ;
04767 }
04768 return sciInitGridStyle( pObj, xStyle, yStyle, zStyle ) ;
04769 }
04770
04771 int sciInitViewport( sciPointObj * pObj, int xSize, int ySize )
04772 {
04773 switch( sciGetEntityType( pObj ) )
04774 {
04775 case SCI_FIGURE:
04776 SciViewportMove( sciGetScilabXgc(pObj), xSize, ySize ) ;
04777 return 0 ;
04778 default:
04779 sciprint( "This object has no viewport property.\n" ) ;
04780 return -1 ;
04781 }
04782 return -1 ;
04783 }
04784
04789 int sciSetViewport( sciPointObj * pObj, int xSize, int ySize )
04790 {
04791 int curXSize = 0 ;
04792 int curYSize = 0 ;
04793 sciGetViewport( pObj, &curXSize, &curYSize ) ;
04794 if ( sciGetResize( pObj ) || ( xSize == curYSize && xSize == curYSize ) )
04795 {
04796
04797 return 1 ;
04798 }
04799
04800 return sciInitViewport( pObj, xSize, ySize ) ;
04801
04802 }
04803
04807 int sciSetInfoMessage( sciPointObj * pObj, const char * newMessage )
04808 {
04809 switch( sciGetEntityType( pObj ) )
04810 {
04811 case SCI_FIGURE:
04812 {
04813 sciFigure * ppFigure = pFIGURE_FEATURE(pObj) ;
04814
04815 if ( newMessage == NULL )
04816 {
04817 FREE( ppFigure->infoMessage ) ;
04818 ppFigure->infoMessage = NULL ;
04819 }
04820 else
04821 {
04822 int messageSize = strlen( newMessage ) + 1 ;
04823 if ( ppFigure->infoMessage != NULL )
04824 {
04825 ppFigure->infoMessage = REALLOC( ppFigure->infoMessage, messageSize * sizeof(char) ) ;
04826 }
04827 else
04828 {
04829 ppFigure->infoMessage = MALLOC( messageSize * sizeof(char) ) ;
04830 }
04831 strcpy( ppFigure->infoMessage, newMessage ) ;
04832 }
04833
04834 return 0 ;
04835 }
04836 default:
04837 sciprint( "This object has no info_message property.\n" ) ;
04838 return -1 ;
04839 }
04840 }
04841