summaryrefslogtreecommitdiffstats
path: root/scilab/modules
diff options
context:
space:
mode:
authorBruno JOFRET <bruno.jofret@scilab.org>2011-05-11 11:41:19 +0200
committerAllan CORNET <allan.cornet@scilab.org>2011-05-11 12:50:23 +0200
commit118800f5c887479029f6f7eaea46e27a622cf6bb (patch)
tree2a8d5c7b4913b5090426e39747231b0fc4acf08a /scilab/modules
parenta037100c04f7b95b9c1e87df0c025c757c733bc0 (diff)
downloadscilab-118800f5c887479029f6f7eaea46e27a622cf6bb.zip
scilab-118800f5c887479029f6f7eaea46e27a622cf6bb.tar.gz
Fix scope display when ending simulation: causes some demos failure.
Change-Id: Ia8744262dc9ff42d9757601eba9aa2793dddf832
Diffstat (limited to 'scilab/modules')
-rwxr-xr-xscilab/modules/scicos_blocks/src/c/cevscpe.c149
-rw-r--r--scilab/modules/scicos_blocks/src/c/cmscope.c145
-rw-r--r--scilab/modules/scicos_blocks/src/c/cscope.c335
-rw-r--r--scilab/modules/scicos_blocks/src/c/scoWindowScope.c151
4 files changed, 396 insertions, 384 deletions
diff --git a/scilab/modules/scicos_blocks/src/c/cevscpe.c b/scilab/modules/scicos_blocks/src/c/cevscpe.c
index 275c30e..899627d 100755
--- a/scilab/modules/scicos_blocks/src/c/cevscpe.c
+++ b/scilab/modules/scicos_blocks/src/c/cevscpe.c
@@ -18,7 +18,7 @@
18* 18*
19* See the file ./license.txt 19* See the file ./license.txt
20*/ 20*/
21/*--------------------------------------------------------------------------*/ 21/*--------------------------------------------------------------------------*/
22/** 22/**
23 \file cevscpe.c 23 \file cevscpe.c
24 \author Benoit Bayol 24 \author Benoit Bayol
@@ -27,7 +27,7 @@
27 \brief CEVSCPE is a scope that indicates when the clocks is activated 27 \brief CEVSCPE is a scope that indicates when the clocks is activated
28 \see CEVENTSCOPE.sci in macros/scicos_blocks/Sinks/ 28 \see CEVENTSCOPE.sci in macros/scicos_blocks/Sinks/
29*/ 29*/
30/*--------------------------------------------------------------------------*/ 30/*--------------------------------------------------------------------------*/
31#include "CurrentObjectsManagement.h" 31#include "CurrentObjectsManagement.h"
32#include "scicos.h" 32#include "scicos.h"
33#include "scoMemoryScope.h" 33#include "scoMemoryScope.h"
@@ -42,7 +42,7 @@
42#include "scicos_free.h" 42#include "scicos_free.h"
43#include "MALLOC.h" 43#include "MALLOC.h"
44#include "dynlib_scicos_blocks.h" 44#include "dynlib_scicos_blocks.h"
45/*--------------------------------------------------------------------------*/ 45/*--------------------------------------------------------------------------*/
46/** \fn cscopxy_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw) 46/** \fn cscopxy_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw)
47 \brief Function to draw or redraw the window 47 \brief Function to draw or redraw the window
48*/ 48*/
@@ -116,7 +116,7 @@ SCICOS_BLOCKS_IMPEXP void cevscpe_draw(scicos_block * block, ScopeMemory ** pSco
116 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE); 116 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE);
117 } 117 }
118} 118}
119/*--------------------------------------------------------------------------*/ 119/*--------------------------------------------------------------------------*/
120/** \fn void cevscpe(scicos_block * block, int flag) 120/** \fn void cevscpe(scicos_block * block, int flag)
121 \brief the computational function 121 \brief the computational function
122 \param block A pointer to a scicos_block 122 \param block A pointer to a scicos_block
@@ -136,87 +136,88 @@ SCICOS_BLOCKS_IMPEXP void cevscpe(scicos_block * block, int flag)
136 { 136 {
137 case Initialization: 137 case Initialization:
138 { 138 {
139 cevscpe_draw(block,&pScopeMemory,1); 139 cevscpe_draw(block,&pScopeMemory,1);
140 break; 140 break;
141 } 141 }
142 142
143 case StateUpdate: 143 case StateUpdate:
144 { 144 {
145 145
146 /* Charging elements */ 146 /* Charging elements */
147 147
148 scoRetrieveScopeMemory(block->work,&pScopeMemory); 148 scoRetrieveScopeMemory(block->work,&pScopeMemory);
149 149
150 if(scoGetScopeActivation(pScopeMemory) == 1) 150 if(scoGetScopeActivation(pScopeMemory) == 1)
151 { 151 {
152 152
153 t = get_scicos_time(); 153 t = get_scicos_time();
154 if(scoGetPointerScopeWindow(pScopeMemory) == NULL) 154 if(scoGetPointerScopeWindow(pScopeMemory) == NULL)
155 { 155 {
156 cevscpe_draw(block,&pScopeMemory,0); 156 cevscpe_draw(block,&pScopeMemory,0);
157 } 157 }
158 158
159 scoRefreshDataBoundsX(pScopeMemory,t); 159 scoRefreshDataBoundsX(pScopeMemory,t);
160 160
161 /*Not Factorize*/ 161 /*Not Factorize*/
162 162
163 for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++) 163 for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
164 { 164 {
165 if((GetNevIn(block)&(1<<i))==(1<<i)) 165 if((GetNevIn(block)&(1<<i))==(1<<i))
166 { 166 {
167 tab[nbseg]=i; 167 tab[nbseg]=i;
168 nbseg++; 168 nbseg++;
169 } 169 }
170 } 170 }
171 171
172 for(i = 0 ; i < nbseg ; i++) 172 for(i = 0 ; i < nbseg ; i++)
173 { 173 {
174 pShortDraw = scoGetPointerShortDraw(pScopeMemory,0,tab[i]); 174 pShortDraw = scoGetPointerShortDraw(pScopeMemory,0,tab[i]);
175 pSEGS_FEATURE(pShortDraw)->vx[0] = t; 175 pSEGS_FEATURE(pShortDraw)->vx[0] = t;
176 pSEGS_FEATURE(pShortDraw)->vx[1] = t; 176 pSEGS_FEATURE(pShortDraw)->vx[1] = t;
177 pSEGS_FEATURE(pShortDraw)->vy[0] = i*0.8/nbseg; 177 pSEGS_FEATURE(pShortDraw)->vy[0] = i*0.8/nbseg;
178 pSEGS_FEATURE(pShortDraw)->vy[1] = (i+1)*0.8/nbseg; 178 pSEGS_FEATURE(pShortDraw)->vy[1] = (i+1)*0.8/nbseg;
179 pSEGS_FEATURE(pShortDraw)->Nbr1 = 2; 179 pSEGS_FEATURE(pShortDraw)->Nbr1 = 2;
180 pSEGS_FEATURE(pShortDraw)->Nbr2 = 2; 180 pSEGS_FEATURE(pShortDraw)->Nbr2 = 2;
181 } 181 }
182 /*End of Not Factorize*/ 182 /*End of Not Factorize*/
183 scoDrawScopeAmplitudeTimeStyle(pScopeMemory,t); 183 scoDrawScopeAmplitudeTimeStyle(pScopeMemory,t);
184 } 184 }
185 break; 185 break;
186 } 186 }
187 187
188 case Ending: 188 case Ending:
189 { 189 {
190 190
191 scoRetrieveScopeMemory(block->work, &pScopeMemory); 191 scoRetrieveScopeMemory(block->work, &pScopeMemory);
192 if(scoGetScopeActivation(pScopeMemory) == 1) 192 if(scoGetScopeActivation(pScopeMemory) == 1)
193 { 193 {
194 /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */ 194 /* sciSetUsedWindow(scoGetWindowID(pScopeMemory)); */
195 /* Check if figure is still opened, otherwise, don't try to destroy it again. */ 195 /* Check if figure is still opened, otherwise, don't try to destroy it again. */
196 if(scoGetPointerScopeWindow(pScopeMemory) != NULL) 196 if(scoGetPointerScopeWindow(pScopeMemory) != NULL)
197 { 197 {
198 for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++) 198 for(i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
199 { 199 {
200 /* maybe a bug here in the last argument of the following instruction (see tab[i]) */ 200 /* maybe a bug here in the last argument of the following instruction (see tab[i]) */
201 pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i); 201 pLongDraw = scoGetPointerLongDraw(pScopeMemory,0,i);
202 forceRedraw(pLongDraw); 202 forceRedraw(pLongDraw);
203 } 203 }
204 204
205 205
206 /* pShortDraw = sciGetCurrentFigure(); */ 206 /* pShortDraw = sciGetCurrentFigure(); */
207 pShortDraw = scoGetPointerScopeWindow(pScopeMemory); 207 pShortDraw = scoGetPointerScopeWindow(pScopeMemory);
208 clearUserData(pShortDraw); 208 clearUserData(pShortDraw);
209 /* pFIGURE_FEATURE(pShortDraw)->user_data = NULL; */ 209 /* pFIGURE_FEATURE(pShortDraw)->user_data = NULL; */
210 /* pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; */ 210 /* pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; */
211 /* restore double buffering */ 211 /* restore double buffering */
212 if (pShortDraw) { 212 if (pShortDraw) {
213 sciSetJavaUseSingleBuffer(pShortDraw, FALSE); 213 sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
214 } 214 }
215 } 215 scoDelCoupleOfSegments(pScopeMemory);
216 } 216 }
217 scoFreeScopeMemory(block->work,&pScopeMemory); 217 }
218 break; 218 scoFreeScopeMemory(block->work,&pScopeMemory);
219 } 219 break;
220 } 220 }
221 }
221} 222}
222/*--------------------------------------------------------------------------*/ 223/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/scicos_blocks/src/c/cmscope.c b/scilab/modules/scicos_blocks/src/c/cmscope.c
index 7504298..b8e7bba 100644
--- a/scilab/modules/scicos_blocks/src/c/cmscope.c
+++ b/scilab/modules/scicos_blocks/src/c/cmscope.c
@@ -18,7 +18,7 @@
18* 18*
19* See the file ./license.txt 19* See the file ./license.txt
20*/ 20*/
21/*--------------------------------------------------------------------------*/ 21/*--------------------------------------------------------------------------*/
22/** 22/**
23 \file cmscope.c 23 \file cmscope.c
24 \author Benoit Bayol 24 \author Benoit Bayol
@@ -27,7 +27,7 @@
27 \brief CMSCOPE is a typical scope which links its input to the simulation time 27 \brief CMSCOPE is a typical scope which links its input to the simulation time
28 \see CMSCOPE.sci in macros/scicos_blocks/Sinks/ 28 \see CMSCOPE.sci in macros/scicos_blocks/Sinks/
29*/ 29*/
30/*--------------------------------------------------------------------------*/ 30/*--------------------------------------------------------------------------*/
31#include "CurrentObjectsManagement.h" 31#include "CurrentObjectsManagement.h"
32#include "scicos.h" 32#include "scicos.h"
33#include "scoMemoryScope.h" 33#include "scoMemoryScope.h"
@@ -41,7 +41,7 @@
41#include "scicos_free.h" 41#include "scicos_free.h"
42#include "MALLOC.h" 42#include "MALLOC.h"
43#include "dynlib_scicos_blocks.h" 43#include "dynlib_scicos_blocks.h"
44/*--------------------------------------------------------------------------*/ 44/*--------------------------------------------------------------------------*/
45/** \fn cmscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw) 45/** \fn cmscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw)
46 \brief Function to draw or redraw the window 46 \brief Function to draw or redraw the window
47*/ 47*/
@@ -102,7 +102,7 @@ SCICOS_BLOCKS_IMPEXP void cmscope_draw(scicos_block * block, ScopeMemory ** pSco
102 for (i = 0 ; i < number_of_subwin ; i++) 102 for (i = 0 ; i < number_of_subwin ; i++)
103 { 103 {
104 period[i] = rpar[i+1]; 104 period[i] = rpar[i+1];
105 nbr_period++; 105 nbr_period++;
106 } 106 }
107 ymin = (double*)scicos_malloc(number_of_subwin*sizeof(double)); 107 ymin = (double*)scicos_malloc(number_of_subwin*sizeof(double));
108 ymax = (double*)scicos_malloc(number_of_subwin*sizeof(double)); 108 ymax = (double*)scicos_malloc(number_of_subwin*sizeof(double));
@@ -118,11 +118,11 @@ SCICOS_BLOCKS_IMPEXP void cmscope_draw(scicos_block * block, ScopeMemory ** pSco
118 118
119 scoInitScopeMemory(block->work,pScopeMemory, number_of_subwin, number_of_curves_by_subwin); 119 scoInitScopeMemory(block->work,pScopeMemory, number_of_subwin, number_of_curves_by_subwin);
120 for(i = 0 ; i < number_of_subwin ; i++) 120 for(i = 0 ; i < number_of_subwin ; i++)
121 { 121 {
122 scoSetLongDrawSize(*pScopeMemory, i, 5000); 122 scoSetLongDrawSize(*pScopeMemory, i, 5000);
123 scoSetShortDrawSize(*pScopeMemory,i,buffer_size); 123 scoSetShortDrawSize(*pScopeMemory,i,buffer_size);
124 scoSetPeriod(*pScopeMemory,i,period[i]); 124 scoSetPeriod(*pScopeMemory,i,period[i]);
125 } 125 }
126 } 126 }
127 127
128 /* Xmin and Xmax are calculated here because we need a variable which is only existing in the pScopeMemory. pScopeMemory is allocated just few lines before. Indeed in this TimeAmplitudeScope Xmin and Xmax have to change often. To be sure to redraw in the correct scale we have to calculate xmin and xmax thanks to the period_counter. If the window haven't to be redraw (recreate) it wouldn't be necessary*/ 128 /* Xmin and Xmax are calculated here because we need a variable which is only existing in the pScopeMemory. pScopeMemory is allocated just few lines before. Indeed in this TimeAmplitudeScope Xmin and Xmax have to change often. To be sure to redraw in the correct scale we have to calculate xmin and xmax thanks to the period_counter. If the window haven't to be redraw (recreate) it wouldn't be necessary*/
@@ -141,7 +141,7 @@ SCICOS_BLOCKS_IMPEXP void cmscope_draw(scicos_block * block, ScopeMemory ** pSco
141 scoAddTitlesScope(*pScopeMemory,label,"t","y",NULL); 141 scoAddTitlesScope(*pScopeMemory,label,"t","y",NULL);
142 142
143 /*Add a couple of polyline : one for the shortdraw and one for the longdraw*/ 143 /*Add a couple of polyline : one for the shortdraw and one for the longdraw*/
144 /* scoAddPolylineLineStyle(*pScopeMemory,colors); */ 144 /* scoAddPolylineLineStyle(*pScopeMemory,colors); */
145 scoAddCoupleOfPolylines(*pScopeMemory,colors); 145 scoAddCoupleOfPolylines(*pScopeMemory,colors);
146 } 146 }
147 scicos_free(number_of_curves_by_subwin); 147 scicos_free(number_of_curves_by_subwin);
@@ -157,7 +157,7 @@ SCICOS_BLOCKS_IMPEXP void cmscope_draw(scicos_block * block, ScopeMemory ** pSco
157 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE); 157 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE);
158 } 158 }
159} 159}
160/*--------------------------------------------------------------------------*/ 160/*--------------------------------------------------------------------------*/
161/** \fn void cmscope(scicos_block * block, int flag) 161/** \fn void cmscope(scicos_block * block, int flag)
162 \brief the computational function 162 \brief the computational function
163 \param block A pointer to a scicos_block 163 \param block A pointer to a scicos_block
@@ -173,100 +173,101 @@ SCICOS_BLOCKS_IMPEXP cmscope(scicos_block * block, int flag)
173 scoGraphicalObject pShortDraw; 173 scoGraphicalObject pShortDraw;
174 int i = 0,j = 0; 174 int i = 0,j = 0;
175 175
176 double d_current_real_time = 0. ; 176 double d_current_real_time = 0. ;
177 177
178 /* Initializations and Allocations*/ 178 /* Initializations and Allocations*/
179 //Allocations are done here because there are dependent of some values presents below 179 //Allocations are done here because there are dependent of some values presents below
180 180
181 /* State Machine Control */ 181 /* State Machine Control */
182 switch(flag) 182 switch(flag)
183 { 183 {
184 case Initialization: 184 case Initialization:
185 { 185 {
186 cmscope_draw(block,&pScopeMemory,1); 186 cmscope_draw(block,&pScopeMemory,1);
187 187
188 //** Init the real time section 188 //** Init the real time section
189 //** current real time as double [second] 189 //** current real time as double [second]
190 d_current_real_time = scoGetRealTime(); 190 d_current_real_time = scoGetRealTime();
191 pScopeMemory->d_last_scope_update_time = d_current_real_time ; //** update the ds for the next step 191 pScopeMemory->d_last_scope_update_time = d_current_real_time ; //** update the ds for the next step
192 192
193 break; //Break of the switch condition: dont forget it 193 break; //Break of the switch condition: dont forget it
194 } //End of Initialization 194 } //End of Initialization
195 195
196 case StateUpdate: 196 case StateUpdate:
197 { 197 {
198 /*Retreiving Scope in the block->work*/ 198 /*Retreiving Scope in the block->work*/
199 scoRetrieveScopeMemory(block->work,&pScopeMemory); 199 scoRetrieveScopeMemory(block->work,&pScopeMemory);
200 if(scoGetScopeActivation(pScopeMemory) == 1) 200 if(scoGetScopeActivation(pScopeMemory) == 1)
201 { 201 {
202 /* Charging Elements */ 202 /* Charging Elements */
203 t = get_scicos_time(); 203 t = get_scicos_time();
204 /* If window has been destroyed we recreate it */ 204 /* If window has been destroyed we recreate it */
205 if(scoGetPointerScopeWindow(pScopeMemory) == NULL) 205 if(scoGetPointerScopeWindow(pScopeMemory) == NULL)
206 { 206 {
207 cmscope_draw(block,&pScopeMemory,0); 207 cmscope_draw(block,&pScopeMemory,0);
208 } 208 }
209 209
210 scoRefreshDataBoundsX(pScopeMemory,t); 210 scoRefreshDataBoundsX(pScopeMemory,t);
211 211
212 //Here we are calculating the points in the polylines 212 //Here we are calculating the points in the polylines
213 for (i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++) 213 for (i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++)
214 { 214 {
215 u1 = GetRealInPortPtrs(block,i+1); 215 u1 = GetRealInPortPtrs(block,i+1);
216 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0); 216 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0);
217 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; 217 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1;
218 for (j = 0; j < scoGetNumberOfCurvesBySubwin(pScopeMemory,i) ; j++) 218 for (j = 0; j < scoGetNumberOfCurvesBySubwin(pScopeMemory,i) ; j++)
219 { 219 {
220 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,j); 220 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,j);
221 pPOLYLINE_FEATURE(pShortDraw)->pvx[NbrPtsShort] = t; 221 pPOLYLINE_FEATURE(pShortDraw)->pvx[NbrPtsShort] = t;
222 pPOLYLINE_FEATURE(pShortDraw)->pvy[NbrPtsShort] = u1[j]; 222 pPOLYLINE_FEATURE(pShortDraw)->pvy[NbrPtsShort] = u1[j];
223 pPOLYLINE_FEATURE(pShortDraw)->n1++; 223 pPOLYLINE_FEATURE(pShortDraw)->n1++;
224 } 224 }
225 } 225 }
226 226
227 // Draw the Scope 227 // Draw the Scope
228 scoDrawScopeAmplitudeTimeStyle(pScopeMemory, t); //** the scope update condition 228 scoDrawScopeAmplitudeTimeStyle(pScopeMemory, t); //** the scope update condition
229 //** is hidden here 229 //** is hidden here
230 230
231 } 231 }
232 break; 232 break;
233 233
234 } //**End of stateupdate 234 } //**End of stateupdate
235 235
236 //** Ending is activated when the simulation is done or when we close Scicos 236 //** Ending is activated when the simulation is done or when we close Scicos
237 case Ending: 237 case Ending:
238 { 238 {
239 scoRetrieveScopeMemory(block->work, &pScopeMemory); 239 scoRetrieveScopeMemory(block->work, &pScopeMemory);
240 if(scoGetScopeActivation(pScopeMemory) == 1) 240 if(scoGetScopeActivation(pScopeMemory) == 1)
241 { 241 {
242 // sciSetUsedWindow(scoGetWindowID(pScopeMemory)); 242 // sciSetUsedWindow(scoGetWindowID(pScopeMemory));
243 // pShortDraw = sciGetCurrentFigure(); 243 // pShortDraw = sciGetCurrentFigure();
244 // pFIGURE_FEATURE(pShortDraw)->user_data = NULL; 244 // pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
245 // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; 245 // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
246 ///* restore double buffering */ 246 ///* restore double buffering */
247 //sciSetJavaUseSingleBuffer(pShortDraw, FALSE); 247 //sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
248 // scoDelCoupleOfPolylines(pScopeMemory); 248 // scoDelCoupleOfPolylines(pScopeMemory);
249 249
250 250
251 /* Check if figure is still opened, otherwise, don't try to destroy it again. */ 251 /* Check if figure is still opened, otherwise, don't try to destroy it again. */
252 scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory); 252 scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
253 if (figure != NULL) 253 if (figure != NULL)
254 { 254 {
255 /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/ 255 /*pShortDraw = scoGetPointerScopeWindow(pScopeMemory);*/
256 clearUserData(figure); 256 clearUserData(figure);
257 257
258 /* restore double buffering */ 258 /* restore double buffering */
259 if (figure) { 259 if (figure) {
260 sciSetJavaUseSingleBuffer(figure, FALSE); 260 sciSetJavaUseSingleBuffer(figure, FALSE);
261 } 261 }
262 } 262 scoDelCoupleOfPolylines(pScopeMemory);
263 }
263 264
264 } 265 }
265 266
266 scoFreeScopeMemory(block->work, &pScopeMemory); 267 scoFreeScopeMemory(block->work, &pScopeMemory);
267 268
268 break; 269 break;
269 } 270 }
270 } 271 }
271} 272}
272/*--------------------------------------------------------------------------*/ 273/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/scicos_blocks/src/c/cscope.c b/scilab/modules/scicos_blocks/src/c/cscope.c
index 1604911..ad6f057 100644
--- a/scilab/modules/scicos_blocks/src/c/cscope.c
+++ b/scilab/modules/scicos_blocks/src/c/cscope.c
@@ -1,24 +1,24 @@
1/* Scicos 1/* Scicos
2* 2 *
3* Copyright (C) INRIA - METALAU Project <scicos@inria.fr> 3 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4* 4 *
5* This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; either version 2 of the License, or
8* (at your option) any later version. 8 * (at your option) any later version.
9* 9 *
10* This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details. 13 * GNU General Public License for more details.
14* 14 *
15* You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16* along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18* 18 *
19* See the file ./license.txt 19 * See the file ./license.txt
20*/ 20 */
21/*--------------------------------------------------------------------------*/ 21/*--------------------------------------------------------------------------*/
22/** 22/**
23 \file cscope.c 23 \file cscope.c
24 \author Benoit Bayol 24 \author Benoit Bayol
@@ -27,7 +27,7 @@
27 \brief CSCOPE is a typical scope which links its input to the simulation time but there is only one input instead of CMSCOPE 27 \brief CSCOPE is a typical scope which links its input to the simulation time but there is only one input instead of CMSCOPE
28 \see CSCOPE.sci in macros/scicos_blocks/Sinks/ 28 \see CSCOPE.sci in macros/scicos_blocks/Sinks/
29*/ 29*/
30/*--------------------------------------------------------------------------*/ 30/*--------------------------------------------------------------------------*/
31#include <stdio.h> 31#include <stdio.h>
32#include "CurrentObjectsManagement.h" 32#include "CurrentObjectsManagement.h"
33#include "scicos.h" 33#include "scicos.h"
@@ -42,88 +42,88 @@
42#include "scicos_free.h" 42#include "scicos_free.h"
43#include "MALLOC.h" 43#include "MALLOC.h"
44#include "dynlib_scicos_blocks.h" 44#include "dynlib_scicos_blocks.h"
45/*--------------------------------------------------------------------------*/ 45/*--------------------------------------------------------------------------*/
46/** \fn cscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw) 46/** \fn cscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw)
47 \brief Function to draw or redraw the window 47 \brief Function to draw or redraw the window
48*/ 48*/
49SCICOS_BLOCKS_IMPEXP void cscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw) 49SCICOS_BLOCKS_IMPEXP void cscope_draw(scicos_block * block, ScopeMemory ** pScopeMemory, int firstdraw)
50{ 50{
51 int i = 0; 51 int i = 0;
52 double *rpar = NULL; 52 double *rpar = NULL;
53 int *ipar = NULL, nipar = 0; 53 int *ipar = NULL, nipar = 0;
54 double period = 0.; 54 double period = 0.;
55 int dimension = 0; 55 int dimension = 0;
56 double ymin = 0., ymax = 0., xmin = 0., xmax = 0.; 56 double ymin = 0., ymax = 0., xmin = 0., xmax = 0.;
57 int buffer_size = 0; 57 int buffer_size = 0;
58 int win_pos[2]; 58 int win_pos[2];
59 int win_dim[2]; 59 int win_dim[2];
60 int win = 0; 60 int win = 0;
61 int number_of_subwin = 0; 61 int number_of_subwin = 0;
62 int number_of_curves_by_subwin[1]; 62 int number_of_curves_by_subwin[1];
63 int * colors = NULL; 63 int * colors = NULL;
64 char *label = NULL; 64 char *label = NULL;
65 65
66 /*Retrieving Parameters*/ 66 /*Retrieving Parameters*/
67 rpar = GetRparPtrs(block); 67 rpar = GetRparPtrs(block);
68 ipar = GetIparPtrs(block); 68 ipar = GetIparPtrs(block);
69 nipar = GetNipar(block); 69 nipar = GetNipar(block);
70 70
71 buffer_size = ipar[2]; //** this is the "standard" buffer size 71 buffer_size = ipar[2]; //** this is the "standard" buffer size
72 72
73 win = ipar[0]; 73 win = ipar[0];
74 period = rpar[3]; 74 period = rpar[3];
75 win_pos[0] = ipar[(nipar-1) - 3]; 75 win_pos[0] = ipar[(nipar-1) - 3];
76 win_pos[1] = ipar[(nipar-1) - 2]; 76 win_pos[1] = ipar[(nipar-1) - 2];
77 win_dim[0] = ipar[(nipar-1) - 1]; 77 win_dim[0] = ipar[(nipar-1) - 1];
78 win_dim[1] = ipar[nipar-1]; 78 win_dim[1] = ipar[nipar-1];
79 dimension = 2; 79 dimension = 2;
80 number_of_curves_by_subwin[0] = GetInPortRows(block,1); 80 number_of_curves_by_subwin[0] = GetInPortRows(block,1);
81 81
82 number_of_subwin = 1; 82 number_of_subwin = 1;
83 ymin = rpar[1]; 83 ymin = rpar[1];
84 ymax = rpar[2]; 84 ymax = rpar[2];
85 label = GetLabelPtrs(block); 85 label = GetLabelPtrs(block);
86 86
87 colors = (int*)scicos_malloc(number_of_curves_by_subwin[0]*sizeof(int)); 87 colors = (int*)scicos_malloc(number_of_curves_by_subwin[0]*sizeof(int));
88 for(i = 0 ; i < number_of_curves_by_subwin[0] ; i++) 88 for(i = 0 ; i < number_of_curves_by_subwin[0] ; i++)
89 { 89 {
90 colors[i] = ipar[3+i]; 90 colors[i] = ipar[3+i];
91 } 91 }
92 92
93 /*Allocating memory*/ 93 /*Allocating memory*/
94 if(firstdraw == 1) 94 if(firstdraw == 1)
95 { 95 {
96 scoInitScopeMemory(block->work,pScopeMemory, number_of_subwin, number_of_curves_by_subwin); 96 scoInitScopeMemory(block->work,pScopeMemory, number_of_subwin, number_of_curves_by_subwin);
97 /*Must be placed before adding polyline or other elements*/ 97 /*Must be placed before adding polyline or other elements*/
98 scoSetLongDrawSize(*pScopeMemory, 0, 50); 98 scoSetLongDrawSize(*pScopeMemory, 0, 50);
99 99
100 scoSetShortDrawSize(*pScopeMemory,0,buffer_size); //** set the short draw size 100 scoSetShortDrawSize(*pScopeMemory,0,buffer_size); //** set the short draw size
101 101
102 scoSetPeriod(*pScopeMemory,0,period); 102 scoSetPeriod(*pScopeMemory,0,period);
103 } 103 }
104 104
105 xmin = period*scoGetPeriodCounter(*pScopeMemory,0); 105 xmin = period*scoGetPeriodCounter(*pScopeMemory,0);
106 xmax = period*(scoGetPeriodCounter(*pScopeMemory,0)+1); 106 xmax = period*(scoGetPeriodCounter(*pScopeMemory,0)+1);
107 107
108 /*Creating the Scope*/ 108 /*Creating the Scope*/
109 scoInitOfWindow(*pScopeMemory, dimension, win, win_pos, win_dim, &xmin, &xmax, &ymin, &ymax, NULL, NULL); 109 scoInitOfWindow(*pScopeMemory, dimension, win, win_pos, win_dim, &xmin, &xmax, &ymin, &ymax, NULL, NULL);
110 if(scoGetScopeActivation(*pScopeMemory) == 1) 110 if(scoGetScopeActivation(*pScopeMemory) == 1)
111 { 111 {
112 scoAddTitlesScope(*pScopeMemory,label,"t","y",NULL); 112 scoAddTitlesScope(*pScopeMemory,label,"t","y",NULL);
113 /*Add a couple of polyline : one for the shortdraw and one for the longdraw*/ 113 /*Add a couple of polyline : one for the shortdraw and one for the longdraw*/
114 scoAddCoupleOfPolylines(*pScopeMemory,colors); 114 scoAddCoupleOfPolylines(*pScopeMemory,colors);
115 /* scoAddPolylineLineStyle(*pScopeMemory,colors); */ 115 /* scoAddPolylineLineStyle(*pScopeMemory,colors); */
116 } 116 }
117 scicos_free(colors); 117 scicos_free(colors);
118 118
119 /* use only single buffering to be sure to draw on the screen */ 119 /* use only single buffering to be sure to draw on the screen */
120 if (scoGetPointerScopeWindow(*pScopeMemory) != NULL) 120 if (scoGetPointerScopeWindow(*pScopeMemory) != NULL)
121 { 121 {
122 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE); 122 sciSetJavaUseSingleBuffer(scoGetPointerScopeWindow(*pScopeMemory), TRUE);
123 } 123 }
124 124
125} 125}
126/*--------------------------------------------------------------------------*/ 126/*--------------------------------------------------------------------------*/
127/** \fn void cscope(scicos_block * block,int flag) 127/** \fn void cscope(scicos_block * block,int flag)
128 \brief the computational function 128 \brief the computational function
129 \param block A pointer to a scicos_block 129 \param block A pointer to a scicos_block
@@ -131,100 +131,101 @@ SCICOS_BLOCKS_IMPEXP void cscope_draw(scicos_block * block, ScopeMemory ** pScop
131*/ 131*/
132SCICOS_BLOCKS_IMPEXP void cscope(scicos_block * block,int flag) 132SCICOS_BLOCKS_IMPEXP void cscope(scicos_block * block,int flag)
133{ 133{
134 ScopeMemory * pScopeMemory = NULL; 134 ScopeMemory * pScopeMemory = NULL;
135 int i = 0; 135 int i = 0;
136 double t = 0.; 136 double t = 0.;
137 int NbrPtsShort = 0; 137 int NbrPtsShort = 0;
138 double * u1 = NULL; 138 double * u1 = NULL;
139 scoGraphicalObject pShortDraw; 139 scoGraphicalObject pShortDraw;
140 140
141 double d_current_real_time = 0.; 141 double d_current_real_time = 0.;
142
143 switch(flag)
144 {
142 145
143 switch(flag) 146 case Initialization:
144 { 147 {
145 148 cscope_draw(block,&pScopeMemory,1);
146 case Initialization:
147 {
148 cscope_draw(block,&pScopeMemory,1);
149 149
150 //** Init the real time section 150 //** Init the real time section
151 //** current real time as double [second] 151 //** current real time as double [second]
152 d_current_real_time = scoGetRealTime(); 152 d_current_real_time = scoGetRealTime();
153 pScopeMemory->d_last_scope_update_time = d_current_real_time ; //** update the ds for the next step 153 pScopeMemory->d_last_scope_update_time = d_current_real_time ; //** update the ds for the next step
154 //** printf("Init:Start! \n\n"); //** DEBUG ONLY ! 154 //** printf("Init:Start! \n\n"); //** DEBUG ONLY !
155 155
156 break; 156 break;
157 } 157 }
158 158
159 case StateUpdate: 159 case StateUpdate:
160 { 160 {
161 scoRetrieveScopeMemory(block->work,&pScopeMemory); 161 scoRetrieveScopeMemory(block->work,&pScopeMemory);
162 if(scoGetScopeActivation(pScopeMemory) == 1) 162 if(scoGetScopeActivation(pScopeMemory) == 1)
163 { 163 {
164 t = get_scicos_time(); 164 t = get_scicos_time();
165 /*Retreiving Scope in the block->work*/ 165 /*Retreiving Scope in the block->work*/
166 166
167 /*If window has been destroyed we recreate it*/ 167 /*If window has been destroyed we recreate it*/
168 if (scoGetPointerScopeWindow(pScopeMemory) == NULL) 168 if (scoGetPointerScopeWindow(pScopeMemory) == NULL)
169 { 169 {
170 cscope_draw(block,&pScopeMemory,0); 170 cscope_draw(block,&pScopeMemory,0);
171 } 171 }
172 172
173 /*Maybe we are in the end of axes so we have to draw new ones */ 173 /*Maybe we are in the end of axes so we have to draw new ones */
174 scoRefreshDataBoundsX(pScopeMemory,t); 174 scoRefreshDataBoundsX(pScopeMemory,t);
175 175
176 // Cannot be factorized depends of the scope 176 // Cannot be factorized depends of the scope
177 u1 = GetRealInPortPtrs(block,1); 177 u1 = GetRealInPortPtrs(block,1);
178 for (i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++) 178 for (i = 0 ; i < scoGetNumberOfCurvesBySubwin(pScopeMemory,0) ; i++)
179 { 179 {
180 pShortDraw = scoGetPointerShortDraw(pScopeMemory,0,i); 180 pShortDraw = scoGetPointerShortDraw(pScopeMemory,0,i);
181 if (pShortDraw) 181 if (pShortDraw)
182 { 182 {
183 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; 183 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1;
184 pPOLYLINE_FEATURE(pShortDraw)->pvx[NbrPtsShort] = t; 184 pPOLYLINE_FEATURE(pShortDraw)->pvx[NbrPtsShort] = t;
185 pPOLYLINE_FEATURE(pShortDraw)->pvy[NbrPtsShort] = u1[i]; 185 pPOLYLINE_FEATURE(pShortDraw)->pvy[NbrPtsShort] = u1[i];
186 pPOLYLINE_FEATURE(pShortDraw)->n1++; 186 pPOLYLINE_FEATURE(pShortDraw)->n1++;
187 } 187 }
188 } 188 }
189 // End of Cannot 189 // End of Cannot
190 190
191 // Draw the Scope 191 // Draw the Scope
192 scoDrawScopeAmplitudeTimeStyle(pScopeMemory, t); //** the scope update condition 192 scoDrawScopeAmplitudeTimeStyle(pScopeMemory, t); //** the scope update condition
193 //** is hidden here 193 //** is hidden here
194 } 194 }
195 195
196 break; 196 break;
197 } //**----------------------------------------------------------- 197 } //**-----------------------------------------------------------
198 198
199 case Ending: 199 case Ending:
200 { 200 {
201 scoRetrieveScopeMemory(block->work, &pScopeMemory); 201 scoRetrieveScopeMemory(block->work, &pScopeMemory);
202 if(scoGetScopeActivation(pScopeMemory) == 1) 202 if(scoGetScopeActivation(pScopeMemory) == 1)
203 { 203 {
204 // sciSetUsedWindow(scoGetWindowID(pScopeMemory)); 204 // sciSetUsedWindow(scoGetWindowID(pScopeMemory));
205 // pShortDraw = sciGetCurrentFigure(); 205 // pShortDraw = sciGetCurrentFigure();
206 // pFIGURE_FEATURE(pShortDraw)->user_data = NULL; 206 // pFIGURE_FEATURE(pShortDraw)->user_data = NULL;
207 // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0; 207 // pFIGURE_FEATURE(pShortDraw)->size_of_user_data = 0;
208 ///* restore double buffering */ 208 ///* restore double buffering */
209 //sciSetJavaUseSingleBuffer(pShortDraw, FALSE); 209 //sciSetJavaUseSingleBuffer(pShortDraw, FALSE);
210 // scoDelCoupleOfPolylines(pScopeMemory); 210 // scoDelCoupleOfPolylines(pScopeMemory);
211 211
212 /* Check if figure is still opened, otherwise, don't try to destroy it again. */ 212 /* Check if figure is still opened, otherwise, don't try to destroy it again. */
213 scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory); 213 scoGraphicalObject figure = scoGetPointerScopeWindow(pScopeMemory);
214 if (figure != NULL) 214 if (figure != NULL)
215 { 215 {
216 clearUserData(figure); 216 clearUserData(figure);
217 217
218 /* restore double buffering */ 218 /* restore double buffering */
219 if (figure) { 219 if (figure) {
220 sciSetJavaUseSingleBuffer(figure, FALSE); 220 sciSetJavaUseSingleBuffer(figure, FALSE);
221 } 221 }
222 } 222 scoDelCoupleOfPolylines(pScopeMemory);
223 }
223 224
224 } 225 }
225 scoFreeScopeMemory(block->work, &pScopeMemory); 226 scoFreeScopeMemory(block->work, &pScopeMemory);
226 break; 227 break;
227 } 228 }
228 } 229 }
229} 230}
230/*--------------------------------------------------------------------------*/ 231/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/scicos_blocks/src/c/scoWindowScope.c b/scilab/modules/scicos_blocks/src/c/scoWindowScope.c
index 455b5e2..d540bc1 100644
--- a/scilab/modules/scicos_blocks/src/c/scoWindowScope.c
+++ b/scilab/modules/scicos_blocks/src/c/scoWindowScope.c
@@ -18,7 +18,7 @@
18* 18*
19* See the file ./license.txt 19* See the file ./license.txt
20*/ 20*/
21/*--------------------------------------------------------------------------*/ 21/*--------------------------------------------------------------------------*/
22/** 22/**
23\file scoWindowScope.c 23\file scoWindowScope.c
24\author Benoit Bayol 24\author Benoit Bayol
@@ -26,7 +26,7 @@
26\date September 2006 - January 2007 26\date September 2006 - January 2007
27\brief Source Code of all functions wich interact with the window like creation of graphical object or refreshing the window 27\brief Source Code of all functions wich interact with the window like creation of graphical object or refreshing the window
28*/ 28*/
29/*--------------------------------------------------------------------------*/ 29/*--------------------------------------------------------------------------*/
30#include <stdio.h> 30#include <stdio.h>
31#include <string.h> 31#include <string.h>
32#include "scoBase.h" 32#include "scoBase.h"
@@ -48,9 +48,9 @@
48#include "HandleManagement.h" /* sciGetHandle */ 48#include "HandleManagement.h" /* sciGetHandle */
49#include "scicos_block4.h" 49#include "scicos_block4.h"
50#include "localization.h" 50#include "localization.h"
51/*--------------------------------------------------------------------------*/ 51/*--------------------------------------------------------------------------*/
52extern int C2F(dcopy)(); 52extern int C2F(dcopy)();
53/*--------------------------------------------------------------------------*/ 53/*--------------------------------------------------------------------------*/
54static void scoSetWindowIDInUserData(ScopeMemory * pScopeMemory,int block_number) 54static void scoSetWindowIDInUserData(ScopeMemory * pScopeMemory,int block_number)
55{ 55{
56 /* 15/07/2009, S. Steer: user data set to a Scilab data structure instead of only the block_number value */ 56 /* 15/07/2009, S. Steer: user data set to a Scilab data structure instead of only the block_number value */
@@ -73,7 +73,7 @@ static void scoSetWindowIDInUserData(ScopeMemory * pScopeMemory,int block_number
73 *ptr_d = (double) block_number; 73 *ptr_d = (double) block_number;
74 *size_ptr = 6; 74 *size_ptr = 6;
75} 75}
76/*--------------------------------------------------------------------------*/ 76/*--------------------------------------------------------------------------*/
77scoInteger scoGetUserData(scoGraphicalObject pTemp) 77scoInteger scoGetUserData(scoGraphicalObject pTemp)
78{ 78{
79 /* 15/07/2009, S. Steer: to take into account the scoSetWindowIDInUserData change */ 79 /* 15/07/2009, S. Steer: to take into account the scoSetWindowIDInUserData change */
@@ -83,7 +83,7 @@ scoInteger scoGetUserData(scoGraphicalObject pTemp)
83 ptr_d = (double *) (*user_data_ptr+4); 83 ptr_d = (double *) (*user_data_ptr+4);
84 return (scoInteger) *ptr_d; 84 return (scoInteger) *ptr_d;
85} 85}
86/*--------------------------------------------------------------------------*/ 86/*--------------------------------------------------------------------------*/
87void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int * win_pos, int * win_dim, double * xmin, double * xmax, double * ymin, double * ymax, double * zmin, double * zmax) 87void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int * win_pos, int * win_dim, double * xmin, double * xmax, double * ymin, double * ymax, double * zmin, double * zmax)
88{ 88{
89 int i = 0; 89 int i = 0;
@@ -94,7 +94,7 @@ void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int
94 //if win-id is -1 we give an auto number based on the block_number on the diagram 94 //if win-id is -1 we give an auto number based on the block_number on the diagram
95 if (win_id == -1) 95 if (win_id == -1)
96 { 96 {
97 win_id = 20000 + block_number; 97 win_id = 20000 + block_number;
98 } 98 }
99 //if we restart the simulation this command delete all previous children of the window 99 //if we restart the simulation this command delete all previous children of the window
100 /* WARNING HERE */ 100 /* WARNING HERE */
@@ -107,7 +107,7 @@ void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int
107 user_data = scoGetUserData(pTemp); 107 user_data = scoGetUserData(pTemp);
108 } 108 }
109 109
110 sciClearFigure(pTemp); //** if already present is cleared 110 sciClearFigure(pTemp); //** if already present is cleared
111 111
112 } 112 }
113 /*if ((user_data == -1 ) || (user_data == win_id))*/ 113 /*if ((user_data == -1 ) || (user_data == win_id))*/
@@ -127,7 +127,7 @@ void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int
127 { 127 {
128 //We are getting the Handle of the current axes but in the same time we are constructing it (see below) 128 //We are getting the Handle of the current axes but in the same time we are constructing it (see below)
129 //Here pTemp is the pointer on the ScopeWindow 129 //Here pTemp is the pointer on the ScopeWindow
130 // J-B please check this 130 // J-B please check this
131 scoSetHandleAxes(pScopeMemory,i,sciGetHandle(sciGetFirstTypedSelectedSon( pTemp, SCI_SUBWIN )) ); 131 scoSetHandleAxes(pScopeMemory,i,sciGetHandle(sciGetFirstTypedSelectedSon( pTemp, SCI_SUBWIN )) );
132 } 132 }
133 else 133 else
@@ -196,7 +196,7 @@ void scoInitOfWindow(ScopeMemory * pScopeMemory, int dimension, int win_id, int
196 Coserror(_("This scope has the same window id than another.")); 196 Coserror(_("This scope has the same window id than another."));
197 } 197 }
198} 198}
199/*--------------------------------------------------------------------------*/ 199/*--------------------------------------------------------------------------*/
200void scoRefreshDataBoundsX(ScopeMemory * pScopeMemory, double t) 200void scoRefreshDataBoundsX(ScopeMemory * pScopeMemory, double t)
201{ 201{
202 scoGraphicalObject pLongDraw = NULL; 202 scoGraphicalObject pLongDraw = NULL;
@@ -336,10 +336,10 @@ void scoRefreshDataBoundsX(ScopeMemory * pScopeMemory, double t)
336 } 336 }
337 } 337 }
338} 338}
339/*--------------------------------------------------------------------------*/ 339/*--------------------------------------------------------------------------*/
340//** ------------------------------------------------------------------------------------------------ 340//** ------------------------------------------------------------------------------------------------
341//** 341//**
342//** ------------ The physical redraw of the scope is hidden here ----------------------------------- 342//** ------------ The physical redraw of the scope is hidden here -----------------------------------
343//** 343//**
344//** 344//**
345void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t) 345void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
@@ -352,7 +352,7 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
352 int NumCurvInSubWin = 0; 352 int NumCurvInSubWin = 0;
353 int NumSubWin = 0 ; 353 int NumSubWin = 0 ;
354 int NumCurvTotal = 0; 354 int NumCurvTotal = 0;
355 int ShortDrawTableIndex = 0; 355 int ShortDrawTableIndex = 0;
356 scoGraphicalObject pLongDraw = NULL; 356 scoGraphicalObject pLongDraw = NULL;
357 scoGraphicalObject pShortDraw = NULL; 357 scoGraphicalObject pShortDraw = NULL;
358 scoGraphicalObject *pShortDrawTable = NULL; 358 scoGraphicalObject *pShortDrawTable = NULL;
@@ -360,25 +360,25 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
360 double d_current_real_time = 0. ; //** the current real time as double (52 bit) data structure 360 double d_current_real_time = 0. ; //** the current real time as double (52 bit) data structure
361 double last_update_time = 0. , delta_time = 0.; 361 double last_update_time = 0. , delta_time = 0.;
362 int force_update[256]; //** ... for some headroom :) 362 int force_update[256]; //** ... for some headroom :)
363 //** ------ Real Time section ------------------------------------------------------------- 363 //** ------ Real Time section -------------------------------------------------------------
364 //** current real time as double [second] 364 //** current real time as double [second]
365 d_current_real_time = scoGetRealTime(); 365 d_current_real_time = scoGetRealTime();
366 last_update_time = pScopeMemory->d_last_scope_update_time; //** recover the last update time 366 last_update_time = pScopeMemory->d_last_scope_update_time; //** recover the last update time
367 delta_time = d_current_real_time - last_update_time ; 367 delta_time = d_current_real_time - last_update_time ;
368 //refresh_time = 0.040 ; //** 40ms -> 25 fps min 368 //refresh_time = 0.040 ; //** 40ms -> 25 fps min
369 //** ------ End of Real Time section ------------------------------------------------------ 369 //** ------ End of Real Time section ------------------------------------------------------
370 370
371 ShortDrawTableIndex = 0; 371 ShortDrawTableIndex = 0;
372 NumCurvTotal = 0; 372 NumCurvTotal = 0;
373 NumSubWin = scoGetNumberOfSubwin(pScopeMemory); 373 NumSubWin = scoGetNumberOfSubwin(pScopeMemory);
374 for(i = 0 ; i < NumSubWin ; i++) //** for all the subwindows in the scope 374 for(i = 0 ; i < NumSubWin ; i++) //** for all the subwindows in the scope
375 { 375 {
376 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0); 376 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0);
377 switch (sciGetEntityType(pShortDraw)) 377 switch (sciGetEntityType(pShortDraw))
378 { 378 {
379 379
380 case SCI_POLYLINE: 380 case SCI_POLYLINE:
381 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration 381 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration
382 break; 382 break;
383 383
384 case SCI_SEGS: 384 case SCI_SEGS:
@@ -391,27 +391,27 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
391 } 391 }
392 392
393 //** combined condition for forced redraw 393 //** combined condition for forced redraw
394 //S.Steer time condition commented out because it slow down the display 394 //S.Steer time condition commented out because it slow down the display
395 //an option should be to increase the ShortDraw size if it is full before refresh_time is reached 395 //an option should be to increase the ShortDraw size if it is full before refresh_time is reached
396 force_update[i]=/*((delta_time>refresh_time) && (NbrPtsShort>=2)) ||*/ 396 force_update[i]=/*((delta_time>refresh_time) && (NbrPtsShort>=2)) ||*/
397 (NbrPtsShort>=scoGetShortDrawSize(pScopeMemory,i)); 397 (NbrPtsShort>=scoGetShortDrawSize(pScopeMemory,i));
398 398
399 399
400 400
401 NumCurvTotal += scoGetNumberOfCurvesBySubwin(pScopeMemory,i); 401 NumCurvTotal += scoGetNumberOfCurvesBySubwin(pScopeMemory,i);
402 402
403 } 403 }
404 404
405 pShortDrawTable = scicos_malloc( NumCurvTotal * sizeof(scoGraphicalObject) ); 405 pShortDrawTable = scicos_malloc( NumCurvTotal * sizeof(scoGraphicalObject) );
406 //** for all the sub window in the scope 406 //** for all the sub window in the scope
407 for (i = 0 ; i < NumSubWin ; i++) 407 for (i = 0 ; i < NumSubWin ; i++)
408 { 408 {
409 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0); 409 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0);
410 switch (sciGetEntityType(pShortDraw)) 410 switch (sciGetEntityType(pShortDraw))
411 { 411 {
412 412
413 case SCI_POLYLINE: 413 case SCI_POLYLINE:
414 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration 414 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration
415 break; 415 break;
416 416
417 case SCI_SEGS: 417 case SCI_SEGS:
@@ -423,10 +423,10 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
423 break; 423 break;
424 } 424 }
425 425
426 //**------------------------------------------------------------------------------------------------------- 426 //**-------------------------------------------------------------------------------------------------------
427 //** 427 //**
428 if (force_update[i] == 1) 428 if (force_update[i] == 1)
429 { 429 {
430 /*Block for Realloc*/ 430 /*Block for Realloc*/
431 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0); 431 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0);
432 switch (sciGetEntityType(pLongDraw)) 432 switch (sciGetEntityType(pLongDraw))
@@ -456,13 +456,13 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
456 /*End od block for Realloc*/ 456 /*End od block for Realloc*/
457 457
458 /*Block for Draw*/ 458 /*Block for Draw*/
459 NumCurvInSubWin = scoGetNumberOfCurvesBySubwin(pScopeMemory,i); //** get number of curves in subwin 459 NumCurvInSubWin = scoGetNumberOfCurvesBySubwin(pScopeMemory,i); //** get number of curves in subwin
460 for (j = 0 ; j < NumCurvInSubWin ; j++) 460 for (j = 0 ; j < NumCurvInSubWin ; j++)
461 { 461 {
462 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,j); 462 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,j);
463 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,j); 463 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,j);
464 464
465 if (pShortDraw != NULL) //** protection for NULL pointer 465 if (pShortDraw != NULL) //** protection for NULL pointer
466 { 466 {
467 sciSetUsedWindow(scoGetWindowID(pScopeMemory)); 467 sciSetUsedWindow(scoGetWindowID(pScopeMemory));
468 sciSetSelectedSubWin(scoGetPointerAxes(pScopeMemory,i)); 468 sciSetSelectedSubWin(scoGetPointerAxes(pScopeMemory,i));
@@ -478,20 +478,20 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
478 /*End of Block for Draw*/ 478 /*End of Block for Draw*/
479 479
480 } 480 }
481 } //** end of the for loop for all the subwindow in the scope 481 } //** end of the for loop for all the subwindow in the scope
482 482
483 /* Draw all short draw(s) in all the _concerned_ subwindows in a row :) */ 483 /* Draw all short draw(s) in all the _concerned_ subwindows in a row :) */
484 sciDrawSetOfObj(pShortDrawTable, ShortDrawTableIndex ); 484 sciDrawSetOfObj(pShortDrawTable, ShortDrawTableIndex );
485 scicos_free(pShortDrawTable); 485 scicos_free(pShortDrawTable);
486 486
487 for (i = 0 ; i < NumSubWin ; i++) //** for all the subwin in the scope 487 for (i = 0 ; i < NumSubWin ; i++) //** for all the subwin in the scope
488 { 488 {
489 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0); 489 pShortDraw = scoGetPointerShortDraw(pScopeMemory,i,0);
490 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0); 490 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0);
491 switch (sciGetEntityType(pShortDraw)) 491 switch (sciGetEntityType(pShortDraw))
492 { 492 {
493 case SCI_POLYLINE: 493 case SCI_POLYLINE:
494 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration 494 NbrPtsShort = pPOLYLINE_FEATURE(pShortDraw)->n1; //** this is incremented by one at each iteration
495 break; 495 break;
496 case SCI_SEGS: 496 case SCI_SEGS:
497 NbrPtsShort = pSEGS_FEATURE(pShortDraw)->Nbr1; 497 NbrPtsShort = pSEGS_FEATURE(pShortDraw)->Nbr1;
@@ -500,7 +500,7 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
500 Coserror(_("Cannot use %s with this type of object."), "scoDrawScopeAmplitudeTimeStyle"); 500 Coserror(_("Cannot use %s with this type of object."), "scoDrawScopeAmplitudeTimeStyle");
501 break; 501 break;
502 } 502 }
503 if (force_update[i] == 1) //** scope need a redraw 503 if (force_update[i] == 1) //** scope need a redraw
504 { 504 {
505 switch (sciGetEntityType(pLongDraw)) 505 switch (sciGetEntityType(pLongDraw))
506 { 506 {
@@ -523,10 +523,10 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
523 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,j); 523 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,j);
524 /*Block for Memory*/ 524 /*Block for Memory*/
525 /* 525 /*
526 * Alan's patch, 04/10/2007 : add NbrPtsToCopy to copy good numbers of pts for the first buffer in LongDraw + 526 * Alan's patch, 04/10/2007 : add NbrPtsToCopy to copy good numbers of pts for the first buffer in LongDraw +
527 * Tricks to handle the trace empty case 527 * Tricks to handle the trace empty case
528 */ 528 */
529 inc = NbrPtsLong!=0; 529 inc = NbrPtsLong!=0;
530 NbrPtsToCopy = NbrPtsShort + (NbrPtsLong==0); 530 NbrPtsToCopy = NbrPtsShort + (NbrPtsLong==0);
531 531
532 switch (sciGetEntityType(pShortDraw)) 532 switch (sciGetEntityType(pShortDraw))
@@ -580,12 +580,12 @@ void scoDrawScopeAmplitudeTimeStyle(ScopeMemory * pScopeMemory, double t)
580 break; 580 break;
581 } 581 }
582 } 582 }
583 } //** close of if() 583 } //** close of if()
584 584
585 pScopeMemory->d_last_scope_update_time = scoGetRealTime(); //** update the time stamping AFTER the draw 585 pScopeMemory->d_last_scope_update_time = scoGetRealTime(); //** update the time stamping AFTER the draw
586 //** this "trick" assure at least 25ms of pure simulation (if the buffer is big enough) 586 //** this "trick" assure at least 25ms of pure simulation (if the buffer is big enough)
587 587
588 } //** the scope has been updated 588 } //** the scope has been updated
589 589
590 } //** for all the subwin 590 } //** for all the subwin
591 591
@@ -662,14 +662,14 @@ scoGraphicalObject scoCreatePolyline(scoGraphicalObject pAxes, scoInteger polyli
662 662
663 return pPolyline; 663 return pPolyline;
664} 664}
665/*--------------------------------------------------------------------------*/ 665/*--------------------------------------------------------------------------*/
666void scoAddPolylineForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int color) 666void scoAddPolylineForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int color)
667{ 667{
668 scoGraphicalObject pShortDraw; 668 scoGraphicalObject pShortDraw;
669 pShortDraw = scoCreatePolyline(scoGetPointerAxes(pScopeMemory,i),scoGetShortDrawSize(pScopeMemory,i),color); 669 pShortDraw = scoCreatePolyline(scoGetPointerAxes(pScopeMemory,i),scoGetShortDrawSize(pScopeMemory,i),color);
670 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw); 670 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw);
671} 671}
672/*--------------------------------------------------------------------------*/ 672/*--------------------------------------------------------------------------*/
673void scoAddPolylineForLongDraw(ScopeMemory * pScopeMemory, int i, int j, int color) 673void scoAddPolylineForLongDraw(ScopeMemory * pScopeMemory, int i, int j, int color)
674{ 674{
675 675
@@ -678,7 +678,7 @@ void scoAddPolylineForLongDraw(ScopeMemory * pScopeMemory, int i, int j, int col
678 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw); 678 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw);
679 679
680} 680}
681/*--------------------------------------------------------------------------*/ 681/*--------------------------------------------------------------------------*/
682void scoAddCoupleOfPolylines(ScopeMemory * pScopeMemory, int * colors) 682void scoAddCoupleOfPolylines(ScopeMemory * pScopeMemory, int * colors)
683{ 683{
684 int i,j; 684 int i,j;
@@ -702,7 +702,7 @@ void scoAddCoupleOfPolylines(ScopeMemory * pScopeMemory, int * colors)
702 inc = j+inc; //not +1 because of we have exited the loop 702 inc = j+inc; //not +1 because of we have exited the loop
703 } 703 }
704} 704}
705/*--------------------------------------------------------------------------*/ 705/*--------------------------------------------------------------------------*/
706void scoDelCoupleOfPolylines(ScopeMemory * pScopeMemory) 706void scoDelCoupleOfPolylines(ScopeMemory * pScopeMemory)
707{ 707{
708 int i,j; 708 int i,j;
@@ -716,7 +716,16 @@ void scoDelCoupleOfPolylines(ScopeMemory * pScopeMemory)
716 for(i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++) 716 for(i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++)
717 { 717 {
718 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0); 718 pLongDraw = scoGetPointerLongDraw(pScopeMemory,i,0);
719 NbrPtsLong = pPOLYLINE_FEATURE(pLongDraw)->n1; 719 /*
720 ** If we have 2 scopes with the same ID, pLongDraw may have already
721 ** been deleted, but we still need to call sciDrawObj in the end.
722 ** http://bugzilla.scilab.org/show_bug.cgi?id=8630
723 */
724 if (pLongDraw == NULL)
725 {
726 break;
727 }
728 NbrPtsLong = pPOLYLINE_FEATURE(pLongDraw)->n1;
720 if(NbrPtsLong + scoGetShortDrawSize(pScopeMemory,i) > scoGetLongDrawSize(pScopeMemory,i)) 729 if(NbrPtsLong + scoGetShortDrawSize(pScopeMemory,i) > scoGetLongDrawSize(pScopeMemory,i))
721 { 730 {
722 //We realloc because maybe if we add the shortdraw the size would be bigger than the longdraw size 731 //We realloc because maybe if we add the shortdraw the size would be bigger than the longdraw size
@@ -756,7 +765,7 @@ void scoDelCoupleOfPolylines(ScopeMemory * pScopeMemory)
756 //**redrawHierarchy(scoGetPointerScopeWindow(pScopeMemory)); 765 //**redrawHierarchy(scoGetPointerScopeWindow(pScopeMemory));
757 } 766 }
758} 767}
759/*--------------------------------------------------------------------------*/ 768/*--------------------------------------------------------------------------*/
760void scoAddCoupleOfSegments(ScopeMemory * pScopeMemory, int * color) 769void scoAddCoupleOfSegments(ScopeMemory * pScopeMemory, int * color)
761{ 770{
762 int i,j; 771 int i,j;
@@ -834,7 +843,7 @@ void scoAddCoupleOfSegments(ScopeMemory * pScopeMemory, int * color)
834 scicos_free(vy2); 843 scicos_free(vy2);
835 } 844 }
836} 845}
837/*--------------------------------------------------------------------------*/ 846/*--------------------------------------------------------------------------*/
838void scoDelCoupleOfSegments(ScopeMemory * pScopeMemory) 847void scoDelCoupleOfSegments(ScopeMemory * pScopeMemory)
839{ 848{
840 /* destroy all short draw */ 849 /* destroy all short draw */
@@ -849,34 +858,34 @@ void scoDelCoupleOfSegments(ScopeMemory * pScopeMemory)
849 } 858 }
850 sciDrawObj(scoGetPointerScopeWindow(pScopeMemory)); 859 sciDrawObj(scoGetPointerScopeWindow(pScopeMemory));
851} 860}
852/*--------------------------------------------------------------------------*/ 861/*--------------------------------------------------------------------------*/
853scoGraphicalObject scoCreateSphere(scoGraphicalObject pAxes, double radius, int color) 862scoGraphicalObject scoCreateSphere(scoGraphicalObject pAxes, double radius, int color)
854{ 863{
855 scoGraphicalObject pSphere; 864 scoGraphicalObject pSphere;
856 pSphere=ConstructArc(pAxes, 0, 0, radius, radius, 0, 23040, &color, &color, TRUE, FALSE); 865 pSphere=ConstructArc(pAxes, 0, 0, radius, radius, 0, 23040, &color, &color, TRUE, FALSE);
857 return pSphere; 866 return pSphere;
858} 867}
859/*--------------------------------------------------------------------------*/ 868/*--------------------------------------------------------------------------*/
860void scoAddSphereForShortDraw(ScopeMemory * pScopeMemory, int i, int j, double radius, int color) 869void scoAddSphereForShortDraw(ScopeMemory * pScopeMemory, int i, int j, double radius, int color)
861{ 870{
862 scoGraphicalObject pShortDraw; 871 scoGraphicalObject pShortDraw;
863 pShortDraw = scoCreateSphere(scoGetPointerAxes(pScopeMemory,i),radius,color); 872 pShortDraw = scoCreateSphere(scoGetPointerAxes(pScopeMemory,i),radius,color);
864 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw); 873 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw);
865} 874}
866/*--------------------------------------------------------------------------*/ 875/*--------------------------------------------------------------------------*/
867void scoAddSphereForLongDraw(ScopeMemory * pScopeMemory, int i, int j, double radius, int color) 876void scoAddSphereForLongDraw(ScopeMemory * pScopeMemory, int i, int j, double radius, int color)
868{ 877{
869 scoGraphicalObject pLongDraw; 878 scoGraphicalObject pLongDraw;
870 pLongDraw = scoCreateSphere(scoGetPointerAxes(pScopeMemory,i),radius,color); 879 pLongDraw = scoCreateSphere(scoGetPointerAxes(pScopeMemory,i),radius,color);
871 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw); 880 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw);
872} 881}
873/*--------------------------------------------------------------------------*/ 882/*--------------------------------------------------------------------------*/
874void scoAddCoupleOfSpheres(ScopeMemory * pScopeMemory, double * radius, int * colors) 883void scoAddCoupleOfSpheres(ScopeMemory * pScopeMemory, double * radius, int * colors)
875{ 884{
876 int i = 0,j = 0; 885 int i = 0,j = 0;
877 sciSetUsedWindow(scoGetWindowID(pScopeMemory)); 886 sciSetUsedWindow(scoGetWindowID(pScopeMemory));
878 for (i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++) 887 for (i = 0 ; i < scoGetNumberOfSubwin(pScopeMemory) ; i++)
879 { 888 {
880 for(j = 0 ; j < scoGetNumberOfCurvesBySubwin(pScopeMemory,i) ; j++) 889 for(j = 0 ; j < scoGetNumberOfCurvesBySubwin(pScopeMemory,i) ; j++)
881 { 890 {
882 if(colors != NULL) 891 if(colors != NULL)
@@ -892,21 +901,21 @@ void scoAddCoupleOfSpheres(ScopeMemory * pScopeMemory, double * radius, int * co
892 } 901 }
893 } 902 }
894} 903}
895/*--------------------------------------------------------------------------*/ 904/*--------------------------------------------------------------------------*/
896scoGraphicalObject scoCreateRectangle(scoGraphicalObject pAxes, double x, double y, double width, double height) 905scoGraphicalObject scoCreateRectangle(scoGraphicalObject pAxes, double x, double y, double width, double height)
897{ 906{
898 scoGraphicalObject pRectangle; 907 scoGraphicalObject pRectangle;
899 pRectangle = ConstructRectangle(pAxes,x,y,height,width,NULL,NULL,0,1); 908 pRectangle = ConstructRectangle(pAxes,x,y,height,width,NULL,NULL,0,1);
900 return pRectangle; 909 return pRectangle;
901} 910}
902/*--------------------------------------------------------------------------*/ 911/*--------------------------------------------------------------------------*/
903void scoAddRectangleForLongDraw(ScopeMemory * pScopeMemory, int i, int j, double x, double y, double width, double height) 912void scoAddRectangleForLongDraw(ScopeMemory * pScopeMemory, int i, int j, double x, double y, double width, double height)
904{ 913{
905 scoGraphicalObject pLongDraw; 914 scoGraphicalObject pLongDraw;
906 pLongDraw = scoCreateRectangle(scoGetPointerAxes(pScopeMemory,i),x,y,width,height); 915 pLongDraw = scoCreateRectangle(scoGetPointerAxes(pScopeMemory,i),x,y,width,height);
907 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw); 916 scoSetHandleFromPointerLongDraw(pScopeMemory,i,j,pLongDraw);
908} 917}
909/*--------------------------------------------------------------------------*/ 918/*--------------------------------------------------------------------------*/
910void scoAddTitlesScope(ScopeMemory * pScopeMemory, char * label, char * x, char * y, char * z) 919void scoAddTitlesScope(ScopeMemory * pScopeMemory, char * label, char * x, char * y, char * z)
911{ 920{
912 921
@@ -962,7 +971,7 @@ void scoAddTitlesScope(ScopeMemory * pScopeMemory, char * label, char * x, char
962 if (label != NULL) 971 if (label != NULL)
963 { 972 {
964 nxname = (int)strlen(label); 973 nxname = (int)strlen(label);
965 if (nxname > 39) 974 if (nxname > 39)
966 { 975 {
967 nxname = 39; 976 nxname = 39;
968 } 977 }
@@ -981,7 +990,7 @@ void scoAddTitlesScope(ScopeMemory * pScopeMemory, char * label, char * x, char
981 sciDrawObj(scoGetPointerScopeWindow(pScopeMemory)); 990 sciDrawObj(scoGetPointerScopeWindow(pScopeMemory));
982 //**redrawHierarchy(scoGetPointerScopeWindow(pScopeMemory)); 991 //**redrawHierarchy(scoGetPointerScopeWindow(pScopeMemory));
983} 992}
984/*--------------------------------------------------------------------------*/ 993/*--------------------------------------------------------------------------*/
985void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory) 994void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory)
986{ 995{
987 /* 15/07/2009, S. Steer: efficiency improved by grouping the objects to be drawn */ 996 /* 15/07/2009, S. Steer: efficiency improved by grouping the objects to be drawn */
@@ -997,7 +1006,7 @@ void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory)
997 //Coded only for one subwin can be easily extended to many with a factorj , j < scoGetNumberOfSubwin() 1006 //Coded only for one subwin can be easily extended to many with a factorj , j < scoGetNumberOfSubwin()
998 1007
999 /* Display the ShortDraw polylines which are filled */ 1008 /* Display the ShortDraw polylines which are filled */
1000 /* The loop on curv has been duplicated for efficiency reason: 1009 /* The loop on curv has been duplicated for efficiency reason:
1001 to be able to draw all the polyline in one call*/ 1010 to be able to draw all the polyline in one call*/
1002 1011
1003 DrawTable = scicos_malloc( Ncurv * sizeof(scoGraphicalObject) ); 1012 DrawTable = scicos_malloc( Ncurv * sizeof(scoGraphicalObject) );
@@ -1005,7 +1014,7 @@ void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory)
1005 { 1014 {
1006 Pinceau = scoGetPointerShortDraw(pScopeMemory,0,i); 1015 Pinceau = scoGetPointerShortDraw(pScopeMemory,0,i);
1007 NbrPtsShort = pPOLYLINE_FEATURE(Pinceau)->n1; 1016 NbrPtsShort = pPOLYLINE_FEATURE(Pinceau)->n1;
1008 if(NbrPtsShort >= scoGetShortDrawSize(pScopeMemory,0)){ 1017 if(NbrPtsShort >= scoGetShortDrawSize(pScopeMemory,0)){
1009 DrawTable[ DrawTableIndex++]=Pinceau; 1018 DrawTable[ DrawTableIndex++]=Pinceau;
1010 } 1019 }
1011 } 1020 }
@@ -1042,7 +1051,7 @@ void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory)
1042 if(pPOLYLINE_FEATURE(Pinceau)->pvz != NULL) 1051 if(pPOLYLINE_FEATURE(Pinceau)->pvz != NULL)
1043 { 1052 {
1044 C2F(dcopy)(&NbrPtsShort,pPOLYLINE_FEATURE(Pinceau)->pvz,&c__1,pPOLYLINE_FEATURE(Trait)->pvz+NbrPtsLong,&c__1); 1053 C2F(dcopy)(&NbrPtsShort,pPOLYLINE_FEATURE(Pinceau)->pvz,&c__1,pPOLYLINE_FEATURE(Trait)->pvz+NbrPtsLong,&c__1);
1045 } 1054 }
1046 pPOLYLINE_FEATURE(Trait)->n1 = NbrPtsLong + NbrPtsShort; 1055 pPOLYLINE_FEATURE(Trait)->n1 = NbrPtsLong + NbrPtsShort;
1047 /*reset the ShortDraw polyline */ 1056 /*reset the ShortDraw polyline */
1048 pPOLYLINE_FEATURE(Pinceau)->pvx[0] = pPOLYLINE_FEATURE(Pinceau)->pvx[NbrPtsShort-1]; 1057 pPOLYLINE_FEATURE(Pinceau)->pvx[0] = pPOLYLINE_FEATURE(Pinceau)->pvx[NbrPtsShort-1];
@@ -1055,7 +1064,7 @@ void scoDrawScopeXYStyle(ScopeMemory * pScopeMemory)
1055 } 1064 }
1056 } 1065 }
1057} 1066}
1058/*--------------------------------------------------------------------------*/ 1067/*--------------------------------------------------------------------------*/
1059void scoDrawScopeAnimXYStyle(ScopeMemory * pScopeMemory, double * u1, double * u2, double * u3) 1068void scoDrawScopeAnimXYStyle(ScopeMemory * pScopeMemory, double * u1, double * u2, double * u3)
1060/* 15/07/2009, S. Steer: efficiency improved by grouping the objects to be drawn */ 1069/* 15/07/2009, S. Steer: efficiency improved by grouping the objects to be drawn */
1061{ 1070{
@@ -1120,7 +1129,7 @@ void scoDrawScopeAnimXYStyle(ScopeMemory * pScopeMemory, double * u1, double * u
1120 pPOLYLINE_FEATURE(Trait)->pvz[j] = pPOLYLINE_FEATURE(Trait)->pvz[j-1]; 1129 pPOLYLINE_FEATURE(Trait)->pvz[j] = pPOLYLINE_FEATURE(Trait)->pvz[j-1];
1121 } 1130 }
1122 pPOLYLINE_FEATURE(Trait)->pvz[0] = pPOLYLINE_FEATURE(Pinceau)->pvz[0]; 1131 pPOLYLINE_FEATURE(Trait)->pvz[0] = pPOLYLINE_FEATURE(Pinceau)->pvz[0];
1123 pPOLYLINE_FEATURE(Pinceau)->pvz[0] = u3[i]; 1132 pPOLYLINE_FEATURE(Pinceau)->pvz[0] = u3[i];
1124 } 1133 }
1125 1134
1126 /* memorize objects to be drawn */ 1135 /* memorize objects to be drawn */
@@ -1190,7 +1199,7 @@ void scoDrawScopeAnimXYStyle(ScopeMemory * pScopeMemory, double * u1, double * u
1190 1199
1191 } 1200 }
1192} 1201}
1193/*--------------------------------------------------------------------------*/ 1202/*--------------------------------------------------------------------------*/
1194scoGraphicalObject scoCreateGrayplot(scoGraphicalObject pAxes, int size_x, int size_y) 1203scoGraphicalObject scoCreateGrayplot(scoGraphicalObject pAxes, int size_x, int size_y)
1195{ 1204{
1196 scoGraphicalObject pGrayplot; 1205 scoGraphicalObject pGrayplot;
@@ -1217,14 +1226,14 @@ scoGraphicalObject scoCreateGrayplot(scoGraphicalObject pAxes, int size_x, int s
1217 1226
1218 return pGrayplot; 1227 return pGrayplot;
1219} 1228}
1220/*--------------------------------------------------------------------------*/ 1229/*--------------------------------------------------------------------------*/
1221void scoAddGrayplotForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int size_x, int size_y) 1230void scoAddGrayplotForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int size_x, int size_y)
1222{ 1231{
1223 scoGraphicalObject pShortDraw; 1232 scoGraphicalObject pShortDraw;
1224 pShortDraw = scoCreateGrayplot(scoGetPointerAxes(pScopeMemory,i),size_x,size_y); 1233 pShortDraw = scoCreateGrayplot(scoGetPointerAxes(pScopeMemory,i),size_x,size_y);
1225 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw); 1234 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw);
1226} 1235}
1227/*--------------------------------------------------------------------------*/ 1236/*--------------------------------------------------------------------------*/
1228scoGraphicalObject scoCreatePlot3d(scoGraphicalObject pAxes, int size_x, int size_y) 1237scoGraphicalObject scoCreatePlot3d(scoGraphicalObject pAxes, int size_x, int size_y)
1229{ 1238{
1230 scoGraphicalObject pPlot3d; 1239 scoGraphicalObject pPlot3d;
@@ -1281,11 +1290,11 @@ scoGraphicalObject scoCreatePlot3d(scoGraphicalObject pAxes, int size_x, int siz
1281 1290
1282 return pPlot3d; 1291 return pPlot3d;
1283} 1292}
1284/*--------------------------------------------------------------------------*/ 1293/*--------------------------------------------------------------------------*/
1285void scoAddPlot3dForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int size_x, int size_y) 1294void scoAddPlot3dForShortDraw(ScopeMemory * pScopeMemory, int i, int j, int size_x, int size_y)
1286{ 1295{
1287 scoGraphicalObject pShortDraw; 1296 scoGraphicalObject pShortDraw;
1288 pShortDraw = scoCreatePlot3d(scoGetPointerAxes(pScopeMemory,i),size_x,size_y); 1297 pShortDraw = scoCreatePlot3d(scoGetPointerAxes(pScopeMemory,i),size_x,size_y);
1289 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw); 1298 scoSetHandleFromPointerShortDraw(pScopeMemory,i,j,pShortDraw);
1290} 1299}
1291/*--------------------------------------------------------------------------*/ 1300/*--------------------------------------------------------------------------*/