#include <stdio.h>#include <string.h>#include <math.h>#include <stdlib.h>#include <stdarg.h>#include <time.h>#include "HandleManagement.h"#include "InitObjects.h"#include "DrawObjects.h"#include "DestroyObjects.h"#include "SetProperty.h"#include "GetProperty.h"#include "BuildObjects.h"#include "bcg.h"#include "WindowList.h"#include "../../../data_structures/includes/DoublyLinkedList.h"#include "sciprint.h"#include "CurrentObjectsManagement.h"#include "ObjectSelection.h"#include "MALLOC.h"Include dependency graph for HandleManagement.c:

Go to the source code of this file.
| int sciAddNewHandle | ( | sciPointObj * | pobj | ) |
sciAddNewHandle Returns a generated handle for this object, and put the handle and the object in the handle table
Definition at line 66 of file HandleManagement.c.
References tagHandleTab::index, long, MALLOC, NULL, PENDOFHANDLETAB, tagHandleTab::pnext, tagHandleTab::pointobj, tagHandleTab::pprev, and sciSetHandle().
Referenced by ConstructCompoundSeq(), ConstructLabel(), ConstructText(), initLabel(), and sciStandrardBuildOperations().
00067 { 00068 sciHandleTab *newhd; 00069 00070 if ((newhd = MALLOC ((sizeof (sciHandleTab)))) == NULL) 00071 return -1; 00072 newhd->pprev = PENDOFHANDLETAB;/* We have to use directly PENDOFHANDLETAB and not sciGetHandleTabPointer */ 00073 newhd->pnext = (sciHandleTab *) NULL; 00074 newhd->index = (long)pobj;/* pour l'instant je prend la valeur du pointeur comme handle !!! */ 00075 00076 newhd->pointobj = pobj; 00077 if (PENDOFHANDLETAB != (sciHandleTab *) NULL) 00078 PENDOFHANDLETAB->pnext = newhd; 00079 else 00080 newhd->pprev = (sciHandleTab *) NULL; 00081 PENDOFHANDLETAB = newhd; 00082 00083 sciSetHandle (pobj, PENDOFHANDLETAB); 00084 return 0; 00085 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL sciAddThisToItsParent | ( | sciPointObj * | pthis, | |
| sciPointObj * | pparent | |||
| ) |
sciAddThisToItsParent Sets this object to its parent. The list is pointed from the newer to the older.
Definition at line 336 of file HandleManagement.c.
References FALSE, MALLOC, NULL, sciRelationShip::plastsons, tagSons::pnext, tagSons::pointobj, tagSons::pprev, sciRelationShip::psons, sciGetRelationship(), sciSetParent(), and TRUE.
Referenced by ConstructCompound(), ConstructCompoundSeq(), ConstructLabel(), ConstructText(), graphicsmodels(), initLabel(), sciCopyObj(), sciRelocateObject(), sciStandrardBuildOperations(), and sciUnCompound().
00337 { 00338 sciSons * OneSon = NULL ; 00339 00340 if ( sciSetParent(pthis, pparent) == -1 ) 00341 { 00342 return FALSE ; 00343 } 00344 00345 if ( pparent == NULL ) 00346 { 00347 /* nothing more to do */ 00348 return TRUE ; 00349 } 00350 00351 /* Si c'est null alors il n'y a pas encore de fils d'affecte */ 00352 if ( sciGetRelationship (pparent)->psons != NULL ) 00353 { 00354 /* Il existe au moins un fils d'affecte */ 00355 /* on cree la nouvelle variable */ 00356 if ( (OneSon = MALLOC(sizeof(sciSons))) == NULL ) { return FALSE ; } 00357 OneSon->pnext = sciGetRelationship (pparent)->psons ; 00358 OneSon->pprev = NULL; 00359 sciGetRelationship(pparent)->psons->pprev = OneSon ; 00360 } 00361 else 00362 { 00363 /* C'est tout neuf alors on cree la variable */ 00364 if ( (OneSon = MALLOC( sizeof(sciSons) )) == NULL ) {return FALSE ; } 00365 OneSon->pnext = NULL ; 00366 OneSon->pprev = NULL ; 00367 sciGetRelationship(pparent)->plastsons = OneSon ; 00368 } 00369 OneSon->pointobj = pthis ; 00370 sciGetRelationship(pparent)->psons = OneSon; 00371 return TRUE; 00372 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL sciCanBeSonOf | ( | sciPointObj * | son, | |
| sciPointObj * | parent | |||
| ) |
check if an object can be the son of an other. In Scilab :
| [in] | son | object we try to move under parent |
Definition at line 598 of file HandleManagement.c.
References FALSE, NULL, SCI_AGREG, SCI_CONSOLE, SCI_FIGURE, SCI_FRAME, SCI_SCREEN, SCI_SUBWIN, SCI_WINDOW, SCI_WINDOWFRAME, and sciGetEntityType().
Referenced by sciRelocateHandles(), and sciSwapObjects().
00599 { 00600 sciEntityType parentType ; 00601 00602 if ( parent == NULL || son == NULL ) 00603 { 00604 return FALSE ; 00605 } 00606 00607 parentType = sciGetEntityType( parent ) ; 00608 switch ( sciGetEntityType( son ) ) 00609 { 00610 case SCI_SCREEN: 00611 return FALSE ; 00612 case SCI_WINDOWFRAME: 00613 return ( parentType == SCI_SCREEN ) ; 00614 case SCI_WINDOW: 00615 return ( parentType == SCI_WINDOWFRAME ) ; 00616 case SCI_FRAME: 00617 return ( parentType == SCI_WINDOW || parentType == SCI_FRAME ) ; 00618 case SCI_CONSOLE: 00619 return ( parentType == SCI_FRAME ) ; 00620 case SCI_FIGURE: 00621 return ( parentType == SCI_FRAME ) ; 00622 case SCI_SUBWIN: 00623 /* axes can only have figure parents */ 00624 return ( parentType == SCI_FIGURE ) ; 00625 default: 00626 return ( parentType == SCI_SUBWIN || parentType == SCI_AGREG ) ; 00627 } 00628 return FALSE ; 00629 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sciDelHandle | ( | sciPointObj * | pobj | ) |
sciDelHandle Removes this pointed handle from the handle table
Definition at line 103 of file HandleManagement.c.
References FREE, NULL, PENDOFHANDLETAB, tagHandleTab::pnext, tagHandleTab::pprev, sciGetHandleTabPointer(), and sciprint().
Referenced by ConstructArc(), ConstructAxes(), ConstructFec(), ConstructFigure(), ConstructGrayplot(), ConstructLabel(), ConstructLegend(), ConstructMenu(), ConstructMenuContext(), ConstructPolyline(), ConstructRectangle(), ConstructSegs(), ConstructStatusBar(), ConstructSubWin(), ConstructSurface(), ConstructText(), ConstructTitle(), ConstructUimenu(), DestroyLabel(), graphicsmodels(), initLabel(), ResetFigureToDefaultValues(), sciStandardDestroyOperations(), and sciStandrardBuildOperations().
00104 { 00105 int tmp = 0; 00106 sciHandleTab *phandletabtodel; /* point to a handle structure (prev, value, next) */ 00107 00108 /* We get the handle pointer */ 00109 tmp = 0; 00110 phandletabtodel = (sciHandleTab *) sciGetHandleTabPointer (pobj); 00111 if (phandletabtodel == (sciHandleTab *) NULL) 00112 tmp = 1; 00113 else 00114 { 00115 if (phandletabtodel->pprev == (sciHandleTab *) NULL) 00116 tmp += 2; 00117 if (phandletabtodel->pnext == (sciHandleTab *) NULL) 00118 tmp += 4; 00119 } 00120 switch (tmp) 00121 { 00122 case 0: /* le phandletabtodel->pprev != NULL et le phandletabtodel->pnext != NULL */ 00123 /*(phandletabtodel->pnext)->pprev = (phandletabtodel->pprev)->pnext; ERREUR */ 00124 (phandletabtodel->pnext)->pprev = phandletabtodel->pprev; 00125 (phandletabtodel->pprev)->pnext = phandletabtodel->pnext; 00126 FREE (phandletabtodel); 00127 break; 00128 case 2:/* le phandletabtodel->pprev == NULL et le phandletabtodel->pnext !NULL */ 00129 (phandletabtodel->pnext)->pprev = (sciHandleTab *) NULL; 00130 FREE (phandletabtodel); 00131 break; 00132 case 4:/* le phandletabtodel->pprev != NULL et le phandletabtodel->pnext == NULL */ 00133 (phandletabtodel->pprev)->pnext = (sciHandleTab *) NULL; 00134 PENDOFHANDLETAB = phandletabtodel->pprev; 00135 FREE (phandletabtodel); 00136 break; 00137 case 6:/* le phandletabtodel->pprev == NULL et le phandletabtodel->pnext == NULL */ 00138 FREE (phandletabtodel); 00139 PENDOFHANDLETAB = (sciHandleTab *) NULL; 00140 break; 00141 case 1:/* the handeltab is empty */ 00142 case 3:/* in prevision */ 00143 case 5:/* in prevision */ 00144 case 7:/* in prevision */ 00145 default: 00146 sciprint ("no handle to del\n"); 00147 return -1; 00148 break; 00149 } 00150 return 0; 00151 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL sciDelThisToItsParent | ( | sciPointObj * | pthis, | |
| sciPointObj * | pparent | |||
| ) |
sciDelThisToItsParent deletes this son object to its parent, free the son structure, but not the son object structure (for which its parent is set to null) , that have to be free manually or packed to another parent
Definition at line 381 of file HandleManagement.c.
References FALSE, FREE, NULL, sciRelationShip::plastsons, tagSons::pnext, tagSons::pointobj, tagSons::pprev, sciRelationShip::psons, sciGetRelationship(), sciprint(), and TRUE.
Referenced by ConstructArc(), ConstructAxes(), ConstructCompound(), ConstructFec(), ConstructGrayplot(), ConstructLegend(), ConstructMenu(), ConstructMenuContext(), ConstructPolyline(), ConstructRectangle(), ConstructSegs(), ConstructStatusBar(), ConstructSubWin(), ConstructSurface(), ConstructTitle(), ConstructUimenu(), DestroyLabel(), DestroyStatusBar(), graphicsmodels(), sciCopyObj(), sciRelocateObject(), sciStandardDestroyOperations(), and sciUnCompound().
00382 { 00383 int tmp = 0 ; 00384 sciSons *OneSon = NULL ; 00385 sciSons *OneSonprev = NULL ; 00386 00387 if ( pparent == NULL ) 00388 { 00389 /* nothing to do */ 00390 return TRUE ; 00391 } 00392 00393 /* recherche de l'objet a effacer*/ 00394 OneSon = (sciGetRelationship (pparent)->psons); 00395 OneSonprev = OneSon; 00396 while ( (OneSon != NULL) && (OneSon->pointobj != pthis) ) 00397 { 00398 OneSonprev = OneSon ; 00399 OneSon = OneSon->pnext; 00400 } 00401 00402 /* dans quel cas de figure somme nous ? */ 00403 if ( OneSon == NULL ) 00404 { 00405 tmp++ ; 00406 } 00407 else 00408 { 00409 if ( OneSon->pprev == NULL ) { tmp += 2 ; } 00410 if ( OneSon->pnext == NULL ) { tmp += 4 ; } 00411 } 00412 00413 switch(tmp) 00414 { 00415 case 0:/* ok<-OneSon->ok */ 00416 (OneSon->pnext)->pprev = (OneSon->pprev); 00417 (OneSon->pprev)->pnext = (OneSon->pnext); 00418 FREE(OneSon); 00419 return TRUE; 00420 break; 00421 case 2:/* ok<-OneSon->NULL */ 00422 (sciGetRelationship (pparent)->psons) = OneSon->pnext; 00423 (sciGetRelationship (pparent)->psons)->pprev = NULL ; 00424 FREE(OneSon); 00425 return TRUE; 00426 break; 00427 case 4:/* NULL<-OneSon->ok */ 00428 sciGetRelationship (pparent)->plastsons = OneSon->pprev; 00429 (sciGetRelationship (pparent)->plastsons)->pnext = NULL; 00430 FREE(OneSon); 00431 return TRUE; 00432 break; 00433 case 6:/* NULL<-OneSon->NULL */ 00434 sciGetRelationship (pparent)->plastsons = NULL; 00435 sciGetRelationship (pparent)->psons = NULL; 00436 FREE(OneSon); 00437 return TRUE; 00438 break; 00439 case 1:/* OneSon == NULL */ 00440 case 3: 00441 case 5: 00442 case 7: 00443 default : 00444 sciprint ("There is no Son in this Parent!!!!\n"); 00445 return FALSE; 00446 break; 00447 } 00448 00449 return FALSE ; 00450 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciSons* sciFindSon | ( | sciPointObj * | searchedObj, | |
| sciPointObj * | parentObj | |||
| ) |
return the first son of parentObj which points on searchObj.
| [in] | searchObj | Object we are looking for in the children list. |
| [in] | parentObj | Object containing the list of children. |
Definition at line 506 of file HandleManagement.c.
References NULL, tagSons::pnext, tagSons::pointobj, and sciGetSons().
Referenced by sciSwapObjects().
00507 { 00508 sciSons * curSon = sciGetSons( parentObj ) ; 00509 while ( curSon != NULL && curSon->pointobj != searchedObj ) 00510 { 00511 curSon = curSon->pnext ; 00512 } 00513 return curSon ; 00514 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciSons* sciGetFirstAccessibleSon | ( | sciPointObj * | pObj | ) |
return the first accessible son of an object or NULL if there is not any.
Definition at line 490 of file HandleManagement.c.
References NULL, tagSons::pnext, tagSons::pointobj, sciGetIsAccessibleChild(), and sciGetSons().
Referenced by get_children_property(), and sciGetNbAccessibleChildren().
00491 { 00492 sciSons * firstSon = sciGetSons( pObj ) ; 00493 while( firstSon != NULL && !(sciGetIsAccessibleChild( firstSon->pointobj ) ) ) 00494 { 00495 firstSon = firstSon->pnext ; 00496 } 00497 return firstSon ; 00498 }
Here is the call graph for this function:

Here is the caller graph for this function:

| long sciGetHandle | ( | sciPointObj * | pobj | ) |
sciGetHandle Returns the handle
Definition at line 157 of file HandleManagement.c.
References sciGetRelationship().
Referenced by fec(), get_children_property(), get_current_axes_property(), get_current_entity_property(), get_current_figure_property(), get_default_axes_property(), get_default_figure_property(), get_parent_property(), get_title_property(), get_x_label_property(), get_y_label_property(), get_z_label_property(), Merge3dBuildTable(), Objarc(), Objfpoly(), Objmove(), Objplot3d(), Objpoly(), Objrect(), Objstring(), Objtitle(), plot2dn(), sci_addcb(), sci_copy(), sci_delete(), sci_get(), sci_glue(), sci_newaxes(), sci_set(), sci_UImenu(), sci_unglue(), sciGetCurrentHandle(), and sciGetPointerFromHandle().
00158 { 00159 return (sciGetRelationship(pobj))->phandle->index ; 00160 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciHandleTab* sciGetHandleTabPointer | ( | sciPointObj * | pobj | ) |
sciGetHandleTabPointer Returns the handle's pointer address structure from this object
Definition at line 91 of file HandleManagement.c.
References sciRelationShip::phandle, and sciGetRelationship().
Referenced by sciDelHandle().
00092 { 00093 return sciGetRelationship (pobj)->phandle ; 00094 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciSons* sciGetLastSons | ( | sciPointObj * | pobj | ) |
sciGetLastSons Returns the pointer to the last son (in fact the first created and drawn). There is no SetSons, because a new Son calls sciAddThisToItsParent() it self
Definition at line 467 of file HandleManagement.c.
References sciRelationShip::plastsons, and sciGetRelationship().
Referenced by drawCompoundEntity(), drawFigureEntity(), drawSubWinEntity(), I3dRotation(), sci_unglue(), sciIsExistingSubWin(), sciRecursiveUpdateBaW(), SciShowAllUimenus(), sciUnCompound(), and zoom_box().
00468 { 00469 return (sciSons *)sciGetRelationship (pobj)->plastsons ; 00470 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sciGetNbFigures | ( | void | ) |
Definition at line 580 of file HandleManagement.c.
References getWins(), and ids.
Referenced by sciRelocateHandles().
00581 { 00582 int nbFigure = 0 ; 00583 int flag = 0 ; 00584 int ids ; 00585 getWins( &nbFigure, &ids, &flag ) ; 00586 return nbFigure ; 00587 }
Here is the call graph for this function:

Here is the caller graph for this function:

return the next son in the sons list which is accessible, ie which can be seen in the Scilab console. If there is not any more accessible one, then return NULL.
Definition at line 477 of file HandleManagement.c.
References NULL, tagSons::pnext, tagSons::pointobj, and sciGetIsAccessibleChild().
Referenced by get_children_property(), and sciGetNbAccessibleChildren().
00478 { 00479 sciSons * nextSon = son->pnext ; 00480 while ( nextSon != NULL && !(sciGetIsAccessibleChild( nextSon->pointobj ) ) ) 00481 { 00482 nextSon = nextSon->pnext ; 00483 } 00484 return nextSon ; 00485 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciPointObj* sciGetParent | ( | sciPointObj * | pobj | ) |
sciGetParent Returns the pointer to the parent object
Definition at line 322 of file HandleManagement.c.
References sciRelationShip::pparent, and sciGetRelationship().
Referenced by CheckForCompound(), CloneArc(), ClonePolyline(), CloneRectangle(), CloneText(), ConstructArc(), ConstructAxes(), ConstructCompound(), ConstructFec(), ConstructGrayplot(), ConstructLegend(), ConstructMenu(), ConstructMenuContext(), ConstructPolyline(), ConstructRectangle(), ConstructSegs(), ConstructStatusBar(), ConstructSubWin(), ConstructSurface(), ConstructTitle(), ConstructUimenu(), DestroyLabel(), DestroyStatusBar(), get_parent_property(), graphicsmodels(), sci_delete(), sci_glue(), sci_xset(), sciCloneConsole(), sciCloneFrame(), sciCloneScreen(), sciCloneWindow(), sciCloneWindowFrame(), sciCopyObj(), sciDelGraphicObj(), sciGetFillStyle(), sciGetIsSelected(), sciGetNum(), sciGetNumFigure(), sciGetParentFigure(), sciGetParentSubwin(), sciGetRealVisibility(), sciGetResize(), sciGetScilabXgc(), sciInitFontContext(), sciInitGraphicContext(), sciInitGraphicMode(), sciInitSelectedObject(), sciIsClicked(), sciRelocateObject(), sciStandardDestroyOperations(), sciSwapObjects(), and sciUnCompound().
00323 { 00324 return sciGetRelationship(pobj)->pparent ; 00325 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciHandleTab* sciGetpendofhandletab | ( | void | ) |
Definition at line 57 of file HandleManagement.c.
References PENDOFHANDLETAB.
Referenced by delete_sgwin_entities().
00058 { 00059 return PENDOFHANDLETAB; 00060 }
Here is the caller graph for this function:

| sciPointObj* sciGetPointerFromHandle | ( | long | handle | ) |
sciGetPointFromHandle Returns the object pointer form the handle argument
Definition at line 168 of file HandleManagement.c.
References getAxesModel(), getFigureModel(), tagHandleTab::index, NULL, PENDOFHANDLETAB, tagHandleTab::pointobj, tagHandleTab::pprev, and sciGetHandle().
Referenced by CheckForCompound(), ConstructCompound(), delete_sgwin_entities(), DrawMerge3d(), Objmove(), sci_addcb(), sci_copy(), sci_delete(), sci_draw(), sci_get(), sci_glue(), sci_set(), sci_show_window(), sci_showalluimenushandles(), sci_StringBox(), sci_UImenu(), sci_unglue(), sci_unzoom(), sciGetIdFigure(), sciRelocateHandles(), set_current_axes_property(), set_current_entity_property(), set_current_figure_property(), and swapHandles().
00169 { 00170 00171 sciHandleTab *phandletab; 00172 if ( handle != sciGetHandle(getFigureModel()) && handle != sciGetHandle(getAxesModel())) 00173 { 00174 phandletab = PENDOFHANDLETAB; 00175 while ((phandletab != NULL) && (phandletab->index != handle)) 00176 phandletab = phandletab->pprev; 00177 00178 if (phandletab == NULL) 00179 { 00180 /* sciprint ("this is not or no more a valid handle !!\n"); F.Leray Adding 'or no more' */ 00181 return (sciPointObj *) NULL; 00182 } 00183 return (sciPointObj *) phandletab->pointobj; 00184 } 00185 else if ( handle == sciGetHandle(getFigureModel())) 00186 return (sciPointObj *) getFigureModel(); 00187 else if ( handle == sciGetHandle(getAxesModel())) 00188 return (sciPointObj *) getAxesModel(); 00189 else 00190 { 00191 /* sciprint ("this is not or no more a valid handle !!\n"); F.Leray Adding 'or no more' */ 00192 return (sciPointObj *) NULL; 00193 } 00194 00195 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciRelationShip* sciGetRelationship | ( | sciPointObj * | pobj | ) |
sciGetRelationship Returns the structure of the relationship. Do not use this in the Consturctor Functions !
Definition at line 206 of file HandleManagement.c.
References NULL, pAGREG_FEATURE, pARC_FEATURE, pAXES_FEATURE, pCONSOLE_FEATURE, pFEC_FEATURE, pFIGURE_FEATURE, pFRAME_FEATURE, pGRAYPLOT_FEATURE, pLABEL_FEATURE, pLEGEND_FEATURE, pLIGHT_FEATURE, pMENU_FEATURE, pMENUCONTEXT_FEATURE, pMERGE_FEATURE, pPANNER_FEATURE, pPOLYLINE_FEATURE, pRECTANGLE_FEATURE, pSBH_FEATURE, pSBV_FEATURE, pSCREEN_FEATURE, pSEGS_FEATURE, pSTATUSB_FEATURE, pSUBWIN_FEATURE, pSURFACE_FEATURE, pTEXT_FEATURE, pTITLE_FEATURE, pUIMENU_FEATURE, pWINDOW_FEATURE, pWINDOWFRAME_FEATURE, SCI_AGREG, SCI_ARC, SCI_AXES, SCI_CONSOLE, SCI_FEC, SCI_FIGURE, SCI_FRAME, SCI_GRAYPLOT, SCI_LABEL, SCI_LEGEND, SCI_LIGHT, SCI_MENU, SCI_MENUCONTEXT, SCI_MERGE, SCI_PANNER, SCI_POLYLINE, SCI_RECTANGLE, SCI_SBH, SCI_SBV, SCI_SCREEN, SCI_SEGS, SCI_STATUSB, SCI_SUBWIN, SCI_SURFACE, SCI_TEXT, SCI_TITLE, SCI_UIMENU, SCI_WINDOW, SCI_WINDOWFRAME, sciGetEntityType(), and sciGetRelationship().
Referenced by ConstructCompoundSeq(), graphicsmodels(), sciAddSelectedSon(), sciAddThisToItsParent(), sciDelThisToItsParent(), sciGetFirstSelectedSon(), sciGetHandle(), sciGetHandleTabPointer(), sciGetLastSons(), sciGetParent(), sciGetRelationship(), sciGetSons(), sciGetTypedList(), sciInitSelectedSons(), sciSetHandle(), sciSetParent(), sciStandrardBuildOperations(), sciUnselectSons(), and sciUnselectTypedSons().
00207 { 00208 sciRelationShip *tmp=NULL; 00209 switch (sciGetEntityType (pobj)) 00210 { 00211 case SCI_FIGURE: 00212 return &(pFIGURE_FEATURE (pobj)->relationship); 00213 break; 00214 case SCI_SUBWIN: 00215 return &(pSUBWIN_FEATURE (pobj)->relationship); 00216 break; 00217 case SCI_TEXT: 00218 return &(pTEXT_FEATURE (pobj)->relationship); 00219 break; 00220 case SCI_TITLE: 00221 return &(pTITLE_FEATURE (pobj)->text.relationship); 00222 break; 00223 case SCI_LEGEND: 00224 return &(pLEGEND_FEATURE (pobj)->text.relationship); 00225 break; 00226 case SCI_ARC: 00227 return &(pARC_FEATURE (pobj)->relationship); 00228 break; 00229 case SCI_SEGS: 00230 return &(pSEGS_FEATURE (pobj)->relationship); 00231 break; 00232 case SCI_FEC: 00233 return &(pFEC_FEATURE (pobj)->relationship); 00234 break; 00235 case SCI_GRAYPLOT: 00236 return &(pGRAYPLOT_FEATURE (pobj)->relationship); 00237 break; 00238 case SCI_POLYLINE: 00239 return &(pPOLYLINE_FEATURE (pobj)->relationship); 00240 break; 00241 case SCI_RECTANGLE: 00242 return &(pRECTANGLE_FEATURE (pobj)->relationship); 00243 break; 00244 case SCI_SURFACE: 00245 return &(pSURFACE_FEATURE (pobj)->relationship); 00246 break; 00247 case SCI_LIGHT: 00248 return &(pLIGHT_FEATURE (pobj)->relationship); 00249 break; 00250 case SCI_AXES: 00251 return &(pAXES_FEATURE (pobj)->relationship); 00252 break; 00253 case SCI_PANNER: 00254 return &(pPANNER_FEATURE (pobj)->relationship); 00255 break; 00256 case SCI_SBH: 00257 return &(pSBH_FEATURE (pobj)->relationship); 00258 break; 00259 case SCI_SBV: 00260 return &(pSBV_FEATURE (pobj)->relationship); 00261 break; 00262 case SCI_MENU: 00263 return &(pMENU_FEATURE (pobj)->relationship); 00264 break; 00265 case SCI_MENUCONTEXT: 00266 return &(pMENUCONTEXT_FEATURE (pobj)->relationship); 00267 break; 00268 case SCI_STATUSB: 00269 return &(pSTATUSB_FEATURE (pobj)->relationship); 00270 break; 00271 case SCI_AGREG: 00272 return &(pAGREG_FEATURE (pobj)->relationship); 00273 break; 00274 case SCI_MERGE: 00275 return &(pMERGE_FEATURE (pobj)->relationship); 00276 break; 00277 case SCI_LABEL: /* F.Leray 27.05.04 */ 00278 return sciGetRelationship( pLABEL_FEATURE (pobj)->text ) ; 00279 break; 00280 case SCI_UIMENU: 00281 tmp=&(pUIMENU_FEATURE (pobj)->label.relationship); 00282 return &(pUIMENU_FEATURE (pobj)->label.relationship); 00283 break; 00284 case SCI_CONSOLE: 00285 return &(pCONSOLE_FEATURE (pobj)->relationship); 00286 break; 00287 case SCI_FRAME: 00288 return &(pFRAME_FEATURE (pobj)->relationship); 00289 break; 00290 case SCI_WINDOW: 00291 return &(pWINDOW_FEATURE (pobj)->relationship); 00292 break; 00293 case SCI_WINDOWFRAME: 00294 return &(pWINDOWFRAME_FEATURE (pobj)->relationship); 00295 break; 00296 case SCI_SCREEN: 00297 return &(pSCREEN_FEATURE (pobj)->relationship); 00298 break; 00299 default: 00300 return (sciRelationShip *) NULL; 00301 break; 00302 } 00303 return (sciRelationShip *) NULL; 00304 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sciSons* sciGetSons | ( | sciPointObj * | pobj | ) |
sciGetSons Returns the pointer to the table of all sons objects. There is no SetSons, because a new Son calls sciAddThisToItsParent() it self
Definition at line 457 of file HandleManagement.c.
References sciRelationShip::psons, and sciGetRelationship().
Referenced by CheckClickedSubwin(), ChildrenCounter(), clearSubWin(), ConstructLegend(), DestroyAllGraphicsSons(), I3dRotation(), Merge3dBuildTable(), Merge3dDimension(), Obj_RedrawNewAngle(), Objmove(), sci_unglue(), sci_xset(), sciFindSon(), sciGetAxes(), sciGetFirstAccessibleSon(), sciGetMerge(), sciGetNbChildren(), sciGetNbTypedObjects(), sciGetObjClicked(), sciGetSurface(), sciIsExistingSubWin(), sciSelectFirstSubwin(), sciXclear(), unzoom(), and zoom_box().
00458 { 00459 return (sciSons *) (sciGetRelationship (pobj)->psons); 00460 }
Here is the call graph for this function:

Here is the caller graph for this function:

move a list of handle from anywhere in the handles hierarchy under another handle. Can be used for example to move an object from a window to another.
| [in] | handles | Indexes of the handles to relocate. [in] nbHandles Size of the handle array. |
| [in] | newParentHandle | handle of which the handles will be sons. |
Definition at line 639 of file HandleManagement.c.
References DoublyLinkedList_new, FREE, i, List_find(), List_free(), List_is_empty, List_pop(), List_push, MALLOC, NULL, sciCanBeSonOf(), sciDrawObj(), sciGetNbFigures(), sciGetParentFigure(), sciGetPointerFromHandle(), and sciRelocateObject().
Referenced by sci_relocate_handle().
00640 { 00641 sciPointObj ** movedObjs = NULL ; /* array of moved objects */ 00642 sciPointObj * parentObj = sciGetPointerFromHandle( newParentHandle ) ; 00643 int i ; 00644 int nbFigure = 0 ; 00645 DoublyLinkedList * modifiedFiguresList = DoublyLinkedList_new() ; /* list of modified figures. */ 00646 /* Only the needed figures are redrawn at the end of the function. */ 00647 00648 /* check parent */ 00649 if ( parentObj == NULL ) 00650 { 00651 Scierror( 999,"The parent handle is not or no more valid.\r\n" ) ; 00652 return -1 ; 00653 } 00654 00655 /* we copy the pointer on the objects in this array */ 00656 movedObjs = MALLOC( nbHandles * sizeof(sciPointObj *) ) ; 00657 if ( movedObjs == NULL ) 00658 { 00659 Scierror(999,"Memory full, aborting operation.\r\n") ; 00660 return -1 ; 00661 } 00662 00663 /* check handles and copy their object in an array */ 00664 /* It is better to do a first loop, just to test the validity of the handles. */ 00665 /* As a result, we won't need to stop in the middle of the changes. */ 00666 for ( i = 0 ; i < nbHandles ; i++ ) 00667 { 00668 movedObjs[i] = sciGetPointerFromHandle( handles[i] ) ; 00669 /* check handle validity */ 00670 if ( movedObjs[i] == NULL ) 00671 { 00672 Scierror(999,"Handle number %d is not or no more valid.\r\n", i + 1 ) ; 00673 FREE( movedObjs ) ; 00674 return -1 ; 00675 } 00676 /* check that handles can be inserted under the parent */ 00677 if ( !sciCanBeSonOf( movedObjs[i], parentObj ) ) 00678 { 00679 Scierror(999,"Handle number %d is not compatible with the parent handle.\r\n", i + 1 ) ; 00680 FREE( movedObjs ) ; 00681 return -1 ; 00682 } 00683 } 00684 00685 /* allocate the array with as much space as number of figures. */ 00686 nbFigure = sciGetNbFigures() ; 00687 00688 /* now move each object */ 00689 for ( i = 0 ; i < nbHandles ; i++ ) 00690 { 00691 /* both the current and future (wich might be the same) figure of the object */ 00692 /* are modified. */ 00693 sciPointObj * currentFig = sciGetParentFigure( movedObjs[i] ) ; 00694 sciPointObj * futureFig = sciGetParentFigure( parentObj ) ; 00695 00696 if ( List_find( modifiedFiguresList, currentFig ) == NULL ) 00697 { 00698 /* the figure was not already considered modified */ 00699 modifiedFiguresList = List_push( modifiedFiguresList, currentFig ) ; 00700 } 00701 00702 if ( List_find( modifiedFiguresList, futureFig ) == NULL ) 00703 { 00704 /* the figure was not already considered modified */ 00705 modifiedFiguresList = List_push( modifiedFiguresList, futureFig ) ; 00706 } 00707 00708 if ( sciRelocateObject( movedObjs[i], parentObj ) != 0 ) 00709 { 00710 Scierror(999,"Error relocating handle %d.", i ) ; 00711 } 00712 } 00713 00714 FREE( movedObjs ) ; 00715 00716 00717 00718 00719 /* redraw the modified figures */ 00720 while( !List_is_empty( modifiedFiguresList ) ) 00721 { 00722 sciPointObj * modifiedFig = NULL ; 00723 modifiedFiguresList = List_pop( modifiedFiguresList, (void *)&modifiedFig ) ; 00724 sciDrawObj( modifiedFig ) ; 00725 } 00726 00727 List_free( modifiedFiguresList ) ; 00728 00729 return 0 ; 00730 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sciRelocateObject | ( | sciPointObj * | movedObj, | |
| sciPointObj * | newParent | |||
| ) |
move a graphic object from its position in the hierarchy to an other place. Note that we don't check wether the moved object is compatible with its new parent.
| in/out] | movedObj graphical object which is moved. | |
| in/out] | newParent graphical object under which the movedObj will be placed. |
Definition at line 526 of file HandleManagement.c.
References ConstructSubWin(), NULL, pSUBWIN_FEATURE, SCI_SUBWIN, SCI_SURFACE, sciAddThisToItsParent(), sciDelThisToItsParent(), sciGetEntityType(), sciGetIsSelected(), sciGetNbTypedObjects(), sciGetNumFigure(), sciGetParent(), sciGetParentSubwin(), sciInitSelectedSubWin(), sciSelectFirstSubwin(), sciSetOriginalSubWin(), and updateMerge().
Referenced by sciRelocateHandles().
00527 { 00528 sciPointObj * oldParent = sciGetParent( movedObj ) ; 00529 00530 if ( oldParent == newParent ) 00531 { 00532 /* nothing to do */ 00533 return 0 ; 00534 } 00535 00536 sciDelThisToItsParent( movedObj, oldParent ) ; 00537 sciAddThisToItsParent( movedObj, newParent ) ; 00538 00539 /* if an axis has been moved, its previous parent, a figure might haven't son any more.*/ 00540 if ( sciGetEntityType( movedObj ) == SCI_SUBWIN && sciGetIsSelected( movedObj ) ) 00541 { 00542 sciSelectFirstSubwin( oldParent ) ; 00543 if ( sciGetNbTypedObjects( oldParent, SCI_SUBWIN ) == 0 ) 00544 { 00545 /* we need to recreate a subwin */ 00546 sciPointObj * newSubWin = ConstructSubWin( oldParent, sciGetNumFigure( oldParent ) ) ; 00547 if ( newSubWin == NULL ) 00548 { 00549 return -1 ; 00550 } 00551 /* we must set the selected subwin */ 00552 sciSetOriginalSubWin( oldParent, newSubWin ) ; 00553 sciInitSelectedSubWin( newSubWin ) ; 00554 } 00555 } 00556 else if ( sciGetEntityType( movedObj ) == SCI_SURFACE ) 00557 { 00558 /* we must take care of the merge objects */ 00559 sciPointObj * oldParentSubwin = sciGetParentSubwin( oldParent ) ; 00560 sciPointObj * newParentSubwin = sciGetParentSubwin( newParent ) ; 00561 00562 /* the merge object will be the same if the surfaces are in the same subwin */ 00563 if ( oldParentSubwin != newParentSubwin ) 00564 { 00565 pSUBWIN_FEATURE(oldParent)->surfcounter-- ; 00566 pSUBWIN_FEATURE(newParent)->surfcounter++ ; 00567 00568 /* reccompute the merge objects */ 00569 updateMerge( oldParentSubwin ) ; 00570 updateMerge( newParentSubwin ) ; 00571 } 00572 } 00573 00574 return 0 ; 00575 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void sciSetHandle | ( | sciPointObj * | pobj, | |
| sciHandleTab * | pvalue | |||
| ) |
sciSetHandle Sets the handle to this object used only by sciAddNewHandle !!!
put the new index handle
Definition at line 48 of file HandleManagement.c.
References getAxesModel(), getFigureModel(), sciRelationShip::phandle, and sciGetRelationship().
Referenced by sciAddNewHandle().
00049 { 00050 if ( (pobj != getFigureModel()) && (pobj != getAxesModel())) 00051 { 00052 sciGetRelationship(pobj)->phandle = pvalue ; 00053 } 00054 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sciSetParent | ( | sciPointObj * | pson, | |
| sciPointObj * | pparent | |||
| ) |
sciSetParent Sets the parent to this object (that have to be the son). The parent's FIGURE has to be NULL pson est l'objet courant et *pparent est le parent a lui associer
Definition at line 312 of file HandleManagement.c.
References sciRelationShip::pparent, and sciGetRelationship().
Referenced by allocateText(), sciAddThisToItsParent(), and sciSwapObjects().
00313 { 00314 sciGetRelationship(pson)->pparent = pparent ; 00315 return 0; 00316 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sciSwapObjects | ( | sciPointObj * | firstObject, | |
| sciPointObj * | secondObject | |||
| ) |
Change the position of two graphic objects in the scilab hierarchy. The two objects should be compatible with their new parents.
Definition at line 737 of file HandleManagement.c.
References NULL, tagSons::pointobj, pSUBWIN_FEATURE, SCI_SURFACE, sciCanBeSonOf(), sciFindSon(), sciGetEntityType(), sciGetParent(), sciGetParentSubwin(), sciSetParent(), and updateMerge().
Referenced by swapHandles().
00738 { 00739 sciSons * firstSon = NULL ; /* the two sons entitities pointing on the objects */ 00740 sciSons * secondSon = NULL ; 00741 sciPointObj * firstParent = sciGetParent( firstObject ) ; /* current parent of the first object */ 00742 sciPointObj * secondParent = sciGetParent( secondObject ) ; 00743 00744 /* check compatibility of the objects with new parents */ 00745 if ( !sciCanBeSonOf( firstObject, sciGetParent( secondObject ) ) ) 00746 { 00747 Scierror(999,"First handle is not compatible with its new parent.\r\n" ) ; 00748 return -1 ; 00749 } 00750 00751 if ( !sciCanBeSonOf( secondObject, sciGetParent( firstObject ) ) ) 00752 { 00753 Scierror(999,"Second handle is not compatible with its new parent.\r\n" ) ; 00754 return -1 ; 00755 } 00756 00757 firstSon = sciFindSon( firstObject , firstParent ) ; 00758 secondSon = sciFindSon( secondObject, secondParent ) ; 00759 00760 /* check if the sons are correct. This should always be true. */ 00761 if ( firstSon == NULL ) 00762 { 00763 Scierror( 999,"First object is not correctly placed in the hierarchy.\r\n" ) ; 00764 return -1 ; 00765 } 00766 if ( secondSon == NULL ) 00767 { 00768 Scierror( 999,"Second object is not correctly placed in the hierarchy.\r\n" ) ; 00769 return -1 ; 00770 } 00771 00772 /* Swap the two pointed values of the handles */ 00773 firstSon->pointobj = secondObject ; 00774 secondSon->pointobj = firstObject ; 00775 00776 /* change their parents */ 00777 sciSetParent( firstObject , secondParent ) ; 00778 sciSetParent( secondObject, firstParent ) ; 00779 00780 00781 /* In the case of surface handles we must take care of merge objects */ 00782 if ( sciGetEntityType( firstObject ) == SCI_SURFACE 00783 || sciGetEntityType( secondObject ) == SCI_SURFACE ) 00784 { 00785 sciPointObj * firstParentSubwin = sciGetParentSubwin( firstObject ) ; 00786 sciPointObj * secondParentSubwin = sciGetParentSubwin( secondObject ) ; 00787 00788 /* update the number of figure for each objects */ 00789 if ( sciGetEntityType( firstObject ) == SCI_SURFACE ) 00790 { 00791 /* beware, the objects have already been moved to their new parents */ 00792 pSUBWIN_FEATURE( firstParentSubwin )->surfcounter++ ; 00793 pSUBWIN_FEATURE( secondParentSubwin )->surfcounter-- ; 00794 } 00795 00796 if ( sciGetEntityType( secondObject ) == SCI_SURFACE ) 00797 { 00798 pSUBWIN_FEATURE( secondParentSubwin )->surfcounter++ ; 00799 pSUBWIN_FEATURE( firstParentSubwin )->surfcounter-- ; 00800 } 00801 00802 updateMerge( firstParentSubwin ) ; 00803 updateMerge( secondParentSubwin ) ; 00804 } 00805 00806 00807 return 0 ; 00808 00809 }
Here is the call graph for this function:

Here is the caller graph for this function:

Swap the position of the two handles in the hierarchy. Both handles should be compatible with their new places.
| [in] | firstHandle | Index of an handle. |
| [in] | secondHandle | Index of the other handle. |
Definition at line 818 of file HandleManagement.c.
References NULL, sciDrawObj(), sciGetParentFigure(), sciGetPointerFromHandle(), and sciSwapObjects().
Referenced by sci_swap_handles().
00819 { 00820 sciPointObj * firstObject = sciGetPointerFromHandle( firstHdl ) ; 00821 sciPointObj * secondObject = sciGetPointerFromHandle( secondHdl ) ; 00822 sciPointObj * firstParentFig = NULL ; 00823 sciPointObj * secondParentFig = NULL ; 00824 00825 if ( firstObject == NULL ) 00826 { 00827 Scierror( 999,"First handle is not or no more valid.\r\n" ) ; 00828 return -1 ; 00829 } 00830 00831 if ( secondObject == NULL ) 00832 { 00833 Scierror( 999,"Second handle is not or no more valid.\r\n" ) ; 00834 return -1 ; 00835 } 00836 00837 if ( sciSwapObjects( firstObject, secondObject ) != 0 ) 00838 { 00839 return -1 ; 00840 } 00841 00842 firstParentFig = sciGetParentFigure( firstObject ) ; 00843 secondParentFig = sciGetParentFigure( secondObject ) ; 00844 00845 /* redraw the parent figures */ 00846 if ( firstParentFig == secondParentFig ) 00847 { 00848 /* we need only to redraw once since it is the same figure */ 00849 sciDrawObj( firstParentFig ) ; 00850 } 00851 else 00852 { 00853 sciDrawObj( firstParentFig ) ; 00854 sciDrawObj( secondParentFig ) ; 00855 } 00856 00857 return 0 ; 00858 00859 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 37 of file HandleManagement.c.
Referenced by sciAddNewHandle(), sciDelHandle(), sciGetIdFigure(), sciGetpendofhandletab(), and sciGetPointerFromHandle().
1.5.1