Rev 8297 | Rev 8304 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8297 | Rev 8299 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | /* |
- | |
2 | 27/7/2013 version 0.01 |
1 | /*27/7/2013 version 0.01 |
3 | "Inspired" by FLY program: http://martin.gleeson.com/fly |
2 | "Inspired" by FLY program: http://martin.gleeson.com/fly |
4 | ********************************************************************************* |
3 | ********************************************************************************* |
5 | * J.M. Evers 7/2013 * |
4 | * J.M. Evers 7/2013 * |
6 | * This is all just amateur scriblings... So no copyrights. * |
5 | * This is all just amateur scriblings... So no copyrights. * |
7 | * This source code file, and compiled objects derived from it, * |
6 | * This source code file, and compiled objects derived from it, * |
Line 323... | Line 322... | ||
323 | break; |
322 | break; |
324 | case CROSSHAIR: |
323 | case CROSSHAIR: |
325 | /* |
324 | /* |
326 | @ crosshair x,y,color |
325 | @ crosshair x,y,color |
327 | @ draw a single crosshair point at (x;y) in color 'color' |
326 | @ draw a single crosshair point at (x;y) in color 'color' |
328 | @ use command 'crosshairsize int' and / or 'linewidth int' to adust |
327 | @ use command 'crosshairsize int' and / or 'linewidth int' to adust |
329 | @ may be set draggable / onclick |
328 | @ may be set draggable / onclick |
330 | */ |
329 | */ |
331 | for(i=0;i<3;i++){ |
330 | for(i=0;i<3;i++){ |
332 | switch(i){ |
331 | switch(i){ |
333 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
332 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
Line 336... | Line 335... | ||
336 | decimals = find_number_of_digits(precision); |
335 | decimals = find_number_of_digits(precision); |
337 | 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[0],decimals,double_data[1],crosshair_size,crosshair_size,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,0,0,0,use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
336 | 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[0],decimals,double_data[1],crosshair_size,crosshair_size,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,0,0,0,use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
338 | click_cnt++;reset(); |
337 | click_cnt++;reset(); |
339 | break; |
338 | break; |
340 | default:break; |
339 | default:break; |
341 | } |
340 | } |
342 | } |
341 | } |
343 | break; |
342 | break; |
344 | case CROSSHAIRS: |
343 | case CROSSHAIRS: |
345 | /* |
344 | /* |
346 | @ crosshairs color,x1,y1,x2,y2,...,x_n,y_n |
345 | @ crosshairs color,x1,y1,x2,y2,...,x_n,y_n |
347 | @ draw multiple crosshair points at given coordinates in color 'color' |
346 | @ draw multiple crosshair points at given coordinates in color 'color' |
348 | @ use command 'crosshairsize int' and / or 'linewidth int' to adust |
347 | @ use command 'crosshairsize int' and / or 'linewidth int' to adust |
349 | @ may be set draggable / onclick individually (!) |
348 | @ may be set draggable / onclick individually (!) |
350 | */ |
349 | */ |
351 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
350 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
352 | fill_color = stroke_color; |
351 | fill_color = stroke_color; |
353 | i=0; |
352 | i=0; |
354 | while( ! done ){ /* get next item until EOL*/ |
353 | while( ! done ){ /* get next item until EOL*/ |
355 | if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");} |
354 | if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");} |
356 | if(i%2 == 0 ){ |
355 | if(i%2 == 0 ){ |
357 | double_data[i] = get_real(infile,0); /* x */ |
356 | double_data[i] = get_real(infile,0); /* x */ |
358 | } |
357 | } |
359 | else |
358 | else |
360 | { |
359 | { |
361 | double_data[i] = get_real(infile,1); /* y */ |
360 | double_data[i] = get_real(infile,1); /* y */ |
362 | } |
361 | } |
363 | i++; |
362 | i++; |
364 | } |
363 | } |
365 | decimals = find_number_of_digits(precision); |
364 | decimals = find_number_of_digits(precision); |
366 | for(c=0 ; c < i-1 ; c = c+2){ |
365 | for(c=0 ; c < i-1 ; c = c+2){ |
367 | 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); |
366 | 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); |
368 | click_cnt++; |
367 | click_cnt++; |
369 | } |
368 | } |
370 | reset(); |
369 | reset(); |
371 | break; |
370 | break; |
372 | case POINT: |
371 | case POINT: |
373 | /* |
372 | /* |
374 | @ point x,y,color |
373 | @ point x,y,color |
Line 410... | Line 409... | ||
410 | double_data[i] = get_real(infile,1); /* y */ |
409 | double_data[i] = get_real(infile,1); /* y */ |
411 | } |
410 | } |
412 | i++; |
411 | i++; |
413 | } |
412 | } |
414 | decimals = find_number_of_digits(precision); |
413 | decimals = find_number_of_digits(precision); |
415 | for(c = 0 ; c < i-1 ; c = c+2){ |
414 | for(c = 0 ; c < i-1 ; c = c+2){ |
416 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,2,[%.*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],line_width,line_width,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); |
415 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,2,[%.*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],line_width,line_width,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); |
- | 416 | click_cnt++; |
|
- | 417 | } |
|
- | 418 | reset(); |
|
- | 419 | break; |
|
- | 420 | case SEGMENTS: |
|
- | 421 | /* |
|
- | 422 | @ segments color,x1,y1,x2,y2,...,x_n,y_n |
|
- | 423 | @ draw multiple segments at given coordinates in color 'color' |
|
- | 424 | @ use command 'linewidth int' to adust size |
|
- | 425 | @ may be set draggable / onclick individually (!) |
|
- | 426 | */ |
|
- | 427 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
|
- | 428 | fill_color = stroke_color; |
|
- | 429 | i=0; |
|
- | 430 | while( ! done ){ /* get next item until EOL*/ |
|
- | 431 | if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");} |
|
- | 432 | if(i%2 == 0 ){ |
|
- | 433 | double_data[i] = get_real(infile,0); /* x */ |
|
- | 434 | } |
|
- | 435 | else |
|
- | 436 | { |
|
- | 437 | double_data[i] = get_real(infile,1); /* y */ |
|
- | 438 | } |
|
- | 439 | i++; |
|
- | 440 | } |
|
- | 441 | decimals = find_number_of_digits(precision); |
|
- | 442 | for(c = 0 ; c < i-1 ; c = c+4){ |
|
- | 443 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%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+2],decimals,double_data[c+1],decimals,double_data[c+3],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
|
417 | click_cnt++; |
444 | click_cnt++; |
418 | } |
445 | } |
419 | reset(); |
446 | reset(); |
420 | break; |
447 | break; |
421 | case SEGMENT: |
448 | case SEGMENT: |
Line 431... | Line 458... | ||
431 | case 2: double_data[2]= get_real(infile,0);break; /* x2-values */ |
458 | case 2: double_data[2]= get_real(infile,0);break; /* x2-values */ |
432 | case 3: double_data[3]= get_real(infile,0);break; /* y2-values */ |
459 | case 3: double_data[3]= get_real(infile,0);break; /* y2-values */ |
433 | case 4: stroke_color=get_color(infile,1);/* name or hex color */ |
460 | case 4: stroke_color=get_color(infile,1);/* name or hex color */ |
434 | decimals = find_number_of_digits(precision); |
461 | decimals = find_number_of_digits(precision); |
435 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%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[2],decimals,double_data[1],decimals,double_data[3],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
462 | fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%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[2],decimals,double_data[1],decimals,double_data[3],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt); |
436 | click_cnt++;reset(); |
463 | click_cnt++;reset(); |
437 | break; |
464 | break; |
438 | default: break; |
465 | default: break; |
439 | } |
466 | } |
440 | } |
467 | } |
441 | break; |
468 | break; |
442 | case LINE: |
469 | case LINE: |
Line 861... | Line 888... | ||
861 | break; |
888 | break; |
862 | case ARROW: |
889 | case ARROW: |
863 | /* |
890 | /* |
864 | @ arrow x1,y1,x2,y2,h,color |
891 | @ arrow x1,y1,x2,y2,h,color |
865 | @ draw a single headed arrow/vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color 'color' |
892 | @ draw a single headed arrow/vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color 'color' |
866 | @ use command 'linewidth int' to adjust thickness of the arrow |
893 | @ use command 'linewidth int' to adjust thickness of the arrow |
867 | @ may be set draggable / onclick |
894 | @ may be set draggable / onclick |
868 | */ |
895 | */ |
869 | for(i=0;i<6;i++){ |
896 | for(i=0;i<6;i++){ |
870 | switch(i){ |
897 | switch(i){ |
871 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
898 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
872 | case 1: double_data[1] = get_real(infile,0);break; /* y */ |
899 | case 1: double_data[1] = get_real(infile,0);break; /* y */ |
873 | case 2: double_data[2] = get_real(infile,0);break; /* x */ |
900 | case 2: double_data[2] = get_real(infile,0);break; /* x */ |
874 | case 3: double_data[3] = get_real(infile,0);break; /* y */ |
901 | case 3: double_data[3] = get_real(infile,0);break; /* y */ |
875 | case 4: arrow_head = (int) get_real(infile,0);break;/* h */ |
902 | case 4: arrow_head = (int) get_real(infile,0);break;/* h */ |
876 | case 5: stroke_color = get_color(infile,1);/* name or hex color */ |
903 | case 5: stroke_color = get_color(infile,1);/* name or hex color */ |
877 | decimals = find_number_of_digits(precision); |
904 | decimals = find_number_of_digits(precision); |
Line 1194... | Line 1221... | ||
1194 | } |
1221 | } |
1195 | add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1222 | add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1196 | } |
1223 | } |
1197 | else |
1224 | else |
1198 | if( strcmp(draw_type,"segments") == 0 ){ |
1225 | if( strcmp(draw_type,"segments") == 0 ){ |
1199 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1226 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1200 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1227 | if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;} |
1201 | if(reply_format == 0){reply_format = 11;} |
1228 | if(reply_format == 0){reply_format = 11;} |
1202 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1229 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1203 | if(use_input_xy == 1){ |
1230 | if(use_input_xy == 1){ |
1204 | add_input_segment(js_include_file,2); |
1231 | add_input_segment(js_include_file,2); |
Line 1206... | Line 1233... | ||
1206 | } |
1233 | } |
1207 | add_js_segments(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1234 | add_js_segments(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1208 | } |
1235 | } |
1209 | else |
1236 | else |
1210 | if( strcmp(draw_type,"circle") == 0 ){ |
1237 | if( strcmp(draw_type,"circle") == 0 ){ |
1211 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1238 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1212 | if(reply_format == 0){reply_format = 10;} |
1239 | if(reply_format == 0){reply_format = 10;} |
1213 | /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */ |
1240 | /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */ |
1214 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1241 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1215 | if(use_input_xy == 1){ |
1242 | if(use_input_xy == 1){ |
1216 | add_input_circle(js_include_file,2,1); |
1243 | add_input_circle(js_include_file,2,1); |
1217 | add_input_xyr(js_include_file,canvas_root_id); |
1244 | add_input_xyr(js_include_file,canvas_root_id); |
Line 1246... | Line 1273... | ||
1246 | if(strcmp(draw_type,"crosshairs") == 0 ){ |
1273 | if(strcmp(draw_type,"crosshairs") == 0 ){ |
1247 | if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;} |
1274 | if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;} |
1248 | if(reply_format == 0){reply_format = 8;} |
1275 | if(reply_format == 0){reply_format = 8;} |
1249 | /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */ |
1276 | /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */ |
1250 | add_js_crosshairs(js_include_file,2,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity); |
1277 | add_js_crosshairs(js_include_file,2,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity); |
1251 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1278 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1252 | if(use_input_xy == 1){ |
1279 | if(use_input_xy == 1){ |
1253 | add_input_crosshair(js_include_file,2); |
1280 | add_input_crosshair(js_include_file,2); |
1254 | add_input_xy(js_include_file,canvas_root_id); |
1281 | add_input_xy(js_include_file,canvas_root_id); |
1255 | } |
1282 | } |
1256 | } |
1283 | } |
1257 | else |
1284 | else |
1258 | if(strcmp(draw_type,"freehandline") == 0 ){ |
1285 | if(strcmp(draw_type,"freehandline") == 0 ){ |
1259 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1286 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1260 | if(reply_format == 0){reply_format = 6;} |
1287 | if(reply_format == 0){reply_format = 6;} |
1261 | add_js_paths(js_include_file,1,draw_type,line_width,0,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1288 | add_js_paths(js_include_file,1,draw_type,line_width,0,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1262 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1289 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1263 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1290 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1264 | } |
1291 | } |
1265 | else |
1292 | else |
1266 | if(strcmp(draw_type,"freehandlines") == 0 ){ |
1293 | if(strcmp(draw_type,"freehandlines") == 0 ){ |
1267 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1294 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1268 | if(reply_format == 0){reply_format = 6;} |
1295 | if(reply_format == 0){reply_format = 6;} |
1269 | add_js_paths(js_include_file,2,draw_type,line_width,0,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1296 | add_js_paths(js_include_file,2,draw_type,line_width,0,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1270 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1297 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1271 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1298 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1272 | } |
1299 | } |
1273 | else |
1300 | else |
1274 | if(strcmp(draw_type,"path") == 0 ){ |
1301 | if(strcmp(draw_type,"path") == 0 ){ |
1275 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1302 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1276 | if(reply_format == 0){reply_format = 6;} |
1303 | if(reply_format == 0){reply_format = 6;} |
1277 | add_js_paths(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1304 | add_js_paths(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1278 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1305 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1279 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1306 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1280 | } |
1307 | } |
1281 | else |
1308 | else |
1282 | if(strcmp(draw_type,"paths") == 0 ){ |
1309 | if(strcmp(draw_type,"paths") == 0 ){ |
1283 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1310 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1284 | if(reply_format == 0){reply_format = 6;} |
1311 | if(reply_format == 0){reply_format = 6;} |
1285 | add_js_paths(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1312 | add_js_paths(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1286 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1313 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1287 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1314 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1288 | } |
1315 | } |
1289 | else |
1316 | else |
1290 | if(strcmp(draw_type,"arrows") == 0 ){ |
1317 | if(strcmp(draw_type,"arrows") == 0 ){ |
1291 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1318 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1292 | if(reply_format == 0){reply_format = 11;} |
1319 | if(reply_format == 0){reply_format = 11;} |
1293 | add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1320 | add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1294 | if(use_input_xy == 1){ |
1321 | if(use_input_xy == 1){ |
1295 | add_input_arrow(js_include_file,2); |
1322 | add_input_arrow(js_include_file,2); |
1296 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1323 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1297 | } |
1324 | } |
1298 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1325 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1299 | } |
1326 | } |
1300 | else |
1327 | else |
1301 | if(strcmp(draw_type,"arrows2") == 0 ){ |
1328 | if(strcmp(draw_type,"arrows2") == 0 ){ |
1302 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1329 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1303 | if(reply_format == 0){reply_format = 11;} |
1330 | if(reply_format == 0){reply_format = 11;} |
1304 | add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1331 | add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1305 | if(use_input_xy == 1){ |
1332 | if(use_input_xy == 1){ |
1306 | add_input_arrow(js_include_file,1); |
1333 | add_input_arrow(js_include_file,1); |
1307 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1334 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1308 | } |
1335 | } |
1309 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1336 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1310 | } |
1337 | } |
1311 | else |
1338 | else |
1312 | if(strcmp(draw_type,"arrow2") == 0 ){ |
1339 | if(strcmp(draw_type,"arrow2") == 0 ){ |
1313 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1340 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1314 | if(reply_format == 0){reply_format = 11;} |
1341 | if(reply_format == 0){reply_format = 11;} |
1315 | add_js_arrows(js_include_file,1,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1342 | add_js_arrows(js_include_file,1,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1316 | if(use_input_xy == 1){ |
1343 | if(use_input_xy == 1){ |
1317 | add_input_arrow(js_include_file,1); |
1344 | add_input_arrow(js_include_file,1); |
1318 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1345 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1319 | } |
1346 | } |
1320 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1347 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1321 | } |
1348 | } |
1322 | else |
1349 | else |
1323 | if(strcmp(draw_type,"arrow") == 0 ){ |
1350 | if(strcmp(draw_type,"arrow") == 0 ){ |
1324 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1351 | if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;} |
1325 | if(reply_format == 0){reply_format = 11;} |
1352 | if(reply_format == 0){reply_format = 11;} |
1326 | add_js_arrows(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1353 | add_js_arrows(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head); |
1327 | if(use_input_xy == 1){ |
1354 | if(use_input_xy == 1){ |
1328 | add_input_arrow(js_include_file,1); |
1355 | add_input_arrow(js_include_file,1); |
1329 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1356 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1330 | } |
1357 | } |
1331 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1358 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1332 | } |
1359 | } |
1333 | else |
1360 | else |
1334 | if(strcmp(draw_type,"polygon") == 0){ |
1361 | if(strcmp(draw_type,"polygon") == 0){ |
1335 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1362 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1336 | if(reply_format == 0){reply_format = 2;} |
1363 | if(reply_format == 0){reply_format = 2;} |
Line 1353... | Line 1380... | ||
1353 | else |
1380 | else |
1354 | if(strcmp(draw_type,"triangle") == 0){ |
1381 | if(strcmp(draw_type,"triangle") == 0){ |
1355 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1382 | if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;} |
1356 | if(reply_format == 0){reply_format = 2;} |
1383 | if(reply_format == 0){reply_format = 2;} |
1357 | add_js_poly(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1384 | add_js_poly(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]); |
1358 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1385 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1359 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1386 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1360 | } |
1387 | } |
1361 | else |
1388 | else |
1362 | if( strcmp(draw_type,"hline") == 0 ){ |
1389 | if( strcmp(draw_type,"hline") == 0 ){ |
1363 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1390 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1364 | if(reply_format == 0){reply_format = 11;} |
1391 | if(reply_format == 0){reply_format = 11;} |
1365 | add_js_hlines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1392 | add_js_hlines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1366 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1393 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1367 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1394 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1368 | } |
1395 | } |
1369 | else |
1396 | else |
1370 | if( strcmp(draw_type,"hlines") == 0 ){ |
1397 | if( strcmp(draw_type,"hlines") == 0 ){ |
1371 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1398 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1372 | if(reply_format == 0){reply_format = 11;} |
1399 | if(reply_format == 0){reply_format = 11;} |
1373 | add_js_hlines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1400 | add_js_hlines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1374 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1401 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1375 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1402 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1376 | } |
1403 | } |
1377 | else |
1404 | else |
1378 | if( strcmp(draw_type,"vline") == 0 ){ |
1405 | if( strcmp(draw_type,"vline") == 0 ){ |
1379 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1406 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1380 | if(reply_format == 0){reply_format = 11;} |
1407 | if(reply_format == 0){reply_format = 11;} |
1381 | add_js_hlines(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1408 | add_js_hlines(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1382 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1409 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1383 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1410 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1384 | } |
1411 | } |
1385 | else |
1412 | else |
1386 | if( strcmp(draw_type,"vlines") == 0 ){ |
1413 | if( strcmp(draw_type,"vlines") == 0 ){ |
1387 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1414 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1388 | if(reply_format == 0){reply_format = 11;} |
1415 | if(reply_format == 0){reply_format = 11;} |
1389 | add_js_hlines(js_include_file,4,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1416 | add_js_hlines(js_include_file,4,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1390 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1417 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1391 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1418 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1392 | } |
1419 | } |
Line 1394... | Line 1421... | ||
1394 | if( strcmp(draw_type,"line") == 0 ){ |
1421 | if( strcmp(draw_type,"line") == 0 ){ |
1395 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1422 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1396 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1423 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1397 | if(reply_format == 0){reply_format = 11;} |
1424 | if(reply_format == 0){reply_format = 11;} |
1398 | add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1425 | add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1399 | if( use_input_xy == 1 ){ |
1426 | if( use_input_xy == 1 ){ |
1400 | add_input_line(js_include_file,1); |
1427 | add_input_line(js_include_file,1); |
1401 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1428 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1402 | } |
1429 | } |
1403 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1430 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1404 | } |
1431 | } |
1405 | else |
1432 | else |
1406 | if( strcmp(draw_type,"lines") == 0 ){ |
1433 | if( strcmp(draw_type,"lines") == 0 ){ |
1407 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1434 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1408 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1435 | if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;} |
1409 | if(reply_format == 0){reply_format = 11;} |
1436 | if(reply_format == 0){reply_format = 11;} |
1410 | add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1437 | add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]); |
1411 | if( use_input_xy == 1 ){ |
1438 | if( use_input_xy == 1 ){ |
1412 | add_input_line(js_include_file,2); |
1439 | add_input_line(js_include_file,2); |
1413 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1440 | add_input_x1y1x2y2(js_include_file,canvas_root_id); |
1414 | } |
1441 | } |
1415 | if(use_input_xy == 2){ canvas_error("usertextarea_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 !");} |
1416 | } |
1443 | } |
1417 | else |
1444 | else |
1418 | if( strcmp(draw_type,"demilines") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1445 | if( strcmp(draw_type,"demilines") == 0 || strcmp(draw_type,"demilines") == 0 ){ |
1419 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1446 | if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;} |
1420 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
1447 | if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;} |
1421 | if(reply_format == 0){reply_format = 11;} |
1448 | if(reply_format == 0){reply_format = 11;} |
Line 1735... | Line 1762... | ||
1735 | case 1: int_data[0] = x2px(get_real(infile,0));break; /* x */ |
1762 | case 1: int_data[0] = x2px(get_real(infile,0));break; /* x */ |
1736 | case 2: int_data[1] = y2px(get_real(infile,0));break; /* y */ |
1763 | case 2: int_data[1] = y2px(get_real(infile,0));break; /* y */ |
1737 | case 3: fly_font = get_string_argument(infile,0); |
1764 | case 3: fly_font = get_string_argument(infile,0); |
1738 | if(strcmp(fly_font,"giant") == 0){ |
1765 | if(strcmp(fly_font,"giant") == 0){ |
1739 | font_size = (int)(font_size + 24); |
1766 | font_size = (int)(font_size + 24); |
1740 | } |
1767 | } |
1741 | else |
1768 | else |
1742 | { |
1769 | { |
1743 | if(strcmp(fly_font,"huge") == 0){ |
1770 | if(strcmp(fly_font,"huge") == 0){ |
1744 | font_size = (int)(font_size + 14); |
1771 | font_size = (int)(font_size + 14); |
1745 | } |
1772 | } |
1746 | else |
1773 | else |
1747 | { |
1774 | { |
Line 1764... | Line 1791... | ||
1764 | string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_affine,affine_matrix); |
1791 | string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_affine,affine_matrix); |
1765 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1792 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1766 | snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_affine,affine_matrix); |
1793 | snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,%s);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_affine,affine_matrix); |
1767 | add_to_buffer(tmp_buffer); |
1794 | add_to_buffer(tmp_buffer); |
1768 | break; |
1795 | break; |
1769 | default:break; |
1796 | default:break; |
1770 | } |
1797 | } |
1771 | } |
1798 | } |
1772 | reset(); |
1799 | reset(); |
1773 | break; |
1800 | break; |
1774 | case FONTFAMILY: |
1801 | case FONTFAMILY: |
1775 | /* |
1802 | /* |
Line 1778... | Line 1805... | ||
1778 | @ font_description: Ariel ,Courier, Helvetica etc |
1805 | @ font_description: Ariel ,Courier, Helvetica etc |
1779 | @ in case commands<br /> 'string color,x,y,the string'<br /> 'stringup color,x,y,rotation,the string'<br />fontfamily can be something like:<br />italic 34px Ariel |
1806 | @ in case commands<br /> 'string color,x,y,the string'<br /> 'stringup color,x,y,rotation,the string'<br />fontfamily can be something like:<br />italic 34px Ariel |
1780 | @ use correct syntax : 'font style' 'font size'px 'fontfamily' |
1807 | @ use correct syntax : 'font style' 'font size'px 'fontfamily' |
1781 | */ |
1808 | */ |
1782 | font_family = get_string(infile,1); |
1809 | font_family = get_string(infile,1); |
1783 | break; |
1810 | break; |
1784 | case STRINGUP: |
1811 | case STRINGUP: |
1785 | /* |
1812 | /* |
1786 | @ stringup color,x,y,rotation_degrees,the text string |
1813 | @ stringup color,x,y,rotation_degrees,the text string |
1787 | @ can <b>not</b> be set "onclick" or "drag xy" (because of translaton matrix...mouse incompatible) |
1814 | @ can <b>not</b> be set "onclick" or "drag xy" (because of translaton matrix...mouse incompatible) |
1788 | @ unicode supported: stringup red,0,0,45,\\u2232 |
1815 | @ unicode supported: stringup red,0,0,45,\\u2232 |
Line 1846... | Line 1873... | ||
1846 | case 2: temp = get_string_argument(infile,1); |
1873 | case 2: temp = get_string_argument(infile,1); |
1847 | /* draw_text = function(canvas_type,y,font_family,stroke_color,stroke_opacity,text) */ |
1874 | /* draw_text = function(canvas_type,y,font_family,stroke_color,stroke_opacity,text) */ |
1848 | decimals = find_number_of_digits(precision); |
1875 | decimals = find_number_of_digits(precision); |
1849 | string_length = snprintf(NULL,0, |
1876 | string_length = snprintf(NULL,0, |
1850 | "draw_centerstring(%d,%.*f,\"%s\",\"%s\",%.2f,\"%s\");\n",canvas_root_id,decimals,double_data[0],font_family,stroke_color,stroke_opacity,temp); |
1877 | "draw_centerstring(%d,%.*f,\"%s\",\"%s\",%.2f,\"%s\");\n",canvas_root_id,decimals,double_data[0],font_family,stroke_color,stroke_opacity,temp); |
1851 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1878 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
1852 | snprintf(tmp_buffer,string_length,"draw_centerstring(%d,%.*f,\"%s\",\"%s\",%.2f,\"%s\");\n",canvas_root_id,decimals,double_data[0],font_family,stroke_color,stroke_opacity,temp); |
1879 | snprintf(tmp_buffer,string_length,"draw_centerstring(%d,%.*f,\"%s\",\"%s\",%.2f,\"%s\");\n",canvas_root_id,decimals,double_data[0],font_family,stroke_color,stroke_opacity,temp); |
1853 | add_to_buffer(tmp_buffer); |
1880 | add_to_buffer(tmp_buffer); |
1854 | break; |
1881 | break; |
1855 | default:break; |
1882 | default:break; |
1856 | } |
1883 | } |
Line 2607... | Line 2634... | ||
2607 | }else{ |
2634 | }else{ |
2608 | if(strstr(temp,"radius") != NULL){ |
2635 | if(strstr(temp,"radius") != NULL){ |
2609 | int_data[0] = 4; |
2636 | int_data[0] = 4; |
2610 | }else{ |
2637 | }else{ |
2611 | int_data[0] = 2; |
2638 | int_data[0] = 2; |
2612 | } |
2639 | } |
2613 | } |
2640 | } |
2614 | } |
2641 | } |
2615 | } |
2642 | } |
2616 | } |
2643 | } |
2617 | stroke_color = get_color(infile,0); |
2644 | stroke_color = get_color(infile,0); |
Line 2714... | Line 2741... | ||
2714 | if( strstr(temp,".mp3") != 0 ){ temp = str_replace(temp,".mp3","");} |
2741 | if( strstr(temp,".mp3") != 0 ){ temp = str_replace(temp,".mp3","");} |
2715 | if( strstr(temp,".ogg") != 0 ){ temp = str_replace(temp,".ogg","");} |
2742 | if( strstr(temp,".ogg") != 0 ){ temp = str_replace(temp,".ogg","");} |
2716 | string_length = snprintf(NULL,0, "draw_audio(%d,%d,%d,%d,%d,%d,%d,\"%s.ogg\",\"%s.mp3\");\n",canvas_root_id,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],temp,temp); |
2743 | string_length = snprintf(NULL,0, "draw_audio(%d,%d,%d,%d,%d,%d,%d,\"%s.ogg\",\"%s.mp3\");\n",canvas_root_id,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],temp,temp); |
2717 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
2744 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
2718 | snprintf(tmp_buffer,string_length,"draw_audio(%d,%d,%d,%d,%d,%d,%d,\"%s.ogg\",\"%s.mp3\");\n",canvas_root_id,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],temp,temp); |
2745 | snprintf(tmp_buffer,string_length,"draw_audio(%d,%d,%d,%d,%d,%d,%d,\"%s.ogg\",\"%s.mp3\");\n",canvas_root_id,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],temp,temp); |
2719 | add_to_buffer(tmp_buffer); |
2746 | add_to_buffer(tmp_buffer); |
2720 | break; |
2747 | break; |
2721 | default:break; |
2748 | default:break; |
2722 | } |
2749 | } |
2723 | } |
2750 | } |
2724 | reset(); |
2751 | reset(); |
2725 | break; |
2752 | break; |
Line 2929... | Line 2956... | ||
2929 | decimals = find_number_of_digits(precision);/*floodfill(interaction,x,y,[R,G,B,A]) */ |
2956 | decimals = find_number_of_digits(precision);/*floodfill(interaction,x,y,[R,G,B,A]) */ |
2930 | /* we need to set a timeout: the canvas is not yet draw in memory? when floodfill is called directly... */ |
2957 | /* we need to set a timeout: the canvas is not yet draw in memory? when floodfill is called directly... */ |
2931 | string_length = snprintf(NULL,0, "setTimeout(function(){floodfill(0,%.*f,%.*f,[%s,%d]);},1000);\n",decimals,double_data[0],decimals,double_data[1],fill_color,(int) (fill_opacity/0.0039215)); |
2958 | string_length = snprintf(NULL,0, "setTimeout(function(){floodfill(0,%.*f,%.*f,[%s,%d]);},1000);\n",decimals,double_data[0],decimals,double_data[1],fill_color,(int) (fill_opacity/0.0039215)); |
2932 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
2959 | check_string_length(string_length);tmp_buffer = my_newmem(string_length+1); |
2933 | snprintf(tmp_buffer,string_length,"setTimeout(function(){floodfill(0,%.*f,%.*f,[%s,%d]);},1000);\n",decimals,double_data[0],decimals,double_data[1],fill_color,(int) (fill_opacity/0.0039215)); |
2960 | snprintf(tmp_buffer,string_length,"setTimeout(function(){floodfill(0,%.*f,%.*f,[%s,%d]);},1000);\n",decimals,double_data[0],decimals,double_data[1],fill_color,(int) (fill_opacity/0.0039215)); |
2934 | add_to_buffer(tmp_buffer); |
2961 | add_to_buffer(tmp_buffer); |
2935 | break; |
2962 | break; |
2936 | default:break; |
2963 | default:break; |
2937 | } |
2964 | } |
2938 | } |
2965 | } |
2939 | reset(); |
2966 | reset(); |
2940 | break; |
2967 | break; |
2941 | case CLICKFILLMARGE: |
2968 | case CLICKFILLMARGE: |
2942 | clickfillmarge = (int) (get_real(infile,1)); |
2969 | clickfillmarge = (int) (get_real(infile,1)); |
Line 3365... | Line 3392... | ||
3365 | } |
3392 | } |
3366 | else |
3393 | else |
3367 | { |
3394 | { |
3368 | if( found_size_command != 3 ){ |
3395 | if( found_size_command != 3 ){ |
3369 | canvas_error("Please specify both xrange and yrange ..."); |
3396 | canvas_error("Please specify both xrange and yrange ..."); |
3370 | } |
3397 | } |
3371 | } |
3398 | } |
3372 | 3399 | ||
3373 | /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable/clickable shapes / objects ! */ |
3400 | /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable/clickable shapes / objects ! */ |
3374 | add_javascript_functions(js_function,canvas_root_id); |
3401 | add_javascript_functions(js_function,canvas_root_id); |
3375 | /* add read_canvas() etc functions if needed */ |
3402 | /* add read_canvas() etc functions if needed */ |
3376 | if( reply_format > 0 ){ add_read_canvas(canvas_root_id,reply_format,reply_precision);} |
3403 | if( reply_format > 0 ){ add_read_canvas(canvas_root_id,reply_format,reply_precision);} |
Line 3434... | Line 3461... | ||
3434 | ** |
3461 | ** |
3435 | ** sync_input |
3462 | ** sync_input |
3436 | ** |
3463 | ** |
3437 | ** synchronises input line - reads to end of line, leaving file pointer |
3464 | ** synchronises input line - reads to end of line, leaving file pointer |
3438 | ** at first character of next line. |
3465 | ** at first character of next line. |
3439 | ** |
3466 | ** |
3440 | ** Used by: |
3467 | ** Used by: |
3441 | ** main program - error handling. |
3468 | ** main program - error handling. |
3442 | ** |
3469 | ** |
3443 | ******************************************************************************/ |
3470 | ******************************************************************************/ |
3444 | void sync_input(FILE *infile) |
3471 | void sync_input(FILE *infile) |
Line 3475... | Line 3502... | ||
3475 | } |
3502 | } |
3476 | 3503 | ||
3477 | if ((ret = malloc(retlen + 1)) == NULL){ |
3504 | if ((ret = malloc(retlen + 1)) == NULL){ |
3478 | ret = NULL; |
3505 | ret = NULL; |
3479 | canvas_error("string argument is NULL"); |
3506 | canvas_error("string argument is NULL"); |
3480 | } |
3507 | } |
3481 | else |
3508 | else |
3482 | { |
3509 | { |
3483 | for (r = ret, p = str; (q = strstr(p, old)) != NULL; p = q + oldlen) { |
3510 | for (r = ret, p = str; (q = strstr(p, old)) != NULL; p = q + oldlen) { |
3484 | size_t l = q - p; |
3511 | size_t l = q - p; |
3485 | memcpy(r, p, l); |
3512 | memcpy(r, p, l); |
3486 | r += l; |
3513 | r += l; |
3487 | memcpy(r, new, newlen); |
3514 | memcpy(r, new, newlen); |
Line 6087... | Line 6114... | ||
6087 | fprintf(js_include_file,"\n<!-- draw text -->\n\ |
6114 | fprintf(js_include_file,"\n<!-- draw text -->\n\ |
6088 | var draw_text = function(canvas_type,x,y,font_size,font_family,stroke_color,stroke_opacity,angle2,text,use_rotate,angle,use_affine,affine_matrix){\ |
6115 | var draw_text = function(canvas_type,x,y,font_size,font_family,stroke_color,stroke_opacity,angle2,text,use_rotate,angle,use_affine,affine_matrix){\ |
6089 | var obj;\ |
6116 | var obj;\ |
6090 | if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
6117 | if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
6091 | obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
6118 | obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
6092 | }\ |
6119 | }\ |
6093 | else\ |
6120 | else\ |
6094 | {\ |
6121 | {\ |
6095 | obj = create_canvas%d(canvas_type,xsize,ysize);\ |
6122 | obj = create_canvas%d(canvas_type,xsize,ysize);\ |
6096 | };\ |
6123 | };\ |
6097 | var ctx = obj.getContext(\"2d\");\ |
6124 | var ctx = obj.getContext(\"2d\");\ |
Line 6407... | Line 6434... | ||
6407 | x_e = x2px(i*num);\ |
6434 | x_e = x2px(i*num);\ |
6408 | if( i == 1 ){\ |
6435 | if( i == 1 ){\ |
6409 | ctx.lineWidth = line_width;\ |
6436 | ctx.lineWidth = line_width;\ |
6410 | ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\ |
6437 | ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\ |
6411 | if( use_axis_numbering == 1 && p > x_min){\ |
6438 | if( use_axis_numbering == 1 && p > x_min){\ |
6412 | xtxt = xlogbase+'^'+p.toFixed(0);\ |
6439 | xtxt = xlogbase+'^'+p.toFixed(0);\ |
6413 | corr = 0.5*(ctx.measureText(xtxt).width);\ |
6440 | corr = 0.5*(ctx.measureText(xtxt).width);\ |
6414 | ctx.fillText(xtxt,x_e - corr,ysize - 4);\ |
6441 | ctx.fillText(xtxt,x_e - corr,ysize - 4);\ |
6415 | };\ |
6442 | };\ |
6416 | }else{\ |
6443 | }else{\ |
6417 | ctx.lineWidth = 0.2*line_width;\ |
6444 | ctx.lineWidth = 0.2*line_width;\ |
6418 | ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\ |
6445 | ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\ |
6419 | };\ |
6446 | };\ |
6420 | if( x_e >= xmarge ){\ |
6447 | if( x_e >= xmarge ){\ |
6421 | ctx.beginPath();\ |
6448 | ctx.beginPath();\ |
6422 | ctx.moveTo(x_e,0);\ |
6449 | ctx.moveTo(x_e,0);\ |
6423 | ctx.lineTo(x_e,ysize - ymarge);\ |
6450 | ctx.lineTo(x_e,ysize - ymarge);\ |
6424 | ctx.stroke();\ |
6451 | ctx.stroke();\ |
Line 6695... | Line 6722... | ||
6695 | *dashed="dashed", |
6722 | *dashed="dashed", |
6696 | *filled="filled", |
6723 | *filled="filled", |
6697 | *lattice="lattice", |
6724 | *lattice="lattice", |
6698 | *parallel="parallel", |
6725 | *parallel="parallel", |
6699 | *segment="segment", |
6726 | *segment="segment", |
- | 6727 | *segments="segments", |
|
6700 | *dsegment="dsegment", |
6728 | *dsegment="dsegment", |
6701 | *seg="seg", |
6729 | *seg="seg", |
6702 | *bgimage="bgimage", |
6730 | *bgimage="bgimage", |
6703 | *bgcolor="bgcolor", |
6731 | *bgcolor="bgcolor", |
6704 | *strokecolor="strokecolor", |
6732 | *strokecolor="strokecolor", |
Line 6958... | Line 6986... | ||
6958 | return VLINE; |
6986 | return VLINE; |
6959 | } |
6987 | } |
6960 | if( strcmp(input_type, line) == 0 ){ |
6988 | if( strcmp(input_type, line) == 0 ){ |
6961 | free(input_type); |
6989 | free(input_type); |
6962 | return LINE; |
6990 | return LINE; |
- | 6991 | } |
|
- | 6992 | if( strcmp(input_type, segments) == 0 ){ |
|
- | 6993 | free(input_type); |
|
- | 6994 | return SEGMENTS; |
|
6963 | } |
6995 | } |
6964 | if( strcmp(input_type, seg) == 0 || strcmp(input_type, segment) == 0 ){ |
6996 | if( strcmp(input_type, seg) == 0 || strcmp(input_type, segment) == 0 ){ |
6965 | free(input_type); |
6997 | free(input_type); |
6966 | return SEGMENT; |
6998 | return SEGMENT; |
6967 | } |
6999 | } |