Rev 8244 | Rev 8262 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8244 | Rev 8257 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | char *str_replace ( const char *word, const char *sub_word, const char *rep_word ); |
29 | char *str_replace ( const char *word, const char *sub_word, const char *rep_word ); |
30 | char *get_color(FILE *infile,int last); /* read hex-color or colorname -> hex */ |
30 | char *get_color(FILE *infile,int last); /* read hex-color or colorname -> hex */ |
31 | char *get_string(FILE *infile,int last); /* get the string at the end of a command */ |
31 | char *get_string(FILE *infile,int last); /* get the string at the end of a command */ |
32 | char *get_string_argument(FILE *infile,int last); /* the same, but with "comma" as separator */ |
32 | char *get_string_argument(FILE *infile,int last); /* the same, but with "comma" as separator */ |
33 | char *convert_hex2rgb(char *hexcolor); |
33 | char *convert_hex2rgb(char *hexcolor); |
34 | void add_read_canvas(int reply_format,int reply_precision); |
34 | void add_read_canvas(int canvas_root_id,int reply_format,int reply_precision); |
35 | void make_js_include(int canvas_root_id); |
35 | void make_js_include(int canvas_root_id); |
36 | void check_string_length(int length);/* checks if the length of string argument of command is correct */ |
36 | void check_string_length(int length);/* checks if the length of string argument of command is correct */ |
37 | FILE *js_include_file; |
37 | FILE *js_include_file; |
38 | FILE *get_file(int *line_number, char **filename); |
38 | FILE *get_file(int *line_number, char **filename); |
39 | FILE *infile; /* will be stdin */ |
39 | FILE *infile; /* will be stdin */ |
Line 164... | Line 164... | ||
164 | type = get_token(infile); |
164 | type = get_token(infile); |
165 | done = FALSE; |
165 | done = FALSE; |
166 | /* |
166 | /* |
167 | @canvasdraw |
167 | @canvasdraw |
168 | @will try use the same syntax as flydraw or svgdraw to paint a html5 bitmap image<br />by generating a tailor-made javascript include file: providing only the js-functionality needed to perform the job.<br />thus ensuring a minimal strain on the client browser <br />(unlike some popular 'canvas-do-it-all' libraries, who have proven to be not suitable for low-end computers found in schools...) |
168 | @will try use the same syntax as flydraw or svgdraw to paint a html5 bitmap image<br />by generating a tailor-made javascript include file: providing only the js-functionality needed to perform the job.<br />thus ensuring a minimal strain on the client browser <br />(unlike some popular 'canvas-do-it-all' libraries, who have proven to be not suitable for low-end computers found in schools...) |
169 | @General syntax <ul><li>The transparency of all objects can be controlled by command 'opacity [0-255],[0,255]'</il><li>a line based object can be controlled by command 'linewidth int'</li><li>a line based object may be dashed by using keyword 'dashed' before the object command.<br />the dashing type can be controled by command 'dashtype int,int'</li><li>a fillable object can be set fillable by starting the object command with an 'f'<br />(like frect,fcircle,ftriangle...)<br />or by using the keyword 'filled' before the object command.<br />The fill colour will be the stroke colour...(19/10/2013)</li><li> all draggable objects may have a slider for translation / rotation; several objects may be translated / rotated by a single slider</li> <li> a draggable object can be set draggable by a preceding command 'drag x/y/xy'<br />The translation can be read by javascript:read_dragdrop();The replyformat is : object_number : x-orig : y-orig : x-drag : y-drag<br />The x-orig/y-orig will be returned in maximum precision (javascript float)...<br />the x-drag/y-drag will be returned in defined 'precision' number of decimals<br />Multiple objects may be set draggable / clickable (no limit)<br /> not all flydraw objects may be dragged / clicked<br />Only draggable / clickable objects will be scaled on zoom and will be translated in case of panning</li><li> a 'onclick object' can be set 'clickable' by the preceding keyword 'onclick'<br />not all flydraw objects can be set clickable</li><li><b>remarks using a ';' as command separator</b><br />commands with only numeric or colour arguments may be using a ';' as command separator (in stead of a new line)<br />commands with a string argument may not use a ';' as command separator !<br />these exceptions are not really straight forward... so keep this in mind.</li></ul> |
169 | @General syntax <ul><li>The transparency of all objects can be controlled by command 'opacity [0-255],[0,255]'</il><li>a line based object can be controlled by command 'linewidth int'</li><li>a line based object may be dashed by using keyword 'dashed' before the object command.<br />the dashing type can be controled by command 'dashtype int,int'</li><li>a fillable object can be set fillable by starting the object command with an 'f'<br />(like frect,fcircle,ftriangle...)<br />or by using the keyword 'filled' before the object command.<br />The fill colour will be the stroke colour...(19/10/2013)</li><li> all draggable objects may have a slider for translation / rotation; several objects may be translated / rotated by a single slider</li> <li> a draggable object can be set draggable by a preceding command 'drag x/y/xy'<br />The translation can be read by javascript:read_dragdrop();The replyformat is : object_number : x-orig : y-orig : x-drag : y-drag<br />The x-orig/y-orig will be returned in maximum precision (javascript float)...<br />the x-drag/y-drag will be returned in defined 'precision' number of decimals<br />Multiple objects may be set draggable / clickable (no limit)<br /> not all flydraw objects may be dragged / clicked<br />Only draggable / clickable objects will be scaled on zoom and will be translated in case of panning</li><li> a 'onclick object' can be set 'clickable' by the preceding keyword 'onclick'<br />not all flydraw objects can be set clickable</li><li><b>remarks using a ';' as command separator</b><br />commands with only numeric or colour arguments may be using a ';' as command separator (in stead of a new line)<br />commands with a string argument may not use a ';' as command separator !<br />these exceptions are not really straight forward... so keep this in mind.</li></ul>Note: for now just <b>one interactive</b> instance of canvasdraw is allowed <br />[e.g. using command 'userdraw' and function javascript:read_canvas()]<br />Aim is to allow multiple interactive instances of canvasdraw to exist in a single page (this will however call for a much more 'object oriented approach' and decent javascript programming...) |
170 | */ |
170 | */ |
171 | switch(type){ |
171 | switch(type){ |
172 | case END: |
172 | case END: |
173 | finished = 1; |
173 | finished = 1; |
174 | done = TRUE; |
174 | done = TRUE; |
Line 198... | Line 198... | ||
198 | 198 | ||
199 | /* |
199 | /* |
200 | The sequence in which stuff is finally printed is important !! |
200 | The sequence in which stuff is finally printed is important !! |
201 | for example, when writing a 'include.js" the may not be a "script tag <script>" etc etc |
201 | for example, when writing a 'include.js" the may not be a "script tag <script>" etc etc |
202 | */ |
202 | */ |
203 | fprintf(stdout,"\n<script type=\"text/javascript\"> |
203 | fprintf(stdout,"\n<script type=\"text/javascript\">\ |
- | 204 | if( typeof wims_status === 'undefined' ){ var wims_status = \"$status\";};\ |
|
- | 205 | if( typeof use_dragdrop_reply === 'undefined' ){ var use_dragdrop_reply = false;};\ |
|
- | 206 | if( typeof canvas_scripts === 'undefined' ){ var canvas_scripts = new Array();};\ |
|
- | 207 | canvas_scripts.push(\"%d\");</script>\n\ |
|
204 |
|
208 | <!-- canvasdraw div and tooltip placeholder, if needed -->\n<div tabindex=\"0\" id=\"canvas_div%d\" style=\"position:relative;width:%dpx;height:%dpx;margin-left:auto;margin-right:auto;\" ></div><div id=\"tooltip_placeholder_div%d\" style=\"display:block;margin-bottom:4px;\"><span id=\"tooltip_placeholder%d\" style=\"display:none;\"></span></div>\n",canvas_root_id,canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id); |
- | 209 | fprintf(stdout,"<!-- include actual object code via include file -->\n<script id=\"canvas_script%d\" type=\"text/javascript\" src=\"%s\"></script>\n",canvas_root_id,getfile_cmd); |
|
205 | fprintf(js_include_file,"\n<!-- begin generated javascript include for canvasdraw -->\n\ |
210 | fprintf(js_include_file,"\n<!-- begin generated javascript include for canvasdraw -->\n\ |
206 | \"use strict\";\n\ |
211 | \"use strict\";\n\ |
207 | <!-- these variables and functions must be global -->\n\ |
212 | <!-- these variables and functions must be global -->\n\ |
208 | var |
213 | var read_dragdrop%d;\ |
209 | var |
214 | var read_canvas%d;\ |
210 | var set_clock;\ |
215 | var set_clock;\ |
211 | var clear_draw_area;\ |
216 | var clear_draw_area;\ |
212 | var userdraw_x = [];var userdraw_y = [];var userdraw_radius = [];\n\ |
- | |
213 | var wims_canvas_function%d = function(){\n<!-- common used stuff -->\n\ |
217 | var wims_canvas_function%d = function(){\n<!-- common used stuff -->\n\ |
- | 218 | var userdraw_x = [];var userdraw_y = [];var userdraw_radius = [];\n\ |
|
214 | var xsize = %d;\ |
219 | var xsize = %d;\ |
215 | var ysize = %d;\ |
220 | var ysize = %d;\ |
216 | var precision = 100;\ |
221 | var precision = 100;\ |
217 | var canvas_div = document.getElementById(\"canvas_div%d\");\ |
222 | var canvas_div = document.getElementById(\"canvas_div%d\");\ |
218 | var create_canvas%d = function(canvas_type,size_x,size_y){var cnv;if(document.getElementById(\"wims_canvas%d\"+canvas_type)){ cnv = document.getElementById(\"wims_canvas%d\"+canvas_type);}else{try{ cnv = document.createElement(\"canvas\"); }catch(e){alert(\"Your browser does not support HTML5 CANVAS:GET FIREFOX !\");return;};canvas_div.appendChild(cnv);};cnv.width = size_x;cnv.height = size_y;cnv.style.top = 0;cnv.style.left = 0;cnv.style.position = \"absolute\";cnv.id = \"wims_canvas%d\"+canvas_type;return cnv;};\ |
223 | var create_canvas%d = function(canvas_type,size_x,size_y){var cnv;if(document.getElementById(\"wims_canvas%d\"+canvas_type)){ cnv = document.getElementById(\"wims_canvas%d\"+canvas_type);}else{try{ cnv = document.createElement(\"canvas\"); }catch(e){alert(\"Your browser does not support HTML5 CANVAS:GET FIREFOX !\");return;};canvas_div.appendChild(cnv);};cnv.width = size_x;cnv.height = size_y;cnv.style.top = 0;cnv.style.left = 0;cnv.style.position = \"absolute\";cnv.id = \"wims_canvas%d\"+canvas_type;return cnv;};\ |
Line 239... | Line 244... | ||
239 | var use_pan_and_zoom = 0;\ |
244 | var use_pan_and_zoom = 0;\ |
240 | var use_jsmath = 0;\ |
245 | var use_jsmath = 0;\ |
241 | var xstart = 0;\ |
246 | var xstart = 0;\ |
242 | var ystart = 0;\ |
247 | var ystart = 0;\ |
243 | var unit_x=\" \";\ |
248 | var unit_x=\" \";\ |
244 | var unit_y=\" \";",canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id); |
249 | var unit_y=\" \";",canvas_root_id,canvas_root_id,canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id); |
245 | /* default add the drag code : nearly always used ...*/ |
250 | /* default add the drag code : nearly always used ...*/ |
246 | add_drag_code(js_include_file,DRAG_CANVAS,canvas_root_id); |
251 | add_drag_code(js_include_file,DRAG_CANVAS,canvas_root_id); |
- | 252 | ||
247 | break; |
253 | break; |
248 | case XRANGE: |
254 | case XRANGE: |
249 | /* |
255 | /* |
250 | @ xrange xmin,xmax |
256 | @ xrange xmin,xmax |
251 | @ if not given: 0,xsize (eg in pixels) |
257 | @ if not given: 0,xsize (eg in pixels) |
Line 257... | Line 263... | ||
257 | default: break; |
263 | default: break; |
258 | } |
264 | } |
259 | } |
265 | } |
260 | if(xmin >= xmax){canvas_error(" xrange is not OK : xmin < xmax !\n");} |
266 | if(xmin >= xmax){canvas_error(" xrange is not OK : xmin < xmax !\n");} |
261 | fprintf(js_include_file,"var xmin = %f;var xmax = %f;",xmin,xmax); |
267 | fprintf(js_include_file,"var xmin = %f;var xmax = %f;",xmin,xmax); |
262 | found_size_command++; |
268 | found_size_command++; |
263 | break; |
269 | break; |
264 | case YRANGE: |
270 | case YRANGE: |
265 | /* |
271 | /* |
266 | @ yrange ymin,ymax |
272 | @ yrange ymin,ymax |
267 | @ if not given 0,ysize (eg in pixels) |
273 | @ if not given 0,ysize (eg in pixels) |
Line 355... | Line 361... | ||
355 | i++; |
361 | i++; |
356 | } |
362 | } |
357 | decimals = find_number_of_digits(precision); |
363 | decimals = find_number_of_digits(precision); |
358 | for(c=0 ; c < i-1 ; c = c+2){ |
364 | for(c=0 ; c < i-1 ; c = c+2){ |
359 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,7,[%.*f],[%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[c],decimals,double_data[c+1],crosshair_size,crosshair_size,line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,1,0,0,0,use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
365 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,7,[%.*f],[%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[c],decimals,double_data[c+1],crosshair_size,crosshair_size,line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,1,0,0,0,use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
360 | click_cnt++; |
366 | click_cnt++; |
361 | } |
367 | } |
362 | reset(); |
368 | reset(); |
363 | break; |
369 | break; |
364 | case POINT: |
370 | case POINT: |
365 | /* |
371 | /* |
Line 599... | Line 605... | ||
599 | stroke_color = get_color(infile,1);/* name or hex color */ |
605 | stroke_color = get_color(infile,1);/* name or hex color */ |
600 | decimals = find_number_of_digits(precision); |
606 | decimals = find_number_of_digits(precision); |
601 | double_data[3] = double_data[0] + (xmax - xmin)*double_data[2]/xsize; |
607 | double_data[3] = double_data[0] + (xmax - xmin)*double_data[2]/xsize; |
602 | double_data[4] = double_data[1] + -1*(ymax - ymin)*double_data[2]/ysize; |
608 | double_data[4] = double_data[1] + -1*(ymax - ymin)*double_data[2]/ysize; |
603 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,1,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[3],decimals,double_data[3],decimals,double_data[0],decimals,double_data[1],decimals,double_data[1],decimals,double_data[4],decimals,double_data[4],line_width,line_width,line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
609 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,1,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[3],decimals,double_data[3],decimals,double_data[0],decimals,double_data[1],decimals,double_data[1],decimals,double_data[4],decimals,double_data[4],line_width,line_width,line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
604 | click_cnt++;reset(); |
610 | click_cnt++;reset(); |
605 | break; |
611 | break; |
606 | } |
612 | } |
607 | } |
613 | } |
608 | break; |
614 | break; |
609 | case ROUNDRECT: |
615 | case ROUNDRECT: |
Line 1379... | Line 1385... | ||
1379 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1385 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1380 | if(reply_format == 0){reply_format = 11;} |
1386 | if(reply_format == 0){reply_format = 11;} |
1381 | add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1387 | add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1382 | if( use_input_xy == 1 ){ |
1388 | if( use_input_xy == 1 ){ |
1383 | add_input_line(js_include_file,2); |
1389 | add_input_line(js_include_file,2); |
1384 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1390 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1385 | } |
1391 | } |
1386 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1392 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1387 | } |
1393 | } |
1388 | else |
1394 | else |
1389 | if( strcmp(draw_type,"demilines") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1395 | if( strcmp(draw_type,"demilines") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1390 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1396 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1391 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
1397 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
1392 | if(reply_format == 0){reply_format = 11;} |
1398 | if(reply_format == 0){reply_format = 11;} |
1393 | add_js_demilines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1399 | add_js_demilines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1394 | if( use_input_xy == 1 ){ |
1400 | if( use_input_xy == 1 ){ |
1395 | add_input_demiline(js_include_file,2); |
1401 | add_input_demiline(js_include_file,2); |
1396 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1402 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1397 | } |
1403 | } |
1398 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1404 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1399 | } |
1405 | } |
1400 | else |
1406 | else |
1401 | if( strcmp(draw_type,"demiline") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1407 | if( strcmp(draw_type,"demiline") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1402 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1408 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1403 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
1409 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
Line 1405... | Line 1411... | ||
1405 | add_js_demilines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1411 | add_js_demilines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1406 | if( use_input_xy == 1 ){ |
1412 | if( use_input_xy == 1 ){ |
1407 | add_input_demiline(js_include_file,1); |
1413 | add_input_demiline(js_include_file,1); |
1408 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1414 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1409 | } |
1415 | } |
1410 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1416 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1411 | } |
1417 | } |
1412 | else |
1418 | else |
1413 | if( strcmp(draw_type,"rects") == 0){ |
1419 | if( strcmp(draw_type,"rects") == 0){ |
1414 | if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;} |
1420 | if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;} |
1415 | if(reply_format == 0){reply_format = 2;} |
1421 | if(reply_format == 0){reply_format = 2;} |
Line 1428... | Line 1434... | ||
1428 | else |
1434 | else |
1429 | if( strcmp(draw_type,"rect") == 0){ |
1435 | if( strcmp(draw_type,"rect") == 0){ |
1430 | if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;} |
1436 | if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;} |
1431 | if(reply_format == 0){reply_format = 2;} |
1437 | if(reply_format == 0){reply_format = 2;} |
1432 | add_js_rect(js_include_file,1,0,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1438 | add_js_rect(js_include_file,1,0,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1433 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1439 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1434 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1440 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1435 | } |
1441 | } |
1436 | else |
1442 | else |
1437 | if( strcmp(draw_type,"roundrect") == 0){ |
1443 | if( strcmp(draw_type,"roundrect") == 0){ |
1438 | if( js_function[DRAW_ROUNDRECTS] != 1 ){ js_function[DRAW_ROUNDRECTS] = 1;} |
1444 | if( js_function[DRAW_ROUNDRECTS] != 1 ){ js_function[DRAW_ROUNDRECTS] = 1;} |
1439 | if(reply_format == 0){reply_format = 2;} |
1445 | if(reply_format == 0){reply_format = 2;} |
1440 | add_js_rect(js_include_file,1,1,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1446 | add_js_rect(js_include_file,1,1,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1441 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1447 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1442 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1448 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1443 | } |
1449 | } |
1444 | else |
1450 | else |
1445 | if( strcmp(draw_type,"arcs") == 0){ |
1451 | if( strcmp(draw_type,"arcs") == 0){ |
1446 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1452 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1447 | if(reply_format == 0){reply_format = 25;} |
1453 | if(reply_format == 0){reply_format = 25;} |
1448 | add_js_arc(js_include_file,canvas_root_id,2,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1454 | add_js_arc(js_include_file,canvas_root_id,2,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1449 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1455 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1450 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1456 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1451 | } |
1457 | } |
1452 | else |
1458 | else |
1453 | if( strcmp(draw_type,"arc") == 0){ |
1459 | if( strcmp(draw_type,"arc") == 0){ |
1454 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1460 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1455 | if(reply_format == 0){reply_format = 25;} |
1461 | if(reply_format == 0){reply_format = 25;} |
1456 | add_js_arc(js_include_file,canvas_root_id,1,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1462 | add_js_arc(js_include_file,canvas_root_id,1,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1457 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1463 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1458 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1464 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1459 | } |
1465 | } |
1460 | else |
1466 | else |
1461 | if( strcmp(draw_type,"text") == 0){ |
1467 | if( strcmp(draw_type,"text") == 0){ |
1462 | if( js_function[DRAW_TEXTS] != 1 ){ js_function[DRAW_TEXTS] = 1;} |
1468 | if( js_function[DRAW_TEXTS] != 1 ){ js_function[DRAW_TEXTS] = 1;} |
1463 | if(reply_format == 0){reply_format = 17;} |
1469 | if(reply_format == 0){reply_format = 17;} |
1464 | add_js_text(js_include_file,canvas_root_id,font_size,font_family,font_color,stroke_opacity); |
1470 | add_js_text(js_include_file,canvas_root_id,font_size,font_family,font_color,stroke_opacity); |
1465 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1471 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1466 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1472 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1467 | } |
1473 | } |
1468 | else |
1474 | else |
1469 | if( strcmp(draw_type,"inputs") == 0){ |
1475 | if( strcmp(draw_type,"inputs") == 0){ |
1470 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1476 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1471 | if(reply_format == 0){reply_format = 27;} |
1477 | if(reply_format == 0){reply_format = 27;} |
1472 | add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width); |
1478 | add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width); |
1473 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1479 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1474 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1480 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1475 | } |
1481 | } |
1476 | else |
1482 | else |
Line 1478... | Line 1484... | ||
1478 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1484 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1479 | if(reply_format == 0){reply_format = 27;} |
1485 | if(reply_format == 0){reply_format = 27;} |
1480 | add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width); |
1486 | add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width); |
1481 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1487 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1482 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1488 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1483 | } |
1489 | } |
1484 | else |
1490 | else |
1485 | { |
1491 | { |
1486 | canvas_error("unknown drawtype or typo? "); |
1492 | canvas_error("unknown drawtype or typo? "); |
1487 | } |
1493 | } |
1488 | reset(); |
1494 | reset(); |
Line 1624... | Line 1630... | ||
1624 | stroke_color = get_color(infile,0); |
1630 | stroke_color = get_color(infile,0); |
1625 | char *fun1 = get_string_argument(infile,0); |
1631 | char *fun1 = get_string_argument(infile,0); |
1626 | char *fun2 = get_string_argument(infile,1); |
1632 | char *fun2 = get_string_argument(infile,1); |
1627 | if( strlen(fun1) == 0 || strlen(fun2) == 0 ){canvas_error("parametric functions are NOT OK !");} |
1633 | if( strlen(fun1) == 0 || strlen(fun2) == 0 ){canvas_error("parametric functions are NOT OK !");} |
1628 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,animation_type,eval_parametric(xsize,ysize,fun1,fun2,xmin,xmax,ymin,ymax,tmin,tmax,plot_steps,precision),2*line_width,2*line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
1634 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,animation_type,eval_parametric(xsize,ysize,fun1,fun2,xmin,xmax,ymin,ymax,tmin,tmax,plot_steps,precision),2*line_width,2*line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
1629 | click_cnt++; |
1635 | click_cnt++; |
1630 | } |
1636 | } |
1631 | else |
1637 | else |
1632 | { |
1638 | { |
1633 | stroke_color = get_color(infile,0); |
1639 | stroke_color = get_color(infile,0); |
1634 | char *fun1 = get_string_argument(infile,1); |
1640 | char *fun1 = get_string_argument(infile,1); |
Line 1653... | Line 1659... | ||
1653 | for(i = 0; i < 5 ;i++){ |
1659 | for(i = 0; i < 5 ;i++){ |
1654 | switch(i){ |
1660 | switch(i){ |
1655 | case 0: stroke_color = get_color(infile,0);break;/* font_color == stroke_color name or hex color */ |
1661 | case 0: stroke_color = get_color(infile,0);break;/* font_color == stroke_color name or hex color */ |
1656 | case 1: double_data[0] = get_real(infile,0);break; /* x */ |
1662 | case 1: double_data[0] = get_real(infile,0);break; /* x */ |
1657 | case 2: double_data[1] = get_real(infile,0);break; /* y */ |
1663 | case 2: double_data[1] = get_real(infile,0);break; /* y */ |
1658 | case 3: fly_font = get_string_argument(infile,0); |
1664 | case 3: fly_font = get_string_argument(infile,0); |
1659 | if(strcmp(fly_font,"giant") == 0){ |
1665 | if(strcmp(fly_font,"giant") == 0){ |
1660 | font_size = (int)(font_size + 24); |
1666 | font_size = (int)(font_size + 24); |
1661 | } |
1667 | } |
1662 | else |
1668 | else |
1663 | { |
1669 | { |
1664 | if(strcmp(fly_font,"huge") == 0){ |
1670 | if(strcmp(fly_font,"huge") == 0){ |
1665 | font_size = (int)(font_size + 14); |
1671 | font_size = (int)(font_size + 14); |
1666 | } |
1672 | } |
1667 | else |
1673 | else |
1668 | { |
1674 | { |
1669 | if(strcmp(fly_font,"large") == 0){ |
1675 | if(strcmp(fly_font,"large") == 0){ |
1670 | font_size = (int)(font_size + 6); |
1676 | font_size = (int)(font_size + 6); |
1671 | } |
1677 | } |
1672 | else |
1678 | else |
1673 | { |
1679 | { |
1674 | if(strcmp(fly_font,"small") == 0){ |
1680 | if(strcmp(fly_font,"small") == 0){ |
1675 | font_size = (int)(font_size - 4); |
1681 | font_size = (int)(font_size - 4); |
1676 | if(font_size<0){font_size = 8;} |
1682 | if(font_size<0){font_size = 8;} |
1677 | } |
1683 | } |
1678 | } |
1684 | } |
1679 | } |
1685 | } |
1680 | } |
1686 | } |
1681 | break; /* font_size ! */ |
1687 | break; /* font_size ! */ |
1682 | case 4: |
1688 | case 4: |
1683 | temp = get_string_argument(infile,1); |
1689 | temp = get_string_argument(infile,1); |
Line 1770... | Line 1776... | ||
1770 | case 4: decimals = find_number_of_digits(precision); |
1776 | case 4: decimals = find_number_of_digits(precision); |
1771 | temp = get_string_argument(infile,1); |
1777 | temp = get_string_argument(infile,1); |
1772 | string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,%.2f,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,double_data[0],temp,use_rotate,angle,use_affine,affine_matrix); |
1778 | string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,%.2f,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,double_data[0],temp,use_rotate,angle,use_affine,affine_matrix); |
1773 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1779 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1774 | snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,%.2f,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,double_data[0],temp,use_rotate,angle,use_affine,affine_matrix); |
1780 | snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,%.2f,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,double_data[0],temp,use_rotate,angle,use_affine,affine_matrix); |
1775 | add_to_buffer(tmp_buffer); |
1781 | add_to_buffer(tmp_buffer); |
1776 | break; |
1782 | break; |
1777 | default:break; |
1783 | default:break; |
1778 | } |
1784 | } |
1779 | } |
1785 | } |
1780 | reset(); |
1786 | reset(); |
Line 2497... | Line 2503... | ||
2497 | @ keyword, no arguments |
2503 | @ keyword, no arguments |
2498 | @ if the next object is clicked, it's 'object sequence number' in fly script is returned <br /> by javascript:read_canvas(); |
2504 | @ if the next object is clicked, it's 'object sequence number' in fly script is returned <br /> by javascript:read_canvas(); |
2499 | @ Line based object will show an increase in linewidth<br />Font based objects will show the text in 'bold' when clicked. |
2505 | @ Line based object will show an increase in linewidth<br />Font based objects will show the text in 'bold' when clicked. |
2500 | @ NOTE: not all objects may be set clickable |
2506 | @ NOTE: not all objects may be set clickable |
2501 | */ |
2507 | */ |
2502 | - | ||
- | 2508 | fprintf(js_include_file,"use_dragdrop_reply = true;"); |
|
2503 | onclick = 1; |
2509 | onclick = 1; |
2504 | break; |
2510 | break; |
2505 | case DRAG: |
2511 | case DRAG: |
2506 | /* |
2512 | /* |
2507 | @ drag [x][y][xy] |
2513 | @ drag [x][y][xy] |
Line 2525... | Line 2531... | ||
2525 | else |
2531 | else |
2526 | { |
2532 | { |
2527 | drag_type = 2; |
2533 | drag_type = 2; |
2528 | } |
2534 | } |
2529 | } |
2535 | } |
2530 | fprintf(js_include_file," |
2536 | fprintf(js_include_file,"dragdrop_precision = %d;use_dragdrop_reply = true;",precision); |
2531 | onclick = 2; |
2537 | onclick = 2; |
- | 2538 | ||
2532 | /* if(use_userdraw == TRUE ){canvas_error("\"drag & drop\" may not be combined with \"userdraw\" or \"pan and zoom\" \n");} */ |
2539 | /* if(use_userdraw == TRUE ){canvas_error("\"drag & drop\" may not be combined with \"userdraw\" or \"pan and zoom\" \n");} */ |
2533 | break; |
2540 | break; |
2534 | case BLINK: |
2541 | case BLINK: |
2535 | /* |
2542 | /* |
2536 | @ blink time(seconds) |
2543 | @ blink time(seconds) |
Line 2538... | Line 2545... | ||
2538 | */ |
2545 | */ |
2539 | break; |
2546 | break; |
2540 | case XUNIT: |
2547 | case XUNIT: |
2541 | /* |
2548 | /* |
2542 | @ xunit some_unit_for_x-values |
2549 | @ xunit some_unit_for_x-values |
2543 | @ unicode allowed (no html code) |
2550 | @ unicode allowed (no html code) |
2544 | @ use together with command mousex |
2551 | @ use together with command mousex |
2545 | @ will display the cursor x-coordinate 'unit' |
2552 | @ will display the cursor x-coordinate 'unit' |
2546 | */ |
2553 | */ |
2547 | fprintf(js_include_file,"unit_x = \"%s\";",get_string(infile,1)); |
2554 | fprintf(js_include_file,"unit_x = \"%s\";",get_string(infile,1)); |
2548 | break; |
2555 | break; |
Line 2552... | Line 2559... | ||
2552 | @ unicode allowed (no html code) |
2559 | @ unicode allowed (no html code) |
2553 | @ use together with command mousex |
2560 | @ use together with command mousex |
2554 | @ will display the cursor y-coordinate 'unit' |
2561 | @ will display the cursor y-coordinate 'unit' |
2555 | */ |
2562 | */ |
2556 | fprintf(js_include_file,"unit_y = \"%s\";",get_string(infile,1)); |
2563 | fprintf(js_include_file,"unit_y = \"%s\";",get_string(infile,1)); |
2557 | break; |
2564 | break; |
2558 | case MOUSE_DISPLAY: |
2565 | case MOUSE_DISPLAY: |
2559 | /* |
2566 | /* |
2560 | @display x|y|xy|degree|radius,color,fontsize |
2567 | @display x|y|xy|degree|radius,color,fontsize |
2561 | @will display the mouse cursor coordinates as x-only,y-only,(x:y),<br />the radius of a circle (this only in case 'userdraw circle(s),color' !!<br />or the angle in degrees ( rhe angle between x-axis;(0:0);(x:y) |
2568 | @will display the mouse cursor coordinates as x-only,y-only,(x:y),<br />the radius of a circle (this only in case 'userdraw circle(s),color' !!<br />or the angle in degrees ( rhe angle between x-axis;(0:0);(x:y) |
2562 | @use commands 'xunit' and / or 'yunit' to add the units to the mouse values |
2569 | @use commands 'xunit' and / or 'yunit' to add the units to the mouse values |
Line 2931... | Line 2938... | ||
2931 | if(js_function[DRAW_FLOODFILL] != 1 ){/* use only once */ |
2938 | if(js_function[DRAW_FLOODFILL] != 1 ){/* use only once */ |
2932 | js_function[DRAW_FLOODFILL] = 1; |
2939 | js_function[DRAW_FLOODFILL] = 1; |
2933 | add_js_floodfill(js_include_file,canvas_root_id); |
2940 | add_js_floodfill(js_include_file,canvas_root_id); |
2934 | } |
2941 | } |
2935 | fprintf(js_include_file,"\n<!-- begin command clickfill -->\nvar marge_xy = %d;userdraw_x = new Array();userdraw_y = new Array();var user_clickfill_cnt = 0;\ncanvas_div.addEventListener(\"mousedown\",clickfill,false);function clickfill(evt){var x = evt.clientX - findPosX(canvas_div) + document.body.scrollLeft + document.documentElement.scrollLeft;var y = evt.clientY - findPosY(canvas_div) + document.body.scrollTop + document.documentElement.scrollTop;if(evt.which != 1){for(var p=0; p < user_clickfill_cnt;p++){if(userdraw_x[p] + marge_xy > x && userdraw_x[p] - marge_xy < x){if(userdraw_y[p] + marge_xy > y && userdraw_y[p] - marge_xy < y){if(confirm(\"Clear ?\")){floodfill(1,userdraw_x[p],userdraw_y[p],canvas_div.style.backgroundColor || [255,255,255,0]);userdraw_x.splice(p,2);userdraw_y.splice(p,2);user_clickfill_cnt--;return;};};};};};userdraw_x[user_clickfill_cnt] = x;userdraw_y[user_clickfill_cnt] = y;user_clickfill_cnt++;floodfill(1,x,y,[%s,%d]);};",clickfillmarge,fill_color,(int) (fill_opacity/0.0039215)); |
2942 | fprintf(js_include_file,"\n<!-- begin command clickfill -->\nvar marge_xy = %d;userdraw_x = new Array();userdraw_y = new Array();var user_clickfill_cnt = 0;\ncanvas_div.addEventListener(\"mousedown\",clickfill,false);function clickfill(evt){var x = evt.clientX - findPosX(canvas_div) + document.body.scrollLeft + document.documentElement.scrollLeft;var y = evt.clientY - findPosY(canvas_div) + document.body.scrollTop + document.documentElement.scrollTop;if(evt.which != 1){for(var p=0; p < user_clickfill_cnt;p++){if(userdraw_x[p] + marge_xy > x && userdraw_x[p] - marge_xy < x){if(userdraw_y[p] + marge_xy > y && userdraw_y[p] - marge_xy < y){if(confirm(\"Clear ?\")){floodfill(1,userdraw_x[p],userdraw_y[p],canvas_div.style.backgroundColor || [255,255,255,0]);userdraw_x.splice(p,2);userdraw_y.splice(p,2);user_clickfill_cnt--;return;};};};};};userdraw_x[user_clickfill_cnt] = x;userdraw_y[user_clickfill_cnt] = y;user_clickfill_cnt++;floodfill(1,x,y,[%s,%d]);};",clickfillmarge,fill_color,(int) (fill_opacity/0.0039215)); |
2936 | add_read_canvas(1,reply_precision); |
2943 | add_read_canvas(canvas_root_id,1,reply_precision); |
2937 | reset(); |
2944 | reset(); |
2938 | break; |
2945 | break; |
2939 | case SETPIXEL: |
2946 | case SETPIXEL: |
2940 | /* |
2947 | /* |
2941 | @ setpixel x,y,color |
2948 | @ setpixel x,y,color |
Line 3000... | Line 3007... | ||
3000 | reset(); |
3007 | reset(); |
3001 | break; |
3008 | break; |
3002 | case REPLYFORMAT: |
3009 | case REPLYFORMAT: |
3003 | /* |
3010 | /* |
3004 | @ replyformat number |
3011 | @ replyformat number |
3005 | @ use number=-1 to deactivate the js- |
3012 | @ use number=-1 to deactivate the js-functions read_canvas() and read_dragdrop() |
3006 | @ default values should be fine ! |
3013 | @ default values should be fine ! |
3007 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
3014 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
3008 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
3015 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
3009 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul> |
3016 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul> |
3010 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
3017 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
Line 3336... | Line 3343... | ||
3336 | { |
3343 | { |
3337 | if( found_size_command != 3 ){ |
3344 | if( found_size_command != 3 ){ |
3338 | canvas_error("Please specify both xrange and yrange ..."); |
3345 | canvas_error("Please specify both xrange and yrange ..."); |
3339 | } |
3346 | } |
3340 | } |
3347 | } |
- | 3348 | ||
3341 | /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable/clickable shapes / objects ! */ |
3349 | /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable/clickable shapes / objects ! */ |
3342 | add_javascript_functions(js_function,canvas_root_id); |
3350 | add_javascript_functions(js_function,canvas_root_id); |
3343 | /* add read_canvas() etc functions if needed */ |
3351 | /* add read_canvas() etc functions if needed */ |
3344 | if( reply_format > 0 ){ add_read_canvas(reply_format,reply_precision);} |
3352 | if( reply_format > 0 ){ add_read_canvas(canvas_root_id,reply_format,reply_precision);} |
3345 | if( use_pan_and_zoom == TRUE ){ |
3353 | if( use_pan_and_zoom == TRUE ){ |
3346 | /* in case of zooming ... */ |
3354 | /* in case of zooming ... */ |
3347 | fprintf(js_include_file,"\n<!-- some extra global stuff : need to rethink panning and zooming !!! -->\n\ |
3355 | fprintf(js_include_file,"\n<!-- some extra global stuff : need to rethink panning and zooming !!! -->\n\ |
3348 | precision = %d;var xmin_start=xmin;var xmax_start=xmax;\ |
3356 | precision = %d;var xmin_start=xmin;var xmax_start=xmax;\ |
3349 | var ymin_start=ymin;var ymax_start=xmax;\ |
3357 | var ymin_start=ymin;var ymax_start=xmax;\ |
Line 3751... | Line 3759... | ||
3751 | 26 = return all userdrawn arcs in radians: |
3759 | 26 = return all userdrawn arcs in radians: |
3752 | 27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2... |
3760 | 27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2... |
3753 | */ |
3761 | */ |
3754 | 3762 | ||
3755 | 3763 | ||
3756 | void add_read_canvas(int type_reply,int reply_precision){ |
3764 | void add_read_canvas(int canvas_root_id,int type_reply,int reply_precision){ |
3757 | /* just 1 reply type allowed */ |
3765 | /* just 1 reply type allowed */ |
3758 | fprintf(js_include_file,"\ |
3766 | fprintf(js_include_file,"\ |
3759 | \n<!-- begin set_reply_precision() -->\n\ |
3767 | \n<!-- begin set_reply_precision() -->\n\ |
3760 | function set_reply_precision(){\ |
3768 | function set_reply_precision(){\ |
3761 | var len = userdraw_x.length;\ |
3769 | var len = userdraw_x.length;\ |
Line 3776... | Line 3784... | ||
3776 | /* |
3784 | /* |
3777 | answers may have: |
3785 | answers may have: |
3778 | x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers |
3786 | x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers |
3779 | */ |
3787 | */ |
3780 | case 1: fprintf(js_include_file,"\ |
3788 | case 1: fprintf(js_include_file,"\ |
3781 | \n<!-- begin function 1 |
3789 | \n<!-- begin function 1 read_canvas%d() -->\n\ |
3782 |
|
3790 | read_canvas%d = function(){\ |
3783 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3791 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3784 | set_reply_precision();\ |
3792 | set_reply_precision();\ |
3785 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3793 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3786 | var p = 0;var input_reply = new Array();\ |
3794 | var p = 0;var input_reply = new Array();\ |
3787 | if( document.getElementById(\"canvas_input0\")){\ |
3795 | if( document.getElementById(\"canvas_input0\")){\ |
Line 3811... | Line 3819... | ||
3811 | {\ |
3819 | {\ |
3812 | return userdraw_x+\"\\n\"+userdraw_y;\ |
3820 | return userdraw_x+\"\\n\"+userdraw_y;\ |
3813 | }\ |
3821 | }\ |
3814 | };\ |
3822 | };\ |
3815 | };\n\ |
3823 | };\n\ |
3816 | <!-- end function 1 |
3824 | <!-- end function 1 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
3817 | break; |
3825 | break; |
3818 | case 2: fprintf(js_include_file,"\ |
3826 | case 2: fprintf(js_include_file,"\ |
3819 | \n<!-- begin function 2 |
3827 | \n<!-- begin function 2 read_canvas%d() -->\n\ |
3820 |
|
3828 | read_canvas%d = function(){\ |
3821 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3829 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3822 | set_reply_precision();\ |
3830 | set_reply_precision();\ |
3823 | var reply_x = new Array();var reply_y = new Array();var p = 0;\ |
3831 | var reply_x = new Array();var reply_y = new Array();var p = 0;\ |
3824 | var prec = %d;\ |
3832 | var prec = %d;\ |
3825 | while(userdraw_x[p]){\ |
3833 | while(userdraw_x[p]){\ |
Line 3857... | Line 3865... | ||
3857 | {\ |
3865 | {\ |
3858 | return reply_x+\"\\n\"+reply_y;\ |
3866 | return reply_x+\"\\n\"+reply_y;\ |
3859 | };\ |
3867 | };\ |
3860 | };\ |
3868 | };\ |
3861 | };\n\ |
3869 | };\n\ |
3862 | <!-- end function 2 |
3870 | <!-- end function 2 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
3863 | break; |
3871 | break; |
3864 | case 3: fprintf(js_include_file,"\ |
3872 | case 3: fprintf(js_include_file,"\ |
3865 | \n<!-- begin function 3 |
3873 | \n<!-- begin function 3 read_canvas%d() -->\n\ |
3866 |
|
3874 | read_canvas%d = function(){\ |
3867 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3875 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3868 | set_reply_precision();\ |
3876 | set_reply_precision();\ |
3869 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3877 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3870 | var p = 0;var input_reply = new Array();\ |
3878 | var p = 0;var input_reply = new Array();\ |
3871 | if( document.getElementById(\"canvas_input0\")){\ |
3879 | if( document.getElementById(\"canvas_input0\")){\ |
Line 3895... | Line 3903... | ||
3895 | {\ |
3903 | {\ |
3896 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius;\ |
3904 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius;\ |
3897 | }\ |
3905 | }\ |
3898 | }\ |
3906 | }\ |
3899 | };\n\ |
3907 | };\n\ |
3900 | <!-- end function 3 |
3908 | <!-- end function 3 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
3901 | break; |
3909 | break; |
3902 | case 4: fprintf(js_include_file,"\ |
3910 | case 4: fprintf(js_include_file,"\ |
3903 | \n<!-- begin function 4 |
3911 | \n<!-- begin function 4 read_canvas%d() -->\n\ |
3904 |
|
3912 | read_canvas%d = function(){\ |
3905 | var prec = %d;\ |
3913 | var prec = %d;\ |
3906 | var reply_x = new Array();var reply_y = new Array();var p = 0;\ |
3914 | var reply_x = new Array();var reply_y = new Array();var p = 0;\ |
3907 | while(userdraw_x[p]){\ |
3915 | while(userdraw_x[p]){\ |
3908 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec;\ |
3916 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec;\ |
3909 | reply_y[p] = (Math.round(prec*(px2y(userdraw_y[p]))))/prec;;\ |
3917 | reply_y[p] = (Math.round(prec*(px2y(userdraw_y[p]))))/prec;;\ |
Line 3939... | Line 3947... | ||
3939 | {\ |
3947 | {\ |
3940 | return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_radius;\ |
3948 | return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_radius;\ |
3941 | }\ |
3949 | }\ |
3942 | };\ |
3950 | };\ |
3943 | };\n\ |
3951 | };\n\ |
3944 | <!-- end function 4 |
3952 | <!-- end function 4 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
3945 | break; |
3953 | break; |
3946 | /* |
3954 | /* |
3947 | attention: we reset userdraw_x / userdraw_y : because userdraw_x = [][] userdraw_y = [][] |
3955 | attention: we reset userdraw_x / userdraw_y : because userdraw_x = [][] userdraw_y = [][] |
3948 | used for userdraw multiple paths |
3956 | used for userdraw multiple paths |
3949 | */ |
3957 | */ |
3950 | case 5: fprintf(js_include_file,"\ |
3958 | case 5: fprintf(js_include_file,"\ |
3951 | \n<!-- begin function 5 |
3959 | \n<!-- begin function 5 read_canvas%d() -->\n\ |
3952 |
|
3960 | read_canvas%d = function(){\ |
3953 | set_reply_precision();\ |
3961 | set_reply_precision();\ |
3954 | var p = 0;\ |
3962 | var p = 0;\ |
3955 | var reply = \"\";\ |
3963 | var reply = \"\";\ |
3956 | for(p = 0; p < userdraw_x.length;p++){\ |
3964 | for(p = 0; p < userdraw_x.length;p++){\ |
3957 | if(userdraw_x[p] != null ){\ |
3965 | if(userdraw_x[p] != null ){\ |
Line 3989... | Line 3997... | ||
3989 | {\ |
3997 | {\ |
3990 | return reply;\ |
3998 | return reply;\ |
3991 | }\ |
3999 | }\ |
3992 | };\ |
4000 | };\ |
3993 | };\n\ |
4001 | };\n\ |
3994 | <!-- end function 5 |
4002 | <!-- end function 5 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
3995 | break; |
4003 | break; |
3996 | /* |
4004 | /* |
3997 | attention: we reset userdraw_x / userdraw_y : because userdraw_x = [][] userdraw_y = [][] |
4005 | attention: we reset userdraw_x / userdraw_y : because userdraw_x = [][] userdraw_y = [][] |
3998 | used for userdraw multiple paths |
4006 | used for userdraw multiple paths |
3999 | */ |
4007 | */ |
4000 | case 6: fprintf(js_include_file,"\ |
4008 | case 6: fprintf(js_include_file,"\ |
4001 | \n<!-- begin function 6 |
4009 | \n<!-- begin function 6 read_canvas%d() -->\n\ |
4002 |
|
4010 | read_canvas%d = function(){\ |
4003 | var p = 0;\ |
4011 | var p = 0;\ |
4004 | var reply = \"\";\ |
4012 | var reply = \"\";\ |
4005 | var tmp_x = new Array();\ |
4013 | var tmp_x = new Array();\ |
4006 | var tmp_y = new Array();\ |
4014 | var tmp_y = new Array();\ |
4007 | var prec = %d;\ |
4015 | var prec = %d;\ |
Line 4047... | Line 4055... | ||
4047 | {\ |
4055 | {\ |
4048 | return reply;\ |
4056 | return reply;\ |
4049 | }\ |
4057 | }\ |
4050 | };\ |
4058 | };\ |
4051 | };\n\ |
4059 | };\n\ |
4052 | <!-- end function 6 |
4060 | <!-- end function 6 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4053 | break; |
4061 | break; |
4054 | case 7: fprintf(js_include_file,"\ |
4062 | case 7: fprintf(js_include_file,"\ |
4055 | \n<!-- begin function 7 |
4063 | \n<!-- begin function 7 read_canvas%d() -->\n\ |
4056 |
|
4064 | read_canvas%d = function(){\ |
4057 | set_reply_precision();\ |
4065 | set_reply_precision();\ |
4058 | var reply = new Array();\ |
4066 | var reply = new Array();\ |
4059 | var p = 0;\ |
4067 | var p = 0;\ |
4060 | while(userdraw_x[p]){\ |
4068 | while(userdraw_x[p]){\ |
4061 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\ |
4069 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\ |
Line 4091... | Line 4099... | ||
4091 | {\ |
4099 | {\ |
4092 | return reply;\ |
4100 | return reply;\ |
4093 | }\ |
4101 | }\ |
4094 | };\ |
4102 | };\ |
4095 | };\n\ |
4103 | };\n\ |
4096 | <!-- end function 7 |
4104 | <!-- end function 7 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4097 | break; |
4105 | break; |
4098 | case 8: fprintf(js_include_file,"\ |
4106 | case 8: fprintf(js_include_file,"\ |
4099 | \n<!-- begin function 8 |
4107 | \n<!-- begin function 8 read_canvas%d() -->\n\ |
4100 |
|
4108 | read_canvas%d = function(){\ |
4101 | var reply = new Array();\ |
4109 | var reply = new Array();\ |
4102 | var p = 0;\ |
4110 | var p = 0;\ |
4103 | var prec = %d;\ |
4111 | var prec = %d;\ |
4104 | while(userdraw_x[p]){\ |
4112 | while(userdraw_x[p]){\ |
4105 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\ |
4113 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\ |
Line 4135... | Line 4143... | ||
4135 | {\ |
4143 | {\ |
4136 | return reply;\ |
4144 | return reply;\ |
4137 | }\ |
4145 | }\ |
4138 | };\ |
4146 | };\ |
4139 | };\n\ |
4147 | };\n\ |
4140 | <!-- end function 8 |
4148 | <!-- end function 8 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4141 | break; |
4149 | break; |
4142 | case 9: fprintf(js_include_file,"\ |
4150 | case 9: fprintf(js_include_file,"\ |
4143 | \n<!-- begin function 9 |
4151 | \n<!-- begin function 9 read_canvas%d() -->\n\ |
4144 |
|
4152 | read_canvas%d = function(){\ |
4145 | set_reply_precision();\ |
4153 | set_reply_precision();\ |
4146 | var reply = new Array();\ |
4154 | var reply = new Array();\ |
4147 | var p = 0;\ |
4155 | var p = 0;\ |
4148 | while(userdraw_x[p]){\ |
4156 | while(userdraw_x[p]){\ |
4149 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\ |
4157 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\ |
Line 4179... | Line 4187... | ||
4179 | {\ |
4187 | {\ |
4180 | return reply;\ |
4188 | return reply;\ |
4181 | }\ |
4189 | }\ |
4182 | };\ |
4190 | };\ |
4183 | };\n\ |
4191 | };\n\ |
4184 | <!-- end function 9 |
4192 | <!-- end function 9 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4185 | break; |
4193 | break; |
4186 | case 10: fprintf(js_include_file,"\ |
4194 | case 10: fprintf(js_include_file,"\ |
4187 | \n<!-- begin function 10 |
4195 | \n<!-- begin function 10 read_canvas%d() -->\n\ |
4188 |
|
4196 | read_canvas%d = function(){\ |
4189 | var reply = new Array();\ |
4197 | var reply = new Array();\ |
4190 | var p = 0;\ |
4198 | var p = 0;\ |
4191 | var prec = %d;\ |
4199 | var prec = %d;\ |
4192 | while(userdraw_x[p]){\ |
4200 | while(userdraw_x[p]){\ |
4193 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*userdraw_radius[p]))/prec;\ |
4201 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*userdraw_radius[p]))/prec;\ |
Line 4223... | Line 4231... | ||
4223 | {\ |
4231 | {\ |
4224 | return reply;\ |
4232 | return reply;\ |
4225 | }\ |
4233 | }\ |
4226 | };\ |
4234 | };\ |
4227 | };\n\ |
4235 | };\n\ |
4228 | <!-- end function 10 |
4236 | <!-- end function 10 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4229 | break; |
4237 | break; |
4230 | case 11: fprintf(js_include_file,"\ |
4238 | case 11: fprintf(js_include_file,"\ |
4231 | \n<!-- begin function 11 |
4239 | \n<!-- begin function 11 read_canvas%d() -->\n\ |
4232 |
|
4240 | read_canvas%d = function(){\ |
4233 | var reply = \"\";\ |
4241 | var reply = \"\";\ |
4234 | var p = 0;\ |
4242 | var p = 0;\ |
4235 | var prec = %d;\ |
4243 | var prec = %d;\ |
4236 | while(userdraw_x[p]){\ |
4244 | while(userdraw_x[p]){\ |
4237 | reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\ |
4245 | reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\ |
Line 4267... | Line 4275... | ||
4267 | {\ |
4275 | {\ |
4268 | return reply;\ |
4276 | return reply;\ |
4269 | }\ |
4277 | }\ |
4270 | };\ |
4278 | };\ |
4271 | };\n\ |
4279 | };\n\ |
4272 | <!-- end function 11 |
4280 | <!-- end function 11 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4273 | break; |
4281 | break; |
4274 | case 12: fprintf(js_include_file,"\ |
4282 | case 12: fprintf(js_include_file,"\ |
4275 | \n<!-- begin function 12 |
4283 | \n<!-- begin function 12 read_canvas%d() -->\n\ |
4276 |
|
4284 | read_canvas%d = function(){\ |
4277 | set_reply_precision();\ |
4285 | set_reply_precision();\ |
4278 | var reply = \"\";\ |
4286 | var reply = \"\";\ |
4279 | var p = 0;\ |
4287 | var p = 0;\ |
4280 | for(p = 0; p< userdraw_x.lenght;p = p+2){\ |
4288 | for(p = 0; p< userdraw_x.lenght;p = p+2){\ |
4281 | if(userdraw_x[p] != null){\ |
4289 | if(userdraw_x[p] != null){\ |
Line 4312... | Line 4320... | ||
4312 | {\ |
4320 | {\ |
4313 | return reply;\ |
4321 | return reply;\ |
4314 | }\ |
4322 | }\ |
4315 | };\ |
4323 | };\ |
4316 | };\n\ |
4324 | };\n\ |
4317 | <!-- end function 12 |
4325 | <!-- end function 12 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4318 | break; |
4326 | break; |
4319 | case 13: fprintf(js_include_file,"\ |
4327 | case 13: fprintf(js_include_file,"\ |
4320 | \n<!-- begin function 13 |
4328 | \n<!-- begin function 13 read_canvas%d() -->\n\ |
4321 |
|
4329 | read_canvas%d = function(){\ |
4322 | var reply = new Array();\ |
4330 | var reply = new Array();\ |
4323 | var p = 0;var i = 0;\ |
4331 | var p = 0;var i = 0;\ |
4324 | var prec = %d;\ |
4332 | var prec = %d;\ |
4325 | while(userdraw_x[p]){\ |
4333 | while(userdraw_x[p]){\ |
4326 | reply[i] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec;\ |
4334 | reply[i] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec;\ |
Line 4356... | Line 4364... | ||
4356 | {\ |
4364 | {\ |
4357 | return reply;\ |
4365 | return reply;\ |
4358 | }\ |
4366 | }\ |
4359 | };\ |
4367 | };\ |
4360 | };\n\ |
4368 | };\n\ |
4361 | <!-- end function 13 |
4369 | <!-- end function 13 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4362 | break; |
4370 | break; |
4363 | case 14: fprintf(js_include_file,"\ |
4371 | case 14: fprintf(js_include_file,"\ |
4364 | \n<!-- begin function 14 |
4372 | \n<!-- begin function 14 read_canvas%d() -->\n\ |
4365 |
|
4373 | read_canvas%d = function(){\ |
4366 | set_reply_precision();\ |
4374 | set_reply_precision();\ |
4367 | var reply = new Array();\ |
4375 | var reply = new Array();\ |
4368 | var p = 0;var i = 0;\ |
4376 | var p = 0;var i = 0;\ |
4369 | while(userdraw_x[p]){\ |
4377 | while(userdraw_x[p]){\ |
4370 | reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\ |
4378 | reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\ |
Line 4400... | Line 4408... | ||
4400 | {\ |
4408 | {\ |
4401 | return reply;\ |
4409 | return reply;\ |
4402 | }\ |
4410 | }\ |
4403 | };\ |
4411 | };\ |
4404 | };\n\ |
4412 | };\n\ |
4405 | <!-- end function 14 |
4413 | <!-- end function 14 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4406 | break; |
4414 | break; |
4407 | case 15: fprintf(js_include_file,"\ |
4415 | case 15: fprintf(js_include_file,"\ |
4408 | \n<!-- begin function 15 |
4416 | \n<!-- begin function 15 read_canvas%d() -->\n\ |
4409 |
|
4417 | read_canvas%d = function(){\ |
4410 | var input_reply = new Array();\ |
4418 | var input_reply = new Array();\ |
4411 | var p = 0;\ |
4419 | var p = 0;\ |
4412 | if( document.getElementById(\"canvas_input0\")){\ |
4420 | if( document.getElementById(\"canvas_input0\")){\ |
4413 | var t = 0;\ |
4421 | var t = 0;\ |
4414 | while(document.getElementById(\"canvas_input\"+t)){\ |
4422 | while(document.getElementById(\"canvas_input\"+t)){\ |
Line 4425... | Line 4433... | ||
4425 | else\ |
4433 | else\ |
4426 | {\ |
4434 | {\ |
4427 | return input_reply;\ |
4435 | return input_reply;\ |
4428 | };\ |
4436 | };\ |
4429 | };\n\ |
4437 | };\n\ |
4430 | <!-- end function 15 |
4438 | <!-- end function 15 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4431 | break; |
4439 | break; |
4432 | case 16: fprintf(js_include_file,"\ |
4440 | case 16: fprintf(js_include_file,"\ |
4433 | \n<!-- begin function 16 read_mathml() -->\n\ |
4441 | \n<!-- begin function 16 read_mathml() -->\n\ |
4434 | function read_mathml(){\ |
4442 | function read_mathml(){\ |
4435 | var reply = new Array();\ |
4443 | var reply = new Array();\ |
Line 4444... | Line 4452... | ||
4444 | };\ |
4452 | };\ |
4445 | this.read_mathml = read_mathml;\n\ |
4453 | this.read_mathml = read_mathml;\n\ |
4446 | <!-- end function 16 read_mathml() -->"); |
4454 | <!-- end function 16 read_mathml() -->"); |
4447 | break; |
4455 | break; |
4448 | case 17: fprintf(js_include_file,"\ |
4456 | case 17: fprintf(js_include_file,"\ |
4449 | \n<!-- begin function 17 |
4457 | \n<!-- begin function 17 read_canvas%d() -->\n\ |
4450 |
|
4458 | read_canvas%d = function(){\ |
4451 | if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\ |
4459 | if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\ |
4452 | return userdraw_text;\ |
4460 | return userdraw_text;\ |
4453 | };\n\ |
4461 | };\n\ |
4454 | <!-- end function 17 |
4462 | <!-- end function 17 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4455 | break; |
4463 | break; |
4456 | case 18: fprintf(js_include_file,"\ |
4464 | case 18: fprintf(js_include_file,"\ |
4457 | \n<!-- begin function 18 |
4465 | \n<!-- begin function 18 read_canvas%d() -->\n\ |
4458 |
|
4466 | read_canvas%d = function(){\ |
4459 | var p = 0;\ |
4467 | var p = 0;\ |
4460 | var reply = new Array();\ |
4468 | var reply = new Array();\ |
4461 | var name;\ |
4469 | var name;\ |
4462 | var t = true;\ |
4470 | var t = true;\ |
4463 | var h;var m;var s;\ |
4471 | var h;var m;var s;\ |
Line 4474... | Line 4482... | ||
4474 | }catch(e){t=false;};\ |
4482 | }catch(e){t=false;};\ |
4475 | };\ |
4483 | };\ |
4476 | if( p == 0 ){alert(\"clock(s) not modified...\");return;}\ |
4484 | if( p == 0 ){alert(\"clock(s) not modified...\");return;}\ |
4477 | return reply;\ |
4485 | return reply;\ |
4478 | };\n\ |
4486 | };\n\ |
4479 | <!-- end function 18 |
4487 | <!-- end function 18 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4480 | break; |
4488 | break; |
4481 | case 19: fprintf(js_include_file,"\ |
4489 | case 19: fprintf(js_include_file,"\ |
4482 | \n<!-- begin function 19 |
4490 | \n<!-- begin function 19 read_canvas%d() -->\n\ |
4483 |
|
4491 | read_canvas%d = function(){\ |
4484 | return reply[0];\ |
4492 | return reply[0];\ |
4485 | };\n\ |
4493 | };\n\ |
4486 | <!-- end function 19 |
4494 | <!-- end function 19 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4487 | break; |
4495 | break; |
4488 | case 20: fprintf(js_include_file,"\ |
4496 | case 20: fprintf(js_include_file,"\ |
4489 | \n<!-- begin function 20 |
4497 | \n<!-- begin function 20 read_canvas%d() -->\n\ |
4490 |
|
4498 | read_canvas%d = function(){\ |
4491 | var prec = %d;\ |
4499 | var prec = %d;\ |
4492 | var len = ext_drag_images.length;\ |
4500 | var len = ext_drag_images.length;\ |
4493 | var reply = new Array(len);\ |
4501 | var reply = new Array(len);\ |
4494 | for(var p = 0 ; p < len ; p++){\ |
4502 | for(var p = 0 ; p < len ; p++){\ |
4495 | var img = ext_drag_images[p];\ |
4503 | var img = ext_drag_images[p];\ |
4496 | reply[p] = (Math.round(prec*(px2x(img[6]))))/prec+\":\"+(Math.round(prec*(px2y(img[7]))))/prec;\ |
4504 | reply[p] = (Math.round(prec*(px2x(img[6]))))/prec+\":\"+(Math.round(prec*(px2y(img[7]))))/prec;\ |
4497 | };\ |
4505 | };\ |
4498 | return reply;\ |
4506 | return reply;\ |
4499 | };\n\ |
4507 | };\n\ |
4500 | <!-- end function 20 |
4508 | <!-- end function 20 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4501 | break; |
4509 | break; |
4502 | case 21: fprintf(js_include_file,"\ |
4510 | case 21: fprintf(js_include_file,"\ |
4503 | \n<!-- begin function 21 |
4511 | \n<!-- begin function 21 read_canvas%d() -->\n\ |
4504 |
|
4512 | read_canvas%d = function(){\ |
4505 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
4513 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
4506 | var reply_coord = new Array();var p = 0;\ |
4514 | var reply_coord = new Array();var p = 0;\ |
4507 | var prec = %d;\ |
4515 | var prec = %d;\ |
4508 | while(userdraw_x[p]){\ |
4516 | while(userdraw_x[p]){\ |
4509 | reply_coord[p] = \"(\"+(Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\")\";\ |
4517 | reply_coord[p] = \"(\"+(Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\")\";\ |
Line 4539... | Line 4547... | ||
4539 | {\ |
4547 | {\ |
4540 | return reply_coord;\ |
4548 | return reply_coord;\ |
4541 | };\ |
4549 | };\ |
4542 | };\ |
4550 | };\ |
4543 | };\n\ |
4551 | };\n\ |
4544 | <!-- end function 21 |
4552 | <!-- end function 21 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4545 | break; |
4553 | break; |
4546 | case 22: fprintf(js_include_file,"\ |
4554 | case 22: fprintf(js_include_file,"\ |
4547 | \n<!-- begin function 22 |
4555 | \n<!-- begin function 22 read_canvas%d() -->\n\ |
4548 |
|
4556 | read_canvas%d = function(){\ |
4549 | var reply = new Array();\ |
4557 | var reply = new Array();\ |
4550 | var lu = userdraw_x.length;\ |
4558 | var lu = userdraw_x.length;\ |
4551 | if(lu == 0){alert(\"nothing drawn...\");return;};\ |
4559 | if(lu == 0){alert(\"nothing drawn...\");return;};\ |
4552 | var idx = 0;\ |
4560 | var idx = 0;\ |
4553 | var prec = %d;\ |
4561 | var prec = %d;\ |
Line 4584... | Line 4592... | ||
4584 | {\ |
4592 | {\ |
4585 | return reply;\ |
4593 | return reply;\ |
4586 | }\ |
4594 | }\ |
4587 | };\ |
4595 | };\ |
4588 | };\n\ |
4596 | };\n\ |
4589 | <!-- end function 22 |
4597 | <!-- end function 22 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4590 | break; |
4598 | break; |
4591 | case 23: fprintf(js_include_file,"\ |
4599 | case 23: fprintf(js_include_file,"\ |
4592 | \n<!-- begin function 23 |
4600 | \n<!-- begin function 23 read_canvas%d() default 5 px marge -->\n\ |
4593 |
|
4601 | read_canvas%d = function(){\ |
4594 | if( userdraw_x.length < 2){alert(\"nothing drawn...\");return;}\ |
4602 | if( userdraw_x.length < 2){alert(\"nothing drawn...\");return;}\ |
4595 | var lu = userdraw_x.length;\ |
4603 | var lu = userdraw_x.length;\ |
4596 | if( lu != userdraw_y.length ){ alert(\"x / y mismatch !\");return;}\ |
4604 | if( lu != userdraw_y.length ){ alert(\"x / y mismatch !\");return;}\ |
4597 | var reply_x = new Array();var reply_y = new Array();\ |
4605 | var reply_x = new Array();var reply_y = new Array();\ |
4598 | var marge = 5;var p = 0;\ |
4606 | var marge = 5;var p = 0;\ |
Line 4634... | Line 4642... | ||
4634 | {\ |
4642 | {\ |
4635 | return reply_x+\"\\n\"+reply_y;\ |
4643 | return reply_x+\"\\n\"+reply_y;\ |
4636 | };\ |
4644 | };\ |
4637 | };\ |
4645 | };\ |
4638 | };\n\ |
4646 | };\n\ |
4639 | <!-- end function 23 |
4647 | <!-- end function 23 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4640 | break; |
4648 | break; |
4641 | case 24: fprintf(js_include_file,"\n\ |
4649 | case 24: fprintf(js_include_file,"\n\ |
4642 | <!-- begin function 24 |
4650 | <!-- begin function 24 read_canvas%d() -->\n\ |
4643 |
|
4651 | read_canvas%d = function(){\ |
4644 | var input_reply = new Array();\ |
4652 | var input_reply = new Array();\ |
4645 | var p = 0;\ |
4653 | var p = 0;\ |
4646 | if( document.getElementById(\"canvas_input0\")){\ |
4654 | if( document.getElementById(\"canvas_input0\")){\ |
4647 | while(document.getElementById(\"canvas_input\"+p)){\ |
4655 | while(document.getElementById(\"canvas_input\"+p)){\ |
4648 | input_reply[p] = document.getElementById(\"canvas_input\"+p).value;\ |
4656 | input_reply[p] = document.getElementById(\"canvas_input\"+p).value;\ |
4649 | p++;\ |
4657 | p++;\ |
4650 | };\ |
4658 | };\ |
4651 | return input_reply;\ |
4659 | return input_reply;\ |
4652 | };\ |
4660 | };\ |
4653 | };\n\ |
4661 | };\n\ |
4654 | <!-- end function 24 |
4662 | <!-- end function 24 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4655 | break; |
4663 | break; |
4656 | case 25: |
4664 | case 25: |
4657 | fprintf(js_include_file,"\n<!-- begin function 25 |
4665 | fprintf(js_include_file,"\n<!-- begin function 25 read_canvas%d() : angle(s) in degrees-->\n\ |
4658 |
|
4666 | read_canvas%d = function(){\ |
4659 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4667 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4660 | var lu = userdraw_radius.length;\ |
4668 | var lu = userdraw_radius.length;\ |
4661 | var prec = %d;\ |
4669 | var prec = %d;\ |
4662 | var angle_reply = new Array(lu);\ |
4670 | var angle_reply = new Array(lu);\ |
4663 | for(var p = 0 ; p < lu ; p++){\ |
4671 | for(var p = 0 ; p < lu ; p++){\ |
4664 | angle_reply[p] = (Math.round(prec*180*(userdraw_radius[p])/Math.PI))/prec;\ |
4672 | angle_reply[p] = (Math.round(prec*180*(userdraw_radius[p])/Math.PI))/prec;\ |
4665 | };\ |
4673 | };\ |
4666 | return angle_reply;\ |
4674 | return angle_reply;\ |
4667 | };\n\ |
4675 | };\n\ |
4668 | <!-- end function 25 |
4676 | <!-- end function 25 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4669 | break; |
4677 | break; |
4670 | case 26: |
4678 | case 26: |
4671 | fprintf(js_include_file,"\n<!-- begin function 26 |
4679 | fprintf(js_include_file,"\n<!-- begin function 26 read_canvas%d() : angle(s) in radians-->\n\ |
4672 |
|
4680 | read_canvas%d = function(){\ |
4673 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4681 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4674 | var lu = userdraw_radius.length;\ |
4682 | var lu = userdraw_radius.length;\ |
4675 | var prec = %d;\ |
4683 | var prec = %d;\ |
4676 | var angle_reply = new Array(lu);\ |
4684 | var angle_reply = new Array(lu);\ |
4677 | for(var p = 0 ; p < lu ; p++){\ |
4685 | for(var p = 0 ; p < lu ; p++){\ |
4678 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4686 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4679 | };\ |
4687 | };\ |
4680 | return angle_reply;\ |
4688 | return angle_reply;\ |
4681 | };\n\ |
4689 | };\n\ |
4682 | <!-- end function 26 |
4690 | <!-- end function 26 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4683 | break; |
4691 | break; |
4684 | case 27: |
4692 | case 27: |
4685 | fprintf(js_include_file,"\n<!-- begin function 27 |
4693 | fprintf(js_include_file,"\n<!-- begin function 27 read_canvas%d() : inputfield(s) location and their values : -->\n\ |
4686 |
|
4694 | read_canvas%d = function(){\ |
4687 | var lu = userdraw_x.length;\ |
4695 | var lu = userdraw_x.length;\ |
4688 | if( lu < 1){alert(\"nothing drawn...\");return;}\ |
4696 | if( lu < 1){alert(\"nothing drawn...\");return;}\ |
4689 | set_reply_precision();\ |
4697 | set_reply_precision();\ |
4690 | var prec = %d;\ |
4698 | var prec = %d;\ |
4691 | for(var p = 0 ; p < lu ; p++){\ |
4699 | for(var p = 0 ; p < lu ; p++){\ |
4692 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\":\"+ document.getElementById(\"canvas_input\"+p).value;\ |
4700 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\":\"+ document.getElementById(\"canvas_input\"+p).value;\ |
4693 | };\ |
4701 | };\ |
4694 | return reply;\ |
4702 | return reply;\ |
4695 | };\n\ |
4703 | };\n\ |
4696 | <!-- end function 27 |
4704 | <!-- end function 27 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4697 | break; |
4705 | break; |
4698 | default: canvas_error("hmmm unknown replyformat...");break; |
4706 | default: canvas_error("hmmm unknown replyformat...");break; |
4699 | } |
4707 | } |
4700 | return; |
4708 | return; |
4701 | } |
4709 | } |