//This case is activated when the simulation is done or when we close scicos
case Ending:
{
- scoRetrieveScopeMemory(block->work, &pScopeMemory);
- if(scoGetScopeActivation(pScopeMemory) == 1)
- {
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- if (scoGetPointerScopeWindow(pScopeMemory) != NULL)
- {
- if(scoGetLongDrawSize(pScopeMemory,0) == 0)
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
- {
- pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(pLongDraw);
- }
- }
- else
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0)/2 ; i++)
- {
- pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(pLongDraw);
- }
- }
- }
- //Attention : here pShortDraw is a Window
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- }
- scoFreeScopeMemory(block->work, &pScopeMemory);
- break; //Break of the switch
+ scoRetrieveScopeMemory(block->work, &pScopeMemory);
+ if(scoGetScopeActivation(pScopeMemory) == 1)
+ {
+ /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ if(scoGetLongDrawSize(pScopeMemory,0) == 0)
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
+ {
+ pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(pLongDraw);
+ }
+ }
+ else
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0)/2 ; i++)
+ {
+ pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(pLongDraw);
+ }
+ }
+ }
+ //Attention : here pShortDraw is a Window
+ /* pShortDraw = sciGetCurrentFigure(); */
+ /*pFIGURE_FEATURE(pShortDraw)->user_data = NULL;*/
+ /*pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;*/
+ clearUserData(figure);
+ }
+ scoFreeScopeMemory(block->work, &pScopeMemory);
+ break; //Break of the switch
}
//free the memory which is allocated at each turn by some variables
//This case is activated when the simulation is done or when we close scicos
case Ending:
{
- scoRetrieveScopeMemory(block->work, &pScopeMemory);
- if(scoGetScopeActivation(pScopeMemory) == 1)
- {
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- if (scoGetPointerScopeWindow(pScopeMemory) != NULL)
- {
- if(scoGetLongDrawSize(pScopeMemory,0) == 0)
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
- {
- pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(pLongDraw);
- }
- }
- else
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0)/2 ; i++)
- {
- pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(pLongDraw);
- }
- }
- }
+ scoRetrieveScopeMemory(block->work, &pScopeMemory);
+ if(scoGetScopeActivation(pScopeMemory) == 1)
+ {
+ /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ if(scoGetLongDrawSize(pScopeMemory,0) == 0)
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
+ {
+ pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(pLongDraw);
+ }
+ }
+ else
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0)/2 ; i++)
+ {
+ pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(pLongDraw);
+ }
+ }
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- }
- scoFreeScopeMemory(block->work, &pScopeMemory);
- break; //Break of the switch
+ /* pShortDraw = sciGetCurrentFigure(); */
+ /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
+ /*pFIGURE_FEATURE(pShortDraw)->user_data = NULL;*/
+ /*pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;*/
+ clearUserData(figure);
+ }
+ }
+ scoFreeScopeMemory(block->work, &pScopeMemory);
+ break; //Break of the switch
}
//free the memory which is allocated at each turn by some variables
case Ending:
{
- scoRetrieveScopeMemory(block->work, &pScopeMemory);
- if(scoGetScopeActivation(pScopeMemory) == 1)
- {
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- if(scoGetPointerScopeWindow(pScopeMemory) != NULL)
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
- {
- //maybe a bug here in the last argument of the following instruction (see tab[i])
- pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(pLongDraw);
- }
- }
-
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- /* restore double buffering */
- sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
- scoDelCoupleOfSegments(pScopeMemory);
- }
- scoFreeScopeMemory(block->work,&pScopeMemory);
- break;
- }
- }
+ scoRetrieveScopeMemory(block->work, &pScopeMemory);
+ if(scoGetScopeActivation(pScopeMemory) == 1)
+ {
+ /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ if(scoGetPointerScopeWindow(pScopeMemory) != NULL)
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
+ {
+ /* maybe a bug here in the last argument of the following instruction (see tab[i]) */
+ pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(pLongDraw);
+ }
+
+
+ /* pShortDraw = sciGetCurrentFigure(); */
+ pShortDraw = scoGetPointerScopeWindow(pScopeMemory);
+ clearUserData(pShortDraw);
+ /* pFIGURE_FEATURE(pShortDraw)->user_data = NULL; */
+ /* pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; */
+ /* restore double buffering */
+ sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
+ scoDelCoupleOfSegments(pScopeMemory);
+ }
+ }
+ scoFreeScopeMemory(block->work,&pScopeMemory);
+ break;
+ }
+ }
}
scoRetrieveScopeMemory(block->work, &pScopeMemory);
if(scoGetScopeActivation(pScopeMemory) == 1)
{
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
+ /*sciSetUsedWindow(scoGetWindowID(pScopeMemory));
pShortDraw = sciGetCurrentFigure();
pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- scoDelCoupleOfPolylines(pScopeMemory);
+ scoDelCoupleOfPolylines(pScopeMemory);*/
+
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
+ clearUserData(figure);
+
+ scoDelCoupleOfPolylines(pScopeMemory);
+ }
}
scoFreeScopeMemory(block->work, &pScopeMemory);
break;
/*Free Memory*/
if(scoGetScopeActivation(pScopeMemory) == 1)
{
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
+ /*sciSetUsedWindow(scoGetWindowID(pScopeMemory));
pShortDraw = sciGetCurrentFigure();
pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
+ pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;*/
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
+ clearUserData(figure);
+ }
}
scoFreeScopeMemory(block->work, &pScopeMemory);
break;
}//End of stateupdate
case Ending:
{
- scoRetrieveScopeMemory(block->work, &pScopeMemory);
- if(scoGetScopeActivation(pScopeMemory) == 1)
- {
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- }
- scoFreeScopeMemory(block->work, &pScopeMemory);
- break;
+ scoRetrieveScopeMemory(block->work, &pScopeMemory);
+ if(scoGetScopeActivation(pScopeMemory) == 1)
+ {
+ /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
+ /*pShortDraw = sciGetCurrentFigure(); */
+ /*pFIGURE_FEATURE(pShortDraw)->user_data = NULL; */
+ /*pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; */
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
+ clearUserData(figure);
+ }
+ }
+ scoFreeScopeMemory(block->work, &pScopeMemory);
+ break;
}
}
}
scoRetrieveScopeMemory(block->work, &pScopeMemory);
if(scoGetScopeActivation(pScopeMemory) == 1)
{
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- /* restore double buffering */
- sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
- scoDelCoupleOfPolylines(pScopeMemory);
+ // sciSetUsedWindow(scoGetWindowID(pScopeMemory));
+ // pShortDraw = sciGetCurrentFigure();
+ // pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
+ // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
+ ///* restore double buffering */
+ //sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
+ // scoDelCoupleOfPolylines(pScopeMemory);
+
+
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
+ clearUserData(figure);
+
+ sciSetJavaUseSingleBuffer(figure, FALSE);
+ scoDelCoupleOfPolylines(pScopeMemory);
+ }
}
scoRetrieveScopeMemory(block->work, &pScopeMemory);
if(scoGetScopeActivation(pScopeMemory) == 1)
{
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
- pShortDraw = sciGetCurrentFigure();
- pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
- pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
- /* restore double buffering */
- sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
- scoDelCoupleOfPolylines(pScopeMemory);
+ // sciSetUsedWindow(scoGetWindowID(pScopeMemory));
+ // pShortDraw = sciGetCurrentFigure();
+ // pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
+ // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
+ ///* restore double buffering */
+ //sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
+ // scoDelCoupleOfPolylines(pScopeMemory);
+
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ clearUserData(figure);
+ /* restore double buffering */
+ sciSetJavaUseSingleBuffer(figure, FALSE);
+ scoDelCoupleOfPolylines(pScopeMemory);
+ }
+
}
scoFreeScopeMemory(block->work, &pScopeMemory);
break;
scoRetrieveScopeMemory(block->work, &pScopeMemory);
if(scoGetScopeActivation(pScopeMemory) == 1)
{
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
+ /*sciSetUsedWindow(scoGetWindowID(pScopeMemory));*/
- if (scoGetPointerScopeWindow(pScopeMemory) != NULL)
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0); i++)
- {
- Pinceau = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(Pinceau);
- }
- }
- //Here Pinceau = Window
- Pinceau = sciGetCurrentFigure();
- pFIGURE_FEATURE(Pinceau)->user_data = NULL;
- pFIGURE_FEATURE(Pinceau)->size_of_user_data = 0;
- /* restore double buffering */
- sciSetJavaUseSingleBuffer(Pinceau, FALSE);
- }
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0); i++)
+ {
+ Pinceau = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(Pinceau);
+ }
+
+ //Here Pinceau = Window
+ /*Pinceau = sciGetCurrentFigure();*/
+ /*pFIGURE_FEATURE(Pinceau)->user_data = NULL;
+ pFIGURE_FEATURE(Pinceau)->size_of_user_data = 0;*/
+ clearUserData(figure);
+ /* restore double buffering */
+ sciSetJavaUseSingleBuffer(figure, FALSE);
+ }
+ }
scoFreeScopeMemory(block->work, &pScopeMemory);
break; //Break of the switch
}
{
scoRetrieveScopeMemory(block->work, &pScopeMemory);
if(scoGetScopeActivation(pScopeMemory) == 1)
- {
- sciSetUsedWindow(scoGetWindowID(pScopeMemory));
-
- if (scoGetPointerScopeWindow(pScopeMemory) != NULL)
- {
- for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
- {
- Pinceau = scoGetPointerLongDraw(pScopeMemory,0,i);
- forceRedraw(Pinceau);
- }
- }
- Pinceau = sciGetCurrentFigure();
- pFIGURE_FEATURE(Pinceau)->user_data = NULL;
- pFIGURE_FEATURE(Pinceau)->size_of_user_data = 0;
- }
+ {
+ /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
+ /* Check if figure is still opened, otherwise, don't try to destroy it again. */
+ scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
+ if (figure != NULL)
+ {
+ for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
+ {
+ Pinceau = scoGetPointerLongDraw(pScopeMemory,0,i);
+ forceRedraw(Pinceau);
+ }
+
+ /* Pinceau = sciGetCurrentFigure();*/
+ /*Pinceau = scoGetPointerScopeWindow(pScopeMemory);*/
+ /* pFIGURE_FEATURE(Pinceau)->user_data = NULL; */
+ /* pFIGURE_FEATURE(Pinceau)->size_of_user_data = 0; */
+ clearUserData(figure);
+ }
+ }
scoFreeScopeMemory(block->work, &pScopeMemory);
break; //Break of the switch
}
copyStrMatElement
sciSetVisibility
sciDelGraphicObj
+clearUserData